Class: VagrantPlugins::KeyManager::Command

Inherits:
Object
  • Object
show all
Includes:
HostsFile
Defined in:
lib/vagrant-keymanager/command.rb

Instance Method Summary collapse

Methods included from HostsFile

#get_guest_keys

Instance Method Details

#executeObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/vagrant-keymanager/command.rb', line 6

def execute
  options = {}
  opts = OptionParser.new do |o|
    o.banner = 'Usage: vagrant keymanager [vm-name]'
    o.separator ''
    o.version = VagrantPlugins::KeyManager::VERSION
    o.program_name = 'vagrant keymanager'

    o.on('--provider provider', String,
      'Update machines with the specific provider.') do |provider|
      options[:provider] = provider.to_sym
    end
  end

  argv = parse_options(opts)
  options[:provider] ||= @env.default_provider

  # run keymanager for specified guest machines
  with_target_vms(argv, options) do |machine|
    @env.action_runner.run(Action.get_guest_keys, {
      :machine => machine,
      :provider => options[:provider]
    })
  end
end