vagrant-lxc 0.6.4 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/CONTRIBUTING.md +2 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +28 -26
- data/README.md +10 -3
- data/boxes/build-all.sh +22 -0
- data/development/Vagrantfile +6 -6
- data/development/site.pp +3 -5
- data/lib/vagrant-lxc/action.rb +2 -0
- data/lib/vagrant-lxc/action/create.rb +1 -1
- data/lib/vagrant-lxc/action/forward_ports.rb +4 -0
- data/lib/vagrant-lxc/action/warn_networks.rb +25 -0
- data/lib/vagrant-lxc/driver.rb +17 -11
- data/lib/vagrant-lxc/plugin.rb +1 -1
- data/lib/vagrant-lxc/sudo_wrapper.rb +1 -1
- data/lib/vagrant-lxc/version.rb +1 -1
- data/locales/en.yml +4 -0
- data/spec/Vagrantfile +7 -3
- data/spec/acceptance/sanity_check_spec.rb +30 -4
- data/spec/acceptance/support/acceptance_example_group.rb +21 -1
- data/spec/acceptance/support/machine_ext.rb +2 -3
- data/spec/acceptance/support/test_ui.rb +2 -2
- data/spec/unit/action/forward_ports_spec.rb +16 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e595cc6f680e584b60fd1a734c4f174bddba99fa
|
4
|
+
data.tar.gz: 9e432b94e595b4da4d33a6d724728a11a06fd4bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8542b6cbd0bcf756ef6846cb0cc87dc489ed47460255b3c16526021cd80c4ae8d52dc42617298f258f5ee51cf64a357b082dabec99265ad80a49cbd32430b00a
|
7
|
+
data.tar.gz: 4dee7221dbc5dacb6e0a290a89174d450f714e6b83c891cea1f11fccd870df144acb2b30e8cf0a62917feac5b6d527d90d28a93f4d2310ff8323786f36c475f3
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
## [0.7.0](https://github.com/fgrehm/vagrant-lxc/compare/v0.6.4...v0.7.0) (unreleased)
|
2
|
+
|
3
|
+
IMPROVEMENTS:
|
4
|
+
|
5
|
+
- Support for `vagrant up` in parallel [#152](https://github.com/fgrehm/vagrant-lxc/issues/152)
|
6
|
+
- Warn users about unsupported private / public networking configs [#154](https://github.com/fgrehm/vagrant-lxc/issues/154)
|
7
|
+
- Respect Vagrantfile options to disable forwarded port [#149](https://github.com/fgrehm/vagrant-lxc/issues/149)
|
8
|
+
|
9
|
+
BUG FIXES:
|
10
|
+
|
11
|
+
- Error out in case an invalid IPs are provided for forwarded ports [#170](https://github.com/fgrehm/vagrant-lxc/issues/170)
|
12
|
+
- Fix "Permission denied" when starting/destroying containers after lxc
|
13
|
+
security update in Ubuntu [#180](https://github.com/fgrehm/vagrant-lxc/issues/180)
|
14
|
+
- Fix `vagrant package` [#172](https://github.com/fgrehm/vagrant-lxc/issues/172)
|
15
|
+
|
16
|
+
|
1
17
|
## [0.6.4](https://github.com/fgrehm/vagrant-lxc/compare/v0.6.3...v0.6.4) (Oct 27, 2013)
|
2
18
|
|
3
19
|
IMPROVEMENTS:
|
data/CONTRIBUTING.md
CHANGED
@@ -4,7 +4,8 @@
|
|
4
4
|
but I'll most likely close the issue right away and will continue the discussion
|
5
5
|
with the issue closed. If you have any questions about the plugin, make sure
|
6
6
|
you go through the [Wiki](https://github.com/fgrehm/vagrant-lxc/wiki) pages
|
7
|
-
first
|
7
|
+
first (specially the [Troubleshooting Section](https://github.com/fgrehm/vagrant-lxc/wiki/Troubleshooting))
|
8
|
+
and if you still need answers please ask a question on [Stack Overflow](http://stackoverflow.com/questions/tagged/vagrant-lxc)
|
8
9
|
using the `vagrant-lxc` tag on it so that I get notified :)
|
9
10
|
|
10
11
|
* Please do a small search on the issues tracker before submitting your issue to
|
data/Gemfile
CHANGED
@@ -3,7 +3,7 @@ source 'https://rubygems.org'
|
|
3
3
|
gemspec
|
4
4
|
|
5
5
|
group :development do
|
6
|
-
gem 'vagrant', github: 'mitchellh/vagrant'
|
6
|
+
gem 'vagrant', github: 'mitchellh/vagrant'
|
7
7
|
gem 'vagrant-cachier', github: 'fgrehm/vagrant-cachier'
|
8
8
|
gem 'vagrant-pristine', github: 'fgrehm/vagrant-pristine'
|
9
9
|
gem 'vagrant-omnibus'
|
data/Gemfile.lock
CHANGED
@@ -1,21 +1,20 @@
|
|
1
1
|
GIT
|
2
2
|
remote: git://github.com/fgrehm/vagrant-cachier.git
|
3
|
-
revision:
|
3
|
+
revision: 536ca7ad54b3096644993f91f363df8a884d4600
|
4
4
|
specs:
|
5
|
-
vagrant-cachier (0.
|
5
|
+
vagrant-cachier (0.4.2.dev)
|
6
6
|
|
7
7
|
GIT
|
8
8
|
remote: git://github.com/fgrehm/vagrant-pristine.git
|
9
|
-
revision:
|
9
|
+
revision: 4638491786943bfbf6f115b1fc379f069963fe46
|
10
10
|
specs:
|
11
|
-
vagrant-pristine (0.
|
11
|
+
vagrant-pristine (0.3.0)
|
12
12
|
|
13
13
|
GIT
|
14
14
|
remote: git://github.com/mitchellh/vagrant.git
|
15
|
-
revision:
|
16
|
-
tag: v1.3.3
|
15
|
+
revision: a92e03cf4ce936243d3959b7b5603262a234a58d
|
17
16
|
specs:
|
18
|
-
vagrant (1.3.
|
17
|
+
vagrant (1.3.6.dev)
|
19
18
|
childprocess (~> 0.3.7)
|
20
19
|
erubis (~> 2.7.0)
|
21
20
|
i18n (~> 0.6.0)
|
@@ -26,44 +25,45 @@ GIT
|
|
26
25
|
PATH
|
27
26
|
remote: .
|
28
27
|
specs:
|
29
|
-
vagrant-lxc (0.
|
28
|
+
vagrant-lxc (0.7.0)
|
30
29
|
|
31
30
|
GEM
|
32
31
|
remote: https://rubygems.org/
|
33
32
|
specs:
|
33
|
+
celluloid (0.15.2)
|
34
|
+
timers (~> 1.1.0)
|
34
35
|
childprocess (0.3.9)
|
35
36
|
ffi (~> 1.0, >= 1.0.11)
|
36
37
|
coderay (1.0.9)
|
37
|
-
|
38
|
-
coveralls (0.6.7)
|
39
|
-
colorize
|
38
|
+
coveralls (0.7.0)
|
40
39
|
multi_json (~> 1.3)
|
41
40
|
rest-client
|
42
41
|
simplecov (>= 0.7)
|
42
|
+
term-ansicolor
|
43
43
|
thor
|
44
44
|
diff-lcs (1.2.4)
|
45
45
|
erubis (2.7.0)
|
46
|
-
ffi (1.9.
|
46
|
+
ffi (1.9.3)
|
47
47
|
formatador (0.2.4)
|
48
|
-
guard (
|
48
|
+
guard (2.2.3)
|
49
49
|
formatador (>= 0.2.4)
|
50
|
-
listen (
|
51
|
-
lumberjack (
|
52
|
-
pry (>= 0.9.
|
53
|
-
thor (>= 0.
|
54
|
-
guard-rspec (3.0
|
50
|
+
listen (~> 2.1)
|
51
|
+
lumberjack (~> 1.0)
|
52
|
+
pry (>= 0.9.12)
|
53
|
+
thor (>= 0.18.1)
|
54
|
+
guard-rspec (3.1.0)
|
55
55
|
guard (>= 1.8)
|
56
56
|
rspec (~> 2.13)
|
57
57
|
i18n (0.6.5)
|
58
|
-
listen (
|
58
|
+
listen (2.2.0)
|
59
|
+
celluloid (>= 0.15.2)
|
59
60
|
rb-fsevent (>= 0.9.3)
|
60
61
|
rb-inotify (>= 0.9)
|
61
|
-
rb-kqueue (>= 0.2)
|
62
62
|
log4r (1.1.10)
|
63
63
|
lumberjack (1.0.4)
|
64
64
|
method_source (0.8.2)
|
65
|
-
mime-types (
|
66
|
-
multi_json (1.8.
|
65
|
+
mime-types (2.0)
|
66
|
+
multi_json (1.8.2)
|
67
67
|
net-scp (1.1.2)
|
68
68
|
net-ssh (>= 2.6.5)
|
69
69
|
net-ssh (2.6.8)
|
@@ -73,9 +73,7 @@ GEM
|
|
73
73
|
slop (~> 3.4)
|
74
74
|
rake (10.1.0)
|
75
75
|
rb-fsevent (0.9.3)
|
76
|
-
rb-inotify (0.9.
|
77
|
-
ffi (>= 0.5.0)
|
78
|
-
rb-kqueue (0.2.0)
|
76
|
+
rb-inotify (0.9.2)
|
79
77
|
ffi (>= 0.5.0)
|
80
78
|
rest-client (1.6.7)
|
81
79
|
mime-types (>= 1.16)
|
@@ -96,8 +94,12 @@ GEM
|
|
96
94
|
simplecov-html (~> 0.7.1)
|
97
95
|
simplecov-html (0.7.1)
|
98
96
|
slop (3.4.6)
|
97
|
+
term-ansicolor (1.2.2)
|
98
|
+
tins (~> 0.8)
|
99
99
|
thor (0.18.1)
|
100
|
-
|
100
|
+
timers (1.1.0)
|
101
|
+
tins (0.12.0)
|
102
|
+
vagrant-omnibus (1.1.2)
|
101
103
|
|
102
104
|
PLATFORMS
|
103
105
|
ruby
|
data/README.md
CHANGED
@@ -5,7 +5,9 @@
|
|
5
5
|
[LXC](http://lxc.sourceforge.net/) provider for [Vagrant](http://www.vagrantup.com/) 1.1+
|
6
6
|
|
7
7
|
This is a Vagrant plugin that allows it to control and provision Linux Containers
|
8
|
-
as an alternative to the built in VirtualBox provider for Linux hosts.
|
8
|
+
as an alternative to the built in VirtualBox provider for Linux hosts. Check out
|
9
|
+
[this blog post](http://fabiorehm.com/blog/2013/04/28/lxc-provider-for-vagrant/)
|
10
|
+
to see it in action.
|
9
11
|
|
10
12
|
|
11
13
|
## Features / Limitations
|
@@ -37,6 +39,9 @@ If you are on a Mac or Windows machine, you might want to have a look at [this](
|
|
37
39
|
blog post for some ideas on how to set things up or check out [this other repo](https://github.com/fgrehm/vagrant-lxc-vbox-hosts)
|
38
40
|
for a set of Vagrant VirtualBox machines ready for vagrant-lxc usage.
|
39
41
|
|
42
|
+
**NOTE: Some users have been experiencing networking issues and right now you might need to
|
43
|
+
disable checksum offloading as described on [this comment](https://github.com/fgrehm/vagrant-lxc/issues/153#issuecomment-26441273)**
|
44
|
+
|
40
45
|
|
41
46
|
## Installation
|
42
47
|
|
@@ -78,7 +83,7 @@ using the [provider block](http://docs.vagrantup.com/v2/providers/configuration.
|
|
78
83
|
Vagrant.configure("2") do |config|
|
79
84
|
config.vm.box = "quantal64"
|
80
85
|
config.vm.provider :lxc do |lxc|
|
81
|
-
# Same effect as
|
86
|
+
# Same effect as 'customize ["modifyvm", :id, "--memory", "1024"]' for VirtualBox
|
82
87
|
lxc.customize 'cgroup.memory.limit_in_bytes', '1024M'
|
83
88
|
end
|
84
89
|
end
|
@@ -118,7 +123,7 @@ list if you have a problem and feel free to use the [issue tracker](https://gith
|
|
118
123
|
propose new functionality and / or report bugs.
|
119
124
|
|
120
125
|
|
121
|
-
##
|
126
|
+
## Support
|
122
127
|
|
123
128
|
Support this project and [others by fgrehm](https://github.com/fgrehm)
|
124
129
|
via [gittip](https://www.gittip.com/fgrehm/).
|
@@ -133,3 +138,5 @@ via [gittip](https://www.gittip.com/fgrehm/).
|
|
133
138
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
134
139
|
4. Push to the branch (`git push origin my-new-feature`)
|
135
140
|
5. Create new Pull Request
|
141
|
+
|
142
|
+
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/fgrehm/vagrant-lxc/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
|
data/boxes/build-all.sh
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
# set -x
|
4
|
+
set -e
|
5
|
+
|
6
|
+
# Convenience script used for building all of the base boxes available
|
7
|
+
|
8
|
+
# Ubuntu boxes
|
9
|
+
sudo -E ./build-ubuntu-box.sh precise
|
10
|
+
sudo -E ./build-ubuntu-box.sh quantal
|
11
|
+
sudo -E ./build-ubuntu-box.sh raring
|
12
|
+
sudo -E ./build-ubuntu-box.sh saucy
|
13
|
+
|
14
|
+
# Debian boxes
|
15
|
+
sudo -E ./build-debian-box.sh squeeze
|
16
|
+
sudo -E ./build-debian-box.sh wheezy
|
17
|
+
sudo -E ./build-debian-box.sh sid
|
18
|
+
|
19
|
+
for box in precise raring quantal saucy squeeze wheezy sid; do
|
20
|
+
box="vagrant-lxc-${box}-amd64-`date +%Y-%m-%d`.box"
|
21
|
+
~/bin/dropbox_uploader.sh upload output/${box} Public/
|
22
|
+
done
|
data/development/Vagrantfile
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# vi: set ft=ruby :
|
3
3
|
|
4
4
|
require 'pathname'
|
5
|
-
BASE_URL = 'http://
|
6
|
-
LAST_RELEASE_DATE = '2013-
|
5
|
+
BASE_URL = 'http://bit.ly/'
|
6
|
+
LAST_RELEASE_DATE = '2013-09-28'
|
7
7
|
LOCAL_BOXES_PATH = Pathname('../boxes/output').expand_path
|
8
8
|
def lxc_box_url(release_name)
|
9
|
-
|
10
|
-
local_box_file = LOCAL_BOXES_PATH.join(
|
9
|
+
box_name = "vagrant-lxc-#{release_name}-amd64-#{LAST_RELEASE_DATE}"
|
10
|
+
local_box_file = LOCAL_BOXES_PATH.join("#{box_name}.box")
|
11
11
|
|
12
12
|
local_box_file.exist? ?
|
13
13
|
local_box_file.to_s :
|
14
|
-
"#{BASE_URL}/#{
|
14
|
+
"#{BASE_URL}/#{box_name}"
|
15
15
|
end
|
16
16
|
|
17
17
|
BOXES = {
|
@@ -25,7 +25,7 @@ BOXES = {
|
|
25
25
|
},
|
26
26
|
raring: {
|
27
27
|
lxc_url: lxc_box_url('raring'),
|
28
|
-
vbox_url: 'http://
|
28
|
+
vbox_url: 'http://cloud-images.ubuntu.com/vagrant/raring/current/raring-server-cloudimg-amd64-vagrant-disk1.box'
|
29
29
|
},
|
30
30
|
saucy: {
|
31
31
|
vbox_url: 'http://cloud-images.ubuntu.com/vagrant/saucy/current/saucy-server-cloudimg-amd64-vagrant-disk1.box'
|
data/development/site.pp
CHANGED
@@ -37,7 +37,7 @@ exec {
|
|
37
37
|
# Install dependencies
|
38
38
|
package {
|
39
39
|
[ 'libffi-dev', 'bsdtar', 'exuberant-ctags', 'ruby1.9.1-dev', 'htop', 'git',
|
40
|
-
'build-essential', 'redir', 'curl', 'vim', 'btrfs-tools' ]:
|
40
|
+
'build-essential', 'redir', 'curl', 'vim', 'btrfs-tools', 'psmisc' ]:
|
41
41
|
ensure => 'installed'
|
42
42
|
;
|
43
43
|
|
@@ -146,8 +146,6 @@ file {
|
|
146
146
|
'/usr/bin/lxc-vagrant-wrapper':
|
147
147
|
ensure => 'present',
|
148
148
|
mode => '0755',
|
149
|
-
content => "
|
150
|
-
|
151
|
-
exec ARGV.join(' ')
|
152
|
-
"
|
149
|
+
content => "#!/usr/bin/env ruby
|
150
|
+
exec ARGV.join(' ')"
|
153
151
|
}
|
data/lib/vagrant-lxc/action.rb
CHANGED
@@ -18,6 +18,7 @@ require 'vagrant-lxc/action/message'
|
|
18
18
|
require 'vagrant-lxc/action/remove_temporary_files'
|
19
19
|
require 'vagrant-lxc/action/setup_package_files'
|
20
20
|
require 'vagrant-lxc/action/share_folders'
|
21
|
+
require 'vagrant-lxc/action/warn_networks'
|
21
22
|
|
22
23
|
unless Vagrant::LXC.vagrant_1_3_or_later
|
23
24
|
require 'vagrant-lxc/action/wait_for_communicator'
|
@@ -58,6 +59,7 @@ module Vagrant
|
|
58
59
|
b.use Builtin::HandleForwardedPortCollisions
|
59
60
|
b.use ShareFolders
|
60
61
|
b.use Builtin::SetHostname
|
62
|
+
b.use WarnNetworks
|
61
63
|
b.use ForwardPorts
|
62
64
|
b.use Boot
|
63
65
|
b.use Builtin::WaitForCommunicator
|
@@ -7,7 +7,7 @@ module Vagrant
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def call(env)
|
10
|
-
container_name = "#{env[:root_path].basename
|
10
|
+
container_name = "#{env[:root_path].basename}_#{env[:machine].name}"
|
11
11
|
container_name.gsub!(/[^-a-z0-9_]/i, "")
|
12
12
|
container_name << "-#{Time.now.to_i}"
|
13
13
|
|
@@ -63,7 +63,11 @@ module Vagrant
|
|
63
63
|
mappings = {}
|
64
64
|
|
65
65
|
config.vm.networks.each do |type, options|
|
66
|
+
next if options[:disabled]
|
67
|
+
|
68
|
+
# TODO: Deprecate this behavior of "automagically" skipping ssh forwarded ports
|
66
69
|
if type == :forwarded_port && options[:id] != 'ssh'
|
70
|
+
options.delete(:host_ip) if options.fetch(:host_ip, '').to_s.strip.empty?
|
67
71
|
mappings[options[:host]] = options
|
68
72
|
end
|
69
73
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Vagrant
|
2
|
+
module LXC
|
3
|
+
module Action
|
4
|
+
class WarnNetworks
|
5
|
+
def initialize(app, env)
|
6
|
+
@app = app
|
7
|
+
end
|
8
|
+
|
9
|
+
def call(env)
|
10
|
+
if public_or_private_network_configured?(env[:machine].config)
|
11
|
+
env[:ui].warn(I18n.t("vagrant_lxc.messages.warn_networks"))
|
12
|
+
end
|
13
|
+
|
14
|
+
@app.call(env)
|
15
|
+
end
|
16
|
+
|
17
|
+
def public_or_private_network_configured?(config)
|
18
|
+
config.vm.networks.find do |type, _|
|
19
|
+
[:private_network, :public_network].include?(type.to_sym)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/vagrant-lxc/driver.rb
CHANGED
@@ -36,11 +36,15 @@ module Vagrant
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def rootfs_path
|
39
|
-
Pathname.new(
|
39
|
+
Pathname.new(config_string.match(/^lxc\.rootfs\s+=\s+(.+)$/)[1])
|
40
40
|
end
|
41
41
|
|
42
42
|
def mac_address
|
43
|
-
@mac_address ||=
|
43
|
+
@mac_address ||= config_string.match(/^lxc\.network\.hwaddr\s+=\s+(.+)$/)[1]
|
44
|
+
end
|
45
|
+
|
46
|
+
def config_string
|
47
|
+
@sudo_wrapper.run('cat', base_path.join('config').to_s)
|
44
48
|
end
|
45
49
|
|
46
50
|
def create(name, template_path, config_file, template_options = {})
|
@@ -106,15 +110,17 @@ module Vagrant
|
|
106
110
|
# TODO: Pass in tmpdir so we can clean up from outside
|
107
111
|
target_path = "#{Dir.mktmpdir}/rootfs.tar.gz"
|
108
112
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
113
|
+
@logger.info "Compressing '#{rootfs_path}' rootfs to #{target_path}"
|
114
|
+
cmds = [
|
115
|
+
"cd #{base_path}",
|
116
|
+
"rm -f rootfs.tar.gz",
|
117
|
+
"tar --numeric-owner -czf #{target_path} -C #{rootfs_path} './.'"
|
118
|
+
]
|
119
|
+
@sudo_wrapper.su_c(cmds.join(' && '))
|
120
|
+
|
121
|
+
@logger.info "Changing rootfs tarball owner"
|
122
|
+
user_details = Etc.getpwnam(Etc.getlogin)
|
123
|
+
@sudo_wrapper.run('chown', "#{user_details.uid}:#{user_details.gid}", target_path)
|
118
124
|
|
119
125
|
target_path
|
120
126
|
end
|
data/lib/vagrant-lxc/plugin.rb
CHANGED
data/lib/vagrant-lxc/version.rb
CHANGED
data/locales/en.yml
CHANGED
@@ -17,6 +17,10 @@ en:
|
|
17
17
|
Waiting for container to start. This should not take long.
|
18
18
|
container_ready: |-
|
19
19
|
Container started and ready for use!
|
20
|
+
warn_networks: |-
|
21
|
+
Warning! The LXC provider doesn't support any of the Vagrant public / private
|
22
|
+
network configurations (ex: `config.vm.network :private_network, ip: "some-ip"`).
|
23
|
+
They will be silently ignored.
|
20
24
|
|
21
25
|
vagrant:
|
22
26
|
commands:
|
data/spec/Vagrantfile
CHANGED
@@ -5,22 +5,26 @@ Vagrant.require_plugin 'vagrant-lxc'
|
|
5
5
|
Vagrant.require_plugin 'vagrant-cachier'
|
6
6
|
|
7
7
|
ENV['BOX_NAME'] ||= 'quantal64'
|
8
|
-
puts "Running
|
8
|
+
puts "Running vagrant commands using #{ENV['BOX_NAME']} box"
|
9
9
|
|
10
10
|
Vagrant.configure("2") do |config|
|
11
11
|
config.vm.box = ENV['BOX_NAME']
|
12
12
|
config.vm.hostname = 'lxc-test-box'
|
13
|
+
config.vm.box_url = ENV['BOX_URL']
|
13
14
|
config.vm.network :forwarded_port, guest: 80, host: 8080
|
14
15
|
|
15
16
|
config.cache.auto_detect = true
|
16
17
|
|
17
18
|
config.vm.provider :lxc do |lxc|
|
18
|
-
lxc.sudo_wrapper = '/usr/bin/lxc-vagrant-wrapper'
|
19
|
+
# lxc.sudo_wrapper = '/usr/bin/lxc-vagrant-wrapper'
|
19
20
|
end
|
20
21
|
|
21
22
|
config.vm.provision :shell,
|
22
23
|
inline: 'mkdir -p /vagrant/tmp && echo -n "Provisioned" > /vagrant/tmp/provisioning'
|
23
24
|
|
24
25
|
config.vm.provision :shell,
|
25
|
-
inline: '
|
26
|
+
inline: 'apt-get install apache2 -y'
|
27
|
+
|
28
|
+
config.vm.provision :shell, privileged: false,
|
29
|
+
inline: "if ! [ -f $HOME/original-box ]; then echo '#{ENV['BOX_NAME']}' > $HOME/original-box; fi"
|
26
30
|
end
|
@@ -48,7 +48,7 @@ describe 'Sanity check' do
|
|
48
48
|
vagrant_halt
|
49
49
|
end
|
50
50
|
|
51
|
-
it 'shuts down container' do
|
51
|
+
it 'shuts down the container' do
|
52
52
|
status = `sudo lxc-info -n #{vagrant_container_name}`
|
53
53
|
expect(status).to include 'STOPPED'
|
54
54
|
end
|
@@ -63,9 +63,10 @@ describe 'Sanity check' do
|
|
63
63
|
expect($?.exitstatus).to_not eq 0
|
64
64
|
end
|
65
65
|
|
66
|
-
|
67
|
-
|
68
|
-
|
66
|
+
xit 'removes files under `/tmp`' do
|
67
|
+
container_tmp_files = `sudo ls -l "/var/lib/lxc/#{vagrant_container_name}/rootfs/tmp"`.split("\n")
|
68
|
+
puts container_tmp_files.join("\n")
|
69
|
+
expect(container_tmp_files).to be_empty
|
69
70
|
end
|
70
71
|
end
|
71
72
|
|
@@ -82,4 +83,29 @@ describe 'Sanity check' do
|
|
82
83
|
expect(containers).to_not include @container_name
|
83
84
|
end
|
84
85
|
end
|
86
|
+
|
87
|
+
pending 'box packaging' do
|
88
|
+
before(:all) do
|
89
|
+
destroy_container
|
90
|
+
vagrant_box_remove('new-box')
|
91
|
+
vagrant_up
|
92
|
+
vagrant_package
|
93
|
+
@box_name = ENV['BOX_NAME']
|
94
|
+
# This will make
|
95
|
+
ENV["BOX_NAME"] = 'new-box'
|
96
|
+
ENV['BOX_URL'] = '/vagrant/spec/tmp/package.box'
|
97
|
+
end
|
98
|
+
|
99
|
+
after(:all) do
|
100
|
+
vagrant_box_remove('new-box')
|
101
|
+
ENV["BOX_NAME"] = @box_name
|
102
|
+
ENV['BOX_URL'] = nil
|
103
|
+
end
|
104
|
+
|
105
|
+
it 'creates a package that can be successfully brought up on a later `vagrant up`' do
|
106
|
+
vagrant_up
|
107
|
+
# Just to make sure we packaged it properly
|
108
|
+
expect(vagrant_ssh('cat /home/vagrant/original-box')).to eq @box_name
|
109
|
+
end
|
110
|
+
end
|
85
111
|
end
|
@@ -13,12 +13,13 @@ module AcceptanceExampleGroup
|
|
13
13
|
`sudo lxc-shutdown -n #{name} 2>/dev/null`
|
14
14
|
`sudo lxc-wait -n #{name} --state STOPPED 2>/dev/null`
|
15
15
|
`sudo lxc-destroy -n #{name} 2>/dev/null`
|
16
|
+
`rm -rf /vagrant/spec/.vagrant/`
|
16
17
|
end
|
17
18
|
`sudo killall -9 redir 2>/dev/null`
|
18
19
|
end
|
19
20
|
|
20
21
|
def with_vagrant_environment
|
21
|
-
opts = { cwd: 'spec', ui_class: TestUI }
|
22
|
+
opts = { cwd: '/vagrant/spec', ui_class: TestUI }
|
22
23
|
env = Vagrant::Environment.new(opts)
|
23
24
|
yield env
|
24
25
|
env.unload
|
@@ -53,4 +54,23 @@ module AcceptanceExampleGroup
|
|
53
54
|
end
|
54
55
|
output
|
55
56
|
end
|
57
|
+
|
58
|
+
def vagrant_package
|
59
|
+
with_vagrant_environment do |env|
|
60
|
+
pkg = '/vagrant/spec/tmp/package.box'
|
61
|
+
`rm -f #{pkg}`
|
62
|
+
env.cli('package', '--output', pkg)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def vagrant_box_remove(name)
|
67
|
+
with_vagrant_environment do |env|
|
68
|
+
env.cli('box', 'list')
|
69
|
+
output = env.ui.messages[:info].join("\n").chomp
|
70
|
+
|
71
|
+
if output.include?(name)
|
72
|
+
env.cli('box', 'remove', name)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
56
76
|
end
|
@@ -1,13 +1,12 @@
|
|
1
1
|
# Monkey patch vagrant in order to reuse the UI test object that is set on
|
2
2
|
# our Vagrant::Environments
|
3
3
|
#
|
4
|
-
# TODO: Find out if this makes sense to be on vagrant core itself
|
5
4
|
require 'vagrant/machine'
|
6
5
|
Vagrant::Machine.class_eval do
|
7
6
|
alias :old_action :action
|
8
7
|
|
9
|
-
define_method :action do |
|
8
|
+
define_method :action do |action_name, extra_env = nil|
|
10
9
|
extra_env = { ui: @env.ui }.merge(extra_env || {})
|
11
|
-
old_action
|
10
|
+
old_action action_name, extra_env
|
12
11
|
end
|
13
12
|
end
|
@@ -15,8 +15,8 @@ class TestUI < Vagrant::UI::Interface
|
|
15
15
|
end
|
16
16
|
|
17
17
|
METHODS.each do |method|
|
18
|
-
define_method(method) do
|
19
|
-
@messages[method].push
|
18
|
+
define_method(method) do |*args|#message, *opts|
|
19
|
+
@messages[method].push args[0]
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -47,6 +47,15 @@ describe Vagrant::LXC::Action::ForwardPorts do
|
|
47
47
|
)
|
48
48
|
end
|
49
49
|
|
50
|
+
it 'skips --laddr parameter if host_ip is a blank string' do
|
51
|
+
forward_conf[:host_ip] = ' '
|
52
|
+
subject.stub(system: true)
|
53
|
+
subject.call(env)
|
54
|
+
subject.should have_received(:spawn).with(
|
55
|
+
"redir --lport=#{host_port} --caddr=#{container_ip} --cport=#{guest_port} 2>/dev/null"
|
56
|
+
)
|
57
|
+
end
|
58
|
+
|
50
59
|
it "stores redir pids on machine's data dir" do
|
51
60
|
subject.stub(system: true)
|
52
61
|
subject.call(env)
|
@@ -54,6 +63,13 @@ describe Vagrant::LXC::Action::ForwardPorts do
|
|
54
63
|
pid_file.should == pid
|
55
64
|
end
|
56
65
|
|
66
|
+
it 'allows disabling a previously forwarded port' do
|
67
|
+
forward_conf[:disabled] = true
|
68
|
+
subject.stub(system: true)
|
69
|
+
subject.call(env)
|
70
|
+
subject.should_not have_received(:spawn)
|
71
|
+
end
|
72
|
+
|
57
73
|
it 'raises RedirNotInstalled error if `redir` is not installed' do
|
58
74
|
subject.stub(system: false)
|
59
75
|
lambda { subject.call(env) }.should raise_error(Vagrant::LXC::Errors::RedirNotInstalled)
|
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
|
+
version: 0.7.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-
|
11
|
+
date: 2013-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Linux Containers provider for Vagrant
|
14
14
|
email:
|
@@ -30,6 +30,7 @@ files:
|
|
30
30
|
- LICENSE.txt
|
31
31
|
- README.md
|
32
32
|
- Rakefile
|
33
|
+
- boxes/build-all.sh
|
33
34
|
- boxes/build-debian-box.sh
|
34
35
|
- boxes/build-openmandriva-box.sh
|
35
36
|
- boxes/build-ubuntu-box.sh
|
@@ -73,6 +74,7 @@ files:
|
|
73
74
|
- lib/vagrant-lxc/action/setup_package_files.rb
|
74
75
|
- lib/vagrant-lxc/action/share_folders.rb
|
75
76
|
- lib/vagrant-lxc/action/wait_for_communicator.rb
|
77
|
+
- lib/vagrant-lxc/action/warn_networks.rb
|
76
78
|
- lib/vagrant-lxc/config.rb
|
77
79
|
- lib/vagrant-lxc/driver.rb
|
78
80
|
- lib/vagrant-lxc/driver/cli.rb
|