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

Manage yumrepos via data #40

Merged
merged 3 commits into from
Feb 13, 2017
Merged

Conversation

lamawithonel
Copy link

@lamawithonel lamawithonel commented Feb 6, 2017

This commit adds parameters to manage Yumrepo resources via data. The
primary parameter, repos, is simply a hash of Yumrepo resources for
digestion by an each loop similar to an old create_resources() call.
It does nothing on its own, acting only as a source of data. The other
parameters control the behavior of the resource instantiation loop.

The parameters managed_repos, os_default_repos, and
repo_exclusions each take an array of key names from the repos hash.
They are then combined to select a set of repos from the repos hash
for instantiation. The formula takes one of the following two forms:

`managed_repos` - `repo_exclusions`

OR, if manage_os_default_repos is set to true

`managed_repos` + `os_default_repos` - `repo_exclusions`

Data is included for most of the CentOS default repositories, with the
exception of the "archive" repos.

Copy link

@vinzent vinzent 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 understand this correctly you are providing default repos for the respective OS. If this is true, this IMHO shouldn't be enabled by default. Just enabling the management of yum shouldn't touch the yumrepos at all.

@@ -27,6 +27,7 @@
default_facts.merge!(YAML.load(File.read(File.expand_path('../default_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_facts.yml', __FILE__))
default_facts.merge!(YAML.load(File.read(File.expand_path('../default_module_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_module_facts.yml', __FILE__))
c.default_facts = default_facts
c.hiera_config = File.expand_path(File.join(__FILE__, '../fixtures/hiera.yaml'))
Copy link

Choose a reason for hiding this comment

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

i think this will be overriden by modulesync.

Copy link
Author

@lamawithonel lamawithonel Feb 6, 2017

Choose a reason for hiding this comment

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

As far as spec_helper.rb goes, I've filed a modulesync_config PR (voxpupuli/modulesync_config#317).

@lamawithonel lamawithonel force-pushed the repos branch 3 times, most recently from bd8d391 to 4b0e6bd Compare February 6, 2017 23:55
@lamawithonel
Copy link
Author

@vinzent This latest version adds a parameter to toggle management of the OS repos, defaulting to false. The spec test for the default case now checks that it includes zero Yumrepo resources.

Copy link
Member

@hunner hunner left a comment

Choose a reason for hiding this comment

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

I think this is complex, but does what's expected for people looking for this functionality.

# @param manage_os_default_repos [Boolean]
# Whether or not to add an operating system's default repos to the `managed_repos` array.
#
# @note Currently only valid on CentOS.
Copy link
Member

Choose a reason for hiding this comment

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

This parameter is valid on other OSs, but os_default_repos will provide no defaults for any OS other than CentOS 6/7. Perhaps say something like "currently only provides defaults for CentOS" on the os_default_repos parameter instead?

This commit adds parameters to manage Yumrepo resources via data.  The
primary parameter, `repos`, is a hash of Yumrepo resources for digestion
by an each loop similar to an old `create_resources()` call.  It does
nothing on its own, acting only as a source of data.  The othe
parameters control the behavior of the resource instantiation loop.

The parameters `managed_repos`, `os_default_repos`, and
`repo_exclusions` each take an array of key names from the `repos` hash.
They are then combined to select a set of repos from the `repos` hash
for instantiation.  The formula takes one of the following two forms:

    `managed_repos` - `repo_exclusions`

OR, if `manage_os_default_repos` is set to `true`

    `managed_repos` + `os_default_repos` - `repo_exclusions`

Data is included for most of the CentOS default repositories, with the
exception of the "archive" repos.
This commit makes the following fixups to the README file:

 * Bring header tags and titles in line with the Puppet, Inc. skeleton
 * Standardize on non-wrapped text
 * Clarifies documentation for `yum::versionlock` and `yum::install`
@lamawithonel
Copy link
Author

I've added a whole bunch of examples to the README. Hopefully they shed some light on why this is useful.

@bastelfreak bastelfreak merged commit 2ecfb6b into voxpupuli:master Feb 13, 2017
@traylenator traylenator added the enhancement New feature or request label Jun 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants