vagrant-smartos-zones 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.kitchen.yml +30 -0
- data/.rubocop.yml +3 -1
- data/Gemfile +5 -0
- data/README.md +15 -0
- data/lib/vagrant/smartos/zones/cap/zone/base.rb +3 -3
- data/lib/vagrant/smartos/zones/cap/zone/create.rb +1 -15
- data/lib/vagrant/smartos/zones/commands/dataset.rb +0 -4
- data/lib/vagrant/smartos/zones/commands/global_zone.rb +0 -4
- data/lib/vagrant/smartos/zones/commands/multi_command.rb +11 -1
- data/lib/vagrant/smartos/zones/commands/smartos.rb +0 -4
- data/lib/vagrant/smartos/zones/commands/zones.rb +44 -46
- data/lib/vagrant/smartos/zones/config/zone.rb +4 -8
- data/lib/vagrant/smartos/zones/models/config.rb +68 -0
- data/lib/vagrant/smartos/zones/models/zone.rb +15 -3
- data/lib/vagrant/smartos/zones/util/platform_images.rb +2 -2
- data/lib/vagrant/smartos/zones/util/zone_project.rb +1 -0
- data/lib/vagrant/smartos/zones/util/{zone_info.rb → zones.rb} +5 -1
- data/lib/vagrant/smartos/zones/version.rb +1 -1
- data/test/integration/default/serverspec/group_spec.rb +7 -0
- data/test/integration/default/serverspec/spec_helper.rb +3 -0
- data/test/integration/default/serverspec/user_spec.rb +7 -0
- data/test/templates/Vagrantfile.smartos.erb +64 -0
- data/test/templates/bootstrap.sh +55 -0
- metadata +16 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 988a3cb1d2037d6bb7f60aa880606009a23ef4ca
|
4
|
+
data.tar.gz: 95a20be29c4b4f6de32fee8eb8e693e6988589a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 733c6c0afe14d5d0a29a5cd9d7710386630aad93285db0caaef743abe688ac340573a1b66038e82f8b1280c073f5f3874c84b8aaa1f4a0bccdbd895c0ca4ba20
|
7
|
+
data.tar.gz: 91aa10f0b5183779696c57982e8739e338aa6aa329ea45e907205287dcfa59b7b6364230f3109584f9e0458d3dc3f8e0bbfa81fb47239bfe15a96c5e91aeab70
|
data/.kitchen.yml
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
driver:
|
3
|
+
name: vagrant
|
4
|
+
|
5
|
+
provisioner:
|
6
|
+
name: shell
|
7
|
+
script: test/templates/bootstrap.sh
|
8
|
+
|
9
|
+
platforms:
|
10
|
+
- name: smartos
|
11
|
+
driver_config:
|
12
|
+
box: livinginthepast/smartos-base64
|
13
|
+
box_url: https://atlas.hashicorp.com/livinginthepast/boxes/smartos-base64
|
14
|
+
vagrantfile_erb: test/templates/Vagrantfile.smartos.erb
|
15
|
+
zone:
|
16
|
+
name: base64
|
17
|
+
brand: joyent
|
18
|
+
image: d34c301e-10c3-11e4-9b79-5f67ca448df0
|
19
|
+
- name: lx
|
20
|
+
driver_config:
|
21
|
+
box: livinginthepast/smartos
|
22
|
+
box_url: https://atlas.hashicorp.com/livinginthepast/boxes/smartos
|
23
|
+
vagrantfile_erb: test/templates/Vagrantfile.smartos.erb
|
24
|
+
zone:
|
25
|
+
name: lx_zone
|
26
|
+
brand: lx
|
27
|
+
image: 14a960b0-614e-11e4-a095-eb789315ae39
|
28
|
+
|
29
|
+
suites:
|
30
|
+
- name: default
|
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -72,6 +72,8 @@ Vagrant.configure('2') do |config|
|
|
72
72
|
v.memory = 3072
|
73
73
|
end
|
74
74
|
|
75
|
+
config.ssh.insert_key = false
|
76
|
+
|
75
77
|
# See https://vagrantcloud.com/livinginthepast for SmartOS boxes
|
76
78
|
config.vm.box = "livinginthepast/smartos"
|
77
79
|
config.vm.synced_folder ".", "/vagrant", disabled: true
|
@@ -229,6 +231,19 @@ group with which to connect. This user should have `Primary
|
|
229
231
|
Administrator` privileges. When creating a local zone, a `vagrant`
|
230
232
|
user and group are also created in the zone.
|
231
233
|
|
234
|
+
## Tests
|
235
|
+
|
236
|
+
There is a basic test suite that uses `test-kitchen` to converge
|
237
|
+
different brands of zones. Although it might not be comprehensive, it
|
238
|
+
should be ran after new features or after any significant refactoring to
|
239
|
+
ensure that nothing breaks the ability to stand up a zone.
|
240
|
+
|
241
|
+
```bash
|
242
|
+
bundle exec kitchen test
|
243
|
+
```
|
244
|
+
|
245
|
+
This may take a while...
|
246
|
+
|
232
247
|
## References / Alternatives
|
233
248
|
|
234
249
|
Any success of this project depends heavily on the work of others,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'vagrant/smartos/zones/cap/base'
|
2
2
|
require 'vagrant/smartos/zones/models/zone'
|
3
|
-
require 'vagrant/smartos/zones/util/
|
3
|
+
require 'vagrant/smartos/zones/util/zones'
|
4
4
|
|
5
5
|
module Vagrant
|
6
6
|
module Smartos
|
@@ -17,8 +17,8 @@ module Vagrant
|
|
17
17
|
machine.config.zone && machine.config.zone.image && machine.config.zone.name
|
18
18
|
end
|
19
19
|
|
20
|
-
def
|
21
|
-
@
|
20
|
+
def zones
|
21
|
+
@zones ||= Util::Zones.new(machine)
|
22
22
|
end
|
23
23
|
|
24
24
|
def zone
|
@@ -11,17 +11,7 @@ module Vagrant
|
|
11
11
|
|
12
12
|
def execute
|
13
13
|
return warn_zone_config unless zone_valid?
|
14
|
-
|
15
|
-
create_zone
|
16
|
-
end
|
17
|
-
|
18
|
-
def create_zone
|
19
|
-
zone_info.create(machine.config.zone.name)
|
20
|
-
end
|
21
|
-
|
22
|
-
def update_zone
|
23
|
-
ui.info "Zone #{machine.config.zone.name} exists"
|
24
|
-
zone_info.update(machine.config.zone.name)
|
14
|
+
Models::Zone.create_or_update(machine.config.zone.name, machine)
|
25
15
|
end
|
26
16
|
|
27
17
|
def warn_zone_config
|
@@ -33,10 +23,6 @@ module Vagrant
|
|
33
23
|
ui.info ' config.zone.memory = 2048'
|
34
24
|
ui.info ' config.zone.disk_size = 5'
|
35
25
|
end
|
36
|
-
|
37
|
-
def zone_json
|
38
|
-
Util::ZoneJson.new(machine).to_json
|
39
|
-
end
|
40
26
|
end
|
41
27
|
end
|
42
28
|
end
|
@@ -26,10 +26,6 @@ module Vagrant
|
|
26
26
|
'View and interact with the SmartOS global zone'
|
27
27
|
end
|
28
28
|
|
29
|
-
def execute
|
30
|
-
process_subcommand
|
31
|
-
end
|
32
|
-
|
33
29
|
def ssh(*_args)
|
34
30
|
with_target_vms('default', single_target: true) do |machine|
|
35
31
|
ssh_info = Util::GlobalZone::SSHInfo.new(machine.provider, machine.config, machine.env).to_hash
|
@@ -12,7 +12,16 @@ module Vagrant
|
|
12
12
|
# OptionParser
|
13
13
|
#
|
14
14
|
module MultiCommand
|
15
|
+
# Automatically called by Vagrant when running a command
|
16
|
+
def execute
|
17
|
+
process_subcommand
|
18
|
+
end
|
19
|
+
|
20
|
+
# Sends parsed argv to an instance method that maps to the
|
21
|
+
# subcommand name. If flags are passed to the option parser,
|
22
|
+
# they will be included in argv as a trailing hash.
|
15
23
|
def process_subcommand
|
24
|
+
@options = {}
|
16
25
|
args = parse_options(option_parser)
|
17
26
|
exit unless args
|
18
27
|
|
@@ -24,6 +33,7 @@ module Vagrant
|
|
24
33
|
exit 1
|
25
34
|
end
|
26
35
|
|
36
|
+
args << @options unless @options.empty?
|
27
37
|
send command, *args
|
28
38
|
end
|
29
39
|
|
@@ -33,7 +43,7 @@ module Vagrant
|
|
33
43
|
end
|
34
44
|
|
35
45
|
def option_parser
|
36
|
-
self.class.const_get('OPTION_PARSER')
|
46
|
+
@option_parser ||= self.class.const_get('OPTION_PARSER')
|
37
47
|
end
|
38
48
|
|
39
49
|
def subcommands
|
@@ -1,8 +1,9 @@
|
|
1
1
|
require 'vagrant'
|
2
2
|
require 'vagrant/smartos/zones/errors'
|
3
|
+
require 'vagrant/smartos/zones/models/config'
|
3
4
|
require 'vagrant/smartos/zones/models/zone'
|
4
5
|
require 'vagrant/smartos/zones/util/snapshots'
|
5
|
-
require 'vagrant/smartos/zones/util/
|
6
|
+
require 'vagrant/smartos/zones/util/zones'
|
6
7
|
require_relative 'multi_command'
|
7
8
|
|
8
9
|
module Vagrant
|
@@ -12,41 +13,49 @@ module Vagrant
|
|
12
13
|
class Zones < Vagrant.plugin('2', :command)
|
13
14
|
include MultiCommand
|
14
15
|
|
15
|
-
COMMANDS = %w(create destroy list show snapshot start stop).freeze
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
16
|
+
COMMANDS = %w(config create destroy list show snapshot start stop).freeze
|
17
|
+
|
18
|
+
# rubocop:disable Metrics/MethodLength
|
19
|
+
def option_parser
|
20
|
+
OptionParser.new do |o|
|
21
|
+
o.banner = 'Usage: vagrant zones [command] [name]'
|
22
|
+
o.separator ''
|
23
|
+
o.separator 'Commands:'
|
24
|
+
o.separator ' list show status of zones'
|
25
|
+
o.separator ' config [action] [options] interact with global plugin configuration'
|
26
|
+
o.separator ' create [name] create or update zone with alias [name]'
|
27
|
+
o.separator ' destroy [name] delete zone with alias [name]'
|
28
|
+
o.separator ' show [name] show info on zone with alias [name]'
|
29
|
+
o.separator ' snapshot [action] [name] [snapshot] snapshot the ZFS filesystem for [name]'
|
30
|
+
o.separator ' actions: list, create, delete, rollback'
|
31
|
+
o.separator ' start [name] start zone with alias [name]'
|
32
|
+
o.separator ' stop [name] stop zone with alias [name]'
|
33
|
+
o.separator ''
|
34
|
+
o.separator 'Options:'
|
35
|
+
o.separator ''
|
36
|
+
o.on('--delete', 'delete configuration key') do |d|
|
37
|
+
@options[:delete] = d
|
38
|
+
end
|
39
|
+
end
|
32
40
|
end
|
41
|
+
# rubocop:enable Metrics/MethodLength
|
33
42
|
|
34
43
|
def self.synopsis
|
35
44
|
'View and interact with SmartOS zones'
|
36
45
|
end
|
37
46
|
|
38
|
-
def
|
39
|
-
|
47
|
+
def config(*args)
|
48
|
+
Models::Config.parse_cli(@env, *args)
|
40
49
|
end
|
41
50
|
|
42
51
|
def create(name)
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
52
|
+
with_target_vms('default') do |machine|
|
53
|
+
Models::Zone.create(name, machine).tap do |zone|
|
54
|
+
@env.ui.info(I18n.t('vagrant.smartos.zones.commands.zones.create',
|
55
|
+
name: zone.name, state: zone.state, uuid: zone.uuid,
|
56
|
+
brand: zone.brand, image: zone.image),
|
57
|
+
prefix: false)
|
58
|
+
end
|
50
59
|
end
|
51
60
|
end
|
52
61
|
|
@@ -54,9 +63,8 @@ module Vagrant
|
|
54
63
|
with_zone(name) do |zone|
|
55
64
|
zone.destroy
|
56
65
|
@env.ui.info(I18n.t('vagrant.smartos.zones.commands.zones.destroyed',
|
57
|
-
name: zone.name, state: zone.state,
|
58
|
-
|
59
|
-
image: zone.image))
|
66
|
+
name: zone.name, state: zone.state, uuid: zone.uuid,
|
67
|
+
brand: zone.brand, image: zone.image))
|
60
68
|
end
|
61
69
|
end
|
62
70
|
|
@@ -73,9 +81,8 @@ module Vagrant
|
|
73
81
|
def show(name)
|
74
82
|
with_zone(name) do |zone|
|
75
83
|
@env.ui.info(I18n.t('vagrant.smartos.zones.commands.zones.show',
|
76
|
-
name: zone.name, state: zone.state,
|
77
|
-
|
78
|
-
image: zone.image),
|
84
|
+
name: zone.name, state: zone.state, uuid: zone.uuid,
|
85
|
+
brand: zone.brand, image: zone.image),
|
79
86
|
prefix: false)
|
80
87
|
end
|
81
88
|
end
|
@@ -91,9 +98,8 @@ module Vagrant
|
|
91
98
|
with_zone(name) do |zone|
|
92
99
|
zone.start
|
93
100
|
@env.ui.info(I18n.t('vagrant.smartos.zones.commands.zones.start',
|
94
|
-
name: zone.name, state: zone.state,
|
95
|
-
|
96
|
-
image: zone.image))
|
101
|
+
name: zone.name, state: zone.state, uuid: zone.uuid,
|
102
|
+
brand: zone.brand, image: zone.image))
|
97
103
|
end
|
98
104
|
end
|
99
105
|
|
@@ -109,21 +115,13 @@ module Vagrant
|
|
109
115
|
|
110
116
|
private
|
111
117
|
|
112
|
-
def zones
|
113
|
-
zones = nil
|
114
|
-
with_target_vms('default') { |machine| zones = Util::ZoneInfo.new(machine) }
|
115
|
-
zones
|
116
|
-
end
|
117
|
-
|
118
118
|
def ui
|
119
119
|
@env.ui
|
120
120
|
end
|
121
121
|
|
122
|
-
def with_zone(name)
|
122
|
+
def with_zone(name, &blk)
|
123
123
|
with_target_vms('default', single_target: true) do |machine|
|
124
|
-
Models::Zone.find(machine, name).tap
|
125
|
-
yield zone
|
126
|
-
end
|
124
|
+
Models::Zone.find(machine, name).tap { |zone| blk.call(zone) }
|
127
125
|
end
|
128
126
|
rescue ZoneNotFound
|
129
127
|
ui.warn(I18n.t('vagrant.smartos.zones.warning.zone_not_found',
|
@@ -10,11 +10,11 @@ module Vagrant
|
|
10
10
|
|
11
11
|
def initialize
|
12
12
|
@brand = UNSET_VALUE
|
13
|
-
@disk_size =
|
14
|
-
@image =
|
13
|
+
@disk_size = nil
|
14
|
+
@image = nil
|
15
15
|
@kernel_version = UNSET_VALUE
|
16
|
-
@memory =
|
17
|
-
@name =
|
16
|
+
@memory = nil
|
17
|
+
@name = nil
|
18
18
|
@synced_folders = []
|
19
19
|
end
|
20
20
|
|
@@ -24,11 +24,7 @@ module Vagrant
|
|
24
24
|
|
25
25
|
def finalize!
|
26
26
|
@brand = 'joyent' if @brand == UNSET_VALUE
|
27
|
-
@disk_size = nil if @disk_size == UNSET_VALUE
|
28
|
-
@image = nil if @image == UNSET_VALUE
|
29
27
|
@kernel_version = '3.16' if @kernel_version == UNSET_VALUE
|
30
|
-
@memory = nil if @memory == UNSET_VALUE
|
31
|
-
@name = nil if @name == UNSET_VALUE
|
32
28
|
end
|
33
29
|
end
|
34
30
|
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
module Vagrant
|
4
|
+
module Smartos
|
5
|
+
module Zones
|
6
|
+
module Models
|
7
|
+
class Config
|
8
|
+
def self.parse_cli(env, *args)
|
9
|
+
config(env).parse(args)
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.config(env)
|
13
|
+
@config ||= new(env).load
|
14
|
+
end
|
15
|
+
|
16
|
+
attr_reader :env, :hash
|
17
|
+
|
18
|
+
def initialize(env)
|
19
|
+
@env = env
|
20
|
+
end
|
21
|
+
|
22
|
+
def parse(args)
|
23
|
+
ui.info(hash.inspect) && return if args.empty?
|
24
|
+
options = args.pop if args.last.is_a?(Hash)
|
25
|
+
if options && options[:delete]
|
26
|
+
delete args.shift
|
27
|
+
else
|
28
|
+
set(*args)
|
29
|
+
end
|
30
|
+
save
|
31
|
+
end
|
32
|
+
|
33
|
+
def delete(name, *_args)
|
34
|
+
hash.delete(name)
|
35
|
+
end
|
36
|
+
|
37
|
+
def set(name, value)
|
38
|
+
hash[name] = value
|
39
|
+
end
|
40
|
+
|
41
|
+
def load
|
42
|
+
@hash = YAML.load_file(path) if File.exist?(path)
|
43
|
+
@hash ||= {}
|
44
|
+
self
|
45
|
+
end
|
46
|
+
|
47
|
+
def save
|
48
|
+
File.open(path, 'w') { |f| f.write(YAML.dump(hash)) }
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def home_path
|
54
|
+
env.respond_to?(:home_path) ? env.home_path : env[:home_path]
|
55
|
+
end
|
56
|
+
|
57
|
+
def path
|
58
|
+
home_path.join('smartos', 'config.yml')
|
59
|
+
end
|
60
|
+
|
61
|
+
def ui
|
62
|
+
env.respond_to?(:ui) ? env.ui : env[:ui]
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'vagrant/smartos/zones/errors'
|
2
2
|
require 'vagrant/smartos/zones/util/global_zone/helper'
|
3
|
+
require 'vagrant/smartos/zones/util/zones'
|
3
4
|
|
4
5
|
module Vagrant
|
5
6
|
module Smartos
|
@@ -19,13 +20,24 @@ module Vagrant
|
|
19
20
|
zones
|
20
21
|
end
|
21
22
|
|
22
|
-
def self.
|
23
|
+
def self.create(name, machine)
|
24
|
+
Util::Zones.new(machine).create(name)
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.create_or_update(name, machine)
|
28
|
+
return Util::Zones.new(machine).update(name) if find(machine, name, raise_on_error: false)
|
29
|
+
Util::Zones.new(machine).create(name)
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.find(machine, name, options = {})
|
33
|
+
options = { raise_on_error: true }.merge(options)
|
23
34
|
zone_hash = {}
|
24
35
|
finder = "pfexec vmadm lookup -j -o uuid,alias,state,image_uuid,brand alias=#{name}"
|
25
36
|
with_gz(machine, finder) do |output|
|
26
37
|
hash = JSON.parse(output).first
|
27
|
-
|
28
|
-
|
38
|
+
break zone_hash.merge!(hash) if hash
|
39
|
+
raise ZoneNotFound if options[:raise_on_error]
|
40
|
+
return
|
29
41
|
end
|
30
42
|
from_hash(zone_hash, machine)
|
31
43
|
end
|
@@ -38,7 +38,7 @@ module Vagrant
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def latest
|
41
|
-
latest_html = Zones::Util::Downloader.new(platform_image_latest_url).read
|
41
|
+
latest_html = Vagrant::Smartos::Zones::Util::Downloader.new(platform_image_latest_url).read
|
42
42
|
latest = latest_html.match(/(\d{8}T\d{6}Z)/)
|
43
43
|
return unless latest
|
44
44
|
latest[1]
|
@@ -55,7 +55,7 @@ module Vagrant
|
|
55
55
|
def download_checksum_file
|
56
56
|
return if machine && machine.config.global_zone.platform_image_url
|
57
57
|
ui.info "Downloading checksums for SmartOS platform image #{image}"
|
58
|
-
Zones::Util::Downloader.get(platform_image_checksum_url, platform_image_checksum_path)
|
58
|
+
Vagrant::Smartos::Zones::Util::Downloader.get(platform_image_checksum_url, platform_image_checksum_path)
|
59
59
|
end
|
60
60
|
|
61
61
|
def download_platform_image
|
@@ -9,7 +9,11 @@ module Vagrant
|
|
9
9
|
module Smartos
|
10
10
|
module Zones
|
11
11
|
module Util
|
12
|
-
|
12
|
+
# Service object for creating zones
|
13
|
+
#
|
14
|
+
# Wraps up creation of associated things within a zone
|
15
|
+
#
|
16
|
+
class Zones
|
13
17
|
include GlobalZone::Helper
|
14
18
|
|
15
19
|
attr_reader :machine
|
@@ -0,0 +1,64 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
#^ruby syntax highlighting
|
3
|
+
|
4
|
+
Vagrant.configure("2") do |c|
|
5
|
+
c.vm.box = "<%= config[:box] %>"
|
6
|
+
c.vm.box_url = "<%= config[:box_url] %>"
|
7
|
+
|
8
|
+
c.ssh.insert_key = false
|
9
|
+
|
10
|
+
<% if config[:zone] %>
|
11
|
+
c.vm.communicator = 'smartos'
|
12
|
+
c.global_zone.platform_image = 'latest'
|
13
|
+
c.zone.name = '<%= config[:zone][:name] %>'
|
14
|
+
c.zone.brand = '<%= config[:zone][:brand] || 'joyent' %>'
|
15
|
+
c.zone.image = '<%= config[:zone][:image] %>'
|
16
|
+
c.zone.memory = 1536
|
17
|
+
c.zone.disk_size = 5
|
18
|
+
<% end %>
|
19
|
+
|
20
|
+
<% if config[:vm_hostname] %>
|
21
|
+
c.vm.hostname = "<%= config[:vm_hostname] %>"
|
22
|
+
<% end %>
|
23
|
+
<% if config[:guest] %>
|
24
|
+
c.vm.guest = <%= config[:guest] %>
|
25
|
+
<% end %>
|
26
|
+
<% if config[:username] %>
|
27
|
+
c.ssh.username = "<%= config[:username] %>"
|
28
|
+
<% end %>
|
29
|
+
<% if config[:password] %>
|
30
|
+
c.ssh.password = "<%= config[:password] %>"
|
31
|
+
<% end %>
|
32
|
+
<% if config[:ssh_key] %>
|
33
|
+
c.ssh.private_key_path = "<%= config[:ssh_key] %>"
|
34
|
+
<% end %>
|
35
|
+
|
36
|
+
<% Array(config[:network]).each do |opts| %>
|
37
|
+
c.vm.network(:<%= opts[0] %>, <%= opts[1..-1].join(", ") %>)
|
38
|
+
<% end %>
|
39
|
+
|
40
|
+
c.vm.synced_folder ".", "/vagrant", disabled: true
|
41
|
+
<% config[:synced_folders].each do |source, destination, options| %>
|
42
|
+
c.vm.synced_folder "<%= source %>", "<%= destination %>", <%= options %>
|
43
|
+
<% end %>
|
44
|
+
|
45
|
+
c.vm.provider :<%= config[:provider] %> do |p|
|
46
|
+
<% config[:customize].each do |key, value| %>
|
47
|
+
<% case config[:provider]
|
48
|
+
when "virtualbox" %>
|
49
|
+
p.customize ["modifyvm", :id, "--<%= key %>", "<%= value %>"]
|
50
|
+
<% when "rackspace", "softlayer" %>
|
51
|
+
p.<%= key %> = "<%= value%>"
|
52
|
+
<% when /^vmware_/ %>
|
53
|
+
<% if key == :memory %>
|
54
|
+
<% unless config[:customize].include?(:memsize) %>
|
55
|
+
p.vmx["memsize"] = "<%= value %>"
|
56
|
+
<% end %>
|
57
|
+
<% else %>
|
58
|
+
p.vmx["<%= key %>"] = "<%= value %>"
|
59
|
+
<% end %>
|
60
|
+
<% end %>
|
61
|
+
<% end %>
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
@@ -0,0 +1,55 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
# This installs ruby in a location that test-kitchen
|
4
|
+
# will use with busser to run integration tests.
|
5
|
+
|
6
|
+
check_platform() {
|
7
|
+
echo $(uname -s)
|
8
|
+
}
|
9
|
+
|
10
|
+
install_fake_chef() {
|
11
|
+
mkdir -p /opt/chef/embedded/bin
|
12
|
+
}
|
13
|
+
|
14
|
+
install_ruby() {
|
15
|
+
local platform=$(check_platform)
|
16
|
+
case ${platform} in
|
17
|
+
SunOS)
|
18
|
+
install_ruby_smartos
|
19
|
+
;;
|
20
|
+
Linux)
|
21
|
+
install_ruby_linux
|
22
|
+
;;
|
23
|
+
esac
|
24
|
+
}
|
25
|
+
|
26
|
+
install_ruby_linux() {
|
27
|
+
apt-get install ruby
|
28
|
+
}
|
29
|
+
|
30
|
+
install_ruby_smartos() {
|
31
|
+
pkgin -y in ruby
|
32
|
+
}
|
33
|
+
|
34
|
+
symlink_ruby() {
|
35
|
+
local ruby=$(local_ruby)
|
36
|
+
local gem=$(local_gem)
|
37
|
+
ln -s ${ruby} /opt/chef/embedded/bin/ruby
|
38
|
+
ln -s ${gem} /opt/chef/embedded/bin/gem
|
39
|
+
}
|
40
|
+
|
41
|
+
local_ruby() {
|
42
|
+
echo $(which ruby)
|
43
|
+
}
|
44
|
+
|
45
|
+
local_gem() {
|
46
|
+
echo $(which gem)
|
47
|
+
}
|
48
|
+
|
49
|
+
main() {
|
50
|
+
install_fake_chef
|
51
|
+
install_ruby
|
52
|
+
symlink_ruby
|
53
|
+
}
|
54
|
+
|
55
|
+
main
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-smartos-zones
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
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-12-
|
11
|
+
date: 2014-12-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -60,6 +60,7 @@ extensions: []
|
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
62
|
- ".gitignore"
|
63
|
+
- ".kitchen.yml"
|
63
64
|
- ".rubocop.yml"
|
64
65
|
- Gemfile
|
65
66
|
- LICENSE.txt
|
@@ -114,6 +115,7 @@ files:
|
|
114
115
|
- lib/vagrant/smartos/zones/errors.rb
|
115
116
|
- lib/vagrant/smartos/zones/guest.rb
|
116
117
|
- lib/vagrant/smartos/zones/hooks.rb
|
118
|
+
- lib/vagrant/smartos/zones/models/config.rb
|
117
119
|
- lib/vagrant/smartos/zones/models/dataset.rb
|
118
120
|
- lib/vagrant/smartos/zones/models/snapshot.rb
|
119
121
|
- lib/vagrant/smartos/zones/models/zone.rb
|
@@ -129,11 +131,16 @@ files:
|
|
129
131
|
- lib/vagrant/smartos/zones/util/public_key.rb
|
130
132
|
- lib/vagrant/smartos/zones/util/snapshots.rb
|
131
133
|
- lib/vagrant/smartos/zones/util/zone_group.rb
|
132
|
-
- lib/vagrant/smartos/zones/util/zone_info.rb
|
133
134
|
- lib/vagrant/smartos/zones/util/zone_json.rb
|
134
135
|
- lib/vagrant/smartos/zones/util/zone_project.rb
|
135
136
|
- lib/vagrant/smartos/zones/util/zone_user.rb
|
137
|
+
- lib/vagrant/smartos/zones/util/zones.rb
|
136
138
|
- lib/vagrant/smartos/zones/version.rb
|
139
|
+
- test/integration/default/serverspec/group_spec.rb
|
140
|
+
- test/integration/default/serverspec/spec_helper.rb
|
141
|
+
- test/integration/default/serverspec/user_spec.rb
|
142
|
+
- test/templates/Vagrantfile.smartos.erb
|
143
|
+
- test/templates/bootstrap.sh
|
137
144
|
- vagrant-smartos-zones.gemspec
|
138
145
|
homepage: https://github.com/vagrant-smartos/vagrant-smartos-zones
|
139
146
|
licenses:
|
@@ -159,5 +166,9 @@ rubygems_version: 2.4.4
|
|
159
166
|
signing_key:
|
160
167
|
specification_version: 4
|
161
168
|
summary: Manage SmartOS zones in Vagrant
|
162
|
-
test_files:
|
163
|
-
|
169
|
+
test_files:
|
170
|
+
- test/integration/default/serverspec/group_spec.rb
|
171
|
+
- test/integration/default/serverspec/spec_helper.rb
|
172
|
+
- test/integration/default/serverspec/user_spec.rb
|
173
|
+
- test/templates/Vagrantfile.smartos.erb
|
174
|
+
- test/templates/bootstrap.sh
|