Skip to content
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

Merged
merged 1 commit into from
May 24, 2016

Conversation

kaushalgala
Copy link

Puppet type and provider for ESXi VIB updates

@kaushalgala
Copy link
Author

Here are all relevant PRs:

#113 - Puppet type and provider for ESXi updates
https://github.com/dell-asm/asm-deployer/pull/1613 - ASM-deployer class for mapping "asm::server_update" puppet defined resource
https://github.com/dell-asm/asm/pull/298 - Puppet manifest(asm::server_update) / helper parser function to apply server updates ( firmware and software )

Puppet.debug("Found pre-installed VIB #{installed_vib_data[:ID]}")
end
end
vibs = resource[:vibs].is_a?(Array) ? resource[:vibs] : [resource[:vibs]]

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|

Copy link
Author

@kaushalgala kaushalgala May 20, 2016

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"}
]

Copy link

@ripienaar ripienaar May 21, 2016

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]]

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
@kaushalgala
Copy link
Author

@gavin-scott , have updated the PR addressing your feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants