vagrant-smartos-zones 0.0.2 → 0.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 988a3cb1d2037d6bb7f60aa880606009a23ef4ca
4
- data.tar.gz: 95a20be29c4b4f6de32fee8eb8e693e6988589a6
3
+ metadata.gz: 84fc0df3970935bc53940c6a9bf1be5b825537b7
4
+ data.tar.gz: ec8eaf0b1edbc52daeecbc073d591d19ddbd7575
5
5
  SHA512:
6
- metadata.gz: 733c6c0afe14d5d0a29a5cd9d7710386630aad93285db0caaef743abe688ac340573a1b66038e82f8b1280c073f5f3874c84b8aaa1f4a0bccdbd895c0ca4ba20
7
- data.tar.gz: 91aa10f0b5183779696c57982e8739e338aa6aa329ea45e907205287dcfa59b7b6364230f3109584f9e0458d3dc3f8e0bbfa81fb47239bfe15a96c5e91aeab70
6
+ metadata.gz: fc7c7632350219fade70bc11585d116149760c0a559188d4c42357ad89406805c2a5371540ae8ed5e366babdd19e821874fd4531d5ece7d71422baf090c36662
7
+ data.tar.gz: 506620ca02aa02d3f35cf4af3c9fcf7c85c594d2b1e4d3c1e89842a0d6d0d1f02529c8dee03ae0dcbb62805f74a954f7979c8e83994851801f1713b1dd3e9163
data/README.md CHANGED
@@ -107,6 +107,7 @@ vagrant smartos install [platform_image]
107
107
  Interact with zones running in a box:
108
108
 
109
109
  ```bash
110
+ vagrant zones config
110
111
  vagrant zones list
111
112
  vagrant zones show [name]
112
113
  vagrant zones start [name]
@@ -244,6 +245,27 @@ bundle exec kitchen test
244
245
 
245
246
  This may take a while...
246
247
 
248
+ ## Plugin configuration
249
+
250
+ The plugin allows for local configuration through the `vagrant zones
251
+ config` command. This can be used for local overrides of zone
252
+ configuration.
253
+
254
+ ```bash
255
+ vagrant zones config
256
+ vagrant zones config key value
257
+ vagrant zones config --delete key
258
+ ```
259
+
260
+ ### Pkgsrc mirror
261
+
262
+ ```bash
263
+ vagrant zones config local.pkgsrc http://mirror.domain.com
264
+ ```
265
+
266
+ This will replace the protocol and domain of the pkgsrc mirror used by
267
+ pkgin in a SmartOS zone.
268
+
247
269
  ## References / Alternatives
248
270
 
249
271
  Any success of this project depends heavily on the work of others,
@@ -35,6 +35,18 @@ en:
35
35
  Started zone %{name} %{uuid}
36
36
  stop: |-
37
37
  Stopped zone %{name} %{uuid}
38
+ config:
39
+ set: |-
40
+ Setting configuration: %{key} => %{value}
41
+ delete:
42
+ success: |-
43
+ Deleting configuration for: %{key}
44
+ failed: |-
45
+ Unable to delete configuration key: %{key}
46
+ Was key actually set?
47
+ pkgsrc:
48
+ mirror:
49
+ Configuring pkgsrc mirror for %{uuid} => %{mirror}
38
50
  warning:
39
51
  zone_not_found: |-
40
52
  Unable to find zone with name %{name}
@@ -31,10 +31,18 @@ module Vagrant
31
31
  end
32
32
 
33
33
  def delete(name, *_args)
34
- hash.delete(name)
34
+ if hash.delete(name)
35
+ env.ui.info(I18n.t('vagrant.smartos.zones.config.delete.success',
36
+ key: name))
37
+ else
38
+ env.ui.info(I18n.t('vagrant.smartos.zones.config.delete.failed',
39
+ key: name))
40
+ end
35
41
  end
36
42
 
37
43
  def set(name, value)
44
+ env.ui.info(I18n.t('vagrant.smartos.zones.config.set',
45
+ key: name, value: value))
38
46
  hash[name] = value
39
47
  end
40
48
 
@@ -40,6 +40,7 @@ module Vagrant
40
40
  end
41
41
 
42
42
  command 'zones' do
43
+ load_il8n
43
44
  require_relative 'commands/zones'
44
45
  Command::Zones
45
46
  end
@@ -1,3 +1,4 @@
1
+ require 'vagrant/smartos/zones/models/config'
1
2
  require 'vagrant/smartos/zones/models/zone'
2
3
  require 'vagrant/smartos/zones/util/global_zone/helper'
3
4
  require 'vagrant/smartos/zones/util/zone_group'
@@ -30,6 +31,7 @@ module Vagrant
30
31
  with_gz("echo '#{zone_json}' | #{sudo} vmadm create")
31
32
  with_zone(name) do |zone|
32
33
  create_zone_users(zone)
34
+ configure_pkgsrc_mirror(zone)
33
35
  end
34
36
  end
35
37
 
@@ -42,6 +44,14 @@ module Vagrant
42
44
 
43
45
  private
44
46
 
47
+ def configure_pkgsrc_mirror(zone)
48
+ return if zone.lx_brand?
49
+ return unless pkgsrc_mirror
50
+ machine.ui.info(I18n.t('vagrant.smartos.zones.pkgsrc.mirror',
51
+ uuid: zone.uuid, mirror: pkgsrc_mirror))
52
+ zone.zlogin("sed -i -e \\'s@http://pkgsrc.joyent.com@#{pkgsrc_mirror}@\\' /opt/local/etc/pkgin/repositories.conf")
53
+ end
54
+
45
55
  def create_zone_users(zone)
46
56
  create_zone_vagrant_user(zone)
47
57
  configure_zone_passwords(zone)
@@ -62,6 +72,14 @@ module Vagrant
62
72
  zone.zlogin("sed -i -e \\'s@#{user}:.*@#{user}:#{pw}:#{ts}::::::@\\' /etc/shadow")
63
73
  end
64
74
 
75
+ def pkgsrc_mirror
76
+ plugin_config['local.pkgsrc']
77
+ end
78
+
79
+ def plugin_config
80
+ @plugin_config ||= Models::Config.config(machine.env).hash
81
+ end
82
+
65
83
  def zone_json
66
84
  Util::ZoneJson.new(machine).to_json
67
85
  end
@@ -1,7 +1,7 @@
1
1
  module Vagrant
2
2
  module Smartos
3
3
  module Zones
4
- VERSION = '0.0.2'
4
+ VERSION = '0.0.3'
5
5
  end
6
6
  end
7
7
  end
@@ -24,7 +24,7 @@ install_ruby() {
24
24
  }
25
25
 
26
26
  install_ruby_linux() {
27
- apt-get install ruby
27
+ apt-get -y install ruby
28
28
  }
29
29
 
30
30
  install_ruby_smartos() {
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.2
4
+ version: 0.0.3
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-24 00:00:00.000000000 Z
11
+ date: 2015-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler