Class: Vagrant::Solaris10::A

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-solaris10.rb

Class Method Summary collapse

Class Method Details

.insert_public_key(machine, contents) ⇒ Object

Copyright © 2014 Mitchell Hashimoto



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/vagrant-solaris10.rb', line 16

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

.mount_parallels_shared_folder(machine, name, guestpath, options) ⇒ Object



7
8
9
# File 'lib/vagrant-solaris10.rb', line 7

def self.mount_parallels_shared_folder(machine, name, guestpath, options)
  p  "mount parallels"
end

.mount_vmware_shared_folder(machine, name, guestpath, options) ⇒ Object



11
12
13
# File 'lib/vagrant-solaris10.rb', line 11

def self.mount_vmware_shared_folder(machine, name, guestpath, options)
  p  "mount vmware"
end

.remove_public_key(machine, contents) ⇒ Object

 Copyright © 2014 Mitchell Hashimoto



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/vagrant-solaris10.rb', line 29

def self.remove_public_key(machine, contents)
  contents = contents.chomp
  contents = Vagrant::Util::ShellQuote.escape(contents, "'")

  machine.communicate.tap do |comm|
    if comm.test("test -f ~/.ssh/authorized_keys")
      comm.execute(
        "gsed -i '/^.*#{contents}.*$/d' ~/.ssh/authorized_keys")
    end
  end
end