vagrant-lxc 0.3.0 → 0.3.1

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: 1c9e378441e40002c34e265155c4066485bf4e00
4
- data.tar.gz: 26cfdc7e029ba157e961944c2346fa1e3d3b5135
3
+ metadata.gz: 8eff41cebc459233af4d304d3234bb3b3d0d2e64
4
+ data.tar.gz: 0feb0dc99a45e4cad8937734bd1a52d8def4ca2c
5
5
  SHA512:
6
- metadata.gz: 20495f21d5311e8397de76cfab8d01cb40247dca891a5051382b16e5b4ba6a948f4708addcafc691384a6f82aca1dc64b7318ea03b98a65c3ca3bb64bcd43010
7
- data.tar.gz: d9b10838087a6d919a83c28430e8c657bd2fddf0223f9cd910d64f6051591a912cf7308ece39f5535ea4c24b02dcdb2124af5d5633b14680b73e09ad9d986b2c
6
+ metadata.gz: 3c96f674a532fec707df11a5ead708535207c37263365042404cdffedc5b92638ab42deb6773a1eb521da8dbe0938b5c0530180e9dbeb5d5ced09a8d49397002
7
+ data.tar.gz: 7f62bd81a6cbaf7683cc918157b942c7c55bd0f87a8da28c328c311fc09c5e57cd3c5bd1829e4dcf8f6c9c8430a9dc4cd548c289566d9531713ba5e3b7670e92
data/.travis.yml CHANGED
@@ -5,4 +5,4 @@ rvm:
5
5
  matrix:
6
6
  allow_failures:
7
7
  - rvm: 2.0.0
8
- script: "bundle exec rake ci"
8
+ script: "bundle exec rake"
data/CHANGELOG.md CHANGED
@@ -1,4 +1,8 @@
1
- ## [0.3.0](https://github.com/fgrehm/vagrant-lxc/compare/v0.2.0...v0.3.0)
1
+ ## [0.3.1](https://github.com/fgrehm/vagrant-lxc/compare/v0.3.0...master) (April 18, 2013)
2
+
3
+ - Improved output to match lxc "verbiage"
4
+
5
+ ## [0.3.0](https://github.com/fgrehm/vagrant-lxc/compare/v0.2.0...v0.3.0) (April 10, 2013)
2
6
 
3
7
  BACKWARDS INCOMPATIBILITIES:
4
8
 
@@ -11,32 +15,32 @@ IMPROVEMENTS:
11
15
 
12
16
  - lxc templates are removed from lxc template dir after container is created
13
17
  - Treat NFS shared folders as a normal shared folder instead of ignoring it so we can share the same Vagrantfile with VBox environments
