kitchen-vz 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.kitchen.yml +3 -1
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +10 -0
- data/README.md +1 -0
- data/lib/kitchen/driver/vz.rb +11 -5
- data/lib/kitchen/driver/vz_version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26d28c6e026fec30c78adec6069fcafc53f48c18
|
4
|
+
data.tar.gz: 1240a2ec9c2f869e25658fe1cb75a5b296e55635
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2614c137bf77f6fd3445df14ff1c75620e62f7f62d34f2dce975cb29959e3a48c52291d51e29cfe4520b2298ec1aa4a75911f4417eec979c7354fb3b2daa8ce
|
7
|
+
data.tar.gz: 1e76e21db61060d93d70de593b41658f42a22223e11a1312bc7021130ded74e2d44266732860ff9edaa2914f5462474cba628072670f0dba19850fbdfb6c100a
|
data/.gitignore
CHANGED
data/.kitchen.yml
CHANGED
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
## 0.1.3
|
2
|
+
|
3
|
+
* Add `additional_options` option. This option allows to set additional options for container, such as features.
|
4
|
+
|
5
|
+
## 0.1.2
|
6
|
+
|
7
|
+
* Add support of a centos 5
|
8
|
+
* Fix bug with incorrect re-creating of containers
|
9
|
+
* Fix bug, when the container does not have time to get IP address
|
10
|
+
|
1
11
|
## 0.1.0
|
2
12
|
|
3
13
|
* Initial release
|
data/README.md
CHANGED
@@ -40,6 +40,7 @@ Example `.kitchen.local.yml`:
|
|
40
40
|
|:public_key|Path to public key. This key pair used by the kitchen to login into container.|.kitchen/kitchen_id_rsa.pub|
|
41
41
|
|:ostemplate|Virtuozzo template which will be used for container creating.||
|
42
42
|
|:use_sudo|It shows will sudo be used or not.|true|
|
43
|
+
|:additional_options|Array with `prlctl set` options, which will be pass as is. Example: ["--features nfs:on"]|[]|
|
43
44
|
|:ct_hostname|Container hostname.|It is formed from platform name and suite name.|
|
44
45
|
|
45
46
|
### Network configuration
|
data/lib/kitchen/driver/vz.rb
CHANGED
@@ -23,12 +23,10 @@ require 'net/ssh'
|
|
23
23
|
|
24
24
|
module Kitchen
|
25
25
|
module Driver
|
26
|
-
|
27
26
|
# Virtuozzo driver for Kitchen.
|
28
27
|
#
|
29
28
|
# @author Pavel Yudin <pyudin@parallels.com>
|
30
29
|
class Vz < Kitchen::Driver::SSHBase
|
31
|
-
|
32
30
|
default_config :socket, 'local'
|
33
31
|
default_config :username, 'kitchen'
|
34
32
|
default_config :private_key, File.join(Dir.pwd, '.kitchen', 'kitchen_id_rsa')
|
@@ -38,6 +36,7 @@ module Kitchen
|
|
38
36
|
default_config :arch, 'x86_64'
|
39
37
|
default_config :customize, memory: '512M', disk: '10G', cpus: 2
|
40
38
|
default_config :ostemplate, nil
|
39
|
+
default_config :additional_options, []
|
41
40
|
default_config :ct_hostname do |driver|
|
42
41
|
driver.instance.name
|
43
42
|
end
|
@@ -52,6 +51,7 @@ module Kitchen
|
|
52
51
|
set_ct_cpu(state)
|
53
52
|
set_ct_mem(state)
|
54
53
|
set_ct_disk(state)
|
54
|
+
set_additional_options(state)
|
55
55
|
run_ct(state)
|
56
56
|
create_user(state)
|
57
57
|
state[:hostname] = ct_ip(state)
|
@@ -76,7 +76,7 @@ module Kitchen
|
|
76
76
|
def generate_keys
|
77
77
|
if !File.exist?(config[:public_key]) || !File.exist?(config[:private_key])
|
78
78
|
private_key = OpenSSL::PKey::RSA.new(2048)
|
79
|
-
blobbed_key = Base64.encode64(private_key.to_blob).
|
79
|
+
blobbed_key = Base64.encode64(private_key.to_blob).delete("\n")
|
80
80
|
public_key = "ssh-rsa #{blobbed_key} kitchen_key"
|
81
81
|
File.open(config[:private_key], 'w') do |file|
|
82
82
|
file.write(private_key)
|
@@ -123,6 +123,12 @@ module Kitchen
|
|
123
123
|
execute_command("#{vzctl} set #{state[:ct_id]} --diskspace #{ds}:#{ds} --save")
|
124
124
|
end
|
125
125
|
|
126
|
+
def set_additional_options(state)
|
127
|
+
unless config[:additional_options].empty?
|
128
|
+
execute_command("#{prlctl} set #{state[:ct_id]} #{config[:additional_options].join(' ')}")
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
126
132
|
def run_ct(state)
|
127
133
|
execute_command("#{prlctl} start #{state[:ct_id]}")
|
128
134
|
end
|
@@ -145,14 +151,14 @@ module Kitchen
|
|
145
151
|
|
146
152
|
def ct_ip(state)
|
147
153
|
ip = nil
|
148
|
-
|
154
|
+
30.times do
|
149
155
|
output = execute_command("#{vzctl} exec #{state[:ct_id]} \"/sbin/ip -o -f inet addr show dev eth0\"")
|
150
156
|
result = %r{(([0-9]{1,3}\.){3}[0-9]{1,3})\/[0-9]{1,2}}.match(output)
|
151
157
|
ip = result[1] if result
|
152
158
|
break if ip
|
153
159
|
sleep(1)
|
154
160
|
end
|
155
|
-
raise "Can't detect an IP!"
|
161
|
+
raise "Can't detect an IP!" unless ip
|
156
162
|
ip
|
157
163
|
end
|
158
164
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitchen-vz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Yudin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-kitchen
|
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
119
|
version: '0'
|
120
120
|
requirements: []
|
121
121
|
rubyforge_project:
|
122
|
-
rubygems_version: 2.6.
|
122
|
+
rubygems_version: 2.6.6
|
123
123
|
signing_key:
|
124
124
|
specification_version: 4
|
125
125
|
summary: A Virtuozzo driver for Test Kitchen
|