class Moonshot::Tools::ASGRollout::HookExecEnvironment
This object is passed into hooks defined in the ASGRollout
process, to give them access to instances and logging facilities.
Attributes
instance_id[R]
Public Class Methods
new(config, instance_id)
click to toggle source
# File lib/moonshot/tools/asg_rollout/hook_exec_environment.rb, line 12 def initialize(config, instance_id) @ilog = config.interactive_logger @command_builder = Moonshot::SSHCommandBuilder.new(config.ssh_config, instance_id) @instance_id = instance_id end
Public Instance Methods
debug(msg)
click to toggle source
# File lib/moonshot/tools/asg_rollout/hook_exec_environment.rb, line 33 def debug(msg) @ilog.debug(msg) end
ec2()
click to toggle source
# File lib/moonshot/tools/asg_rollout/hook_exec_environment.rb, line 24 def ec2 Aws::EC2::Client.new end
ec2_instance()
click to toggle source
# File lib/moonshot/tools/asg_rollout/hook_exec_environment.rb, line 28 def ec2_instance res = Aws::EC2::Resource.new(client: ec2) res.instance(@instance_id) end
exec(cmd)
click to toggle source
# File lib/moonshot/tools/asg_rollout/hook_exec_environment.rb, line 18 def exec(cmd) cb = @command_builder.build(cmd) fe = SSHForkExecutor.new fe.run(cb.cmd) end
info(msg)
click to toggle source
# File lib/moonshot/tools/asg_rollout/hook_exec_environment.rb, line 37 def info(msg) @ilog.info(msg) end