Class: Ec2::Cli::Hosts
- Inherits:
-
Object
- Object
- Ec2::Cli::Hosts
- Defined in:
- lib/ec2/cli/hosts.rb
Instance Method Summary collapse
- #config ⇒ Object
-
#initialize(argv) ⇒ Hosts
constructor
A new instance of Hosts.
- #lock ⇒ Object
- #opts ⇒ Object
- #run ⇒ Object
- #salt ⇒ Object
Constructor Details
#initialize(argv) ⇒ Hosts
Returns a new instance of Hosts.
9 10 11 |
# File 'lib/ec2/cli/hosts.rb', line 9 def initialize(argv) @argv = argv end |
Instance Method Details
#config ⇒ Object
29 30 31 |
# File 'lib/ec2/cli/hosts.rb', line 29 def config @config ||= ::Ec2::Config.new("ec2.rb").config end |
#lock ⇒ Object
25 26 27 |
# File 'lib/ec2/cli/hosts.rb', line 25 def lock @lock ||= ::Ec2::Lock.new end |
#opts ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/ec2/cli/hosts.rb', line 33 def opts OptionParser.new do |opts| opts. = "Usage: ec2 hosts [options] [target]" opts.on("-f", "--file FILE", "Specify hosts file") do |f| salt.hosts_file = f end opts.on("-h", "--help", "Help") do puts opts exit end end end |
#run ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/ec2/cli/hosts.rb', line 13 def run lock.acquire opts.parse!(@argv) salt.config = config salt.run puts "ran hosts" end |
#salt ⇒ Object
21 22 23 |
# File 'lib/ec2/cli/hosts.rb', line 21 def salt @salt ||= ::Ec2::SaltCloud.new end |