vagrant-lxc 1.2.3 → 1.2.4

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: b633ab22ce6deadea3b2b3d25a2a74052c02acf9
4
- data.tar.gz: 94b3ccfec12f25d33dc0e14bcd95fce6ae5b8399
3
+ metadata.gz: be12d8c8e72a9909dec8bf1a588338dcba483bbc
4
+ data.tar.gz: 4331cfda3e8612bf69e4090c383967508387acb6
5
5
  SHA512:
6
- metadata.gz: d8630c4edd319dcc1220b3c9cd051f1f6fdaa665acf0083a7b414b71a85650b3c53419a32da4aa6ef792325c1e8c066e3a48db760e9c36111f246fc3a6a4e963
7
- data.tar.gz: 7a2214f974b67cde3fb876ddf29c459677299941792978e025102ae42b03ad736222f0f7655f8e57a3809d65e073d61996d13241877f7dbc576ae3088a06841d
6
+ metadata.gz: 48107a2da8b24576f1af4999374f96819441332de0fffeed7602554347aed266a4f15e0f3d07e821b16fb54eb3d888b1556cd2db32ecfda3416415e00191fde0
7
+ data.tar.gz: 7e40658d9a437855025e71b57c9ee82f25e532cc439410763adaa312c5abf2852571552159bd183cedfde9c92bf7e95a496fc602fa0ac9449fcc5c012c3875de
data/CHANGELOG.md CHANGED
@@ -1,19 +1,44 @@
1
+ ## [1.2.4](https://github.com/fgrehm/vagrant-lxc/compare/v1.2.3...v1.2.4) (Dec 20, 2017)
2
+
3
+ BUGFIX:
4
+ - Support alternative `lxcpath` [[GH-413]]
5
+ - Update `pipework` regexp in sudo wrapper for Vagrant 1.9+ [[GH-438]]
6
+ - Work around restrictive `umask` values [[GH-435]]
7
+ - Make `--config` in `lxc-template` optional [[GH-421]]
8
+ - Fix sudo wrapper binpath construction logic [[GH-410]]
9
+ - Fix bug causing CTRL-C on `vagrant up` to destroy the VM [[GH-449]]
10
+
11
+ [GH-413]: https://github.com/fgrehm/vagrant-lxc/pull/413
12
+ [GH-438]: https://github.com/fgrehm/vagrant-lxc/pull/438
13
+ [GH-435]: https://github.com/fgrehm/vagrant-lxc/pull/435
14
+ [GH-421]: https://github.com/fgrehm/vagrant-lxc/pull/421
15
+ [GH-410]: https://github.com/fgrehm/vagrant-lxc/pull/410
16
+ [GH-449]: https://github.com/fgrehm/vagrant-lxc/pull/449
17
+
1
18
  ## [1.2.3](https://github.com/fgrehm/vagrant-lxc/compare/v1.2.2...v1.2.3) (Dec 20, 2016)
2
19
 
3
20
  - Fix bug in Gemfile.lock
4
21
 
5
22
  ## [1.2.2](https://github.com/fgrehm/vagrant-lxc/compare/v1.2.1...v1.2.2) (Dec 20, 2016)
6
23
 
24
+ BUGFIX:
7
25
  - Make the timeout for fetching container IP's configurable [[GH-426]]
8
26
  - Load locale file only once [[GH-423]]
9
27
  - Preserve xattrs in container filesystems [[GH-411]]
10
28
  - Forward port latest pipework script [[GH-408]]
11
29
  - Fix handling of non-fatal lxc-stop return code [[GH-405]]
12
30
 
31
+ [GH-426]: https://github.com/fgrehm/vagrant-lxc/pull/426
32
+ [GH-423]: https://github.com/fgrehm/vagrant-lxc/pull/423
33
+ [GH-411]: https://github.com/fgrehm/vagrant-lxc/pull/411
34
+ [GH-408]: https://github.com/fgrehm/vagrant-lxc/pull/408
35
+ [GH-405]: https://github.com/fgrehm/vagrant-lxc/pull/405
36
+
13
37
  ## [1.2.1](https://github.com/fgrehm/vagrant-lxc/compare/v1.2.0...v1.2.1) (Sep 24, 2015)
14
38
 
15
39
  BUGFIX:
16
40
  - Fix sudo Wrapper [[GH-393]]
41
+
17
42
  [GH-393]: https://github.com/fgrehm/vagrant-lxc/pull/393
18
43
 
19
44
  ## [1.2.0](https://github.com/fgrehm/vagrant-lxc/compare/v1.1.0...v1.2.0) (Sep 15, 2015)
@@ -31,6 +56,7 @@ IMPROVEMENTS:
31
56
  - Fix shebangs to be more portable [[GH-376]]
32
57
  - Fix removal of lxcbr0/virbr0 when using private networking [[GH-383]]
33
58
  - Improve /tmp handling by using tmpfs [[GH-362]]
59
+
34
60
  [GH-301]: https://github.com/fgrehm/vagrant-lxc/issues/301
35
61
  [GH-355]: https://github.com/fgrehm/vagrant-lxc/pull/355
36
62
  [GH-357]: https://github.com/fgrehm/vagrant-lxc/pull/357
data/Gemfile.lock CHANGED
@@ -46,7 +46,7 @@ GIT
46
46
  PATH
47
47
  remote: .
48
48
  specs:
49
- vagrant-lxc (1.2.3)
49
+ vagrant-lxc (1.2.4)
50
50
 
51
51
  GEM
52
52
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -18,7 +18,7 @@ to see it in action.
18
18
  ## Requirements
19
19
 
20
20
  * [Vagrant 1.5+](http://www.vagrantup.com/downloads.html) (tested with 1.7.2)
21
- * lxc 0.7.5+
21
+ * lxc >=0.7.5 and <2.1.0 (see [#445](https://github.com/fgrehm/vagrant-lxc/issues/445))
22
22
  * tar 1.27 (the lxc-template script uses the --xattrs option)
23
23
  * `redir` (if you are planning to use port forwarding)
24
24
  * `brctl` (if you are planning to use private networks, on Ubuntu this means `apt-get install bridge-utils`)
@@ -1,5 +1,7 @@
1
1
  require 'tempfile'
2
2
 
3
+ require "vagrant-lxc/driver"
4
+
3
5
  module Vagrant
4
6
  module LXC
5
7
  module Command
@@ -43,12 +45,14 @@ module Vagrant
43
45
 
44
46
  # This requires vagrant 1.5.2+ https://github.com/mitchellh/vagrant/commit/3371c3716278071680af9b526ba19235c79c64cb
45
47
  def create_wrapper!
48
+ lxc_base_path = Driver.new(0, LXC.sudo_wrapper).containers_path
46
49
  wrapper = Tempfile.new('lxc-wrapper').tap do |file|
47
50
  template = Vagrant::Util::TemplateRenderer.new(
48
51
  'sudoers.rb',
49
52
  :template_root => Vagrant::LXC.source_root.join('templates').to_s,
50
53
  :cmd_paths => build_cmd_paths_hash,
51
- :pipework_regex => "#{ENV['HOME']}/\.vagrant\.d/gems/gems/vagrant-lxc.+/scripts/pipework"
54
+ :lxc_base_path => lxc_base_path,
55
+ :pipework_regex => "#{ENV['HOME']}/\.vagrant\.d/gems/(?:\\d+?\\.\\d+?\\.\\d+?/)?gems/vagrant-lxc.+/scripts/pipework"
52
56
  )
53
57
  file.puts template.render
54
58
  end
@@ -80,9 +84,9 @@ module Vagrant
80
84
  def build_cmd_paths_hash
81
85
  {}.tap do |hash|
82
86
  %w( which cat mkdir cp chown chmod rm tar chown ip ifconfig brctl ).each do |cmd|
83
- hash[cmd] = `which #{cmd}`.strip
87
+ hash[cmd] = `sudo which #{cmd}`.strip
84
88
  end
85
- hash['lxc_bin'] = Pathname(`which lxc-create`.strip).parent.to_s
89
+ hash['lxc_bin'] = Pathname(`sudo which lxc-create`.strip).parent.to_s
86
90
  hash['ruby'] = Gem.ruby
87
91
  end
88
92
  end
@@ -16,6 +16,15 @@ module Vagrant
16
16
  end
17
17
  end
18
18
 
19
+ # Raised when user interrupts a subprocess
20
+ class SubprocessInterruptError < Vagrant::Errors::VagrantError
21
+ error_key(:lxc_interrupt_error)
22
+ def initialize(message, *args)
23
+ super
24
+ end
25
+ end
26
+
27
+
19
28
  class NamespacesNotSupported < Vagrant::Errors::VagrantError
20
29
  end
21
30
 
@@ -2,7 +2,6 @@ require "log4r"
2
2
 
3
3
  require "vagrant-lxc/action"
4
4
  require "vagrant-lxc/driver"
5
- require "vagrant-lxc/sudo_wrapper"
6
5
 
7
6
  module Vagrant
8
7
  module LXC
@@ -26,12 +25,7 @@ module Vagrant
26
25
  end
27
26
 
28
27
  def sudo_wrapper
29
- @shell ||= begin
30
- wrapper = Pathname.new(LXC.sudo_wrapper_path).exist? &&
31
- LXC.sudo_wrapper_path || nil
32
- @logger.debug("Found sudo wrapper : #{wrapper}") if wrapper
33
- SudoWrapper.new(wrapper)
34
- end
28
+ @shell ||= LXC.sudo_wrapper
35
29
  end
36
30
 
37
31
  def ensure_lxc_installed!
@@ -13,11 +13,24 @@ module Vagrant
13
13
 
14
14
  def run(*command)
15
15
  options = command.last.is_a?(Hash) ? command.last : {}
16
- if @wrapper_path && !options[:no_wrapper]
17
- command.unshift @wrapper_path
18
- execute *(['sudo'] + command)
19
- else
20
- execute *(['sudo', '/usr/bin/env'] + command)
16
+
17
+ # Avoid running LXC commands with a restrictive umask.
18
+ # Otherwise disasters occur, like the container root directory
19
+ # having permissions `rwxr-x---` which prevents the `vagrant`
20
+ # user from accessing its own home directory; among other
21
+ # problems, SSH cannot then read `authorized_keys`!
22
+ old_mask = File.umask
23
+ File.umask(old_mask & 022) # allow all `r` and `x` bits
24
+
25
+ begin
26
+ if @wrapper_path && !options[:no_wrapper]
27
+ command.unshift @wrapper_path
28
+ execute *(['sudo'] + command)
29
+ else
30
+ execute *(['sudo', '/usr/bin/env'] + command)
31
+ end
32
+ ensure
33
+ File.umask(old_mask)
21
34
  end
22
35
  end
23
36
 
@@ -46,7 +59,7 @@ module Vagrant
46
59
  # nicely handled by Vagrant.
47
60
  if r.exit_code != 0
48
61
  if @interrupted
49
- @logger.info("Exit code != 0, but interrupted. Ignoring.")
62
+ raise LXC::Errors::SubprocessInterruptError, command.inspect
50
63
  else
51
64
  raise LXC::Errors::ExecuteError,
52
65
  command: command.inspect, stderr: r.stderr, stdout: r.stdout, exitcode: r.exit_code
@@ -1,5 +1,5 @@
1
1
  module Vagrant
2
2
  module LXC
3
- VERSION = "1.2.3"
3
+ VERSION = "1.2.4"
4
4
  end
5
5
  end
data/lib/vagrant-lxc.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require "vagrant-lxc/version"
2
2
  require "vagrant-lxc/plugin"
3
+ require "vagrant-lxc/sudo_wrapper"
3
4
 
4
5
  module Vagrant
5
6
  module LXC
@@ -10,5 +11,12 @@ module Vagrant
10
11
  def self.sudo_wrapper_path
11
12
  "/usr/local/bin/vagrant-lxc-wrapper"
12
13
  end
14
+
15
+ def self.sudo_wrapper
16
+ wrapper = Pathname.new(sudo_wrapper_path).exist? &&
17
+ sudo_wrapper_path || nil
18
+ SudoWrapper.new(wrapper)
19
+ end
20
+
13
21
  end
14
22
  end
data/locales/en.yml CHANGED
@@ -40,6 +40,9 @@ en:
40
40
  preparing: Setting up mount entries for shared folders...
41
41
 
42
42
  errors:
43
+ lxc_interrupt_error: |-
44
+ Interrupted
45
+
43
46
  lxc_execute_error: |-
44
47
  There was an error executing %{command}
45
48
 
data/scripts/lxc-template CHANGED
@@ -96,11 +96,6 @@ if [ -z "${LXC_PATH}" ]; then
96
96
  exit 1
97
97
  fi
98
98
 
99
- if [ -z "${LXC_CONFIG}" ]; then
100
- echo "'config' parameter is required"
101
- exit 1
102
- fi
103
-
104
99
  # if $LXC_ROOTFS exists here, it was passed in with --rootfs
105
100
  if [ -z "${LXC_ROOTFS}" ]; then
106
101
  config=${LXC_PATH}/config
@@ -160,11 +155,13 @@ if [ -e "${LXC_PATH}/config-network" ]; then
160
155
  rm ${LXC_PATH}/config-network
161
156
  fi
162
157
 
163
- ## Append the defaults
164
- echo "" >> ${LXC_PATH}/config
165
- echo "##############################################" >> ${LXC_PATH}/config
166
- echo "# vagrant-lxc base box specific configuration" >> ${LXC_PATH}/config
167
- cat ${LXC_CONFIG} >> ${LXC_PATH}/config
158
+ if [ -n "${LXC_CONFIG}" ]; then
159
+ ## Append the defaults
160
+ echo "" >> ${LXC_PATH}/config
161
+ echo "##############################################" >> ${LXC_PATH}/config
162
+ echo "# vagrant-lxc base box specific configuration" >> ${LXC_PATH}/config
163
+ cat ${LXC_CONFIG} >> ${LXC_PATH}/config
164
+ fi
168
165
 
169
166
  # Empty section for lxc.customize calls from vagrantfile
170
167
  echo "" >> ${LXC_PATH}/config
@@ -78,7 +78,7 @@ class Whitelist
78
78
  end
79
79
  end
80
80
 
81
- base = "/var/lib/lxc"
81
+ base = "<%= lxc_base_path %>"
82
82
  base_path = %r{\A#{base}/.*\z}
83
83
 
84
84
  ##
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-lxc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fabio Rehm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-21 00:00:00.000000000 Z
11
+ date: 2017-12-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Linux Containers provider for Vagrant
14
14
  email:
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  version: '0'
102
102
  requirements: []
103
103
  rubyforge_project:
104
- rubygems_version: 2.2.2
104
+ rubygems_version: 2.6.14
105
105
  signing_key:
106
106
  specification_version: 4
107
107
  summary: Linux Containers provider for Vagrant