vagrant-lxd 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5b7a90200673f156589bed529f7a173e7950798d
4
- data.tar.gz: 2e266432e3978370153b9788740ab7619fb61687
3
+ metadata.gz: 7a2ea2589b750536f634123b1deed2718c13151b
4
+ data.tar.gz: 24d46b5fac9f49b1d3daed822653518c2cbff856
5
5
  SHA512:
6
- metadata.gz: c69f93fad75e816cc856e75783b040bd38188468d7a4f8f098eddfb0f592e22d5fbdb23dacc430f23b72f48c07aaabc409246fbbbe8096dbb0ea999285ad821c
7
- data.tar.gz: e77b010f6287d9aa119f535e845859cbc85ee0a16269ccacd6abedd6f884bba82e1dc076f7d230ec0d2169d3796cee56a091b5ab69e46d8b5d67ea8edc2a21b8
6
+ metadata.gz: f83fcd225dfd64d6792677de3678530753ac902f5eda4bdf3091d13f30b1b51e58b45b358fe0884364c884806a431778aa872bcf293d5382dc8bf89d94652b3c
7
+ data.tar.gz: 912fb1cd29e3211aa42bceab0261f3831ca080625b8baba9fb428f8cc861accdfa9b69d9c065d16198b0029094c8d40e66df55bbc020563ac8b76b712aa7aba6
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
1
  /.bundle/
2
2
  /.vagrant/
3
3
  /Vagrantfile
4
+ /vendor
@@ -0,0 +1,13 @@
1
+ image: "ruby:2.3"
2
+
3
+ before_script:
4
+ - apt-get -y update
5
+ - apt-get -y upgrade
6
+ - gem install bundler --no-ri --no-rdoc
7
+ - bundle install -j $(nproc) --path vendor/bundle
8
+
9
+ spec:
10
+ script:
11
+ - bundle exec rake spec
12
+ tags:
13
+ - shared
data/Gemfile CHANGED
@@ -3,6 +3,8 @@ source 'https://rubygems.org/'
3
3
  group :development do
4
4
  gem 'rake'
5
5
  gem 'rspec'
6
+ gem 'rspec-its'
7
+ gem 'rspec-mocks'
6
8
  gem 'vagrant', :git => 'https://github.com/mitchellh/vagrant.git'
7
9
  end
8
10
 
@@ -1,17 +1,17 @@
1
1
  GIT
2
2
  remote: https://github.com/mitchellh/vagrant.git
3
- revision: a7b228eb698352638270dc076d0385fa324ca187
3
+ revision: 1cc4a48371c5f0713a2d98ac446b80170b4b71f0
4
4
  specs:
5
- vagrant (1.9.8.dev)
5
+ vagrant (2.0.3.dev)
6
6
  childprocess (~> 0.6.0)
7
7
  erubis (~> 2.7.0)
8
- hashicorp-checkpoint (~> 0.1.1)
8
+ hashicorp-checkpoint (~> 0.1.5)
9
9
  i18n (>= 0.6.0, <= 0.8.0)
10
10
  listen (~> 3.1.5)
11
11
  log4r (~> 1.1.9, < 1.1.11)
12
12
  net-scp (~> 1.2.0)
13
13
  net-sftp (~> 2.1)
14
- net-ssh (~> 4.1.0)
14
+ net-ssh (~> 4.2.0)
15
15
  rb-kqueue (~> 0.2.0)
16
16
  rest-client (>= 1.6.0, < 3.0)
17
17
  ruby_dep (<= 1.3.1)
@@ -23,19 +23,19 @@ GIT
23
23
  PATH
24
24
  remote: .
25
25
  specs:
26
- vagrant-lxd (0.1.3)
26
+ vagrant-lxd (0.1.4)
27
27
  hyperkit (~> 1.1)
28
28
 
29
29
  GEM
30
30
  remote: https://rubygems.org/
31
31
  specs:
32
- activesupport (4.2.9)
32
+ activesupport (4.2.10)
33
33
  i18n (~> 0.7)
34
34
  minitest (~> 5.1)
35
35
  thread_safe (~> 0.3, >= 0.3.4)
36
36
  tzinfo (~> 1.1)
37
- addressable (2.5.1)
38
- public_suffix (~> 2.0, >= 2.0.2)
37
+ addressable (2.5.2)
38
+ public_suffix (>= 2.0.2, < 4.0)
39
39
  builder (3.2.3)
40
40
  childprocess (0.6.3)
41
41
  ffi (~> 1.0, >= 1.0.11)
@@ -43,14 +43,14 @@ GEM
43
43
  domain_name (0.5.20170404)
44
44
  unf (>= 0.0.5, < 1.0.0)
45
45
  erubis (2.7.0)
46
- faraday (0.12.2)
46
+ faraday (0.14.0)
47
47
  multipart-post (>= 1.2, < 3)
48
- ffi (1.9.18)
48
+ ffi (1.9.21)
49
49
  gssapi (1.2.0)
50
50
  ffi (>= 1.0.1)
51
51
  gyoku (1.3.1)
52
52
  builder (>= 2.1.2)
53
- hashicorp-checkpoint (0.1.4)
53
+ hashicorp-checkpoint (0.1.5)
54
54
  http-cookie (1.0.3)
55
55
  domain_name (~> 0.5)
56
56
  httpclient (2.8.3)
@@ -70,17 +70,17 @@ GEM
70
70
  mime-types (3.1)
71
71
  mime-types-data (~> 3.2015)
72
72
  mime-types-data (3.2016.0521)
73
- minitest (5.10.3)
74
- multi_json (1.12.1)
73
+ minitest (5.11.3)
74
+ multi_json (1.13.1)
75
75
  multipart-post (2.0.0)
76
76
  net-scp (1.2.1)
77
77
  net-ssh (>= 2.6.5)
78
78
  net-sftp (2.1.2)
79
79
  net-ssh (>= 2.6.5)
80
- net-ssh (4.1.0)
80
+ net-ssh (4.2.0)
81
81
  netrc (0.11.0)
82
82
  nori (2.6.0)
83
- public_suffix (2.0.5)
83
+ public_suffix (3.0.2)
84
84
  rake (12.0.0)
85
85
  rb-fsevent (0.10.2)
86
86
  rb-inotify (0.9.10)
@@ -100,6 +100,9 @@ GEM
100
100
  rspec-expectations (3.5.0)
101
101
  diff-lcs (>= 1.2.0, < 2.0)
102
102
  rspec-support (~> 3.5.0)
103
+ rspec-its (1.2.0)
104
+ rspec-core (>= 3.0.0)
105
+ rspec-expectations (>= 3.0.0)
103
106
  rspec-mocks (3.5.0)
104
107
  diff-lcs (>= 1.2.0, < 2.0)
105
108
  rspec-support (~> 3.5.0)
@@ -111,11 +114,11 @@ GEM
111
114
  addressable (>= 2.3.5, < 2.6)
112
115
  faraday (~> 0.8, < 1.0)
113
116
  thread_safe (0.3.6)
114
- tzinfo (1.2.3)
117
+ tzinfo (1.2.5)
115
118
  thread_safe (~> 0.1)
116
119
  unf (0.1.4)
117
120
  unf_ext
118
- unf_ext (0.0.7.4)
121
+ unf_ext (0.0.7.5)
119
122
  wdm (0.1.1)
120
123
  winrm (2.2.3)
121
124
  builder (>= 2.1.2)
@@ -129,7 +132,7 @@ GEM
129
132
  winrm-elevated (1.1.0)
130
133
  winrm (~> 2.0)
131
134
  winrm-fs (~> 1.0)
132
- winrm-fs (1.0.1)
135
+ winrm-fs (1.2.0)
133
136
  erubis (~> 2.7)
134
137
  logging (>= 1.6.1, < 3.0)
135
138
  rubyzip (~> 1.1)
@@ -141,6 +144,8 @@ PLATFORMS
141
144
  DEPENDENCIES
