kitchen-gogetit 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 802bcd1a77528a3dcac4a4c974d50e3e7480c18f
4
+ data.tar.gz: 1ace96d90008e39b59240d762d6180ecf1795c52
5
+ SHA512:
6
+ metadata.gz: 2a34fc7d440b77e88e69b604553e29b2dd562c7fcc9ae5645449f73ea8c51bd218a1779fc972fa898a93e04414330731df5edfbbdcbd597c558feefa1d2dd7d5
7
+ data.tar.gz: 1e76307769c4c22d9f427e96bd31f8275167947761f1ee9ce405e96e8ba308ac8e85c9713b5e04dc2480850f07d53ac6b291b3ab0ee53905f7e1b63d712c6ae4
data/.cane ADDED
File without changes
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.*
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ kitchen-gogetit
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.3.0
data/.tailor ADDED
@@ -0,0 +1,4 @@
1
+ Tailor.config do |config|
2
+ config.formatters "text"
3
+ config.file_set 'lib/**/*.rb'
4
+ end
data/.travis.yml ADDED
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 2.0.0
5
+ - 1.9.3
6
+ - 1.9.2
7
+ - ruby-head
8
+
9
+ matrix:
10
+ allow_failures:
11
+ - rvm: ruby-head
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ ## 0.1.0 / Unreleased
2
+
3
+ * Initial release
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ Author:: Don Draper (<donoldfashioned@gmail.com>)
2
+
3
+ Copyright (C) 2017, Don Draper
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,114 @@
1
+ # <a name="title"></a> Kitchen::Gogetit
2
+
3
+ A test kitchen driver for [Gogetit](https://github.com/itisnotdone/gogetit).
4
+
5
+ ## <a name="requirements"></a> Requirements
6
+
7
+ **TODO:** document any software or library prerequisites that are required to
8
+ use this driver. Implement the `#verify_dependencies` method in your Driver
9
+ class to enforce these requirements in code, if possible.
10
+
11
+ What are needed when using Gogetit library are needed as well
12
+ Since this is devised to use Gogetit as a kitchen driver.
13
+ Please refer following link before begin.
14
+ https://github.com/itisnotdone/gogetit
15
+
16
+ ## <a name="installation"></a> Installation and Setup
17
+
18
+ Please read the [Driver usage][driver_usage] page for more details.
19
+
20
+ ```bash
21
+
22
+ $ export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig
23
+
24
+ $ kitchen init -D kitchen-gogetit -P chef_zero
25
+
26
+ ```
27
+ ## <a name="config"></a> Configuration
28
+
29
+ ```yaml
30
+
31
+ ---
32
+ driver:
33
+ name: gogetit
34
+
35
+ provisioner:
36
+ name: chef_zero
37
+
38
+ transport:
39
+ ssh_key: <%= Dir.home + '/.ssh/id_rsa' %>
40
+
41
+ platforms:
42
+ - name: lxc01
43
+ driver:
44
+ provider: lxd
45
+ template: default
46
+ - name: kvm01
47
+ driver:
48
+ provider: libvirt
49
+ template: default
50
+
51
+ suites:
52
+ - name: default
53
+ run_list:
54
+ - recipe[all_nodes::default]
55
+ attributes:
56
+
57
+ ```
58
+
59
+ ## <a name="Uninstall"></a> Uninstall
60
+
61
+ Please read the [Driver usage][driver_usage] page for more details.
62
+
63
+ ```bash
64
+
65
+ gem uninstall kitchen-gogetit gogetit maas-client
66
+
67
+ ```
68
+
69
+ ### <a name="config-require-chef-omnibus"></a> require\_chef\_omnibus
70
+
71
+ Determines whether or not a Chef [Omnibus package][chef_omnibus_dl] will be
72
+ installed. There are several different behaviors available:
73
+
74
+ * `true` - the latest release will be installed. Subsequent converges
75
+ will skip re-installing if chef is present.
76
+ * `latest` - the latest release will be installed. Subsequent converges
77
+ will always re-install even if chef is present.
78
+ * `<VERSION_STRING>` (ex: `10.24.0`) - the desired version string will
79
+ be passed the the install.sh script. Subsequent converges will skip if
80
+ the installed version and the desired version match.
81
+ * `false` or `nil` - no chef is installed.
82
+
83
+ The default value is unset, or `nil`.
84
+
85
+ ## <a name="development"></a> Development
86
+
87
+ * Source hosted at [GitHub][repo]
88
+ * Report issues/questions/feature requests on [GitHub Issues][issues]
89
+
90
+ Pull requests are very welcome! Make sure your patches are well tested.
91
+ Ideally create a topic branch for every separate change you make. For
92
+ example:
93
+
94
+ 1. Fork the repo
95
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
96
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
97
+ 4. Push to the branch (`git push origin my-new-feature`)
98
+ 5. Create new Pull Request
99
+
100
+ ## <a name="authors"></a> Authors
101
+
102
+ Created and maintained by [Don Draper][author] (<donoldfashioned@gmail.com>)
103
+
104
+ ## <a name="license"></a> License
105
+
106
+ Apache 2.0 (see [LICENSE][license])
107
+
108
+
109
+ [author]: https://github.com/enter-github-user
110
+ [issues]: https://github.com/enter-github-user/kitchen-gogetit/issues
111
+ [license]: https://github.com/enter-github-user/kitchen-gogetit/blob/master/LICENSE
112
+ [repo]: https://github.com/enter-github-user/kitchen-gogetit
113
+ [driver_usage]: http://docs.kitchen-ci.org/drivers/usage
114
+ [chef_omnibus_dl]: http://www.chef.io/chef/install/
data/Rakefile ADDED
@@ -0,0 +1,21 @@
1
+ require "bundler/gem_tasks"
2
+ require 'cane/rake_task'
3
+ require 'tailor/rake_task'
4
+
5
+ desc "Run cane to check quality metrics"
6
+ Cane::RakeTask.new do |cane|
7
+ cane.canefile = './.cane'
8
+ end
9
+
10
+ Tailor::RakeTask.new
11
+
12
+ desc "Display LOC stats"
13
+ task :stats do
14
+ puts "\n## Production Code Stats"
15
+ sh "countloc -r lib"
16
+ end
17
+
18
+ desc "Run all quality tasks"
19
+ task :quality => [:cane, :tailor, :stats]
20
+
21
+ task :default => [:quality]
@@ -0,0 +1,4 @@
1
+ #!/bin/bash
2
+
3
+ git config --global user.name "Don Draper"
4
+ git config --global user.email "donoldfashioned@gmail.com"
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'kitchen/driver/gogetit_version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'kitchen-gogetit'
8
+ spec.version = Kitchen::Driver::GOGETIT_VERSION
9
+ spec.authors = ['Don Draper']
10
+ spec.email = ['donoldfashioned@gmail.com']
11
+ spec.summary = %q{A kitchen driver based on Gogetit.}
12
+ spec.description = %q{A kitchen driver based on Gogetit that has abilities to control MAAS, Libvirt and LXD.}
13
+ spec.homepage = 'https://github.com/itisnotdone/kitchen-gogetit'
14
+ spec.license = 'Apache 2.0'
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = []
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_dependency 'test-kitchen'
22
+ spec.add_dependency 'gogetit'
23
+
24
+ spec.add_development_dependency 'pry'
25
+ spec.add_development_dependency 'bundler'
26
+ spec.add_development_dependency 'rake'
27
+ spec.add_development_dependency 'cane'
28
+ spec.add_development_dependency 'tailor'
29
+ spec.add_development_dependency 'countloc'
30
+ end
@@ -0,0 +1,79 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ # Author:: Don Draper (<donoldfashioned@gmail.com>)
4
+ #
5
+ # Copyright (C) 2017, Don Draper
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+
19
+ require 'kitchen/driver/gogetit_version'
20
+ require 'kitchen'
21
+ require 'gogetit'
22
+
23
+ module Kitchen
24
+
25
+ module Driver
26
+
27
+ # Gogetit driver for Kitchen.
28
+ #
29
+ # @author Don Draper <donoldfashioned@gmail.com>
30
+ class Gogetit < Kitchen::Driver::Base
31
+ kitchen_driver_api_version 2
32
+ plugin_version Kitchen::Driver::GOGETIT_VERSION
33
+
34
+ default_config :username, 'ubuntu'
35
+ default_config :provider
36
+ default_config :template
37
+
38
+ Gogetit.config[:consumer] = 'kitchen'
39
+
40
+ def create(state)
41
+ options = { 'alias' => config[:template] } if config[:template]
42
+ provider = choose_provider(config[:provider])
43
+ result = provider.create(instance.name, options)
44
+ domain = Gogetit.maas.get_domain
45
+ state[:hostname] = instance.name + '.' + domain
46
+ state[:username] = result[:info][:default_user]
47
+ info 'Waiting for the new domain to be available..'
48
+ wait_until_available(instance.name)
49
+
50
+ info 'Waiting for SSH..'
51
+ conn = instance.transport.connection(state)
52
+ conn.wait_until_ready
53
+ conn.close
54
+ end
55
+
56
+ def destroy(state)
57
+ provider = choose_provider(config[:provider])
58
+ provider.destroy(instance.name)
59
+
60
+ instance.transport.connection(state).close
61
+ end
62
+
63
+ def choose_provider(provider)
64
+ case provider
65
+ when 'lxd'
66
+ Gogetit.lxd
67
+ when 'libvirt'
68
+ Gogetit.libvirt
69
+ end
70
+ end
71
+
72
+ def wait_until_available(hostname)
73
+ until Gogetit.maas.domain_name_exists?(hostname)
74
+ sleep 3
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ # Author:: Don Draper (<donoldfashioned@gmail.com>)
4
+ #
5
+ # Copyright (C) 2017, Don Draper
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+
19
+ module Kitchen
20
+
21
+ module Driver
22
+ # Version string for Gogetit Kitchen driver
23
+ GOGETIT_VERSION = "0.2.2"
24
+ end
25
+ end
metadata ADDED
@@ -0,0 +1,172 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kitchen-gogetit
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.2
5
+ platform: ruby
6
+ authors:
7
+ - Don Draper
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-02-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: test-kitchen
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: gogetit
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: cane
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: tailor
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: countloc
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ description: A kitchen driver based on Gogetit that has abilities to control MAAS,
126
+ Libvirt and LXD.
127
+ email:
128
+ - donoldfashioned@gmail.com
129
+ executables: []
130
+ extensions: []
131
+ extra_rdoc_files: []
132
+ files:
133
+ - ".cane"
134
+ - ".gitignore"
135
+ - ".ruby-gemset"
136
+ - ".ruby-version"
137
+ - ".tailor"
138
+ - ".travis.yml"
139
+ - CHANGELOG.md
140
+ - Gemfile
141
+ - LICENSE
142
+ - README.md
143
+ - Rakefile
144
+ - bin/git_autoconfig.sh
145
+ - kitchen-gogetit.gemspec
146
+ - lib/kitchen/driver/gogetit.rb
147
+ - lib/kitchen/driver/gogetit_version.rb
148
+ homepage: https://github.com/itisnotdone/kitchen-gogetit
149
+ licenses:
150
+ - Apache 2.0
151
+ metadata: {}
152
+ post_install_message:
153
+ rdoc_options: []
154
+ require_paths:
155
+ - lib
156
+ required_ruby_version: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ required_rubygems_version: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - ">="
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ requirements: []
167
+ rubyforge_project:
168
+ rubygems_version: 2.6.14
169
+ signing_key:
170
+ specification_version: 4
171
+ summary: A kitchen driver based on Gogetit.
172
+ test_files: []