Class: Fum::Commands::Repair
- Inherits:
-
Fum::Command
- Object
- Fum::Command
- Fum::Commands::Repair
- Includes:
- DNS
- Defined in:
- lib/fum/commands/repair.rb
Instance Method Summary collapse
Methods included from DNS
#dns, #dns_names_equal, #ensure_trailing_dot, #find_records, #update_zone, #update_zones
Methods inherited from Fum::Command
Methods included from Util
Constructor Details
This class inherits a constructor from Fum::Command
Instance Method Details
#execute(options) ⇒ Object
-
:type
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/fum/commands/repair.rb', line 22 def execute() stage_name = [:stage_name] stage_decl = stage(@application.main_decl, stage_name) analyzer = StageAnalyzer.new(stage_decl) analyzer.analyze() degraded = analyzer.env_map.each_value.select { |env| env[:state] == :degraded } if degraded.length == 1 degraded = degraded.shift puts "Repairing environment #{degraded[:env].name}." update_zones(stage_decl, degraded[:env], ) puts "Repair complete." else puts "Nothing to repair." end end |
#parse_options ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/fum/commands/repair.rb', line 6 def opts = Trollop:: do "usage: repair [options] <stage-id>, where options are:" opt :environment, "Environment name to repair", :type => :string end if ARGV.empty? die "Please specify a stage name type to repair." end opts[:stage_name] = ARGV.shift opts end |