142
145
  rake
143
146
  rspec
147
+ rspec-its
148
+ rspec-mocks
144
149
  vagrant!
145
150
  vagrant-lxd!
146
151
 
data/README.md CHANGED
@@ -80,9 +80,10 @@ Vagrant.configure('2') do |config|
80
80
  lxd.api_endpoint = 'https://127.0.0.1:8443'
81
81
  lxd.timeout = 10
82
82
  lxd.name = nil
83
- lxd.nesting = false
84
- lxd.privileged = false
83
+ lxd.nesting = nil
84
+ lxd.privileged = nil
85
85
  lxd.ephemeral = false
86
+ lxd.profiles = ['default']
86
87
  end
87
88
  end
88
89
  ```
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'rspec/core/rake_task'
5
5
  Bundler::GemHelper.install_tasks
6
6
 
7
7
  RSpec::Core::RakeTask.new(:spec) do |t|
8
- t.rspec_opts = '-I. -rspec/common'
8
+ t.rspec_opts = '-I. -fd -rspec/common'
9
9
  t.verbose = false
10
10
  end
11
11
 
@@ -26,6 +26,7 @@ module VagrantLXD
26
26
  attr_accessor :nesting
27
27
  attr_accessor :privileged
28
28
  attr_accessor :ephemeral
29
+ attr_accessor :profiles
29
30
  attr_accessor :timeout
30
31
 
31
32
  def initialize
@@ -34,13 +35,14 @@ module VagrantLXD
34
35
  @nesting = UNSET_VALUE
35
36
  @privileged = UNSET_VALUE
36
37
  @ephemeral = UNSET_VALUE
38
+ @profiles = UNSET_VALUE
37
39
  @api_endpoint = UNSET_VALUE
38
40
  end
39
41
 
40
42
  def validate(machine)
41
43
  errors = _detected_errors
42
44
 
43
- unless [UNSET_VALUE, nil].include? name
45
+ unless name.nil?
44
46
  if not name.is_a? String
45
47
  errors << "Invalid `name' (value must be a string): #{name.inspect}"
46
48
  elsif name.size >= 64
@@ -50,34 +52,34 @@ module VagrantLXD
50
52
  end
51
53
  end
52
54
 
53
- unless timeout == UNSET_VALUE
54
- if not timeout.is_a? Integer
55
- errors << "Invalid `timeout' (value must be an integer): #{timeout.inspect}"
56
- elsif timeout < 1
57
- errors << "Invalid `timeout' (value must be positive): #{timeout.inspect}"
58
- end
55
+ if not timeout.is_a? Integer
56
+ errors << "Invalid `timeout' (value must be an integer): #{timeout.inspect}"
57
+ elsif timeout < 1
58
+ errors << "Invalid `timeout' (value must be positive): #{timeout.inspect}"
59
59
  end
60
60
 
61
- unless api_endpoint == UNSET_VALUE
62
- begin
63
- URI(api_endpoint).scheme == 'https' or raise URI::InvalidURIError
64
- rescue URI::InvalidURIError
65
- errors << "Invalid `api_endpoint' (value must be a valid HTTPS address): #{api_endpoint.inspect}"
66
- end
61
+ begin
62
+ URI(api_endpoint).scheme == 'https' or raise URI::InvalidURIError
63
+ rescue URI::InvalidURIError
64
+ errors << "Invalid `api_endpoint' (value must be a valid HTTPS address): #{api_endpoint.inspect}"
67
65
  end
68
66
 
69
- unless [UNSET_VALUE, true, false].include? nesting
67
+ unless [true, false, nil].include? nesting
70
68
  errors << "Invalid `nesting' (value must be true or false): #{nesting.inspect}"
71
69
  end
72
70
 
73
- unless [UNSET_VALUE, true, false].include? privileged
71
+ unless [true, false, nil].include? privileged
74
72
  errors << "Invalid `privileged' (value must be true or false): #{privileged.inspect}"
75
73
  end
76
74
 
