knife-vrealize 1.3.0 → 1.3.1

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: 578b154a3ccbf57ebe1e6ebc53ab5e0f787880fd
4
- data.tar.gz: 387f75225a0c35f7e9da8c6fb8e89e0a966e2746
3
+ metadata.gz: 07d9ed1c0da967a7f546ea03d5b82b603a80e72f
4
+ data.tar.gz: 0d59826e9bd3cbc25639432815870cc2b62f73f5
5
5
  SHA512:
6
- metadata.gz: d95052a813c5ca77126f8d223bc6808993fd63843379a0356ecf03b7c5dd2d44abb7c33ac1246e8eb09d6d8883eeee50b300d404fc633b5d6076cf00c4bb98ca
7
- data.tar.gz: 0c8f5c49e7537f9ed02aaa1e2671ac4baee6a1f0d52fa1bcf382346faaaf7a098ce2c88874913bd86435838357ed28aee9863590d00094dfa2ed0bf8f8d022d3
6
+ metadata.gz: bf7a696e7bcfe5cdca74c065943d01b35a1fb3a32d5b07f72f01a7603894405057e3d67ff03b81c54c0f932f6e291ed552efd88c97551f3edb38817729304b9c
7
+ data.tar.gz: 01bf0b0454049fdab9fd9af2f529e8b3aa32576d0769a3299af3c88c10b88faa208bd79003e25dcdb343b3ac0655d8688948fbfec27b75867bc797223b092839
@@ -1,5 +1,8 @@
1
1
  # knife-vrealize Change Log
2
2
 
3
+ ## Release: v1.3.1
4
+ * [pr#9](https://github.com/chef-partners/knife-vrealize/pull/9) Bug fix for handling of extra parameters, which were never properly sent to the vRA API
5
+
3
6
  ## Release: v1.3.0
4
7
  * [pr#8](https://github.com/chef-partners/knife-vrealize/pull/8) Allow configuration of pagination result set size to work around known vRA pagination bug.
5
8
 
@@ -128,9 +128,9 @@ class Chef
128
128
  catalog_request.notes = options[:notes] unless options[:notes].nil?
129
129
  catalog_request.subtenant_id = options[:subtenant_id] unless options[:subtenant_id].nil?
130
130
 
131
- if options[:vra_extra_params]
132
- options[:vra_extra_params].each do |key, value_data|
133
- catalog_request.set_parameter(key, value_data[:type], value_data[:value])
131
+ if options[:extra_params]
132
+ options[:extra_params].each do |param|
133
+ catalog_request.set_parameter(param[:key], param[:type], param[:value])
134
134
  end
135
135
  end
136
136
 
@@ -113,15 +113,12 @@ class Chef
113
113
  end
114
114
 
115
115
  def extra_params
116
- return unless Chef::Config[:knife][:vra_extra_params]
116
+ return if Chef::Config[:knife][:vra_extra_params].nil? || Chef::Config[:knife][:vra_extra_params].empty?
117
117
 
118
- params = []
119
- Chef::Config[:knife][:vra_extra_params].each do |key, value_str|
118
+ Chef::Config[:knife][:vra_extra_params].each_with_object([]) do |(key, value_str), memo|
120
119
  type, value = value_str.split(':')
121
- params << { key: key, type: type, value: value }
120
+ memo << { key: key, type: type, value: value }
122
121
  end
123
-
124
- params
125
122
  end
126
123
 
127
124
  def validate_extra_params!
@@ -17,5 +17,5 @@
17
17
  #
18
18
 
19
19
  module KnifeVrealize
20
- VERSION = '1.3.0'
20
+ VERSION = '1.3.1'
21
21
  end
@@ -240,10 +240,10 @@ describe Chef::Knife::Cloud::VraService do
240
240
  cpus: 1,
241
241
  memory: 512,
242
242
  requested_for: 'myuser@corp.local',
243
- vra_extra_params: {
244
- 'key1' => { type: 'string', value: 'value1' },
245
- 'key2' => { type: 'integer', value: '2' }
246
- })
243
+ extra_params: [
244
+ { key: 'key1', type: 'string', value: 'value1' },
245
+ { key: 'key2', type: 'integer', value: '2' }
246
+ ])
247
247
  end
248
248
  end
249
249
  end
@@ -22,6 +22,10 @@ require 'support/shared_examples_for_command'
22
22
  require 'support/shared_examples_for_servercreatecommand'
23
23
 
24
24
  describe Chef::Knife::Cloud::VraServerCreate do
25
+ before(:each) do
26
+ Chef::Config.reset
27
+ end
28
+
25
29
  argv = []
26
30
  argv += %w(--cpus 1)
27
31
  argv += %w(--memory 512)
@@ -60,14 +64,33 @@ describe Chef::Knife::Cloud::VraServerCreate do
60
64
  end
61
65
 
62
66
  describe '#extra_params' do
63
- it 'parses extra parameters properly' do
64
- params = subject.extra_params
65
- expect(params[0][:key]).to eq 'key1'
66
- expect(params[0][:type]).to eq 'string'
67
- expect(params[0][:value]).to eq 'value1'
68
- expect(params[1][:key]).to eq 'key2'
69
- expect(params[1][:type]).to eq 'integer'
70
- expect(params[1][:value]).to eq '2'
67
+ context 'when there are no extra params' do
68
+ before do
69
+ Chef::Config[:knife][:vra_extra_params] = {}
70
+ end
71
+
72
+ it 'returns nil' do
73
+ expect(subject.extra_params).to eq(nil)
74
+ end
75
+ end
76
+
77
+ context 'when extra params are provided' do
78
+ before do
79
+ Chef::Config[:knife][:vra_extra_params] = {
80
+ 'key1' => 'string:value1',
81
+ 'key2' => 'integer:2'
82
+ }
83
+ end
84
+
85
+ it 'parses extra parameters properly' do
86
+ params = subject.extra_params
87
+ expect(params[0][:key]).to eq 'key1'
88
+ expect(params[0][:type]).to eq 'string'
89
+ expect(params[0][:value]).to eq 'value1'
90
+ expect(params[1][:key]).to eq 'key2'
91
+ expect(params[1][:type]).to eq 'integer'
92
+ expect(params[1][:value]).to eq '2'
93
+ end
71
94
  end
72
95
  end
73
96
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-vrealize
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
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-10-26 00:00:00.000000000 Z
11
+ date: 2015-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef