class Acmesmith::PostIssuingHooks::Shell

Public Class Methods

new(command:, ignore_failure: false) click to toggle source
# File lib/acmesmith/post_issuing_hooks/shell.rb, line 7
def initialize(command:, ignore_failure: false)
  @command = command
  @ignore_failure = ignore_failure
end

Public Instance Methods

execute() click to toggle source
# File lib/acmesmith/post_issuing_hooks/shell.rb, line 12
def execute
  puts "=> Executing Post Issueing Hook for #{common_name} in #{self.class.name}"
  puts " $ #{@command}"

  status = system({"COMMON_NAME" => common_name}, @command)

  unless status
    if @ignore_failure
      $stderr.puts " ! execution failed"
    else
      raise "Execution failed"
    end
  end
end