77
- unless [UNSET_VALUE, true, false].include? ephemeral
75
+ unless [true, false].include? ephemeral
78
76
  errors << "Invalid `ephemeral' (value must be true or false): #{ephemeral.inspect}"
79
77
  end
80
78
 
79
+ unless profiles.is_a? Array and profiles == profiles.grep(String)
80
+ errors << "Invalid `profiles' (value must be an array of strings): #{profiles.inspect}"
81
+ end
82
+
81
83
  { Version::NAME => errors }
82
84
  end
83
85
 
@@ -87,17 +89,21 @@ module VagrantLXD
87
89
  end
88
90
 
89
91
  if nesting == UNSET_VALUE
90
- @nesting = false
92
+ @nesting = nil
91
93
  end
92
94
 
93
95
  if privileged == UNSET_VALUE
94
- @privileged = false
96
+ @privileged = nil
95
97
  end
96
98
 
97
99
  if ephemeral == UNSET_VALUE
98
100
  @ephemeral = false
99
101
  end
100
102
 
103
+ if profiles == UNSET_VALUE
104
+ @profiles = ['default']
105
+ end
106
+
101
107
  if timeout == UNSET_VALUE
102
108
  @timeout = 10
103
109
  end
@@ -93,6 +93,7 @@ module VagrantLXD
93
93
  attr_reader :ephemeral
94
94
  attr_reader :name
95
95
  attr_reader :timeout
96
+ attr_reader :profiles
96
97
 
97
98
  def initialize(machine)
98
99
  @machine = machine
@@ -101,6 +102,7 @@ module VagrantLXD
101
102
  @nesting = machine.provider_config.nesting
102
103
  @privileged = machine.provider_config.privileged
103
104
  @ephemeral = machine.provider_config.ephemeral
105
+ @profiles = machine.provider_config.profiles
104
106
  @name = machine.provider_config.name
105
107
  @logger = Log4r::Logger.new('vagrant::lxd')
106
108
  @lxd = Hyperkit::Client.new(api_endpoint: api_endpoint.to_s, verify_ssl: false)
@@ -216,7 +218,7 @@ module VagrantLXD
216
218
  @logger.debug 'Created image alias: ' << image_alias.inspect
217
219
  end
218
220
 
219
- container = @lxd.create_container(machine_id, ephemeral: ephemeral, fingerprint: fingerprint, config: config)
221
+ container = @lxd.create_container(machine_id, ephemeral: ephemeral, fingerprint: fingerprint, config: config, profiles: profiles)
220
222
  @logger.debug 'Created container: ' << container.inspect
221
223
 
222
224
  @machine.id = machine_id
@@ -369,10 +371,12 @@ module VagrantLXD
369
371
  end
370
372
 
371
373
  def config
372
- config = {
373
- :'security.nesting' => nesting,
374
- :'security.privileged' => privileged,
375
- }
374
+ config = {}
375
+
376
+ # Add security settings, if specified. If not, we omit them so
377
+ # they can be configured by one of the container's profiles instead.
378
+ config[:'security.nesting'] = nesting unless nesting.nil?
379
+ config[:'security.privileged'] = privileged unless privileged.nil?
376
380
 
377
381
  # Set "raw.idmap" if the host's sub{u,g}id configuration allows it.
378
382
  # This allows sharing folders via LXD (see synced_folder.rb).
@@ -20,7 +20,7 @@
20
20
  module VagrantLXD
21
21
  module Version
22
22
  NAME = 'vagrant-lxd'
23
- VERSION = '0.1.3'
23
+ VERSION = '0.1.4'
24
24
  DESCRIPTION = 'Vagrant LXD provider'
25
25
  end
26
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-lxd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Hanson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-14 00:00:00.000000000 Z
11
+ date: 2018-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hyperkit
@@ -32,6 +32,7 @@ extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
34
  - ".gitignore"
35
+ - ".gitlab-ci.yml"
35
36
  - Gemfile
36
37
  - Gemfile.lock
37
38
  - LICENSE.md