14
- - Support for lxc 0.7.5 (tested on Ubuntu 12.04) [#49](https://github.com/fgrehm/vagrant-lxc/issues/49)
15
- - Remove `/tmp` files when packaging quantal64 base box [#48](https://github.com/fgrehm/vagrant-lxc/issues/48)
16
- - Avoid picking the best mirror on quantal64 base box [#38](https://github.com/fgrehm/vagrant-lxc/issues/38)
18
+ - Support for lxc 0.7.5 (tested on Ubuntu 12.04) [#49][]
19
+ - Remove `/tmp` files when packaging quantal64 base box [#48][]
20
+ - Avoid picking the best mirror on quantal64 base box [#38][]
17
21
 
18
22
  BUG FIXES:
19
23
 
20
- - Redirect `redir`'s stderr output to `/dev/null` [#51](https://github.com/fgrehm/vagrant-lxc/issues/51)
21
- - Switch from `ifconfig` to `ip` to grab container's IP to avoid localization issues [#50](https://github.com/fgrehm/vagrant-lxc/issues/50)
24
+ - Redirect `redir`'s stderr output to `/dev/null` [#51][]
25
+ - Switch from `ifconfig` to `ip` to grab container's IP to avoid localization issues [#50][]
22
26
 
23
- ## [0.2.0](https://github.com/fgrehm/vagrant-lxc/compare/v0.1.1...v0.2.0)
27
+ ## [0.2.0](https://github.com/fgrehm/vagrant-lxc/compare/v0.1.1...v0.2.0) (March 30, 2013)
24
28
 
25
29
  - Experimental box packaging (only tested with Ubuntu 64 base box)
26
30
 
27
- ## [0.1.1](https://github.com/fgrehm/vagrant-lxc/compare/v0.1.0...v0.1.1)
31
+ ## [0.1.1](https://github.com/fgrehm/vagrant-lxc/compare/v0.1.0...v0.1.1) (March 29, 2013)
28
32
 
29
33
  - Removed support for development under Vagrant < 1.1
30
- - Removed rsync from base quantal64 box to speed up containers creation [#40](https://github.com/fgrehm/vagrant-lxc/issues/40)
31
- - Containers are now named after project's root dir [#14](https://github.com/fgrehm/vagrant-lxc/issues/14)
34
+ - Removed rsync from base quantal64 box to speed up containers creation [#40][]
35
+ - Containers are now named after project's root dir [#14][]
32
36
  - Skip Vagrant's built in SSH redirect
33
- - Allow setting rootfs from Vagrantfile [#30](https://github.com/fgrehm/vagrant-lxc/issues/30)
37
+ - Allow setting rootfs from Vagrantfile [#30][]
34
38
 
35
- ## [0.1.0](https://github.com/fgrehm/vagrant-lxc/compare/v0.0.3...v0.1.0)
39
+ ## [0.1.0](https://github.com/fgrehm/vagrant-lxc/compare/v0.0.3...v0.1.0) (March 27, 2013)
36
40
 
37
41
  - Support for chef added to base quantal64 box
38
42
  - Puppet upgraded to 3.1.1 on base quantal64 box
39
- - Port forwarding support added [#6](https://github.com/fgrehm/vagrant-lxc/issues/6)
43
+ - Port forwarding support added [#6][]
40
44
 
41
45
  ## Previous
42
46
 
data/Gemfile CHANGED
@@ -12,7 +12,6 @@ group :development do
12
12
  gem 'guard-bundler'
13
13
  gem 'guard-ctags-bundler'
14
14
  gem 'rb-inotify'
15
- gem 'simplecov', require: false
16
15
  end
17
16
 
18
17
 
@@ -21,4 +20,5 @@ group :development, :test do
21
20
  gem 'rspec'
22
21
  gem 'rspec-fire', require: 'rspec/fire'
23
22
  gem 'rspec-spies', require: false
23
+ gem 'coveralls', require: false
24
24
  end
data/Gemfile.lock CHANGED
@@ -15,7 +15,7 @@ GIT
15
15
  PATH
16
16
  remote: .
17
17
  specs:
18
- vagrant-lxc (0.3.0)
18
+ vagrant-lxc (0.3.1)
19
19
 
20
20
  GEM
21
21
  remote: https://rubygems.org/
@@ -23,6 +23,13 @@ GEM
23
23
  childprocess (0.3.9)
24
24
  ffi (~> 1.0, >= 1.0.11)
25
25
  coderay (1.0.9)
26
+ colorize (0.5.8)
27
+ coveralls (0.6.5)
28
+ colorize
29
+ multi_json (~> 1.3)
30
+ rest-client
31
+ simplecov (>= 0.7)
32
+ thor
26
33
  diff-lcs (1.2.2)
27
34
  erubis (2.7.0)
28
35
  ffi (1.6.0)
@@ -47,6 +54,7 @@ GEM
47
54
  log4r (1.1.10)
48
55
  lumberjack (1.0.3)
49
56
  method_source (0.8.1)
57
+ mime-types (1.22)
50
58
  multi_json (1.7.2)
51
59
  net-scp (1.1.0)
52
60
  net-ssh (>= 2.6.5)
@@ -58,6 +66,8 @@ GEM
58
66
  rake (10.0.4)
59
67
  rb-inotify (0.9.0)
60
68
  ffi (>= 0.5.0)
69
+ rest-client (1.6.7)
70
+ mime-types (>= 1.16)
61
71
  rspec (2.13.0)
62
72
  rspec-core (~> 2.13.0)
63
73
  rspec-expectations (~> 2.13.0)
@@ -81,6 +91,7 @@ PLATFORMS
81
91
  ruby
82
92
 
83
93
  DEPENDENCIES
94
+ coveralls
84
95
  guard
85
96
  guard-bundler
86
97
  guard-ctags-bundler
@@ -90,6 +101,5 @@ DEPENDENCIES
90
101
  rspec
91
102
  rspec-fire
92
103
  rspec-spies
93
- simplecov
94
104
  vagrant!
95
105
  vagrant-lxc!
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # vagrant-lxc [![Build Status](https://travis-ci.org/fgrehm/vagrant-lxc.png?branch=master)](https://travis-ci.org/fgrehm/vagrant-lxc) [![Gem Version](https://badge.fury.io/rb/vagrant-lxc.png)](http://badge.fury.io/rb/vagrant-lxc) [![Code Climate](https://codeclimate.com/github/fgrehm/vagrant-lxc.png)](https://codeclimate.com/github/fgrehm/vagrant-lxc)
1
+ # vagrant-lxc [![Build Status](https://travis-ci.org/fgrehm/vagrant-lxc.png?branch=master)](https://travis-ci.org/fgrehm/vagrant-lxc) [![Gem Version](https://badge.fury.io/rb/vagrant-lxc.png)](http://badge.fury.io/rb/vagrant-lxc) [![Code Climate](https://codeclimate.com/github/fgrehm/vagrant-lxc.png)](https://codeclimate.com/github/fgrehm/vagrant-lxc) [![Coverage Status](https://coveralls.io/repos/fgrehm/vagrant-lxc/badge.png?branch=master)](https://coveralls.io/r/fgrehm/vagrant-lxc)
2
2
 
3
3
  Linux Containers support for Vagrant 1.1+
4
4
 
@@ -7,7 +7,8 @@ Linux Containers support for Vagrant 1.1+
7
7
 
8
8
  * Vagrant 1.1+ (1.1.3+ recommended)
9
9
  * lxc 0.7.5+ (0.8.0-rc1+ recommended)
10
- * redir
10
+ * redir (if you are planning to use port forwarding)
11
+ * arch command (uname -m) on PATH
11
12
  * A Kernel [higher than 3.5.0-17.28](#help-im-unable-to-restart-containers)
12
13
 
13
14
  On a clean Ubuntu 12.10 machine it means something like:
@@ -172,8 +173,8 @@ to a bug on linux kernel, so make sure you are using a bug-free kernel
172
173
  * https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1065434
173
174
 
174
175
  Sometimes the dev boxes I'm using are not able to `lxc-start` containers
175
- anymore. Most of the times it was an issue with the arguments [I provided](https://github.com/fgrehm/vagrant-lxc/blob/master/example/Vagrantfile#L14-L18)
176
- to it (or a *buggy* kernel). If you run into that, rollback your changes
176
+ anymore. Most of the times it was an issue with the arguments I provided
177
+ to it for customization (or a *buggy* kernel). If you run into that, rollback your changes
177
178
  and try to `vagrant reload` the dev box. If it still doesn't work,
178
179
  please file a bug at the [issue tracker](https://github.com/fgrehm/vagrant-lxc/issues).
179
180
 
data/Rakefile CHANGED
@@ -1,5 +1,3 @@
1
1
  Dir['./tasks/**/*.rake'].each { |f| load f }
2
2
 
3
3
  require 'bundler/gem_tasks'
4
-
5
- task :ci => ['spec:unit']
@@ -9,6 +9,6 @@ fi
9
9
  echo 'An old kernel was found on the guest machine and it will be upgraded' 1>&2
10
10
  echo 'Please reload the box after provisioning when finished' 1>&2
11
11
  sudo apt-get update
12
- sudo apt-get install linux-image-3.5.0-26-generic linux-headers-3.5.0-26-generic -y
12
+ sudo apt-get install linux-image-3.5.0-27-generic linux-headers-3.5.0-27-generic -y
13
13
  sudo apt-get dist-upgrade -y
14
14
  sudo apt-get autoremove -y
@@ -5,12 +5,14 @@ require 'vagrant-lxc/action/clear_forwarded_ports'
5
5
  require 'vagrant-lxc/action/create'
6
6
  require 'vagrant-lxc/action/created'
7
7
  require 'vagrant-lxc/action/destroy'
8
+ require 'vagrant-lxc/action/destroy_confirm'
8
9
  require 'vagrant-lxc/action/disconnect'
9
10
  require 'vagrant-lxc/action/compress_rootfs'
10
11
  require 'vagrant-lxc/action/forced_halt'
11
12
  require 'vagrant-lxc/action/forward_ports'
12
13
  require 'vagrant-lxc/action/handle_box_metadata'
13
14
  require 'vagrant-lxc/action/is_running'
15
+ require 'vagrant-lxc/action/message'
14
16
  require 'vagrant-lxc/action/setup_package_files'
15
17
  require 'vagrant-lxc/action/share_folders'
16
18
 
@@ -25,8 +27,7 @@ module Vagrant
25
27
  # b.use CheckDependencies
26
28
  b.use Vagrant::Action::Builtin::Call, Created do |env1, b2|
27
29
  if !env1[:result]
28
- # TODO: Implement our own MessageNotCreated
29
- b2.use VagrantPlugins::ProviderVirtualBox::Action::MessageNotCreated
30
+ b2.use Message, :not_created
30
31
  next
31
32
  end
32
33
 
@@ -60,15 +61,13 @@ module Vagrant
60
61
  b.use Vagrant::Action::Builtin::ConfigValidate
61
62
  b.use Vagrant::Action::Builtin::Call, Created do |env1, b2|
62
63
  if !env1[:result]
63
- # TODO: Implement our own MessageNotCreated
64
- b2.use VagrantPlugins::ProviderVirtualBox::Action::MessageNotCreated
64
+ b2.use Message, :not_created
65
65
  next
66
66
  end
67
67
 
68
68
  b2.use Vagrant::Action::Builtin::Call, IsRunning do |env2, b3|
69
69
  if !env2[:result]
70
- # TODO: Implement our own MessageNotRunning
71
- b3.use VagrantPlugins::ProviderVirtualBox::Action::MessageNotRunning
70
+ b3.use Message, :not_running
72
71
  next
73
72
  end
74
73
 
@@ -127,8 +126,7 @@ module Vagrant
127
126
  end
128
127
  end
129
128
  else
130
- # TODO: Implement our own MessageNotCreated
131
- b2.use VagrantPlugins::ProviderVirtualBox::Action::MessageNotCreated
129
+ b2.use Message, :not_created
132
130
  end
133
131
  end
134
132
  end
@@ -141,21 +139,18 @@ module Vagrant
141
139
  # b.use CheckDependencies
142
140
  b.use Vagrant::Action::Builtin::Call, Created do |env1, b2|
143
141
  if !env1[:result]
144
- # TODO: Implement our own MessageNotCreated
145
- b2.use VagrantPlugins::ProviderVirtualBox::Action::MessageNotCreated
142
+ b2.use Message, :not_created
146
143
  next
147
144
  end
148
145
 
149
- # TODO: Implement our own DestroyConfirm
150
- b2.use Vagrant::Action::Builtin::Call, VagrantPlugins::ProviderVirtualBox::Action::DestroyConfirm do |env2, b3|
146
+ b2.use Vagrant::Action::Builtin::Call, DestroyConfirm do |env2, b3|
151
147
  if env2[:result]
152
148
  b3.use Vagrant::Action::Builtin::ConfigValidate
153
149
  b3.use Vagrant::Action::Builtin::EnvSet, :force_halt => true
154
150
  b3.use action_halt
155
151
  b3.use Destroy
156
152
  else
157
- # TODO: Implement our own MessageWillNotDestroy
158
- b3.use VagrantPlugins::ProviderVirtualBox::Action::MessageWillNotDestroy
153
+ b3.use Message, :will_not_destroy
159
154
  end
160
155
  end
161
156
  end
@@ -168,8 +163,7 @@ module Vagrant
168
163
  # b.use CheckDependencies
169
164
  b.use Vagrant::Action::Builtin::Call, Created do |env1, b2|
170
165
  if !env1[:result]
171
- # TODO: Implement our own MessageNotCreated
172
- b2.use VagrantPlugins::ProviderVirtualBox::Action::MessageNotCreated
166
+ b2.use Message, :not_created
173
167
  next
174
168
  end
175
169
 
@@ -11,7 +11,7 @@ module Vagrant
11
11
 
12
12
  config = env[:machine].provider_config
13
13
 
14
- env[:ui].info I18n.t("vagrant.actions.vm.boot.booting")
14
+ env[:ui].info I18n.t("vagrant_lxc.messages.starting")
15
15
  env[:machine].provider.driver.start(config.customizations)
16
16
  raise Vagrant::Errors::VMFailedToBoot if !wait_for_boot
17
17
 
@@ -20,11 +20,11 @@ module Vagrant
20
20
 
21
21
  # Stolen from on VagrantPlugins::ProviderVirtualBox::Action::Boot
22
22
  def wait_for_boot
23
- @env[:ui].info I18n.t("vagrant.actions.vm.boot.waiting")
23
+ @env[:ui].info I18n.t("vagrant_lxc.messages.waiting_for_start")
24
24
 
25
25
  @env[:machine].config.ssh.max_tries.to_i.times do |i|
26
26
  if @env[:machine].communicate.ready?
27
- @env[:ui].info I18n.t("vagrant.actions.vm.boot.ready")
27
+ @env[:ui].info I18n.t("vagrant_lxc.messages.container_ready")
28
28
  return true
29
29
  end
30
30
 
@@ -0,0 +1,17 @@
1
+ require "vagrant/action/builtin/confirm"
2
+
3
+ module Vagrant
4
+ module LXC
5
+ module Action
6
+ class DestroyConfirm < Vagrant::Action::Builtin::Confirm
7
+ def initialize(app, env)
8
+ force_key = :force_confirm_destroy
9
+ message = I18n.t("vagrant.commands.destroy.confirmation",
10
+ :name => env[:machine].name)
11
+
12
+ super(app, env, message, force_key)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -8,7 +8,7 @@ module Vagrant
8
8
 
9
9
  def call(env)
10
10
  if env[:machine].provider.state.id == :running
11
- env[:ui].info I18n.t("vagrant.actions.vm.halt.force")
11
+ env[:ui].info I18n.t("vagrant_lxc.messages.force_shutdown")
12
12
  # TODO: Driver#halt is kinda graceful as well, if it doesn't
13
13
  # work we can issue a lxc-stop.
14
14
  env[:machine].provider.driver.halt
@@ -0,0 +1,22 @@
1
+ module Vagrant
2
+ module LXC
3
+ module Action
4
+ class Message
5
+ def initialize(app, env, msg_key, type = :info)
6
+ @app = app
7
+ @msg_key = msg_key
8
+ @type = type
9
+ end
10
+
11
+ def call(env)
12
+ machine = env[:machine]
13
+ message = I18n.t("vagrant_lxc.messages.#{@msg_key}", name: machine.name)
14
+
15
+ env[:ui].send @type, message
16
+
17
+ @app.call env
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -105,22 +105,6 @@ module Vagrant
105
105
  end
106
106
 
107
107
  def assigned_ip
108
- ip = ''
109
- retryable(:on => LXC::Errors::ExecuteError, :tries => 10, :sleep => 3) do
110
- unless ip = get_container_ip_from_ip_addr
111
- # retry
112
- raise LXC::Errors::ExecuteError, :command => "lxc-attach"
113
- end
114
- end
115
- ip
116
- end
117
-
118
- # From: https://github.com/lxc/lxc/blob/staging/src/python-lxc/lxc/__init__.py#L371-L385
119
- def get_container_ip_from_ip_addr
120
- output = @cli.attach '/sbin/ip', '-4', 'addr', 'show', 'scope', 'global', 'eth0', namespaces: 'network'
121
- if output =~ /^\s+inet ([0-9.]+)\/[0-9]+\s+/
122
- return $1.to_s
123
- end
124
108
  end
125
109
 
126
110
  protected
@@ -1,5 +1,5 @@
1
1
  module Vagrant
2
2
  module LXC
3
- VERSION = "0.3.0"
3
+ VERSION = "0.3.1"
4
4
  end
5
5
  end
data/locales/en.yml CHANGED
@@ -1,4 +1,23 @@
1
1
  en:
2
+ vagrant_lxc:
3
+ messages:
4
+ not_created: |-
5
+ The container hasn't been created yet.
6
+ not_running: |-
7
+ The container is not currently running.
8
+ will_not_destroy: |-
9
+ The container '%{name}' will not be destroyed, since the confirmation
10
+ was declined.
11
+ starting: |-
12
+ Starting container...
13
+ waiting_for_start: |-
14
+ Waiting for container to start. This should not take long.
15
+ container_ready: |-
16
+ Container started and ready for use!
17
+ force_shutdown: |-
18
+ Forcing shutdown of container...
19
+
20
+ # TODO: Review messages below
2
21
  vagrant:
3
22
  actions:
4
23
  lxc:
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,12 @@
1
1
  if ENV['COVERAGE']
2
2
  require 'simplecov'
3
+ require 'coveralls'
4
+
5
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
6
+ SimpleCov::Formatter::HTMLFormatter,
7
+ Coveralls::SimpleCov::Formatter
8
+ ]
9
+
3
10
  SimpleCov.start do
4
11
  add_filter { |source_file| source_file.filename =~ /\/spec\/support/ }
5
12
  end
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.3.0
4
+ version: 0.3.1
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-04-10 00:00:00.000000000 Z
11
+ date: 2013-04-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Linux Containers provider for Vagrant
14
14
  email:
@@ -50,11 +50,13 @@ files:
50
50
  - lib/vagrant-lxc/action/create.rb
51
51
  - lib/vagrant-lxc/action/created.rb
52
52
  - lib/vagrant-lxc/action/destroy.rb
53
+ - lib/vagrant-lxc/action/destroy_confirm.rb
53
54
  - lib/vagrant-lxc/action/disconnect.rb
54
55
  - lib/vagrant-lxc/action/forced_halt.rb
55
56
  - lib/vagrant-lxc/action/forward_ports.rb
56
57
  - lib/vagrant-lxc/action/handle_box_metadata.rb
57
58
  - lib/vagrant-lxc/action/is_running.rb
59
+ - lib/vagrant-lxc/action/message.rb
58
60
  - lib/vagrant-lxc/action/setup_package_files.rb
59
61
  - lib/vagrant-lxc/action/share_folders.rb
60
62
  - lib/vagrant-lxc/config.rb