Sha256: fc9db34073f4a05bdd8b69365ad9883ef0f0bebcc4207de4aac19f75784a06f2

Contents?: true

Size: 619 Bytes

Versions: 9

Compression:

Stored size: 619 Bytes

Contents

require "vagrant/util/shell_quote"

module VagrantPlugins
  module GuestNetBSD
    module Cap
      class InsertPublicKey
        def self.insert_public_key(machine, contents)
          contents = Vagrant::Util::ShellQuote.escape(contents, "'")
          contents = contents.gsub("\n", "\\n")

          machine.communicate.tap do |comm|
            comm.execute("mkdir -p ~/.ssh")
            comm.execute("chmod 0700 ~/.ssh")
            comm.execute("printf '#{contents}' >> ~/.ssh/authorized_keys")
            comm.execute("chmod 0600 ~/.ssh/authorized_keys")
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 6 versions & 3 rubygems

Version Path
vagrant-unbundled-1.8.4.2 plugins/guests/netbsd/cap/insert_public_key.rb
vagrant-unbundled-1.8.4.1 plugins/guests/netbsd/cap/insert_public_key.rb
vagrant-unbundled-1.8.1.2 plugins/guests/netbsd/cap/insert_public_key.rb
vagrant-unbundled-1.8.1.1 plugins/guests/netbsd/cap/insert_public_key.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-b421af58e8b3/plugins/guests/netbsd/cap/insert_public_key.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-1cf2a8db4ccb/plugins/guests/netbsd/cap/insert_public_key.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-272fb27e0536/plugins/guests/netbsd/cap/insert_public_key.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-309e896975d1/plugins/guests/netbsd/cap/insert_public_key.rb
vagrant-tiktalik-0.0.3 vendor/bundle/ruby/2.0.0/bundler/gems/vagrant-1e28f1ac31e7/plugins/guests/netbsd/cap/insert_public_key.rb