vagrant-smartos-guest 0.0.1.pre.3 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -31
- data/lib/vagrant/smartos/guest.rb +3 -2
- data/lib/vagrant/smartos/guest/cap/rsync.rb +18 -15
- data/lib/vagrant/smartos/guest/guest.rb +20 -8
- data/lib/vagrant/smartos/guest/version.rb +1 -1
- metadata +5 -10
- data/lib/vagrant/smartos/guest/cap/change_host_name.rb +0 -19
- data/lib/vagrant/smartos/guest/cap/configure_networks.rb +0 -29
- data/lib/vagrant/smartos/guest/cap/halt.rb +0 -24
- data/lib/vagrant/smartos/guest/cap/mount_nfs.rb +0 -21
- data/lib/vagrant/smartos/guest/config.rb +0 -22
- data/lib/vagrant/smartos/guest/plugin.rb +0 -52
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5ce5d98205844ddbf7c2ee01efb4302dd62db42
|
4
|
+
data.tar.gz: 4822c9ef8fb73f4b89569a96594fc4402fd019c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ad8fd641ce8719f381085ddb0e5c21a2a68498c1b27c5417355e15029134087aca31af1fc59d5c5c3872de28e763404acd59bac422b61c524dcb637b16033a7
|
7
|
+
data.tar.gz: 2274b99cb7f8270334f83dde4ecb18b0d67feaf668ff74db751e465203275b255ada68e77500ac1abba86c0313e7c3af0e3f8d4175c10433d05fbb774bfe0aa6
|
data/README.md
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
vagrant-smartos-guest
|
2
2
|
=====================
|
3
3
|
|
4
|
-
Adds
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
time of this writing (Vagrant 1.5), it has not yet been released.
|
4
|
+
Adds some fixes to Vagrant for integrating with SmartOS. This gem
|
5
|
+
is intended to package code fixes that have already been submitted to
|
6
|
+
Vagrant as pull requests, before those fixes have been includes in an
|
7
|
+
official release.
|
9
8
|
|
10
9
|
## Installation
|
11
10
|
|
@@ -28,32 +27,12 @@ Otherwise install the plugin into your omnibus installation of Vagrant:
|
|
28
27
|
vagrant plugin install vagrant-smartos-guest
|
29
28
|
```
|
30
29
|
|
31
|
-
##
|
32
|
-
|
33
|
-
This plugin allows Vagrant to recognize when a guest box is a SmartOS
|
34
|
-
global zone or local zone.
|
35
|
-
|
36
|
-
When connecting to a SmartOS global zone in VirtualBox without guest
|
37
|
-
additions, very likely the default mountpoint will need to be disabled.
|
38
|
-
|
39
|
-
To disable the default mountpoint, add this to your Vagrantfile inside
|
40
|
-
your config block:
|
41
|
-
|
42
|
-
```ruby
|
43
|
-
config.vm.synced_folder ".", "/vagrant", disabled: true
|
44
|
-
```
|
30
|
+
## Current state
|
45
31
|
|
46
|
-
|
47
|
-
|
32
|
+
This gem is currently usable with Vagrant 1.6.3. It fixes some
|
33
|
+
regressions in the way that Vagrant handles synced folders of type:
|
34
|
+
'rsync'.
|
48
35
|
|
49
|
-
|
50
|
-
|
51
|
-
config.vm.synced_folder ".", "/zones/vagrant", type: 'rsync'
|
52
|
-
```
|
53
|
-
|
54
|
-
When sharing a folder via NFS, you can override the default mountpoint:
|
55
|
-
|
56
|
-
```ruby
|
57
|
-
config.vm.synced_folder ".", "/vagrant", type: "nfs"
|
58
|
-
```
|
36
|
+
* <https://github.com/mitchellh/vagrant/pull/4415>
|
37
|
+
* <https://github.com/mitchellh/vagrant/pull/4274>
|
59
38
|
|
@@ -1,22 +1,25 @@
|
|
1
|
-
module
|
2
|
-
module
|
3
|
-
module
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
end
|
1
|
+
module VagrantPlugins
|
2
|
+
module GuestSmartos
|
3
|
+
module Cap
|
4
|
+
class RSync
|
5
|
+
def self.rsync_installed(machine)
|
6
|
+
machine.communicate.test("which rsync")
|
7
|
+
end
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
def self.rsync_command(machine)
|
10
|
+
"#{machine.config.smartos.suexec_cmd} rsync"
|
11
|
+
end
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
end
|
13
|
+
def self.rsync_pre(machine, opts)
|
14
|
+
machine.communicate.tap do |comm|
|
15
|
+
comm.execute("#{machine.config.smartos.suexec_cmd} mkdir -p '#{opts[:guestpath]}'")
|
18
16
|
end
|
19
17
|
end
|
18
|
+
|
19
|
+
def self.rsync_post(machine, opts)
|
20
|
+
machine.communicate.execute("#{machine.config.smartos.suexec_cmd} find '#{opts[:guestpath]}' '(' ! -user #{opts[:owner]} -or ! -group #{opts[:group]} ')' -print0 | " +
|
21
|
+
"#{machine.config.smartos.suexec_cmd} xargs -0 chown #{opts[:owner]}:#{opts[:group]}")
|
22
|
+
end
|
20
23
|
end
|
21
24
|
end
|
22
25
|
end
|
@@ -1,12 +1,24 @@
|
|
1
|
-
|
1
|
+
module VagrantPlugins
|
2
|
+
module GuestSmartos
|
3
|
+
class Plugin < Vagrant.plugin('2')
|
4
|
+
guest_capability("smartos", "rsync_installed") do
|
5
|
+
require_relative "cap/rsync"
|
6
|
+
Cap::RSync
|
7
|
+
end
|
8
|
+
|
9
|
+
guest_capability("smartos", "rsync_command") do
|
10
|
+
require_relative "cap/rsync"
|
11
|
+
Cap::RSync
|
12
|
+
end
|
13
|
+
|
14
|
+
guest_capability("smartos", "rsync_post") do
|
15
|
+
require_relative "cap/rsync"
|
16
|
+
Cap::RSync
|
17
|
+
end
|
2
18
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
class Guest < Vagrant.plugin("2", :guest)
|
7
|
-
def detect?(machine)
|
8
|
-
machine.communicate.test("cat /etc/release | grep -i SmartOS")
|
9
|
-
end
|
19
|
+
guest_capability("smartos", "rsync_pre") do
|
20
|
+
require_relative "cap/rsync"
|
21
|
+
Cap::RSync
|
10
22
|
end
|
11
23
|
end
|
12
24
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-smartos-guest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Saxby
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -51,14 +51,8 @@ files:
|
|
51
51
|
- README.md
|
52
52
|
- Rakefile
|
53
53
|
- lib/vagrant/smartos/guest.rb
|
54
|
-
- lib/vagrant/smartos/guest/cap/change_host_name.rb
|
55
|
-
- lib/vagrant/smartos/guest/cap/configure_networks.rb
|
56
|
-
- lib/vagrant/smartos/guest/cap/halt.rb
|
57
|
-
- lib/vagrant/smartos/guest/cap/mount_nfs.rb
|
58
54
|
- lib/vagrant/smartos/guest/cap/rsync.rb
|
59
|
-
- lib/vagrant/smartos/guest/config.rb
|
60
55
|
- lib/vagrant/smartos/guest/guest.rb
|
61
|
-
- lib/vagrant/smartos/guest/plugin.rb
|
62
56
|
- lib/vagrant/smartos/guest/version.rb
|
63
57
|
- vagrant-smartos-guest.gemspec
|
64
58
|
homepage: ''
|
@@ -76,9 +70,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
76
70
|
version: '0'
|
77
71
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
72
|
requirements:
|
79
|
-
- - "
|
73
|
+
- - ">="
|
80
74
|
- !ruby/object:Gem::Version
|
81
|
-
version:
|
75
|
+
version: '0'
|
82
76
|
requirements: []
|
83
77
|
rubyforge_project:
|
84
78
|
rubygems_version: 2.2.0
|
@@ -86,3 +80,4 @@ signing_key:
|
|
86
80
|
specification_version: 4
|
87
81
|
summary: Allow Vagrant to detect SmartOS guests and guest capabilities
|
88
82
|
test_files: []
|
83
|
+
has_rdoc:
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module Vagrant
|
2
|
-
module Smartos
|
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
|
8
|
-
|
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
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
module Vagrant
|
2
|
-
module Smartos
|
3
|
-
module Guest
|
4
|
-
module Cap
|
5
|
-
class ConfigureNetworks
|
6
|
-
def self.configure_networks(machine, networks)
|
7
|
-
su_cmd = machine.config.smartos.suexec_cmd
|
8
|
-
|
9
|
-
networks.each do |network|
|
10
|
-
device = "#{machine.config.smartos.device}#{network[:interface]}"
|
11
|
-
ifconfig_cmd = "#{su_cmd} /sbin/ifconfig #{device}"
|
12
|
-
|
13
|
-
machine.communicate.execute("#{ifconfig_cmd} plumb")
|
14
|
-
|
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
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
@@ -1,24 +0,0 @@
|
|
1
|
-
module Vagrant
|
2
|
-
module Smartos
|
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
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module Vagrant
|
2
|
-
module Smartos
|
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
|
8
|
-
|
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
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'vagrant'
|
2
|
-
|
3
|
-
module Vagrant
|
4
|
-
module Smartos
|
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
|
12
|
-
|
13
|
-
def initialize
|
14
|
-
@halt_timeout = 30
|
15
|
-
@halt_check_interval = 1
|
16
|
-
@suexec_cmd = 'pfexec'
|
17
|
-
@device = "e1000g"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
require 'vagrant'
|
2
|
-
|
3
|
-
module Vagrant
|
4
|
-
module Smartos
|
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_pre") do
|
46
|
-
require_relative "cap/rsync"
|
47
|
-
Cap::RSync
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|