kitchen-dokken 2.0.1 → 2.0.2

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: 7c5b7b7002c7d29ca102d308c4181c17b6784a23
4
- data.tar.gz: 2fd2ed37b36d7e06fc2052457ea7c55794c0a361
3
+ metadata.gz: 81daf71f8d536cfea2ed2c3cc01515f1314c6e5b
4
+ data.tar.gz: 2b534fd81353056a9dcc0b979f4851f34da2c361
5
5
  SHA512:
6
- metadata.gz: 1a7a73124810ce381907b0be9d087a5de2a1fcad14c9d7f995f475d622bfd0a2c38ce82fb0b47bdee4ccef37ec487356d84e9e5fcf5fd7bcd1aaa4c47484d7c6
7
- data.tar.gz: d9a383aae0f51ab4c6c860c63716a93eec01635a2209e890a6d277919a523c7a9600351a19082cb31774f08dc975c61712a65f0fc5204fc330ef358d4f949e0e
6
+ metadata.gz: 66e0a6d48b6c8491b46c4b16fb12cb2ebc885ce70357b62bf0cbd14c451b066fee8c8c358168e830d6e95518710f8679ec65537ffc56a1fa767fd2117373eee0
7
+ data.tar.gz: 68fc9c3c03950a75a5169cd779ac9669da7d1801d28cbf698df09c3d12e1dda325b8c72c2c3d22e26ce972a0007914290a765c971ed7f28909fab6e96f49ab5e
@@ -86,7 +86,7 @@ module Kitchen
86
86
  stop_data_container
87
87
  delete_data_container
88
88
  end
89
-
89
+
90
90
  stop_runner_container
91
91
  delete_runner_container
92
92
  delete_work_image
@@ -19,6 +19,6 @@
19
19
  module Kitchen
20
20
  module Driver
21
21
  # Version string for Dokken Kitchen driver
22
- DOKKEN_VERSION = '2.0.1'.freeze
22
+ DOKKEN_VERSION = '2.0.2'.freeze
23
23
  end
24
24
  end
@@ -64,7 +64,7 @@ module Kitchen
64
64
  end
65
65
 
66
66
  def execute(command)
67
- return if command.nil?
67
+ require 'pry'; return if command.nil?
68
68
 
69
69
  with_retries { @runner = ::Docker::Container.get(instance_name, {}, docker_connection) }
70
70
  with_retries do
@@ -75,58 +75,58 @@ module Kitchen
75
75
  raise Transport::DockerExecFailed, "Docker Exec (#{@exit_code}) for command: [#{command}]" if @exit_code != 0
76
76
  end
77
77
 
