-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
Add a Array[String] argument of repo IDs to be enabled #78
Add a Array[String] argument of repo IDs to be enabled #78
Conversation
Rubocop wanted the addition of a few trailing commas on the tests as they currently exist. Adding these here ensures that they don't clutter my direct changes.
This commit reworks the main class to accept an array of repo IDs instead of the original boolean values. Each ID is used as the namevar of a repo define entity which uses the `subscription-manager repos --enable` command to activate.
This commit corrects a bug where an undefined repo list would cause the manifest to fail during compilation.
Corrected the os/family filter so that it works. For some reason the Facter.value syntax wasn't actually finding the structured ['os']['name'] fact so I had to convert to a ruby block. Additionally, the aggregation wasn't correct as the return values from each chunk were not hashes and therefore couldn't be merged.
Added the new parameter to both the README and the puppet strings. Also generated a new REFERENCE.md file using the puppetstring function.
Huh. Is there a reason that the rubocop configuration for this module expects exactly the opposite behavior for trailing comments than that of the default in |
Configure the enabled_repo_ids array to merge unique values when searching in hiera.
This has been updated to meet the build-requirements defined by travis.
.rspec
Outdated
--color | ||
--format documentation |
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.
why did you change this?
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.
Shoot - I didn't mean to commit that. I converted the module to be PDK compatible for my own local testing during development and I accidentally added this file. PDK changed a ton of stuff and I'm not familiar enough with Travis or the testing configuration in use on this module so I didn't add the other changes. I'll revert this for now.
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.
Very valuable changes. They require a new major version of the module in my point of view.
README.md
Outdated
@@ -51,6 +51,33 @@ You shouldn't specify the protocol, subscription-manager will use HTTP. For prox | |||
|
|||
The proxy settings will be used to register the system and as connection option for all the YUM repositories generated in `/etc/yum.repos.d/redhat.repo` | |||
|
|||
### Enabled Repos | |||
|
|||
A string array of repo IDs can now be provided as an argument to the class definition. This list will be used to enable the target repos if that has not already occurred. |
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'd rather say "can be provided" instead of "now".
class { 'rhsm': | ||
rh_user => 'myuser', | ||
rh_password => 'mypassword', | ||
enabled_repo_ids => [ |
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 like it!
rh_user => 'myuser', | ||
rh_password => 'mypassword', | ||
enabled_repo_ids => [ | ||
'rhel-7-server-rpms', |
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.
Has this been tested with non-RHEL repositories, e.g. custom repositories on Satellite 6?
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.
Unfortunately no, I don't have Satellite in my environment so I haven't tested anything like that.
@@ -0,0 +1,26 @@ | |||
Facter.add(:rhsm, type: :aggregate) do |
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.
This fact is a major change. For example, we rely on rhsm_subscription_type for a Satellite 5 to 6 migration.
@@ -12,9 +12,13 @@ | |||
# ::rhsm::repo { "rhel-${::operatingsystemmajrelease}-server-extras-rpms": } | |||
define rhsm::repo ( |
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.
empty braces ()
might be removed.
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.
Thinking about it again, it would be nice to have a parameter for disabling repositories, too. Or better than nice: we need this functionality but solve it in a additional module. It will simplify the configuration.
This change includes some minor tweaks to the readme file as well as adding in a build status and puppet version badge.
Added in the original rhsm_repos and rhsm_subscription_type facts for backward compatibility. These facts are now derived from the new rhsm structured fact to avoid doubling work.
@kallies should I add a version bump in this pull request? I'm assuming by major you mean 4.x.x? |
Yes, 4.0.0 would be nice. If there are no braking changes (no fact removal etc.) 3.2.0 is fine for me, too. @bastelfreak should the version bump be a separate PR? |
Added an explicit check to the enabled repos facts such that the fact will only be calculated if the subscription-manager command exists. This allows the fact to run on CentOS machines which have subscription-manager installed and prevents errors on those that do not.
An incorrect indendation was left within the enabled_repo_ids chunk when the test for subscription-manager was moved outside of the chunk. Should be all set now.
Because of the changed fact this is a breaking change and requires a new major release. You do not need to bump any version here, this will be triggered through the label I applied, during the next release. However, we need to ensure that an upgrade works smoothly for the users. I'm currently not sure how we should properly test it. |
@bastelfreak is this still backwards incompatible with the re-introduced 'rhsm_' facts? I also converted the confines statement to target the RedHat family again but caused it to skip execution for the list of enabled repos if the subscription-manager binary is missing. |
The following corrections are included in this commit: * enabled_repo_ids is nolonger optional, however, an empty array can be provided * Legacy syntax left in previous releases has been removed * PDK conversions which were accidentally committed have been removed * Compile with all deps is now selected.
|
||
## Development | ||
|
||
Some general guidelines on PR structure can be found [here](https://voxpupuli.org/docs/#reviewing-a-module-pr). |
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.
neat, we should add that to all modules.
@pdemonaco you're right, I think this is fine now. Please align the |
Alignment of the equal signs on the interface to the primary class.
@bastelfreak will this generate a new version on the puppet forge automatically? |
No, we will have to do a new release, maybe in the next few days. |
That looks like an awesome PR! I can't wait to try it (when I find time to do so). Thanks! |
Pull Request (PR) description
This request introduces three primary changes
enabled_repo_ids
has been added to the rhsm class to allow an array of strings.This Pull Request (PR) fixes the following issues