kitchen-lxd_cli 2.0.1 → 2.0.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: a122089b7742dd6200e4989317330712e0d1900a
4
- data.tar.gz: ce6ef71bb797a9cd96874382b647644b4809a0f9
3
+ metadata.gz: 3aba5aaed0f962cf7e3f0d09e27bd1260204e6e6
4
+ data.tar.gz: 7e31964bf92ed3b05c05262c4fa5588df05ebe63
5
5
  SHA512:
6
- metadata.gz: 94f664ec976a9c59913e1c9f8b29cb1bf025a0ef959562000f2ef67e91d7b1231f3ec6f2b635f333bed2f32b66da732dc6aa26cd55a828c870703411ed428799
7
- data.tar.gz: 02987d6fb2ad4ee40cb4ad6b5081bcad24a759a39f08580c2d9a914e0968e4242c4f459daee514c2c12bcf1fd576c8df3230713ae372f50e4138e4859a000952
6
+ metadata.gz: 88dad7ad58fb0e1acba6b90c4848b042bb32fbef856876c2bead66b0d2c749f932a14a75debb37c34b7e5f4c8e40524381934d59dfb7276d524d58343cb1897a
7
+ data.tar.gz: 182c4bfdf26a9c7411cb8d2dd534efb39917f066f93f91e998245dff213a7d0e62a45e663d909df133017e8765de38c30fd514dc71b49ad2dbb7893551003791
@@ -37,7 +37,7 @@ module Kitchen
37
37
  File.expand_path('~/.ssh/identity.pub'),
38
38
  File.expand_path('~/.ssh/id_ecdsa.pub')
39
39
  ].find { |path| File.exist?(path) }
40
-
40
+
41
41
  raise 'Public key could not be found in the public_key_path provided. Please update the kitchen-lxd_cli config public_key_path in kitchen yaml or create a ssh key pair (e.g. `ssh-keygen -t rsa`)' unless pub_key
42
42
 
43
43
  pub_key
@@ -70,7 +70,7 @@ module Kitchen
70
70
  setup_ssh_access
71
71
  wait_for_ssh_login(lxc_ip) if config[:enable_wait_for_ssh_login] == "true"
72
72
  IO.popen("lxc exec #{@@instance_name} bash", "r+") do |p|
73
- p.puts("if [ ! -d '#{config[:verifier_path]}' ]; then mkdir -p #{config[:verifier_path]}; fi")
73
+ p.puts("if [ ! -d '#{config[:verifier_path]}' ]; then mkdir -p #{config[:verifier_path]}; fi")
74
74
  p.puts("if [ ! -L '/tmp/verifier' ]; then ln -s #{config[:verifier_path]} /tmp/verifier; fi")
75
75
  end if config[:verifier_path] && config[:verifier_path].length > 0
76
76
  end
@@ -134,9 +134,9 @@ module Kitchen
134
134
  unless image_exists?(image_name)
135
135
  info("Creating image #{image_name} now.")
136
136
  image = get_image_info
137
- image_os = config[:image_os]
137
+ image_os = config[:image_os]
138
138
  image_os ||= image[:os]
139
- image_release = config[:image_release]
139
+ image_release = config[:image_release]
140
140
  image_release ||= image[:release_num]
141
141
  debug("Ran command: lxc image copy #{image_os}:#{image_release} local: --alias #{image_name}")
142
142
  IO.popen("lxc image copy #{image_os}:#{image_release} local: --alias #{image_name}", "w") { |pipe| puts pipe.gets rescue nil }
@@ -185,7 +185,7 @@ module Kitchen
185
185
  def get_image_name
186
186
  image_name = get_publish_image_name
187
187
  unless config[:use_publish_image] == true && image_exists?(image_name)
188
- image_name = config[:image_name]
188
+ image_name = config[:image_name]
189
189
  image_name ||= instance.platform.name
190
190
  end
191
191
 
@@ -211,8 +211,9 @@ module Kitchen
211
211
  return false
212
212
  end
213
213
  end
214
-
214
+ 0
215
215
  def config_and_start_container
216
+ platform, release = instance.platform.name.split('-')
216
217
  config[:ip_gateway] ||= "auto"
217
218
  arg_disable_dhcp = ""
218
219
 
@@ -221,7 +222,11 @@ module Kitchen
221
222
  p.puts("echo -e \"lxc.network.0.ipv4 = #{config[:ipv4]}\nlxc.network.0.ipv4.gateway = #{config[:ip_gateway]}\n\" | lxc config set #{@@instance_name} raw.lxc -")
222
223
  p.puts("exit")
223
224
  end
224
- arg_disable_dhcp = "&& lxc exec #{@@instance_name} -- sed -i 's/dhcp/manual/g' /etc/network/interfaces.d/eth0.cfg"
225
+ if platform.downcase == "ubuntu"
226
+ arg_disable_dhcp = "&& lxc exec #{@@instance_name} -- sed -i 's/dhcp/manual/g' /etc/network/interfaces.d/eth0.cfg"
227
+ elsif platform.downcase == "centos"
228
+ arg_disable_dhcp = "&& lxc exec #{@@instance_name} -- sed -i 's/dhcp/none/g' /etc/sysconfig/network-scripts/ifcfg-eth0"
229
+ end
225
230
  end
226
231
 
227
232
  info("Starting container #{@@instance_name}")
@@ -443,7 +448,7 @@ module Kitchen
443
448
  debug("NOTE: Restarting seemed to be the only way I could get things to work. Tried lxc profiles, config options. Tried restart networking service but it didn't work, also tried passing command like ifconfig 10.0.3.x/24 eth0 up. Which set the ip but after container ran for a while, it would reset to dhcp address that had been assigned. Restarting container seems to be working, and is really fast. Open to better alternatives.")
444
449
  end
445
450
 
446
-
451
+
447
452
  =begin
448
453
  def configure_ip_via_lxc_restart
449
454
  debug("Configuring new ip address on eth0")
@@ -21,6 +21,6 @@ module Kitchen
21
21
  module Driver
22
22
 
23
23
  # Version string for LxdCli Kitchen driver
24
- LXD_CLI_VERSION = "2.0.1"
24
+ LXD_CLI_VERSION = "2.0.2"
25
25
  end
26
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-lxd_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Braden Wright
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-10 00:00:00.000000000 Z
11
+ date: 2016-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen
@@ -133,9 +133,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
133
  version: '0'
134
134
  requirements: []
135
135
  rubyforge_project:
136
- rubygems_version: 2.6.4
136
+ rubygems_version: 2.6.6
137
137
  signing_key:
138
138
  specification_version: 4
139
139
  summary: A Test Kitchen Driver for LXD
140
140
  test_files: []
141
- has_rdoc: