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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7bf73d0a9618e839b979290bc316e954e599ad2b
4
- data.tar.gz: 60bbface59b54d4d90f38fc90369b96445f89909
3
+ metadata.gz: 26d28c6e026fec30c78adec6069fcafc53f48c18
4
+ data.tar.gz: 1240a2ec9c2f869e25658fe1cb75a5b296e55635
5
5
  SHA512:
6
- metadata.gz: 8b8028692e37e9b830428025296864564e449b6a3e1a53012d20836eb10563081e7ef5721f68abc5a1478e5abacca714dae2ecfffbbbda8bae9a8ce313946eb8
7
- data.tar.gz: 2a2ac99562a167204b59acd3868ce45a391b67da9adec9c15572dc2ed59a6527133658ec2f4c83bd70ab431823b278b7a16678b83f42f308c398d9d0718462dd
6
+ metadata.gz: d2614c137bf77f6fd3445df14ff1c75620e62f7f62d34f2dce975cb29959e3a48c52291d51e29cfe4520b2298ec1aa4a75911f4417eec979c7354fb3b2daa8ce
7
+ data.tar.gz: 1e76e21db61060d93d70de593b41658f42a22223e11a1312bc7021130ded74e2d44266732860ff9edaa2914f5462474cba628072670f0dba19850fbdfb6c100a
data/.gitignore CHANGED
@@ -16,3 +16,4 @@ test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
18
  .kitchen
19
+ .kitchen.local.yml
data/.kitchen.yml CHANGED
@@ -8,7 +8,9 @@ provisioner:
8
8
  platforms:
9
9
  - name: centos-6.6
10
10
  driver:
11
- socket: 'ssh://cookbook-ci.prls.net'
11
+ socket: 'ssh://virtuozzo.your-domain.loc'
12
+ additional_options:
13
+ ["--features nfs:on", "--features nfsd:on"]
12
14
  network:
13
15
  Bridged:
14
16
  dhcp: true
data/.rubocop.yml CHANGED
@@ -22,7 +22,7 @@ Metrics/AbcSize:
22
22
  Enabled: false
23
23
  PerceivedComplexity:
24
24
  Enabled: false
25
- Lint/SpaceBeforeFirstArg:
25
+ Style/SpaceBeforeFirstArg:
26
26
  Enabled: false
27
27
  Style/ClassAndModuleChildren:
28
28
  Enabled: false
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
@@ -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).gsub("\n", '')
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
- 1..30.times do
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!" if !ip
161
+ raise "Can't detect an IP!" unless ip
156
162
  ip
157
163
  end
158
164
 
@@ -19,6 +19,6 @@
19
19
  module Kitchen
20
20
  module Driver
21
21
  # Version string for Vz Kitchen driver
22
- VZ_VERSION = '0.1.2'.freeze
22
+ VZ_VERSION = '0.1.3'.freeze
23
23
  end
24
24
  end
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.2
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-06-23 00:00:00.000000000 Z
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.4
122
+ rubygems_version: 2.6.6
123
123
  signing_key:
124
124
  specification_version: 4
125
125
  summary: A Virtuozzo driver for Test Kitchen