module Kitchen::Pulumi::ShellOut
Module orchestrating calls to the Pulumi
CLI
Public Class Methods
run(cmd:, logger:, duration: 7200, &block)
click to toggle source
Shells out to the Pulumi
CLI
# File lib/kitchen/pulumi/shell_out.rb, line 12 def self.run(cmd:, logger:, duration: 7200, &block) cmds = Array(cmd) block ||= ->(stdout) { stdout } shell_out(commands: cmds, duration: duration, logger: logger, &block) rescue ::Errno::EACCES, ::Errno::ENOENT, ::Mixlib::ShellOut::InvalidCommandOption, ::Mixlib::ShellOut::CommandTimeout, ::Mixlib::ShellOut::ShellCommandFailed => e raise(::Kitchen::Pulumi::Error, "Error: #{e.message}") end
shell_out(commands:, logger:, duration: 7200) { |stdout: stdout| ... }
click to toggle source
# File lib/kitchen/pulumi/shell_out.rb, line 23 def self.shell_out(commands:, logger:, duration: 7200) commands.each do |command| shell_out = ::Mixlib::ShellOut.new( "pulumi #{command}", live_stream: logger, timeout: duration, ) logger.warn("Running #{shell_out.command}") shell_out.run_command shell_out.error! yield(stdout: shell_out.stdout) end end