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

Support ensuring all yum group packages are installed #140

Merged
merged 1 commit into from
Jan 30, 2020

Conversation

treydock
Copy link

Pull Request (PR) description

Update yum::group to have additional state of latest that will ensure all mandatory packages of a group are always installed.

When a mandatory package is not installed for a group that is installed it will be prefixed with +. Without this change any changes to a mandatory package list would never get installed without manual intervention.

We use package groups to ensure baseline package list and it's much faster to apply one package group than dozens of individual Package resources.

if $ensure == 'latest' {
exec { "yum-groupinstall-${name}-latest":
command => join(concat(["yum -y groupinstall '${name}'"], $install_options), ' '),
onlyif => "yum groupinfo '${name}' | egrep '\\s+\\+'",
Copy link

@othalla othalla Jul 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please explain what you're expecting to filter with egrep

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic is looking for +package in the list from groupinfo. If there is no package with + (plus sign) then all packages in the package group are installed and it's not necessary to run yum groupinstall. If a package in the package list has + then it is in the group but not installed on the system so yum groupinstall will ensure all packages get installed.

The existing Exec covers the initial install but the output from yum grouplist hidden $group does not change if some packages are added to a group after it's installed. This PR covers that case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please comment what the regex is meant to do above the regex.

@treydock
Copy link
Author

I've applied this PR to my environment where I had a local package group installed. I then added 2 packages to that group and ran Puppet and this change allowed my systems to pick up that package group update and install the new additions to the group. Before this change I'd have to manually install additional packages via something like mcollective.

Copy link

@othalla othalla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me

@LongLiveCHIEF
Copy link

I like it. 👍

Copy link

@othalla othalla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If i'm right the latest option just ensure all packages from the given group are installed? If yes, i guess we can accept it.

@treydock
Copy link
Author

@othalla Correct, latest just ensures the entire group is installed, doesn't check to see if they are the newest version.

@treydock
Copy link
Author

Any update on getting this merged?

@othalla
Copy link

othalla commented Jan 29, 2020

@bastelfreak what do you think?

if $ensure == 'latest' {
exec { "yum-groupinstall-${name}-latest":
command => join(concat(["yum -y groupinstall '${name}'"], $install_options), ' '),
onlyif => "yum groupinfo '${name}' | egrep '\\s+\\+'",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please comment what the regex is meant to do above the regex.

manifests/group.pp Show resolved Hide resolved
@ghoneycutt ghoneycutt merged commit 7fc2d1f into voxpupuli:master Jan 30, 2020
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.

4 participants