kitchen-nodes 0.1.0.dev → 0.2.0.dev

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: df1c8dede4f01d42226a9fbfbc0f32d4fe97ca37
4
- data.tar.gz: 00ecf4c1ec8cbad7c709636ff31463f456cf08d6
3
+ metadata.gz: 16404efb54531fe1bd15a88b0f2ae15cc4fb16f2
4
+ data.tar.gz: 05845fd2866124fccc58a78f6c36c7fa18043a64
5
5
  SHA512:
6
- metadata.gz: bdd211c9b78b8b67834191f2634c9903a54f40f8889df6014a620be48efb590d68d92382c9726c9b8ff7bb96bba46026f1c2274c5692bc007ffff80d861e359b
7
- data.tar.gz: 4a5fa19be79e810f21caf38276ed929c2bebd83fa6a66126bb4862743ee2b3031e18923f79f66b85f5e946bf76507ad519780b6f760a653504b2a075e516f7c9
6
+ metadata.gz: 734bffbe6238d2ce7be508e64c938abcec242fa8546cbcf96e6e071cab35ae23e1dedcf90427eeba7a9a4b4600fbae4bd6d2da084a954253d30f78ce8ddf789d
7
+ data.tar.gz: 94b9f6d54f7caf1ae4fe9b5e1efaefb757474ddd6d5f2d1b7c04b4dc86a68677a1ebcb1c264ebf96d151ded31ea2780d8e2ab5c01a2a98b725fea10cdc6bbeda
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
+ spec.add_dependency 'net-ping'
22
+
21
23
  spec.add_development_dependency 'bundler', '~> 1.3'
22
24
  spec.add_development_dependency 'rake'
23
25
  end
@@ -18,9 +18,20 @@
18
18
 
19
19
  require "kitchen"
20
20
  require "kitchen/provisioner/chef_zero"
21
+ require "net/ping"
21
22
 
22
23
  module Kitchen
23
24
 
25
+ module Transport
26
+ class Winrm < Kitchen::Transport::Base
27
+ class Connection < Kitchen::Transport::Base::Connection
28
+ def node_session(retry_options = {})
29
+ session(retry_options)
30
+ end
31
+ end
32
+ end
33
+ end
34
+
24
35
  module Provisioner
25
36
 
26
37
  # Nodes provisioner for Kitchen.
@@ -39,11 +50,12 @@ module Kitchen
39
50
  node_file = File.join(node_dir, "#{instance.name}.json")
40
51
 
41
52
  state = Kitchen::StateFile.new(config[:kitchen_root], instance.name).read
53
+ ipaddress = get_reachable_guest_address(state) || state[:hostname]
42
54
 
43
55
  node = {
44
56
  :id => instance.name,
45
57
  :automatic => {
46
- :ipaddress => state[:hostname]
58
+ :ipaddress => ipaddress
47
59
  },
48
60
  :run_list => config[:run_list]
49
61
  }
@@ -51,6 +63,15 @@ module Kitchen
51
63
  File.open(node_file, 'w') do |out|
52
64
  out << JSON.pretty_generate(node)
53
65
  end
66
+ end
67
+
68
+ def get_reachable_guest_address(state)
69
+ instance.transport.connection(state).node_session.run_powershell_script("Get-NetIPConfiguration | % { $_.ipv4address.IPAddress}") do |address, _|
70
+ address = address.chomp unless address.nil?
71
+ next if address.nil? || address == "127.0.0.1"
72
+ return address if Net::Ping::External.new.ping(address)
73
+ end
74
+ return nil
54
75
  end
55
76
  end
56
77
  end
@@ -21,6 +21,6 @@ module Kitchen
21
21
  module Provisioner
22
22
 
23
23
  # Version string for Nodes Kitchen driver
24
- NODES_VERSION = "0.1.0.dev"
24
+ NODES_VERSION = "0.2.0.dev"
25
25
  end
26
26
  end
metadata CHANGED
@@ -1,41 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-nodes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.dev
4
+ version: 0.2.0.dev
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Wrock
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-24 00:00:00.000000000 Z
11
+ date: 2015-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: net-ping
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
- - - ~>
31
+ - - "~>"
18
32
  - !ruby/object:Gem::Version
19
33
  version: '1.3'
20
34
  type: :development
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
- - - ~>
38
+ - - "~>"
25
39
  - !ruby/object:Gem::Version
26
40
  version: '1.3'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rake
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
- - - '>='
45
+ - - ">="
32
46
  - !ruby/object:Gem::Version
33
47
  version: '0'
34
48
  type: :development
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
- - - '>='
52
+ - - ">="
39
53
  - !ruby/object:Gem::Version
40
54
  version: '0'
41
55
  description: A Test Kitchen Provisioner for Chef Nodes
@@ -45,8 +59,8 @@ executables: []
45
59
  extensions: []
46
60
  extra_rdoc_files: []
47
61
  files:
48
- - .gitignore
49
- - .travis.yml
62
+ - ".gitignore"
63
+ - ".travis.yml"
50
64
  - CHANGELOG.md
51
65
  - Gemfile
52
66
  - LICENSE
@@ -65,17 +79,17 @@ require_paths:
65
79
  - lib
66
80
  required_ruby_version: !ruby/object:Gem::Requirement
67
81
  requirements:
68
- - - '>='
82
+ - - ">="
69
83
  - !ruby/object:Gem::Version
70
84
  version: '0'
71
85
  required_rubygems_version: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - '>'
87
+ - - ">"
74
88
  - !ruby/object:Gem::Version
75
89
  version: 1.3.1
76
90
  requirements: []
77
91
  rubyforge_project:
78
- rubygems_version: 2.4.4
92
+ rubygems_version: 2.4.1
79
93
  signing_key:
80
94
  specification_version: 4
81
95
  summary: A Test Kitchen Provisioner for Chef Nodes