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

fix #5 - Breaks when a Package title != name #6

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

giuliano108
Copy link
Contributor

Fixes #5 .

When computing the set of managed packages, we can't just look them up by title in the Catalog. Because title and name can be different, we need to look into the "resource aliases" table too.

package {'arbitrarytitle': name => 'pkgname'}

I couldn't find a public API to access @aliases, hence the instance_variable_get hack... :(

The @aliases data structure looks as follows:

[4] pry(#<Puppet::Type::Aptly_purge>)> catalog.instance_variable_get :@aliases
=> {"Class[Main]"=>[["Class", "main"]],
 "Package[ubuntu-minimal]"=>[["Package", "ubuntu-minimal", :held_apt]],
 "Package[puppetlabs-release-pc1]"=>[["Package", "puppetlabs-release-pc1", :held_apt]],
 "Package[puppet-agent]"=>[["Package", "puppet-agent", :held_apt]],
 "Package[openssh-server]"=>[["Package", "openssh-server", :held_apt]],
 "Package[fortunespkg]"=>[["Package", "fortunes", :held_apt]],
 "Aptly_purge[packages]"=>[["Aptly_purge", :packages]]}

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.

None yet

2 participants