Class: Captive::Commands::AppsRestart
- Inherits:
-
Object
- Object
- Captive::Commands::AppsRestart
- Defined in:
- lib/captive/commands/apps_restart.rb
Instance Method Summary collapse
-
#initialize(kubectl:, poller: nil) ⇒ AppsRestart
constructor
A new instance of AppsRestart.
- #run(app) ⇒ Object
Constructor Details
#initialize(kubectl:, poller: nil) ⇒ AppsRestart
Returns a new instance of AppsRestart.
9 10 11 12 |
# File 'lib/captive/commands/apps_restart.rb', line 9 def initialize(kubectl:, poller: nil) @kubectl = kubectl @poller = poller || Poller.new(interval: 5, timeout: 120) end |
Instance Method Details
#run(app) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/captive/commands/apps_restart.rb', line 14 def run(app) old_pod, = @kubectl.pod_info(app, app) @kubectl.restart_deployment(app, app) @poller.poll_until(context: "nouveau pod #{app} Running") do new_pod, = @kubectl.pod_info(app, app) new_pod && !new_pod.empty? && new_pod != old_pod end end |