vagrant-lxc 0.4.0 → 0.5.0

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.
data/vagrant-lxc.gemspec CHANGED
@@ -10,6 +10,7 @@ Gem::Specification.new do |gem|
10
10
  gem.email = ["fgrehm@gmail.com"]
11
11
  gem.description = %q{Linux Containers provider for Vagrant}
12
12
  gem.summary = gem.description
13
+ gem.license = 'MIT'
13
14
  gem.homepage = "https://github.com/fgrehm/vagrant-lxc"
14
15
 
15
16
  gem.files = `git ls-files`.split($/)
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: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fabio Rehm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-18 00:00:00.000000000 Z
11
+ date: 2013-08-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Linux Containers provider for Vagrant
14
14
  email:
@@ -32,6 +32,7 @@ files:
32
32
  - boxes/common/install-babushka
33
33
  - boxes/common/install-chef
34
34
  - boxes/common/install-puppet
35
+ - boxes/common/install-salt
35
36
  - boxes/common/lxc-template
36
37
  - boxes/common/lxc.conf
37
38
  - boxes/common/metadata.json
@@ -67,6 +68,8 @@ files:
67
68
  - lib/vagrant-lxc/action/destroy.rb
68
69
  - lib/vagrant-lxc/action/destroy_confirm.rb
69
70
  - lib/vagrant-lxc/action/disconnect.rb
71
+ - lib/vagrant-lxc/action/fetch_ip_from_dnsmasq_leases.rb
72
+ - lib/vagrant-lxc/action/fetch_ip_with_lxc_attach.rb
70
73
  - lib/vagrant-lxc/action/forced_halt.rb
71
74
  - lib/vagrant-lxc/action/forward_ports.rb
72
75
  - lib/vagrant-lxc/action/handle_box_metadata.rb
@@ -77,13 +80,11 @@ files:
77
80
  - lib/vagrant-lxc/action/share_folders.rb
78
81
  - lib/vagrant-lxc/config.rb
79
82
  - lib/vagrant-lxc/driver.rb
80
- - lib/vagrant-lxc/driver/builder.rb
81
83
  - lib/vagrant-lxc/driver/cli.rb
82
- - lib/vagrant-lxc/driver/fetch_ip_from_dnsmasq.rb
83
- - lib/vagrant-lxc/driver/fetch_ip_with_attach.rb
84
84
  - lib/vagrant-lxc/errors.rb
85
85
  - lib/vagrant-lxc/plugin.rb
86
86
  - lib/vagrant-lxc/provider.rb
87
+ - lib/vagrant-lxc/sudo_wrapper.rb
87
88
  - lib/vagrant-lxc/version.rb
88
89
  - locales/en.yml
89
90
  - spec/Vagrantfile
@@ -109,7 +110,8 @@ files:
109
110
  - tasks/spec.rake
110
111
  - vagrant-lxc.gemspec
111
112
  homepage: https://github.com/fgrehm/vagrant-lxc
112
- licenses: []
113
+ licenses:
114
+ - MIT
113
115
  metadata: {}
114
116
  post_install_message:
115
117
  rdoc_options: []
@@ -1,21 +0,0 @@
1
- require_relative 'fetch_ip_with_attach'
2
- require_relative 'fetch_ip_from_dnsmasq'
3
-
4
- module Vagrant
5
- module LXC
6
- class Driver
7
- class Builder
8
- def self.build(id)
9
- version = CLI.new.version.match(/^(\d+\.\d+)\./)[1].to_f
10
- Driver.new(id).tap do |driver|
11
- mod = version >= 0.8 ?
12
- Driver::FetchIpWithAttach :
13
- Driver::FetchIpFromDsnmasq
14
-
15
- driver.extend(mod)
16
- end
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,41 +0,0 @@
1
- module Vagrant
2
- module LXC
3
- class Driver
4
- module FetchIpFromDsnmasq
5
- def assigned_ip
6
- @logger.debug 'Loading ip from dnsmasq leases'
7
- ip = nil
8
- # TODO: Use Vagrant::Util::Retryable
9
- 10.times do
10
- if dnsmasq_leases =~ /#{Regexp.escape mac_address}\s+([0-9.]+)\s+/
11
- ip = $1.to_s
12
- break
13
- else
14
- @logger.debug 'Ip could not be parsed from dnsmasq leases file'
15
- sleep 2
16
- end
17
- end
18
- # TODO: Raise an user friendly error
19
- raise 'Unable to identify container IP!' unless ip
20
- ip
21
- end
22
-
23
- def mac_address
24
- @mac_address ||= base_path.join('config').read.match(/^lxc\.network\.hwaddr\s+=\s+(.+)$/)[1]
25
- end
26
-
27
- LEASES_PATHS = %w(
28
- /var/lib/misc/dnsmasq.leases
29
- /var/lib/dnsmasq/dnsmasq.leases
30
- /var/db/dnsmasq.leases
31
- )
32
-
33
- def dnsmasq_leases
34
- LEASES_PATHS.map do |path|
35
- File.read(path) if File.exists?(path)
36
- end.join("\n")
37
- end
38
- end
39
- end
40
- end
41
- end
@@ -1,29 +0,0 @@
1
- module Vagrant
2
- module LXC
3
- class Driver
4
- module FetchIpWithAttach
5
- # Include this so we can use `Subprocess` more easily.
6
- include Vagrant::Util::Retryable
7
-
8
- def assigned_ip
9
- ip = ''
10
- retryable(:on => LXC::Errors::ExecuteError, :tries => 10, :sleep => 3) do
11
- unless ip = get_container_ip_from_ip_addr
12
- # retry
13
- raise LXC::Errors::ExecuteError, :command => "lxc-attach"
14
- end
15
- end
16
- ip
17
- end
18
-
19
- # From: https://github.com/lxc/lxc/blob/staging/src/python-lxc/lxc/__init__.py#L371-L385
20
- def get_container_ip_from_ip_addr
21
- output = @cli.attach '/sbin/ip', '-4', 'addr', 'show', 'scope', 'global', 'eth0', namespaces: 'network'
22
- if output =~ /^\s+inet ([0-9.]+)\/[0-9]+\s+/
23
- return $1.to_s
24
- end
25
- end
26
- end
27
- end
28
- end
29
- end