-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ASM-6588: Apply the vib update on ESXi host #113
Conversation
Here are all relevant PRs: #113 - Puppet type and provider for ESXi updates |
Puppet.debug("Found pre-installed VIB #{installed_vib_data[:ID]}") | ||
end | ||
end | ||
vibs = resource[:vibs].is_a?(Array) ? resource[:vibs] : [resource[:vibs]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could just do vibs = Array(resource[:vibs])
or on line below Array(resource[:vibs]).each do |vib_data|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess since resource[:vibs] can be an Array of Hash, or a single Hash.
So basically for seconds case, we need single array hash.
Doing Array(resource[:vibs]) leads to array of array, instead of desired array of hash :
i.e. Array(resource[:vibs]) yields
[
["uri_path", "path_value"],
[:vib_path, "vib"], [:nfs_share, "/share"],
[:volume_name, "foo"]
]
whereas, [resource[:vibs]] yields:
[
{ "uri_path" => "path_value"},
{:vib_path => "vib" }, {:nfs_share => "/share"},
{:volume_name => "foo"}
]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Array(foo)
does exactly what you need:
irb(main):002:0> Array(:x)
=> [:x]
irb(main):003:0> Array([:x])
=> [:x]
hmm, wow, scratch that, you're right that's strange:
irb(main):004:0> Array({:x => 1})
=> [[:x, 1]]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well crap ;-) Good catch @kaushalgala
Puppet type and provider for ESXi VIB updates
@gavin-scott , have updated the PR addressing your feedback. |
Puppet type and provider for ESXi VIB updates