Class: Ec2Hosts::Runner
- Inherits:
-
Object
- Object
- Ec2Hosts::Runner
- Defined in:
- lib/ec2_hosts/runner.rb
Instance Method Summary collapse
-
#initialize(args) ⇒ Runner
constructor
A new instance of Runner.
- #run! ⇒ Object
Constructor Details
Instance Method Details
#run! ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/ec2_hosts/runner.rb', line 8 def run! if @options[:vpc] && @options[:clear] raise ArgumentError.new("Cannot specify 'clear' and 'vpc' at the same time.") end if @options[:tags] && @options[:template] raise ArgumentError.new("Cannot specify 'tags' and 'template' at the same time.") end updater = Updater.new(@options) if @options[:clear] updater.clear else if @options[:vpc].nil? raise ArgumentError.new("No ec2 vpc specified.") end if @options[:delete] new_hosts_list = [] else hosts = Hosts.new(@options) new_hosts_list = hosts.to_a end updater.update(new_hosts_list) end end |