kitchen-vra 1.0.0 → 1.1.0

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: f16b036a56b3f13f8def98498eb1a101c1feb02d
4
- data.tar.gz: fabcc430c9d91f4720625af34eef073c295c49d1
3
+ metadata.gz: 809c8cf566e76098fd34ca3428983d631d4e4170
4
+ data.tar.gz: f4863346038f89134bd1d9de0c60184abfeebed5
5
5
  SHA512:
6
- metadata.gz: 5bf076a6e0b2f56330977dbb00267d311a382178b89085ad94e2133bcbc7229b4eb500f2669f7e2d7ea559bf17f3fa23fe92565bb56d31522320e5e22790e861
7
- data.tar.gz: a6bbb96508c893bc1a022f3141d252a5abe40a54aa9b82abd37f147ff0143e37522abc478a04404fee4ada7bcd0b9cfdc163c5525c3c815927bab63542b340df
6
+ metadata.gz: dd0290ce381d0adfda2ea38de3d34afcf346e4a28c6692a7ad0f1c29e05ea84323e454ad55d26669f4378284c19d59e4c8f83e2266596f6bba5fd9f0691a8245
7
+ data.tar.gz: 97e02008a31a9a84e0e109b2bc873e18abf9f4bfe791d43f9beec8f563d74ded8c263f6e46e1ff11a645adc11dd986944a84432ed3617d5589b9ec2c44f23b2e
data/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ # kitchen-vra Changelog
2
+
3
+ ## v1.1.0 (2015-10-13)
4
+ * New `use_dns` option (defaults to false) for the driver to use the server name instead of the IP address - thanks to @stevehedrick in PR [#3](https://github.com/chef-partners/kitchen-vra/pull/3)
5
+
6
+ ## v1.1.0
7
+ * Initial reelase
8
+
data/README.md CHANGED
@@ -57,6 +57,7 @@ Other options that you can set include:
57
57
  * **requested_for**: the vRA login ID to list as the owner of this resource. Defaults to the vRA username configured in the `driver` section.
58
58
  * **subtenant_id**: the Business Group ID to list as the owner. This is required if the catalog item is a shared/global item; we are unable to determine the subtenant_id from the catalog, and vRA requires it to be set on every request.
59
59
  * **private_key_path**: path to the SSH private key to use when logging in. Defaults to '~/.ssh/id_rsa' or '~/.ssh/id_dsa', preferring the RSA key. Only applies to instances where SSH transport is used (i.e. does not apply to Windows hosts with the WinRM transport configured).
60
+ * **use_dns**: Defaults to `false`. Set to `true` if vRA doesn't manage vm ip addresses. This will cause kitchen to attempt to connect via hostname.
60
61
 
61
62
  These settings can be set globally under the top-level `driver` section, or they can be set on each platform, which allows you to set globals and then override them. For example, this configuration would set the CPU count to 1 except on the "large" platform:
62
63
 
@@ -50,6 +50,7 @@ module Kitchen
50
50
  file if File.exist?(file)
51
51
  end.compact.first
52
52
  end
53
+ default_config :use_dns, false
53
54
 
54
55
  def name
55
56
  'vRA'
@@ -60,11 +61,14 @@ module Kitchen
60
61
 
61
62
  server = request_server
62
63
  state[:resource_id] = server.id
63
-
64
- ip_address = server.ip_addresses.first
65
- raise 'No IP address returned for the vRA request' if ip_address.nil?
66
- state[:hostname] = server.ip_addresses.first
67
- state[:ssh_key] = config[:private_key_path] unless config[:private_key_path].nil?
64
+ if config[:use_dns]
65
+ raise 'No server name returned for the vRA request' if server.name.nil?
66
+ state[:hostname] = server.name
67
+ else
68
+ raise 'No IP address returned for the vRA request' if server.ip_addresses.first.nil?
69
+ state[:hostname] = server.ip_addresses.first
70
+ end
71
+ state[:ssh_key] = config[:private_key_path] unless config[:private_key_path].nil?
68
72
 
69
73
  wait_for_server(state, server)
70
74
  info("Server #{server.id} (#{server.name}) ready.")
@@ -18,6 +18,6 @@
18
18
 
19
19
  module Kitchen
20
20
  module Driver
21
- VRA_VERSION = '1.0.0'
21
+ VRA_VERSION = '1.1.0'
22
22
  end
23
23
  end
data/spec/vra_spec.rb CHANGED
@@ -41,7 +41,8 @@ describe Kitchen::Driver::Vra do
41
41
  requested_for: 'override_user@corp.local',
42
42
  notes: 'some notes',
43
43
  subtenant_id: '160b473a-0ec9-473d-8156-28dd96c0b6b7',
44
- lease_days: 5
44
+ lease_days: 5,
45
+ use_dns: false
45
46
  }
46
47
  end
47
48
 
@@ -102,16 +103,24 @@ describe Kitchen::Driver::Vra do
102
103
  expect(state[:resource_id]).to eq('e8706351-cf4c-4c12-acb7-c90cc683b22c')
103
104
  end
104
105
 
105
- describe 'getting the IP address from the server' do
106
- context 'when no IP addresses are returned' do
107
- it 'raises an exception' do
108
- allow(resource).to receive(:ip_addresses).and_return([])
106
+ describe 'setting the hostname in the state hash' do
107
+ context 'when use_dns is true' do
108
+ let(:config) { { use_dns: true } }
109
+ it 'raises an exception if the server name is nil' do
110
+ allow(resource).to receive(:name).and_return(nil)
109
111
  expect { driver.create(state) }.to raise_error(RuntimeError)
110
112
  end
113
+ it 'uses the server name as the hostname' do
114
+ driver.create(state)
115
+ expect(state[:hostname]).to eq('server1')
116
+ end
111
117
  end
112
-
113
- context 'when IP addresses are returned' do
114
- it 'sets the IP address as the hostname in the state hash' do
118
+ context 'when use_dns is false' do
119
+ it 'raises an exception if no IP address is available' do
120
+ allow(resource).to receive(:ip_addresses).and_return([])
121
+ expect { driver.create(state) }.to raise_error(RuntimeError)
122
+ end
123
+ it 'uses the IP address as the hostname' do
115
124
  driver.create(state)
116
125
  expect(state[:hostname]).to eq('1.2.3.4')
117
126
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-vra
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chef Partner Engineering
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-12 00:00:00.000000000 Z
11
+ date: 2015-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen
@@ -123,6 +123,7 @@ extra_rdoc_files: []
123
123
  files:
124
124
  - ".gitignore"
125
125
  - ".rubocop.yml"
126
+ - CHANGELOG.md
126
127
  - Gemfile
127
128
  - LICENSE.txt
128
129
  - README.md
@@ -152,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
153
  version: '0'
153
154
  requirements: []
154
155
  rubyforge_project:
155
- rubygems_version: 2.4.4
156
+ rubygems_version: 2.4.8
156
157
  signing_key:
157
158
  specification_version: 4
158
159
  summary: A Test Kitchen driver for VMware vRealize Automation (vRA)