Class: Crowbar::Client::Command::Upgrade::Mode
- Includes:
- Mixin::UpgradeError
- Defined in:
- lib/crowbar/client/command/upgrade/mode.rb
Overview
Implementation for the upgrade nodes command
Instance Attribute Summary
Attributes inherited from Base
#args, #options, #stderr, #stdin, #stdout
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Crowbar::Client::Command::Base
Instance Method Details
#execute ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/crowbar/client/command/upgrade/mode.rb', line 33 def execute unless ["normal", "non_disruptive", nil].include? args.mode err "Invalid upgrade mode '#{args.mode}'. " \ "Only 'normal' and 'non_disruptive' are valid upgrade modes" end method = request.method request.process do |request| case request.code when 200 if method == :post say "Successfully switched to the \"#{args.mode}\" upgrade mode. " else mode = request.parsed_response["mode"] || "none" say "Selected upgrade mode: '#{mode}'" end else err request.parsed_response["error"] end end end |