Sha256: 0ffcdb24ac4b3c5278f076ef43379b821a02546513a04bac77e47eb2473ec085

Contents?: true

Size: 716 Bytes

Versions: 3

Compression:

Stored size: 716 Bytes

Contents

# Copyright (c) 2014 Tnarik Innael - repackaged
# Copyright (c) 2014 Mitchell Hashimoto - from plugins/guest/linux/cap/insert_public_key.rb
module Vagrant
  module Solaris10
    module Cap
      class InsertPublicKey

        def self.insert_public_key(machine, contents)
          contents = contents.chomp
          contents = Vagrant::Util::ShellQuote.escape(contents, "'")
  
          machine.communicate.tap do |comm|
            comm.execute("mkdir -p ~/.ssh")
            comm.execute("chmod 0700 ~/.ssh")
            comm.execute("printf '#{contents}\\n' >> ~/.ssh/authorized_keys")
            comm.execute("chmod 0600 ~/.ssh/authorized_keys")
          end
        end
        
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vagrant-solaris10-0.0.4 lib/vagrant-solaris10/cap/insert_public_key.rb
vagrant-solaris10-0.0.3 lib/vagrant-solaris10/cap/insert_public_key.rb
vagrant-solaris10-0.0.2 lib/vagrant-solaris10/cap/insert_public_key.rb