Class: JamesBond::MissionKubernetes::PatchDeployHandler
- Inherits:
-
Object
- Object
- JamesBond::MissionKubernetes::PatchDeployHandler
- Defined in:
- lib/james_bond/mission_kubernetes/patch_deploy_handler.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize(command, config) ⇒ PatchDeployHandler
constructor
A new instance of PatchDeployHandler.
- #run ⇒ Object
Constructor Details
#initialize(command, config) ⇒ PatchDeployHandler
Returns a new instance of PatchDeployHandler.
9 10 11 12 13 14 15 |
# File 'lib/james_bond/mission_kubernetes/patch_deploy_handler.rb', line 9 def initialize(command, config) @command = command @config = config.for( env: command.[:environment], command: command.main_command ) end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
7 8 9 |
# File 'lib/james_bond/mission_kubernetes/patch_deploy_handler.rb', line 7 def config @config end |
Instance Method Details
#run ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/james_bond/mission_kubernetes/patch_deploy_handler.rb', line 17 def run command = [ "kubectl", "patch", "deployment #{app_name}", "-p '#{JSON.dump(spec)}'", ] command = switch_environment(command).join(' ') puts command Open3.popen3(command) do |stdin, stdout, stderr, thread| Thread.new do until (line = stdout.gets).nil? do puts line end end Thread.new do until (line = stderr.gets).nil? do puts line end end thread.join end end |