kitchen-k8s 0.9.3 → 0.9.8

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: a19eb36821f265a527c1e28e93796ec45c004aa3
4
- data.tar.gz: e6388f01c84365f087d74986e14da83bf0418da4
3
+ metadata.gz: d6ec0ddfb08029d4fc89d1a801aa0d5f545e60ea
4
+ data.tar.gz: 3e74f4784125ce5a675cdc338e7ed2aab777863f
5
5
  SHA512:
6
- metadata.gz: 72b84e9c0e56c57be9792d949b32add73edf6fd928ee929f26535400e2edd33d533131d072488de8ef1fbd112fe1f352dee93ed410199b17eaf496ddcc05e8ea
7
- data.tar.gz: 244f09bf4579c5a64f69c6ce24b80b4b3ec9b29a06da713c986f3214092b7b892e212894d759fec3ab2a0365cba57e7f5133ad3648da7bca919286ea29d5376a
6
+ metadata.gz: 98c7df56653ddb12ba8b49d70d60232b04148e937a9877239afe485932402deeca0d7a1da75d36995b069de7da0b7b410adbf15b4edb94a494205adf43570341
7
+ data.tar.gz: bad42d7d59784d89a512d029097e06835a127ca479ec054b8d8ad2c1bf2c1f46dd7feef9901e610b6b59e5875a6bfc034000cd149a16d092039b9cf60d300180
@@ -65,7 +65,7 @@ module Kitchen
65
65
  require_chef_omnibus: false,
66
66
  product_name: nil,
67
67
  chef_omnibus_root: '/opt/chef',
68
- sudo: false,
68
+ sudo: false
69
69
  )
70
70
  end
71
71
  # Ditto to the above, other verifiers will need their own hacks, but
@@ -83,18 +83,18 @@ module Kitchen
83
83
  instance.verifier.send(:define_singleton_method, :runner_options) do |transport, state = {}, platform = nil, suite = nil|
84
84
  if transport.is_a?(Kitchen::Transport::K8s)
85
85
  {
86
- "backend" => "k8s_hack",
87
- "logger" => logger,
88
- "pod" => state[:pod_id],
89
- "container" => "default",
90
- "kubectl_path" => _config[:binary],
91
- "context" => _config[:context],
86
+ backend: 'k8s_hack',
87
+ logger: logger,
88
+ pod: state[:pod_id],
89
+ container: 'default',
90
+ kubectl_path: _config[:binary],
91
+ context: _config[:context],
92
92
  }.tap do |runner_options|
93
93
  # Copied directly from kitchen-inspec because there is no way not to. Sigh.
94
- runner_options["color"] = (config[:color].nil? ? true : config[:color])
95
- runner_options["format"] = config[:format] unless config[:format].nil?
96
- runner_options["output"] = config[:output] % { platform: platform, suite: suite } unless config[:output].nil?
97
- runner_options["profiles_path"] = config[:profiles_path] unless config[:profiles_path].nil?
94
+ runner_options['color'] = (config[:color].nil? ? true : config[:color])
95
+ runner_options['format'] = config[:format] unless config[:format].nil?
96
+ runner_options['output'] = config[:output] % { platform: platform, suite: suite } unless config[:output].nil?
97
+ runner_options['profiles_path'] = config[:profiles_path] unless config[:profiles_path].nil?
98
98
  runner_options[:controls] = config[:controls]
99
99
  end
100
100
  else
@@ -127,11 +127,11 @@ module Kitchen
127
127
  status = client.get_pod(pod_id, config[:namespace]).status.phase
128
128
  end
129
129
  platform_dependencies.each do |cmd|
130
- run_command(kubectl_command('exec', '--tty', '--container=default', pod_id, '--', *Shellwords.split(cmd)))
130
+ run_command(kubectl_command('exec', '--tty', '--container=default', pod_id, '--', *Shellwords.split(wrap_command(cmd))))
131
131
  end
132
132
  if config[:provision_command]
133
133
  config[:provision_command].each do |cmd|
134
- run_command(kubectl_command('exec', '--tty', '--container=default', pod_id, '--', *Shellwords.split(cmd)))
134
+ run_command(kubectl_command('exec', '--tty', '--container=default', pod_id, '--', *Shellwords.split(wrap_command(cmd))))
135
135
  end
136
136
  end
137
137
  state[:pod_id] = pod_id
@@ -146,6 +146,10 @@ module Kitchen
146
146
 
147
147
  protected
148
148
 
149
+ def wrap_command(cmd)
150
+ cmd.match(/\Ash\s\-c/) ? cmd : Util.wrap_command(cmd.gsub('\'', "'\\\\''"))
151
+ end
152
+
149
153
  # Get an instance of Kubeclient::Client
150
154
  def kubectl_client
151
155
  kubeconfig = Kubeclient::Config.read(config[:kubeconfig])
@@ -1,6 +1,6 @@
1
1
  module Kitchen
2
2
  module Driver
3
3
  # Version string for k8s Kitchen driver
4
- K8S_VERSION = '0.9.3'.freeze
4
+ K8S_VERSION = '0.9.8'.freeze
5
5
  end
6
6
  end
@@ -3,6 +3,7 @@ require 'mixlib/shellout'
3
3
  require 'train'
4
4
 
5
5
  module Train::Transports
6
+ # Hack for verifier
6
7
  class K8sHack < Train.plugin(1)
7
8
  name 'k8s_hack'
8
9
 
@@ -23,6 +24,7 @@ module Train::Transports
23
24
  @connection
24
25
  end
25
26
 
27
+ # Base
26
28
  class Connection < BaseConnection
27
29
  if Gem::Requirement.create('< 0.30').satisfied_by?(Gem::Version.create(Train::VERSION))
28
30
  # The API for a connection changed a lot in 0.30, this is a compat shim.
@@ -68,4 +70,4 @@ module Train::Transports
68
70
  end
69
71
  end
70
72
  end
71
- end
73
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-k8s
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris McFee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-20 00:00:00.000000000 Z
11
+ date: 2018-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kubeclient