Class: Wakame::Command::PropagateService
- Inherits:
-
Object
- Object
- Wakame::Command::PropagateService
- Includes:
- Wakame::Command
- Defined in:
- lib/wakame/command/propagate_service.rb
Instance Method Summary collapse
-
#parse(args) ⇒ Object
command_name=‘launch_cluster’.
- #run(rule) ⇒ Object
Methods included from Wakame::Command
included, #options=, #print_result
Instance Method Details
#parse(args) ⇒ Object
command_name=‘launch_cluster’
7 8 9 |
# File 'lib/wakame/command/propagate_service.rb', line 7 def parse(args) @resource end |
#run(rule) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/wakame/command/propagate_service.rb', line 11 def run(rule) prop = nil prop = rule.service_cluster.properties[@options["service"]] if prop.nil? raise "UnknownProperty: #{@options["service"]}" end @num = nil @num = @options["num"] || 1 unless /^(\d){1,32}$/ =~ @num.to_s raise "The number is not appropriate: #{@num}" end instance = rule.master.service_cluster.dump_status[:properties][@options["service"]] if @num.to_i > (instance[:max_instances].to_i - instance[:instances].count.to_i) raise "The number is not appropriate: #{@num}" end rule.trigger_action(Wakame::Actions::PropagateInstances.new(prop, @num.to_i)) end |