class Ec2::Cli::Hosts

Public Class Methods

new(argv) click to toggle source
# File lib/ec2/cli/hosts.rb, line 9
def initialize(argv)
  @argv = argv
end

Public Instance Methods

config() click to toggle source
# File lib/ec2/cli/hosts.rb, line 29
def config
  @config ||= ::Ec2::Config.new("ec2.rb").config
end
lock() click to toggle source
# File lib/ec2/cli/hosts.rb, line 25
def lock
  @lock ||= ::Ec2::Lock.new
end
opts() click to toggle source
# File lib/ec2/cli/hosts.rb, line 33
def opts
  OptionParser.new do |opts|

    opts.banner = "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() click to toggle source
# 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() click to toggle source
# File lib/ec2/cli/hosts.rb, line 21
def salt
  @salt ||= ::Ec2::SaltCloud.new
end