78
- # def upload(locals, remote)
79
- # port = options[:data_container][:NetworkSettings][:Ports][:"22/tcp"][0][:HostPort]
80
-
81
- # if options[:host_ip_override]
82
- # # Allow connecting to any ip/hostname to support sibling containers
83
- # ip = options[:host_ip_override]
84
- # elsif options[:docker_host_url] =~ /unix:/
85
- # if options[:data_container][:NetworkSettings][:Ports][:"22/tcp"][0][:HostIp] == '0.0.0.0'
86
- # ip = options[:data_container][:NetworkSettings][:IPAddress]
87
- # port = '22'
88
- # else
89
- # # we should read the proper mapped ip, since this allows us to upload the files
90
- # ip = options[:data_container][:NetworkSettings][:Ports][:"22/tcp"][0][:HostIp]
91
- # end
92
- # elsif options[:docker_host_url] =~ /tcp:/
93
- # ip = options[:docker_host_url].split('tcp://')[1].split(':')[0]
94
- # else
95
- # raise Kitchen::UserError, 'docker_host_url must be tcp:// or unix://'
96
- # end
97
-
98
- # tmpdir = Dir.tmpdir
99
- # FileUtils.mkdir_p "#{tmpdir}/dokken"
100
- # File.write("#{tmpdir}/dokken/id_rsa", insecure_ssh_private_key)
101
- # FileUtils.chmod(0600, "#{tmpdir}/dokken/id_rsa")
102
-
103
- # begin
104
- # rsync_cmd = '/usr/bin/rsync -a -e'
105
- # rsync_cmd << ' \''
106
- # rsync_cmd << 'ssh -2'
107
- # rsync_cmd << " -i #{tmpdir}/dokken/id_rsa"
108
- # rsync_cmd << ' -o CheckHostIP=no'
109
- # rsync_cmd << ' -o Compression=no'
110
- # rsync_cmd << ' -o PasswordAuthentication=no'
111
- # rsync_cmd << ' -o StrictHostKeyChecking=no'
112
- # rsync_cmd << ' -o UserKnownHostsFile=/dev/null'
113
- # rsync_cmd << ' -o LogLevel=ERROR'
114
- # rsync_cmd << " -p #{port}"
115
- # rsync_cmd << '\''
116
- # rsync_cmd << " #{locals.join(' ')} root@#{ip}:#{remote}"
117
- # `#{rsync_cmd}`
118
- # rescue Errno::ENOENT
119
- # debug 'Rsync is not installed. Falling back to SCP.'
120
- # locals.each do |local|
121
- # Net::SCP.upload!(ip,
122
- # 'root',
123
- # local,
124
- # remote,
125
- # recursive: true,
126
- # ssh: { port: port, keys: ["#{tmpdir}/dokken/id_rsa"] })
127
- # end
128
- # end
129
- # end
78
+ def upload(locals, remote)
79
+ port = options[:data_container][:NetworkSettings][:Ports][:"22/tcp"][0][:HostPort]
80
+
81
+ if options[:host_ip_override]
82
+ # Allow connecting to any ip/hostname to support sibling containers
83
+ ip = options[:host_ip_override]
84
+ elsif options[:docker_host_url] =~ /unix:/
85
+ if options[:data_container][:NetworkSettings][:Ports][:"22/tcp"][0][:HostIp] == '0.0.0.0'
86
+ ip = options[:data_container][:NetworkSettings][:IPAddress]
87
+ port = '22'
88
+ else
89
+ # we should read the proper mapped ip, since this allows us to upload the files
90
+ ip = options[:data_container][:NetworkSettings][:Ports][:"22/tcp"][0][:HostIp]
91
+ end
92
+ elsif options[:docker_host_url] =~ /tcp:/
93
+ ip = options[:docker_host_url].split('tcp://')[1].split(':')[0]
94
+ else
95
+ raise Kitchen::UserError, 'docker_host_url must be tcp:// or unix://'
96
+ end
97
+
98
+ tmpdir = Dir.tmpdir
99
+ FileUtils.mkdir_p "#{tmpdir}/dokken"
100
+ File.write("#{tmpdir}/dokken/id_rsa", insecure_ssh_private_key)
101
+ FileUtils.chmod(0600, "#{tmpdir}/dokken/id_rsa")
102
+
103
+ begin
104
+ rsync_cmd = '/usr/bin/rsync -a -e'
105
+ rsync_cmd << ' \''
106
+ rsync_cmd << 'ssh -2'
107
+ rsync_cmd << " -i #{tmpdir}/dokken/id_rsa"
108
+ rsync_cmd << ' -o CheckHostIP=no'
109
+ rsync_cmd << ' -o Compression=no'
110
+ rsync_cmd << ' -o PasswordAuthentication=no'
111
+ rsync_cmd << ' -o StrictHostKeyChecking=no'
112
+ rsync_cmd << ' -o UserKnownHostsFile=/dev/null'
113
+ rsync_cmd << ' -o LogLevel=ERROR'
114
+ rsync_cmd << " -p #{port}"
115
+ rsync_cmd << '\''
116
+ rsync_cmd << " #{locals.join(' ')} root@#{ip}:#{remote}"
117
+ `#{rsync_cmd}`
118
+ rescue Errno::ENOENT
119
+ debug 'Rsync is not installed. Falling back to SCP.'
120
+ locals.each do |local|
121
+ Net::SCP.upload!(ip,
122
+ 'root',
123
+ local,
124
+ remote,
125
+ recursive: true,
126
+ ssh: { port: port, keys: ["#{tmpdir}/dokken/id_rsa"] })
127
+ end
128
+ end
129
+ end
130
130
 
131
131
  def login_command
132
132
  @runner = options[:instance_name].to_s
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-dokken
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
  - Sean OMeara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-24 00:00:00.000000000 Z
11
+ date: 2017-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen