kitchen-opennebula 0.1.1 → 0.1.2

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: 4aa2f07facce9d15588344222e675ad9ecb5fe9f
4
- data.tar.gz: 5ec519944e3a5ff31aeb1964287a1b3d6ae67734
3
+ metadata.gz: 545f5bb2c0058823f7682d1aeaf6dde47e390950
4
+ data.tar.gz: 44bcb4d0c4c44a440fd7ab767404326f1c8d35d8
5
5
  SHA512:
6
- metadata.gz: ad95628a34b8415e54cc0b0f7e8a12757c4392631fca308e758322b055e64a00bf5f3c389d6d94ff2820a83dfd7041e627a2938c7b0911556ccedd4b6f222116
7
- data.tar.gz: 9b91c666fce2d0da921c83c75c98f40e61d448657c6fad7d2d2937e6c78401f8d225639d2c1e9afe3b85744d2f71bd0e1130bbb2e563665c1a8caf0abb444a39
6
+ metadata.gz: e79c21812616427f1b7ae57f27b30d0d58517f1e4a848699e59c40ccf3435dd3ee082de8c317a63c698b86cd9c2e4a1ce8191a6c54dfb9ebf931bd0c67921c28
7
+ data.tar.gz: 43f0ca7a7e9ef1c3a3aee3eeb32cfc4ac3ec7c6110cd9dff1a413bda589788bfe668504e95dc3e6f6f74cd43c05af73b1a19b051320ce7657d33011fa48534a9
data/.gitignore CHANGED
@@ -1 +1 @@
1
- .project
1
+ .project
@@ -1,3 +1,3 @@
1
- ## 0.1.0 / Unreleased
2
-
3
- * Initial release
1
+ ## 0.1.0 / Unreleased
2
+
3
+ * Initial release
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE CHANGED
@@ -1,15 +1,15 @@
1
- Author:: Andrew J. Brown (<anbrown@blackberry.com>)
2
-
3
- Copyright (C) 2014, BlackBerry, Ltd.
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.
1
+ Author:: Andrew J. Brown (<anbrown@blackberry.com>)
2
+
3
+ Copyright (C) 2014, BlackBerry, Ltd.
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 CHANGED
@@ -1,157 +1,170 @@
1
- # <a name="title"></a> Kitchen::Opennebula
2
-
3
- A Test Kitchen Driver for Opennebula.
4
-
5
- ## <a name="requirements"></a> Requirements
6
-
7
- This driver depends on BlackBerry patches to Fog (https://github.com/fog/fog)
8
- for better support for OpenNebula. These patches can be found at
9
- https://github.com/blackberry/fog until they are merged to upstream.
10
-
11
- ## <a name="installation"></a> Installation and Setup
12
-
13
- Please read the [Driver usage][driver_usage] page for more details.
14
-
15
- ## Virtual Machine Requirements
16
-
17
- This driver requires an OpenNebula OS image that conforms to a number of requirements
18
-
19
- * The VM puts the ssh key defined in the SSH\_PUBLIC\_KEY context variable into `$HOME/.ssh/authorized_keys`
20
- * The VM ensures the user has passwordless sudo access
21
-
22
- ## <a name="config"></a> Configuration
23
-
24
- ### <a name="opennebula_endpoint"></a> opennebula\_endpoint
25
-
26
- URL where the OpenNebula daemon is listening.
27
- The default value is taken from the ONE\_XMLRPC environment variable, or `http://127.0.0.1:2633/RPC2` if unset.
28
-
29
- ### <a name="oneauth_file"></a> oneauth\_file
30
-
31
- Path to the file containing OpenNebula authentication information. It should contain a single line stating "username:password".
32
- The default value is taken from the ONE\_AUTH environment variable, or `$HOME/.one/one_auth` if unset.
33
-
34
- ### <a name="template_name"></a> template\_name
35
-
36
- Name of the VM definition file (OpenNebula template) registered with OpenNebula. Can be used with `template_uname` or `template_uid` to further restrict which template to use if multiple users have the same template name. Only one of `template_name` or `template_id` must be specified in the .kitchen.yml file.
37
- The default value is unset, or `nil`.
38
-
39
- ### <a name="template_id"></a> template\_id
40
-
41
- ID of the VM definition file (OpenNebula template) registered with OpenNebula. Only one of `template_name` or `template_id` must be specified in the .kitchen.yml file.
42
- The default value is unset, or `nil`.
43
-
44
- ### <a name="template_uname"></a> template\_uname
45
-
46
- Username who owns the VM definition file (OpenNebula template). Can be used with `template_name` to address naming conflicts where multiple users have the same template name.
47
- The default value is unset, or `nil`.
48
-
49
- ### <a name="template_uid"></a> template\_uid
50
-
51
- UID of the user who owns the VM definition file (OpenNebula template). Can be used with `template_name` to address naming conflicts where multiple users have the same template name.
52
- The default value is unset, or `nil`.
53
-
54
- ### <a name="vm_hostname"></a> vm\_hostname
55
-
56
- Hostname to set for the newly created VM.
57
- The default value is `driver.instance.name`
58
-
59
- ### <a name="public_key_path"></a> public\_key\_path
60
-
61
- Path to SSH public key to pass to the VM, to use to authenticate with `username` when logging in or converging a node.
62
- The default value is `~/.ssh/id_rsa.pub`, `~/.ssh/id_dsa.pub`, `~/.ssh/identity.pub`, or `~/.ssh/id_ecdsa.pub`, whichever is present on the filesystem.
63
-
64
- ### <a name="username"></a> username
65
-
66
- This is the username used for SSH authentication to the new VM.
67
- The default value is `local`.
68
-
69
- ### <a name="memory"></a> memory
70
-
71
- The amount of memory to provision for the new VM. This parameter will override the memory settings provided in the VM template.
72
- The default value is 512MB.
73
-
74
- ### <a name="user_variables"></a> user\_variables
75
-
76
- A hash of variables to pass into the "user template" section of the VM, to customize the virtual machine.
77
- The default value is `{}`.
78
-
79
- ### <a name="context_variables"></a> context\_variables
80
-
81
- A hash of variables to pass into the "CONTEXT" section of the VM, to further customize the virtual machine. These variables override any existing context variables that are provided as part of the specified VM template.
82
- The default value is `{}`.
83
-
84
- ### <a name="config-require-chef-omnibus"></a> require\_chef\_omnibus
85
-
86
- Determines whether or not a Chef [Omnibus package][chef_omnibus_dl] will be
87
- installed. There are several different behaviors available:
88
-
89
- * `true` - the latest release will be installed. Subsequent converges
90
- will skip re-installing if chef is present.
91
- * `latest` - the latest release will be installed. Subsequent converges
92
- will always re-install even if chef is present.
93
- * `<VERSION_STRING>` (ex: `10.24.0`) - the desired version string will
94
- be passed the the install.sh script. Subsequent converges will skip if
95
- the installed version and the desired version match.
96
- * `false` or `nil` - no chef is installed.
97
-
98
- The default value is unset, or `nil`.
99
-
100
- ### <a name="wait_for"></a> wait_for
101
-
102
- This variable is used to override timeout for Fog's common `wait_for` method which states that it "takes a block and waits for either the block to return true for the object or for a timeout (defaults to 10 minutes)".
103
-
104
- ### <a name="no_ssh_tcp_check"></a> no\_ssh\_tcp\_check
105
-
106
- To avoid test-kitchen's ssh tcp check in the create phase you can set `no_ssh_tcp_check` to `true` and do single sleep instead. Sleep period is configured by `no_ssh_tcp_check_sleep`. The default for `no_ssh_tcp_check` is set to `false`.
107
-
108
- ### <a name="no_ssh_tcp_check_sleep"></a> no\_ssh\_tcp\_check\_sleep
109
-
110
- This variable configures a single sleep used when `no_ssh_tcp_check` is set to `true`. The default for `no_ssh_tcp_check` is 2 minutes.
111
-
112
- ### <a name="no_passwordless_sudo_check"></a> no\_passwordless\_sudo\_check
113
-
114
- To avoid test-kitchen's passwordless sudo check in the create phase you can set `no_passwordless_sudo_check` to `true` and do single sleep instead. Sleep period is configured by `no_passwordless_sudo_sleep`. The default for `no_passwordless_sudo_check` is set to `false`.
115
-
116
- ### <a name="no_passwordless_sudo_sleep"></a> no\_passwordless\_sudo\_sleep
117
-
118
- This variable configures a single sleep used when `no_passwordless_sudo_check` is set to `true`. The default for `no_passwordless_sudo_sleep` is 2 minutes.
119
-
120
- ### <a name="passwordless_sudo_timeout"></a> passwordless\_sudo\_timeout
121
-
122
- This variable configures the max timeout will wait in the create phase for passwordless sudo to be setup. The variable is used when `no_passwordless_sudo_check` is set to `false`. The default for `passwordless_sudo_timeout` is 5 minutes.
123
-
124
- ### <a name="passwordless_sudo_retry_interval"></a> passwordless\_sudo\_retry\_interval
125
-
126
- This variable configures retry interval in the create phase to periodically check that passwordless sudo is setup. It does this until max timeout (set by `passwordless_sudo_timeout`) is reached. The variable is used when `no_passwordless_sudo_check` is set to `false`. The default for `passwordless_sudo_retry_interval` is 10 seconds.
127
-
128
- ## <a name="development"></a> Development
129
-
130
- * Source hosted at [GitHub][repo]
131
- * Report issues/questions/feature requests on [GitHub Issues][issues]
132
-
133
- Pull requests are very welcome! Make sure your patches are well tested.
134
- Ideally create a topic branch for every separate change you make. For
135
- example:
136
-
137
- 1. Fork the repo
138
- 2. Create your feature branch (`git checkout -b my-new-feature`)
139
- 3. Commit your changes (`git commit -am 'Added some feature'`)
140
- 4. Push to the branch (`git push origin my-new-feature`)
141
- 5. Create new Pull Request
142
-
143
- ## <a name="authors"></a> Authors
144
-
145
- Created and maintained by [Andrew Brown][author] (<anbrown@blackberry.com>)
146
-
147
- ## <a name="license"></a> License
148
-
149
- Apache 2.0 (see [LICENSE][license])
150
-
151
-
152
- [author]: https://github.com/andrewjamesbrown
153
- [issues]: https://github.com/test-kitchen/kitchen-opennebula/issues
154
- [license]: https://github.com/test-kitchen/kitchen-opennebula/blob/master/LICENSE
155
- [repo]: https://github.com/test-kitchen/kitchen-opennebula
156
- [driver_usage]: http://docs.kitchen-ci.org/drivers/usage
157
- [chef_omnibus_dl]: http://www.getchef.com/chef/install/
1
+ # <a name="title"></a> Kitchen::Opennebula
2
+
3
+ A Test Kitchen Driver for Opennebula.
4
+
5
+ ## <a name="requirements"></a> Requirements
6
+
7
+ This driver depends on [fog](https://github.com/fog/fog). Please note possibility that unreleased changes on master branch may depend on patches that can be found at https://github.com/blackberry/fog until they are merged to upstream.
8
+
9
+ ## <a name="installation"></a> Installation and Setup
10
+
11
+ 1. Download and install latest [ChefDK](https://downloads.chef.io/chef-dk/).
12
+ 2. Please add bin locations to your PATH:
13
+ * C:\opscode\chefdk\bin;C:\opscode\chefdk\embedded\bin\ (windows)
14
+ * /opt/chefdk/bin/:/opt/chefdk/embedded/bin (unix)
15
+ 3. Reopen console or reload your env PATH
16
+ 4. Run following command:
17
+ gem install kitchen-opennebula --no-user-install --no-ri --no-rdoc
18
+
19
+ Please read the [config_yml_kitchen](https://docs.chef.io/config_yml_kitchen.html) page for more details.
20
+
21
+ ## Virtual Machine Requirements
22
+
23
+ This driver requires an OpenNebula OS image that conforms to a number of requirements
24
+
25
+ * The VM puts the ssh key defined in the SSH\_PUBLIC\_KEY context variable into `$HOME/.ssh/authorized_keys`
26
+ * The VM ensures the user has passwordless sudo access
27
+
28
+ ## <a name="config"></a> Configuration
29
+
30
+ ### <a name="opennebula_endpoint"></a> opennebula\_endpoint
31
+
32
+ URL where the OpenNebula daemon is listening.
33
+ The default value is taken from the ONE\_XMLRPC environment variable, or `http://127.0.0.1:2633/RPC2` if unset.
34
+
35
+ ### <a name="oneauth_file"></a> oneauth\_file
36
+
37
+ Path to the file containing OpenNebula authentication information. It should contain a single line stating "username:password".
38
+ The default value is taken from the ONE\_AUTH environment variable, or `$HOME/.one/one_auth` if unset.
39
+
40
+ ### <a name="template_name"></a> template\_name
41
+
42
+ Name of the VM definition file (OpenNebula template) registered with OpenNebula. Can be used with `template_uname` or `template_uid` to further restrict which template to use if multiple users have the same template name. Only one of `template_name` or `template_id` must be specified in the .kitchen.yml file.
43
+ The default value is unset, or `nil`.
44
+
45
+ ### <a name="template_id"></a> template\_id
46
+
47
+ ID of the VM definition file (OpenNebula template) registered with OpenNebula. Only one of `template_name` or `template_id` must be specified in the .kitchen.yml file.
48
+ The default value is unset, or `nil`.
49
+
50
+ ### <a name="template_uname"></a> template\_uname
51
+
52
+ Username who owns the VM definition file (OpenNebula template). Can be used with `template_name` to address naming conflicts where multiple users have the same template name.
53
+ The default value is unset, or `nil`.
54
+
55
+ ### <a name="template_uid"></a> template\_uid
56
+
57
+ UID of the user who owns the VM definition file (OpenNebula template). Can be used with `template_name` to address naming conflicts where multiple users have the same template name.
58
+ The default value is unset, or `nil`.
59
+
60
+ ### <a name="vm_hostname"></a> vm\_hostname
61
+
62
+ Hostname to set for the newly created VM.
63
+ The default value is `driver.instance.name`
64
+
65
+ ### <a name="public_key_path"></a> public\_key\_path
66
+
67
+ Path to SSH public key to pass to the VM, to use to authenticate with `username` when logging in or converging a node.
68
+ The default value is `~/.ssh/id_rsa.pub`, `~/.ssh/id_dsa.pub`, `~/.ssh/identity.pub`, or `~/.ssh/id_ecdsa.pub`, whichever is present on the filesystem.
69
+
70
+ ### <a name="username"></a> username
71
+
72
+ This is the username used for SSH authentication to the new VM.
73
+ The default value is `local`.
74
+
75
+ ### <a name="memory"></a> memory
76
+
77
+ The amount of memory to provision for the new VM. This parameter will override the memory settings provided in the VM template.
78
+ The default value is 512MB.
79
+
80
+ ### <a name="user_variables"></a> user\_variables
81
+
82
+ A hash of variables to pass into the "user template" section of the VM, to customize the virtual machine.
83
+ The default value is `{}`.
84
+
85
+ ### <a name="context_variables"></a> context\_variables
86
+
87
+ A hash of variables to pass into the "CONTEXT" section of the VM, to further customize the virtual machine. These variables override any existing context variables that are provided as part of the specified VM template.
88
+ The default value is `{}`.
89
+
90
+ ### <a name="config-require-chef-omnibus"></a> require\_chef\_omnibus
91
+
92
+ Determines whether or not a Chef [Omnibus package][chef_omnibus_dl] will be
93
+ installed. There are several different behaviors available:
94
+
95
+ * `true` - the latest release will be installed. Subsequent converges
96
+ will skip re-installing if chef is present.
97
+ * `latest` - the latest release will be installed. Subsequent converges
98
+ will always re-install even if chef is present.
99
+ * `<VERSION_STRING>` (ex: `10.24.0`) - the desired version string will
100
+ be passed the the install.sh script. Subsequent converges will skip if
101
+ the installed version and the desired version match.
102
+ * `false` or `nil` - no chef is installed.
103
+
104
+ The default value is unset, or `nil`.
105
+
106
+ ### <a name="wait_for"></a> wait_for
107
+
108
+ This variable is used to override timeout for Fog's common `wait_for` method which states that it "takes a block and waits for either the block to return true for the object or for a timeout (defaults to 10 minutes)".
109
+
110
+ ### <a name="no_ssh_tcp_check"></a> no\_ssh\_tcp\_check
111
+
112
+ To avoid test-kitchen's ssh tcp check in the create phase you can set `no_ssh_tcp_check` to `true` and do single sleep instead. Sleep period is configured by `no_ssh_tcp_check_sleep`. The default for `no_ssh_tcp_check` is set to `false`.
113
+
114
+ ### <a name="no_ssh_tcp_check_sleep"></a> no\_ssh\_tcp\_check\_sleep
115
+
116
+ This variable configures a single sleep used when `no_ssh_tcp_check` is set to `true`. The default for `no_ssh_tcp_check` is 2 minutes.
117
+
118
+ ### <a name="no_passwordless_sudo_check"></a> no\_passwordless\_sudo\_check
119
+
120
+ To avoid test-kitchen's passwordless sudo check in the create phase you can set `no_passwordless_sudo_check` to `true` and do single sleep instead. Sleep period is configured by `no_passwordless_sudo_sleep`. The default for `no_passwordless_sudo_check` is set to `false`.
121
+
122
+ ### <a name="no_passwordless_sudo_sleep"></a> no\_passwordless\_sudo\_sleep
123
+
124
+ This variable configures a single sleep used when `no_passwordless_sudo_check` is set to `true`. The default for `no_passwordless_sudo_sleep` is 2 minutes.
125
+
126
+ ### <a name="passwordless_sudo_timeout"></a> passwordless\_sudo\_timeout
127
+
128
+ This variable configures the max timeout will wait in the create phase for passwordless sudo to be setup. The variable is used when `no_passwordless_sudo_check` is set to `false`. The default for `passwordless_sudo_timeout` is 5 minutes.
129
+
130
+ ### <a name="passwordless_sudo_retry_interval"></a> passwordless\_sudo\_retry\_interval
131
+
132
+ This variable configures retry interval in the create phase to periodically check that passwordless sudo is setup. It does this until max timeout (set by `passwordless_sudo_timeout`) is reached. The variable is used when `no_passwordless_sudo_check` is set to `false`. The default for `passwordless_sudo_retry_interval` is 10 seconds.
133
+
134
+ ## <a name="development"></a> Development
135
+
136
+ * Source hosted at [GitHub][repo]
137
+ * Report issues/questions/feature requests on [GitHub Issues][issues]
138
+
139
+ Pull requests are very welcome! Make sure your patches are well tested.
140
+ Ideally create a topic branch for every separate change you make. For
141
+ example:
142
+
143
+ 1. Fork the repo
144
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
145
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
146
+ 4. Push to the branch (`git push origin my-new-feature`)
147
+ 5. Create new Pull Request
148
+
149
+ ## <a name="authors"></a> Authors
150
+
151
+ Created by [Andrew Brown][author] (<anbrown@blackberry.com>)
152
+
153
+ ## <a name="maintainers"></a> Maintainers
154
+
155
+ Maintained by
156
+ * [Andrew Brown][author] (<anbrown@blackberry.com>)
157
+ * [Philip Oliva][maintainer] (<philoliva8@gmail.com>)
158
+
159
+ ## <a name="license"></a> License
160
+
161
+ Apache 2.0 (see [LICENSE][license])
162
+
163
+
164
+ [author]: https://github.com/andrewjamesbrown
165
+ [maintainer]: https://github.com/poliva83
166
+ [issues]: https://github.com/test-kitchen/kitchen-opennebula/issues
167
+ [license]: https://github.com/test-kitchen/kitchen-opennebula/blob/master/LICENSE
168
+ [repo]: https://github.com/test-kitchen/kitchen-opennebula
169
+ [driver_usage]: http://docs.kitchen-ci.org/drivers/usage
170
+ [chef_omnibus_dl]: http://www.getchef.com/chef/install/
data/Rakefile CHANGED
@@ -1,21 +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]
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]
@@ -1,31 +1,31 @@
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/opennebula_version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = 'kitchen-opennebula'
8
- spec.version = Kitchen::Driver::OPENNEBULA_VERSION
9
- spec.authors = ['Andrew J. Brown']
10
- spec.email = ['anbrown@blackberry.com']
11
- spec.description = %q{A Test Kitchen Driver for Opennebula}
12
- spec.summary = spec.description
13
- spec.homepage = ''
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', '~> 1.2'
22
- spec.add_dependency 'fog', '~> 1.26'
23
- spec.add_dependency 'opennebula'
24
-
25
- spec.add_development_dependency 'bundler', '~> 1.3'
26
- spec.add_development_dependency 'rake'
27
-
28
- spec.add_development_dependency 'cane'
29
- spec.add_development_dependency 'tailor'
30
- spec.add_development_dependency 'countloc'
31
- end
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/opennebula_version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'kitchen-opennebula'
8
+ spec.version = Kitchen::Driver::OPENNEBULA_VERSION
9
+ spec.authors = ['Andrew J. Brown']
10
+ spec.email = ['anbrown@blackberry.com']
11
+ spec.description = %q{A Test Kitchen Driver for Opennebula}
12
+ spec.summary = spec.description
13
+ spec.homepage = ''
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', '~> 1.2'
22
+ spec.add_dependency 'fog', '~> 1.30'
23
+ spec.add_dependency 'opennebula'
24
+
25
+ spec.add_development_dependency 'bundler', '~> 1.3'
26
+ spec.add_development_dependency 'rake'
27
+
28
+ spec.add_development_dependency 'cane'
29
+ spec.add_development_dependency 'tailor'
30
+ spec.add_development_dependency 'countloc'
31
+ end
@@ -1,189 +1,193 @@
1
- # -*- encoding: utf-8 -*-
2
- #
3
- # Author:: Andrew J. Brown (<anbrown@blackberry.com>)
4
- #
5
- # Copyright (C) 2014, BlackBerry, Ltd.
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 'fog'
20
- require 'kitchen'
21
-
22
- module Kitchen
23
-
24
- module Driver
25
-
26
- # Opennebula driver for Kitchen.
27
- #
28
- # @author Andrew J. Brown <anbrown@blackberry.com>
29
- class Opennebula < Kitchen::Driver::SSHBase
30
- default_config :opennebula_endpoint,
31
- ENV.fetch('ONE_XMLRPC', 'http://127.0.0.1:2633/RPC2')
32
-
33
- default_config :oneauth_file,
34
- ENV.fetch('ONE_AUTH', "#{ENV['HOME']}/.one/one_auth")
35
-
36
- default_config :vm_hostname do |driver|
37
- "#{driver.instance.name}"
38
- end
39
-
40
- default_config :public_key_path do
41
- [
42
- File.expand_path('~/.ssh/id_rsa.pub'),
43
- File.expand_path('~/.ssh/id_dsa.pub'),
44
- File.expand_path('~/.ssh/identity.pub'),
45
- File.expand_path('~/.ssh/id_ecdsa.pub')
46
- ].find { |path| File.exist?(path) }
47
- end
48
-
49
- default_config :username, 'local'
50
- default_config :memory, 512
51
- default_config :user_variables, { }
52
- default_config :context_variables, { }
53
-
54
- default_config :wait_for, 600
55
- default_config :no_ssh_tcp_check, false
56
- default_config :no_ssh_tcp_check_sleep, 120
57
- default_config :no_passwordless_sudo_check, false
58
- default_config :no_passwordless_sudo_sleep, 120
59
-
60
- def initialize(config)
61
- super
62
- Fog.timeout = config[:wait_for].to_i
63
- end
64
-
65
- def create(state)
66
- conn = opennebula_connect
67
-
68
- # Check if VM is already created.
69
- if state[:vm_id] && !conn.list_vms({:id => state[:vm_id]}).empty?
70
- info("OpenNebula instance #{instance.to_str} already created.")
71
- return
72
- end
73
-
74
- if config[:template_id].nil? and config[:template_name].nil?
75
- raise "template_name or template_id not specified in .kitchen.yml"
76
- elsif !config[:template_id].nil? and !config[:template_name].nil?
77
- raise "Only one of template_name or template_id should be specified in .kitchen.yml"
78
- end
79
-
80
- newvm = conn.servers.new
81
- if config[:template_id]
82
- newvm.flavor = conn.flavors.get config[:template_id]
83
- elsif config[:template_name]
84
- filter = {
85
- :name => config[:template_name],
86
- :uname => config[:template_uname],
87
- :uid => config[:template_uid]
88
- }
89
- newvm.flavor = conn.flavors.get_by_filter filter
90
- if !newvm.flavor.nil? and newvm.flavor.length > 1
91
- raise 'More than one template found. Please restrict using template_uname'
92
- end
93
- newvm.flavor = newvm.flavor.first unless newvm.flavor.nil?
94
- end
95
- if newvm.flavor.nil?
96
- raise "Could not find template to create VM."
97
- end
98
- newvm.name = config[:vm_hostname]
99
-
100
- newvm.flavor.user_variables = {} if newvm.flavor.user_variables.nil? || newvm.flavor.user_variables.empty?
101
- config[:user_variables].each do |key, val|
102
- newvm.flavor.user_variables[key.to_s] = val
103
- end
104
-
105
- newvm.flavor.context = {} if newvm.flavor.context.nil? || newvm.flavor.context.empty?
106
- newvm.flavor.context['SSH_PUBLIC_KEY'] = File.read(config[:public_key_path]).chomp
107
- newvm.flavor.context['TEST_KITCHEN'] = "YES"
108
- # Support for overriding context variables in the VM template
109
- config[:context_variables].each do |key, val|
110
- newvm.flavor.context[key.to_s] = val
111
- end
112
- newvm.flavor.memory = config[:memory]
113
-
114
- # TODO: Set up NIC and disk if not specified in template
115
- vm = newvm.save
116
- vm.wait_for { ready? }
117
- state[:vm_id] = vm.id
118
- state[:hostname] = vm.ip
119
- state[:username] = config[:username]
120
- tcp_check(state)
121
- passwordless_sudo_check(state)
122
- info("OpenNebula instance #{instance.to_str} created.")
123
- end
124
-
125
- def tcp_check(state)
126
- wait_for_sshd(state[:hostname]) unless config[:no_ssh_tcp_check]
127
- sleep(config[:no_ssh_tcp_check_sleep]) if config[:no_ssh_tcp_check]
128
- debug("SSH ready on #{instance.to_str}")
129
- end
130
-
131
- def passwordless_sudo_check(state)
132
- wait_for_passwordless_sudo(state) unless config[:no_passwordless_sudo_check]
133
- sleep(config[:no_passwordless_sudo_sleep]) if config[:no_passwordless_sudo_check]
134
- debug("Passwordless sudo ready on #{instance.to_str}")
135
- end
136
-
137
- def wait_for_passwordless_sudo(state)
138
- Kitchen::SSH.new(*build_ssh_args(state)) do |conn|
139
- retries = config[:passwordless_sudo_timeout] || 300
140
- retry_interval = config[:passwordless_sudo_retry_interval] || 10
141
- begin
142
- logger.info("Waiting #{retries.to_s} seconds for #{config[:username]} user to be granted passwordless sudo on #{state[:hostname]}...")
143
- retries -= retry_interval
144
- run_remote("sudo -n true", conn)
145
- rescue ActionFailed => e
146
- if (e.message.eql? "SSH exited (1) for command: [sudo -n true]") && (retries >= 0)
147
- sleep retry_interval
148
- retry
149
- end
150
- raise ActionFailed, e.message
151
- end
152
- end
153
- end
154
-
155
- def converge(state)
156
- super
157
- end
158
-
159
- def verify(state)
160
- super
161
- end
162
-
163
- def destroy(state)
164
- conn = opennebula_connect
165
- conn.servers.destroy(state[:vm_id])
166
- end
167
-
168
- protected
169
-
170
- def opennebula_connect()
171
- opennebula_creds = nil
172
- if File.exists?(config[:oneauth_file])
173
- opennebula_creds = File.read(config[:oneauth_file])
174
- else
175
- raise ActionFailed, "Could not find one_auth file #{config[:oneauth_file]}"
176
- end
177
- opennebula_username = opennebula_creds.split(':')[0]
178
- opennebula_password = opennebula_creds.split(':')[1]
179
- conn = Fog::Compute.new( {
180
- :provider => 'OpenNebula',
181
- :opennebula_username => opennebula_username,
182
- :opennebula_password => opennebula_password,
183
- :opennebula_endpoint => config[:opennebula_endpoint]
184
- } )
185
- conn
186
- end
187
- end
188
- end
189
- end
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ # Author:: Andrew J. Brown (<anbrown@blackberry.com>)
4
+ #
5
+ # Copyright (C) 2014, BlackBerry, Ltd.
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 'fog'
20
+ require 'kitchen'
21
+
22
+ module Kitchen
23
+
24
+ module Driver
25
+
26
+ # Opennebula driver for Kitchen.
27
+ #
28
+ # @author Andrew J. Brown <anbrown@blackberry.com>
29
+ class Opennebula < Kitchen::Driver::SSHBase
30
+ default_config :opennebula_endpoint,
31
+ ENV.fetch('ONE_XMLRPC', 'http://127.0.0.1:2633/RPC2')
32
+
33
+ default_config :oneauth_file,
34
+ ENV.fetch('ONE_AUTH', "#{ENV['HOME']}/.one/one_auth")
35
+
36
+ default_config :vm_hostname do |driver|
37
+ "#{driver.instance.name}"
38
+ end
39
+
40
+ default_config :public_key_path do
41
+ [
42
+ File.expand_path('~/.ssh/id_rsa.pub'),
43
+ File.expand_path('~/.ssh/id_dsa.pub'),
44
+ File.expand_path('~/.ssh/identity.pub'),
45
+ File.expand_path('~/.ssh/id_ecdsa.pub')
46
+ ].find { |path| File.exist?(path) }
47
+ end
48
+
49
+ default_config :username, 'local'
50
+ default_config :memory, 512
51
+ default_config :user_variables, { }
52
+ default_config :context_variables, { }
53
+
54
+ default_config :wait_for, 600
55
+ default_config :no_ssh_tcp_check, false
56
+ default_config :no_ssh_tcp_check_sleep, 120
57
+ default_config :no_passwordless_sudo_check, false
58
+ default_config :no_passwordless_sudo_sleep, 120
59
+
60
+ def initialize(config)
61
+ super
62
+ Fog.timeout = config[:wait_for].to_i
63
+ end
64
+
65
+ def create(state)
66
+ conn = opennebula_connect
67
+
68
+ # Ensure we can authenticate with OpenNebula
69
+ rc = conn.client.get_version
70
+ raise(rc.message) if OpenNebula.is_error?(rc)
71
+
72
+ # Check if VM is already created.
73
+ if state[:vm_id] && !conn.list_vms({:id => state[:vm_id]}).empty?
74
+ info("OpenNebula instance #{instance.to_str} already created.")
75
+ return
76
+ end
77
+
78
+ if config[:template_id].nil? and config[:template_name].nil?
79
+ raise "template_name or template_id not specified in .kitchen.yml"
80
+ elsif !config[:template_id].nil? and !config[:template_name].nil?
81
+ raise "Only one of template_name or template_id should be specified in .kitchen.yml"
82
+ end
83
+
84
+ newvm = conn.servers.new
85
+ if config[:template_id]
86
+ newvm.flavor = conn.flavors.get config[:template_id]
87
+ elsif config[:template_name]
88
+ filter = {
89
+ :name => config[:template_name],
90
+ :uname => config[:template_uname],
91
+ :uid => config[:template_uid]
92
+ }
93
+ newvm.flavor = conn.flavors.get_by_filter filter
94
+ if !newvm.flavor.nil? and newvm.flavor.length > 1
95
+ raise 'More than one template found. Please restrict using template_uname'
96
+ end
97
+ newvm.flavor = newvm.flavor.first unless newvm.flavor.nil?
98
+ end
99
+ if newvm.flavor.nil?
100
+ raise "Could not find template to create VM. -- Verify your template filters and one_auth credentials"
101
+ end
102
+ newvm.name = config[:vm_hostname]
103
+
104
+ newvm.flavor.user_variables = {} if newvm.flavor.user_variables.nil? || newvm.flavor.user_variables.empty?
105
+ config[:user_variables].each do |key, val|
106
+ newvm.flavor.user_variables[key.to_s] = val
107
+ end
108
+
109
+ newvm.flavor.context = {} if newvm.flavor.context.nil? || newvm.flavor.context.empty?
110
+ newvm.flavor.context['SSH_PUBLIC_KEY'] = File.read(config[:public_key_path]).chomp
111
+ newvm.flavor.context['TEST_KITCHEN'] = "YES"
112
+ # Support for overriding context variables in the VM template
113
+ config[:context_variables].each do |key, val|
114
+ newvm.flavor.context[key.to_s] = val
115
+ end
116
+ newvm.flavor.memory = config[:memory]
117
+
118
+ # TODO: Set up NIC and disk if not specified in template
119
+ vm = newvm.save
120
+ vm.wait_for { ready? }
121
+ state[:vm_id] = vm.id
122
+ state[:hostname] = vm.ip
123
+ state[:username] = config[:username]
124
+ tcp_check(state)
125
+ passwordless_sudo_check(state)
126
+ info("OpenNebula instance #{instance.to_str} created.")
127
+ end
128
+
129
+ def tcp_check(state)
130
+ wait_for_sshd(state[:hostname]) unless config[:no_ssh_tcp_check]
131
+ sleep(config[:no_ssh_tcp_check_sleep]) if config[:no_ssh_tcp_check]
132
+ debug("SSH ready on #{instance.to_str}")
133
+ end
134
+
135
+ def passwordless_sudo_check(state)
136
+ wait_for_passwordless_sudo(state) unless config[:no_passwordless_sudo_check]
137
+ sleep(config[:no_passwordless_sudo_sleep]) if config[:no_passwordless_sudo_check]
138
+ debug("Passwordless sudo ready on #{instance.to_str}")
139
+ end
140
+
141
+ def wait_for_passwordless_sudo(state)
142
+ Kitchen::SSH.new(*build_ssh_args(state)) do |conn|
143
+ retries = config[:passwordless_sudo_timeout] || 300
144
+ retry_interval = config[:passwordless_sudo_retry_interval] || 10
145
+ begin
146
+ logger.info("Waiting #{retries.to_s} seconds for #{config[:username]} user to be granted passwordless sudo on #{state[:hostname]}...")
147
+ retries -= retry_interval
148
+ run_remote("sudo -n true", conn)
149
+ rescue ActionFailed => e
150
+ if (e.message.eql? "SSH exited (1) for command: [sudo -n true]") && (retries >= 0)
151
+ sleep retry_interval
152
+ retry
153
+ end
154
+ raise ActionFailed, e.message
155
+ end
156
+ end
157
+ end
158
+
159
+ def converge(state)
160
+ super
161
+ end
162
+
163
+ def verify(state)
164
+ super
165
+ end
166
+
167
+ def destroy(state)
168
+ conn = opennebula_connect
169
+ conn.servers.destroy(state[:vm_id])
170
+ end
171
+
172
+ protected
173
+
174
+ def opennebula_connect()
175
+ opennebula_creds = nil
176
+ if File.exists?(config[:oneauth_file])
177
+ opennebula_creds = File.read(config[:oneauth_file])
178
+ else
179
+ raise ActionFailed, "Could not find one_auth file #{config[:oneauth_file]}"
180
+ end
181
+ opennebula_username = opennebula_creds.split(':')[0]
182
+ opennebula_password = opennebula_creds.split(':')[1]
183
+ conn = Fog::Compute.new( {
184
+ :provider => 'OpenNebula',
185
+ :opennebula_username => opennebula_username,
186
+ :opennebula_password => opennebula_password,
187
+ :opennebula_endpoint => config[:opennebula_endpoint]
188
+ } )
189
+ conn
190
+ end
191
+ end
192
+ end
193
+ end
@@ -1,26 +1,26 @@
1
- # -*- encoding: utf-8 -*-
2
- #
3
- # Author:: Andrew Brown (<anbrown@blackberry.com>)
4
- #
5
- # Copyright (C) 2014, BlackBerry, Ltd.
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
-
23
- # Version string for Opennebula Kitchen driver
24
- OPENNEBULA_VERSION = "0.1.1"
25
- end
26
- end
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ # Author:: Andrew Brown (<anbrown@blackberry.com>)
4
+ #
5
+ # Copyright (C) 2014, BlackBerry, Ltd.
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
+
23
+ # Version string for Opennebula Kitchen driver
24
+ OPENNEBULA_VERSION = "0.1.2"
25
+ end
26
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-opennebula
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew J. Brown
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-16 00:00:00.000000000 Z
11
+ date: 2015-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: '1.26'
33
+ version: '1.30'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: '1.26'
40
+ version: '1.30'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: opennebula
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -158,9 +158,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
158
  version: '0'
159
159
  requirements: []
160
160
  rubyforge_project:
161
- rubygems_version: 2.4.1
161
+ rubygems_version: 2.0.14
162
162
  signing_key:
163
163
  specification_version: 4
164
164
  summary: A Test Kitchen Driver for Opennebula
165
165
  test_files: []
166
- has_rdoc: