kitchen-lxc 0.0.1 → 0.1.0

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: 418715ee25b2e76bc05bdb529246672c285a4a03
4
- data.tar.gz: b6e88dd94c7188b5c42dd26b43bf5f918ffa9aaf
3
+ metadata.gz: 9b48bbd0c4877b4b20f9d4ba3a96210d484810aa
4
+ data.tar.gz: 0012088b2a49f1a0abd894727b8c951985cf29b2
5
5
  SHA512:
6
- metadata.gz: 4a257a729d514716151fc6f81ea5efb460dcf640daf59624828d2afafa9009dc5aac6fbe34c91df51c5c32a10cd3eaf005ed8426d3b568a32a17bc7a637871c0
7
- data.tar.gz: 0733d4006ea2409a31a359899349f4f932c54f86da727b45e6cc234aeaf2fd6caec644a77c4a36fdfe4a4a95e3c8eff267945bcdf81c143373fed2d7f9f1b836
6
+ metadata.gz: 865ecb374db59a9b18301e9134cc14cb54989ddd1df6565d7cd55b88370200d60d780ec97d5e04c2d3ef986914cbd78167ce64bf439ea57f1d9c0eb498dac2e7
7
+ data.tar.gz: 8f0e81d162ce7775afe5bb8687d240e349818e47e8ba80b3caf78c18bc114c8e494a86cd2d461b3200b20d62a032de34b7e934a7afa66c851eb522ee805a6057
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013 Sean Porter
1
+ Copyright (c) 2013 Sean Porter (and Chris Roberts)
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -3,10 +3,9 @@
3
3
  The LXC driver for the Chef convergence integration test harness,
4
4
  [Test Kitchen](https://github.com/test-kitchen).
5
5
 
6
- Kitchen LXC creates an ephemeral clone of a "base" LXC container to
7
- run a test suite.
6
+ Kitchen LXC uses ephemeral containers to run a test suite.
8
7
 
9
- You may want to use the
8
+ You may want to use this instead of the
10
9
  [Docker driver](https://github.com/portertech/kitchen-docker).
11
10
 
12
11
  ## Installation
@@ -23,8 +22,8 @@ And then execute:
23
22
 
24
23
  ### Configuration
25
24
 
26
- #### base_container
27
- The base LXC container to be cloned for each Test Kitchen suite.
25
+ #### lxc_directory
26
+ The base LXC container directory on the host.
28
27
 
29
28
  #### username
30
29
  The username used to login to the container.
@@ -41,6 +40,29 @@ The SSH port used to login to the container.
41
40
 
42
41
  Defaults to 22.
43
42
 
43
+ ### System layout
44
+
45
+ This driver will map the platform name to a container name
46
+ with the defined lxc directory. The name is munged with a
47
+ simple gsub regex:
48
+
49
+ ```ruby
50
+ name.gsub(/[_\-.]/, '')
51
+ ```
52
+
53
+ and it will then look for container names that start with
54
+ the updated platform name. So, if the platform name is
55
+ 'ubuntu', and the host system has 'ubuntu_1204' and 'ubuntu_1404',
56
+ the container used will be 'ubuntu_1204'
57
+
58
+ ### System setup
59
+
60
+ An easy way to setup the host machine is to use the `vagabond` cookbook.
61
+ It will provide you with a collection of platforms including ubuntu,
62
+ centos, and debian. Just copy the `/opt/hw-lxc-config/id_rsa` to the
63
+ user's default key. This will remove the need to futz with user/pass
64
+ configuration.
65
+
44
66
  ### Example
45
67
 
46
68
  `.kitchen.local.yml`
@@ -50,9 +72,8 @@ Defaults to 22.
50
72
  driver_plugin: lxc
51
73
 
52
74
  platforms:
53
- - name: ubuntu_1204
75
+ - name: ubuntu
54
76
  driver_config:
55
- base_container: ubuntu_1204 # your base container name
56
77
  username: kitchen # defaults to "root"
57
78
  password: kitchen # defaults to "root"
58
79
  ```
@@ -73,6 +94,10 @@ Instance Driver Provisioner Last Action
73
94
  default-ubuntu_1204 Lxc Chef Solo <Not Created>
74
95
  ```
75
96
 
97
+ ## Note
98
+
99
+ Tests are failing right now. They'll be fixed soon!
100
+
76
101
  ## Contributing
77
102
 
78
103
  1. Fork it
data/kitchen-lxc.gemspec CHANGED
@@ -1,16 +1,16 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = "kitchen-lxc"
3
- gem.version = "0.0.1"
4
- gem.authors = ["Sean Porter"]
5
- gem.email = ["portertech@gmail.com"]
3
+ gem.version = "0.1.0"
4
+ gem.authors = ["Sean Porter", "Chris Roberts"]
5
+ gem.email = ["portertech@gmail.com", "code@chrisroberts.org"]
6
6
  gem.description = "LXC driver for Test Kitchen"
7
7
  gem.summary = "LXC driver for Test Kitchen"
8
- gem.homepage = "https://github.com/portertech/kitchen-lxc"
8
+ gem.homepage = "https://github.com/chrisroberts/kitchen-lxc"
9
9
  gem.license = "MIT"
10
10
  gem.has_rdoc = false
11
11
 
12
- gem.add_dependency("test-kitchen", ">= 1.0.0.beta.4")
13
- gem.add_dependency("elecksee", ">= 1.0.14")
12
+ gem.add_dependency("test-kitchen", '~> 1.2', '>= 1.2.1')
13
+ gem.add_dependency("elecksee", '~> 1.0', '>= 1.0.22')
14
14
 
15
15
  gem.add_development_dependency("rake")
16
16
 
@@ -13,13 +13,17 @@ module Kitchen
13
13
  default_config :username, "root" # most LXC templates use this
14
14
  default_config :password, "root" # most LXC templates use this
15
15
 
16
- default_config :original do |driver|
17
- driver[:base_container]
18
- end
19
-
20
16
  no_parallel_for :create
21
17
 
22
18
  def create(state)
19
+ name = instance.platform.name.gsub(/[_\-.]/, '')
20
+ names = Dir.glob(instance.driver.fetch(:lxc_directory, '/var/lib/lxc/*')).map do |path|
21
+ if(File.directory?(path))
22
+ File.basename(path)
23
+ end
24
+ end.compact.sort
25
+ config[:original] = names.detect{|n| n.start_with?(name)}
26
+
23
27
  container = ::Lxc::Ephemeral.new(config.to_hash)
24
28
  container.create!
25
29
 
@@ -35,13 +39,11 @@ module Kitchen
35
39
  def destroy(state)
36
40
  if state[:container_name]
37
41
  lxc = ::Lxc.new(state[:container_name])
38
- lxc.destroy
42
+ lxc.stop
39
43
  end
40
44
  end
41
45
 
42
46
  end
43
47
 
44
- class LXC < Lxc; end
45
-
46
48
  end
47
49
  end
@@ -1,24 +1,25 @@
1
1
  require "minitest/spec"
2
2
  require "minitest/autorun"
3
3
  require "stringio"
4
+ require 'ostruct'
4
5
 
5
6
  require File.join(File.dirname(__FILE__), "..", "lib", "kitchen", "driver", "lxc")
6
7
 
7
8
  describe Kitchen::Driver::Lxc do
8
9
 
9
10
  before do
10
- @base_container = ENV["BASE_CONTAINER"]
11
- raise "You must set BASE_CONTAINER" unless @base_container
12
11
  driver_options = {
13
12
  :kitchen_root => File.dirname(__FILE__),
14
- :base_container => @base_container
15
13
  }
16
14
  @logger_output = StringIO.new
17
15
  instance_options = {
18
16
  :logger => Kitchen::Logger.new(:stdout => @logger_output),
19
17
  :suite => Kitchen::Suite.new(:name => "test", :run_list => Array.new),
20
18
  :platform => Kitchen::Platform.new(:name => @base_container),
21
- :driver => Kitchen::Driver::Lxc.new(driver_options)
19
+ :driver => Kitchen::Driver::Lxc.new(driver_options),
20
+ :provisioner => Kitchen::Provisioner::Base.new,
21
+ :busser => Object.new,
22
+ :state_file => Kitchen::StateFile.new('default', OpenStruct.new(:name => 'ubuntu'))#Kitchen::Busser
22
23
  }
23
24
  @instance = Kitchen::Instance.new(instance_options)
24
25
  end
metadata CHANGED
@@ -1,65 +1,79 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-lxc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Porter
8
+ - Chris Roberts
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-11-14 00:00:00.000000000 Z
12
+ date: 2014-10-03 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: test-kitchen
15
16
  requirement: !ruby/object:Gem::Requirement
16
17
  requirements:
17
- - - '>='
18
+ - - "~>"
18
19
  - !ruby/object:Gem::Version
19
- version: 1.0.0.beta.4
20
+ version: '1.2'
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.2.1
20
24
  type: :runtime
21
25
  prerelease: false
22
26
  version_requirements: !ruby/object:Gem::Requirement
23
27
  requirements:
24
- - - '>='
28
+ - - "~>"
29
+ - !ruby/object:Gem::Version
30
+ version: '1.2'
31
+ - - ">="
25
32
  - !ruby/object:Gem::Version
26
- version: 1.0.0.beta.4
33
+ version: 1.2.1
27
34
  - !ruby/object:Gem::Dependency
28
35
  name: elecksee
29
36
  requirement: !ruby/object:Gem::Requirement
30
37
  requirements:
31
- - - '>='
38
+ - - "~>"
32
39
  - !ruby/object:Gem::Version
33
- version: 1.0.14
40
+ version: '1.0'
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 1.0.22
34
44
  type: :runtime
35
45
  prerelease: false
36
46
  version_requirements: !ruby/object:Gem::Requirement
37
47
  requirements:
38
- - - '>='
48
+ - - "~>"
49
+ - !ruby/object:Gem::Version
50
+ version: '1.0'
51
+ - - ">="
39
52
  - !ruby/object:Gem::Version
40
- version: 1.0.14
53
+ version: 1.0.22
41
54
  - !ruby/object:Gem::Dependency
42
55
  name: rake
43
56
  requirement: !ruby/object:Gem::Requirement
44
57
  requirements:
45
- - - '>='
58
+ - - ">="
46
59
  - !ruby/object:Gem::Version
47
60
  version: '0'
48
61
  type: :development
49
62
  prerelease: false
50
63
  version_requirements: !ruby/object:Gem::Requirement
51
64
  requirements:
52
- - - '>='
65
+ - - ">="
53
66
  - !ruby/object:Gem::Version
54
67
  version: '0'
55
68
  description: LXC driver for Test Kitchen
56
69
  email:
57
70
  - portertech@gmail.com
71
+ - code@chrisroberts.org
58
72
  executables: []
59
73
  extensions: []
60
74
  extra_rdoc_files: []
61
75
  files:
62
- - .gitignore
76
+ - ".gitignore"
63
77
  - Gemfile
64
78
  - LICENSE.txt
65
79
  - README.md
@@ -67,7 +81,7 @@ files:
67
81
  - kitchen-lxc.gemspec
68
82
  - lib/kitchen/driver/lxc.rb
69
83
  - test/lxc_driver_tests.rb
70
- homepage: https://github.com/portertech/kitchen-lxc
84
+ homepage: https://github.com/chrisroberts/kitchen-lxc
71
85
  licenses:
72
86
  - MIT
73
87
  metadata: {}
@@ -77,17 +91,17 @@ require_paths:
77
91
  - lib
78
92
  required_ruby_version: !ruby/object:Gem::Requirement
79
93
  requirements:
80
- - - '>='
94
+ - - ">="
81
95
  - !ruby/object:Gem::Version
82
96
  version: '0'
83
97
  required_rubygems_version: !ruby/object:Gem::Requirement
84
98
  requirements:
85
- - - '>='
99
+ - - ">="
86
100
  - !ruby/object:Gem::Version
87
101
  version: '0'
88
102
  requirements: []
89
103
  rubyforge_project:
90
- rubygems_version: 2.0.6
104
+ rubygems_version: 2.2.2
91
105
  signing_key:
92
106
  specification_version: 4
93
107
  summary: LXC driver for Test Kitchen