vagrant-smartos-guest 0.0.1.pre.1 → 0.0.1.pre.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/vagrant/smartos/guest.rb +1 -0
- data/lib/vagrant/smartos/guest/cap/change_host_name.rb +10 -8
- data/lib/vagrant/smartos/guest/cap/configure_networks.rb +16 -14
- data/lib/vagrant/smartos/guest/cap/halt.rb +16 -14
- data/lib/vagrant/smartos/guest/cap/mount_nfs.rb +10 -8
- data/lib/vagrant/smartos/guest/cap/rsync.rb +16 -14
- data/lib/vagrant/smartos/guest/config.rb +13 -11
- data/lib/vagrant/smartos/guest/guest.rb +5 -3
- data/lib/vagrant/smartos/guest/plugin.rb +49 -47
- data/lib/vagrant/smartos/guest/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dee092fcabd9dfaf6d67050e20c22dc6ff4b905b
|
4
|
+
data.tar.gz: bf7bbca5e49a6165625955057517bab2eb02ac32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eaabaeae218f672ca25b84c235459edf1e6cf55af501a62d318fe3d5d652d51c86b345e42ccb4d6f3c4dd1ce9852d0272758d48f6d0072768abfbc3cc4b4263d
|
7
|
+
data.tar.gz: e7d33aabf39a63b3eb0cd084ba3b7132dcffd72bb0b38b7398c5eceb2e49aad7860220c93f0a08230e2dbe831a1ee5bb8baacdbd013f45672b8c8913f715d851
|
@@ -1,14 +1,16 @@
|
|
1
1
|
module Vagrant
|
2
2
|
module Smartos
|
3
|
-
module
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
module Guest
|
4
|
+
module Cap
|
5
|
+
class ChangeHostName
|
6
|
+
def self.change_host_name(machine, name)
|
7
|
+
su_cmd = machine.config.smartos.suexec_cmd
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
# Only do this if the hostname is not already set
|
10
|
+
if !machine.communicate.test("hostname | grep '#{name}'")
|
11
|
+
machine.communicate.execute("#{su_cmd} sh -c \"echo '#{name}' > /etc/nodename\"")
|
12
|
+
machine.communicate.execute("#{su_cmd} hostname #{name}")
|
13
|
+
end
|
12
14
|
end
|
13
15
|
end
|
14
16
|
end
|
@@ -1,22 +1,24 @@
|
|
1
1
|
module Vagrant
|
2
2
|
module Smartos
|
3
|
-
module
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
module Guest
|
4
|
+
module Cap
|
5
|
+
class ConfigureNetworks
|
6
|
+
def self.configure_networks(machine, networks)
|
7
|
+
su_cmd = machine.config.smartos.suexec_cmd
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
networks.each do |network|
|
10
|
+
device = "#{machine.config.smartos.device}#{network[:interface]}"
|
11
|
+
ifconfig_cmd = "#{su_cmd} /sbin/ifconfig #{device}"
|
11
12
|
|
12
|
-
|
13
|
+
machine.communicate.execute("#{ifconfig_cmd} plumb")
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
if network[:type].to_sym == :static
|
16
|
+
machine.communicate.execute("#{ifconfig_cmd} inet #{network[:ip]} netmask #{network[:netmask]}")
|
17
|
+
machine.communicate.execute("#{ifconfig_cmd} up")
|
18
|
+
machine.communicate.execute("#{su_cmd} sh -c \"echo '#{network[:ip]}' > /etc/hostname.#{device}\"")
|
19
|
+
elsif network[:type].to_sym == :dhcp
|
20
|
+
machine.communicate.execute("#{ifconfig_cmd} dhcp start")
|
21
|
+
end
|
20
22
|
end
|
21
23
|
end
|
22
24
|
end
|
@@ -1,19 +1,21 @@
|
|
1
1
|
module Vagrant
|
2
2
|
module Smartos
|
3
|
-
module
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
3
|
+
module Guest
|
4
|
+
module Cap
|
5
|
+
class Halt
|
6
|
+
def self.halt(machine)
|
7
|
+
# There should be an exception raised if the line
|
8
|
+
#
|
9
|
+
# vagrant::::profiles=Primary Administrator
|
10
|
+
#
|
11
|
+
# does not exist in /etc/user_attr. TODO
|
12
|
+
begin
|
13
|
+
machine.communicate.execute(
|
14
|
+
"#{machine.config.smartos.suexec_cmd} /usr/sbin/shutdown -y -i5 -g0")
|
15
|
+
rescue IOError
|
16
|
+
# Ignore, this probably means connection closed because it
|
17
|
+
# shut down.
|
18
|
+
end
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
@@ -1,14 +1,16 @@
|
|
1
1
|
module Vagrant
|
2
2
|
module Smartos
|
3
|
-
module
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
module Guest
|
4
|
+
module Cap
|
5
|
+
class MountNFS
|
6
|
+
def self.mount_nfs_folder(machine, ip, folders)
|
7
|
+
sudo = machine.config.smartos.suexec_cmd
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
folders.each do |name, opts|
|
10
|
+
machine.communicate.tap do |comm|
|
11
|
+
comm.execute("#{sudo} mkdir -p #{opts[:guestpath]}", {:shell => "sh"})
|
12
|
+
comm.execute("#{sudo} /usr/sbin/mount -F nfs '#{ip}:#{opts[:hostpath]}' '#{opts[:guestpath]}'", {:shell => "sh"})
|
13
|
+
end
|
12
14
|
end
|
13
15
|
end
|
14
16
|
end
|
@@ -1,23 +1,25 @@
|
|
1
1
|
module Vagrant
|
2
2
|
module Smartos
|
3
|
-
module
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
module Guest
|
4
|
+
module Cap
|
5
|
+
class RSync
|
6
|
+
def self.rsync_installed(machine)
|
7
|
+
machine.communicate.test("which rsync")
|
8
|
+
end
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
def self.rsync_install(machine, folder_opts)
|
11
|
+
username = machine.ssh_info[:username]
|
12
|
+
sudo = machine.config.smartos.suexec_cmd
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
14
|
+
machine.communicate.tap do |comm|
|
15
|
+
comm.execute("#{sudo} mkdir -p '#{folder_opts[:guestpath]}'")
|
16
|
+
comm.execute("#{sudo} chown -R #{username} '#{folder_opts[:guestpath]}'")
|
17
|
+
end
|
16
18
|
end
|
17
|
-
end
|
18
19
|
|
19
|
-
|
20
|
-
|
20
|
+
def self.rsync_pre(machine, folder_opts)
|
21
|
+
rsync_install(machine, folder_opts)
|
22
|
+
end
|
21
23
|
end
|
22
24
|
end
|
23
25
|
end
|
@@ -2,18 +2,20 @@ require 'vagrant'
|
|
2
2
|
|
3
3
|
module Vagrant
|
4
4
|
module Smartos
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
module Guest
|
6
|
+
class Config < Vagrant.plugin("2", :config)
|
7
|
+
attr_accessor :halt_timeout
|
8
|
+
attr_accessor :halt_check_interval
|
9
|
+
# This sets the command to use to execute items as a superuser. sudo is default
|
10
|
+
attr_accessor :suexec_cmd
|
11
|
+
attr_accessor :device
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
def initialize
|
14
|
+
@halt_timeout = 30
|
15
|
+
@halt_check_interval = 1
|
16
|
+
@suexec_cmd = 'pfexec'
|
17
|
+
@device = "e1000g"
|
18
|
+
end
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
@@ -2,9 +2,11 @@ require 'vagrant'
|
|
2
2
|
|
3
3
|
module Vagrant
|
4
4
|
module Smartos
|
5
|
-
|
6
|
-
|
7
|
-
machine
|
5
|
+
module Guest
|
6
|
+
class Guest < Vagrant.plugin("2", :guest)
|
7
|
+
def detect?(machine)
|
8
|
+
machine.communicate.test("cat /etc/release | grep -i SmartOS")
|
9
|
+
end
|
8
10
|
end
|
9
11
|
end
|
10
12
|
end
|
@@ -2,53 +2,55 @@ require 'vagrant'
|
|
2
2
|
|
3
3
|
module Vagrant
|
4
4
|
module Smartos
|
5
|
-
|
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
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
5
|
+
module Guest
|
6
|
+
class Plugin < Vagrant.plugin("2")
|
7
|
+
name "SmartOS guest."
|
8
|
+
description "SmartOS guest support."
|
9
|
+
|
10
|
+
config("smartos") do
|
11
|
+
require_relative 'config'
|
12
|
+
Config
|
13
|
+
end
|
14
|
+
|
15
|
+
guest("smartos") do
|
16
|
+
require_relative 'guest'
|
17
|
+
::Vagrant::Smartos::Guest::Guest
|
18
|
+
end
|
19
|
+
|
20
|
+
guest_capability("smartos", "change_host_name") do
|
21
|
+
require_relative "cap/change_host_name"
|
22
|
+
Cap::ChangeHostName
|
23
|
+
end
|
24
|
+
|
25
|
+
guest_capability("smartos", "configure_networks") do
|
26
|
+
require_relative "cap/configure_networks"
|
27
|
+
Cap::ConfigureNetworks
|
28
|
+
end
|
29
|
+
|
30
|
+
guest_capability("smartos", "halt") do
|
31
|
+
require_relative "cap/halt"
|
32
|
+
Cap::Halt
|
33
|
+
end
|
34
|
+
|
35
|
+
guest_capability("smartos", "mount_nfs_folder") do
|
36
|
+
require_relative "cap/mount_nfs"
|
37
|
+
Cap::MountNFS
|
38
|
+
end
|
39
|
+
|
40
|
+
guest_capability("smartos", "rsync_installed") do
|
41
|
+
require_relative "cap/rsync"
|
42
|
+
Cap::RSync
|
43
|
+
end
|
44
|
+
|
45
|
+
guest_capability("smartos", "rsync_install") do
|
46
|
+
require_relative "cap/rsync"
|
47
|
+
Cap::RSync
|
48
|
+
end
|
49
|
+
|
50
|
+
guest_capability("smartos", "rsync_pre") do
|
51
|
+
require_relative "cap/rsync"
|
52
|
+
Cap::RSync
|
53
|
+
end
|
52
54
|
end
|
53
55
|
end
|
54
56
|
end
|