Module: VagrantPlugins::Dotvm::Injector::AuthorizedKey
- Extended by:
- AbstractInjector
- Defined in:
- lib/vagrant-dotvm/injector/authorizedkey.rb
Overview
Injects DotVm authorized key configuration into Vagrant
Class Method Summary collapse
Methods included from AbstractInjector
generate_hash, rewrite_hash, rewrite_options
Class Method Details
.inject(key: nil, machine: nil) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/vagrant-dotvm/injector/authorizedkey.rb', line 10 def inject(key: nil, machine: nil) if key.type == 'file' pubkey = File.readlines(File.(key.path)).first.strip elsif key.type == 'static' pubkey = key.key end machine.vm.provision 'shell' do |s| s.path = "#{UTILS_PATH}/authorize_key.sh" s.args = [pubkey] s.privileged = false s.name = "authorized ssh key #{pubkey.split[2]}" end end |