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

ncm-spma: yum: Expose support for multiple reposdirs #1236

Merged
merged 3 commits into from
Mar 29, 2018

Conversation

jrha
Copy link
Member

@jrha jrha commented Feb 7, 2018

The underlying module code supports multiple reposdirs so expose this through the schema.
Potentially replaces #1075.

@jrha jrha changed the title ncm-spma: yum: Support multiple reposdirs ncm-spma: yum: Expose support for multiple reposdirs Feb 7, 2018
@jrha
Copy link
Member Author

jrha commented Feb 7, 2018

Locally I'm seeing the FileEditor inserting extra blank lines again...

@jrha jrha force-pushed the reposdir branch 2 times, most recently from 142edd1 to e172d85 Compare February 7, 2018 09:15
@jrha
Copy link
Member Author

jrha commented Feb 7, 2018

Found and fixed the source of the extra blank lines, also the tests which were actually checking for this strange behaviour.

@@ -1015,7 +1015,7 @@ sub configure_yum
$fh->add_or_replace_lines(
$name,
$name. q{\s*=\s*}.$valuereg.'$',
"\n$name=$value\n",
"$name=$value\n",
Copy link
Member

Choose a reason for hiding this comment

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

what if the file doesn't end with a newline? i'm not sure FileEditor tests this...

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

FileEditor should deal with that, not the components.

Copy link
Member Author

Choose a reason for hiding this comment

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

The match should still work though...

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, the noaction test now starts with a file that has a missing newline at EOF.

@jrha
Copy link
Member Author

jrha commented Feb 7, 2018

@stdweird I've been trying to write an end-to-end test case that uses the new property in a profile and then checks that it exists in yum.conf but can't figure out how to get it to work. Are there any of the existing tests that I can steal from/extend?

@stdweird
Copy link
Member

stdweird commented Feb 7, 2018

no end to end tests. but yum-configure.t should show more dirs passed to configure_yum. and configure_yum is tested.

@jrha
Copy link
Member Author

jrha commented Feb 7, 2018

Also: any opinions on the name of the schema option?

Start with file with missing newline at EOF.
@jrha jrha added this to the 18.3 milestone Feb 7, 2018
@@ -37,6 +37,7 @@ type component_spma_yum = {
"run" ? legacy_binary_affirmation_string # Run the SPMA after configuring it
"userpkgs_retry" : boolean = true
"userpkgs" ? legacy_binary_affirmation_string # Allow user packages
"extra_reposdirs" ? absolute_file_path[] # List of additional repo dirs to be included
Copy link
Member

Choose a reason for hiding this comment

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

add comment as annotation. also add that the priority: indentical repos in the extra dir precede (or not?) the quattor generated ones.

Copy link
Member

Choose a reason for hiding this comment

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

wrt name: just reposdirs? or userreposdirs?

Copy link
Member Author

Choose a reason for hiding this comment

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

Just reposdirs seems fine, I'll make sure the annotation explains what happens with regards to the managed repodir. As far as precendence... I might have to experiment to see how yum behaves.

Copy link
Contributor

Choose a reason for hiding this comment

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

Given the yum.conf option is reposdir I think reposdirs makes sense. The only downside is this is additional config to be added to reposdir, there is no way to remove the default? OTOH that seems like such a niche use case that it's OK?

@jrha
Copy link
Member Author

jrha commented Feb 15, 2018

I've been playing around on a host with multiple reposdirs configured to see if one takes priority over another and there doesn't appear to be any form of precedence. It behaves the same as it does with all definitions in the same directory (or even same file).

All the repos are read and in the case of duplicate definitions, yum issues a warning and one of them (I haven't been able to predict which one) wins.

@jrha jrha force-pushed the reposdir branch 3 times, most recently from 1149969 to d6d2733 Compare February 15, 2018 16:28
@ned21
Copy link
Contributor

ned21 commented Feb 16, 2018

@jrha We should be able to detect duplicates in PAN and error out before it's deployed? For the priorities I think you need yum-plugin-priorities. So the schema should allow the setting of priorities - does that mean the list needs to become a dict?

@jrha
Copy link
Member Author

jrha commented Feb 19, 2018

@ned21 priorities are already supported in the individual repositories and work fine as is (we make heavy use of them). Unfortunately duplicates between managed and unmanaged repositories will be impossible to catch at build time, but that's the price you pay if you are want this functionality.

@jrha
Copy link
Member Author

jrha commented Mar 14, 2018

This has been well tested at RAL and seems to be working well for us. Could someone re-review it?

@@ -37,6 +37,8 @@ type component_spma_yum = {
"run" ? legacy_binary_affirmation_string # Run the SPMA after configuring it
"userpkgs_retry" : boolean = true
"userpkgs" ? legacy_binary_affirmation_string # Allow user packages
@{ List of additional repo dirs to be included }
Copy link
Member

Choose a reason for hiding this comment

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

make it more clear that this are additional repository directories that are not managed by ncm-spma. maybe replacing additional with external?

@@ -1168,6 +1168,9 @@ sub Configure
# TODO: for userpkgs, insert quattor unmanaged dir as first (so it takes priority)
# TODO: check that the first one wins
my $reposdir = [$quattor_managed_reposdir];
if ($t->{reposdirs}) {
$reposdir = [@$reposdir, @{$t->{reposdirs}}];
Copy link
Member

Choose a reason for hiding this comment

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

push(@$reposdir, @{$t->{reposdirs}})

@stdweird
Copy link
Member

@jrha tiny remarks

@jrha
Copy link
Member Author

jrha commented Mar 29, 2018

@stdweird comments addressed.

@stdweird stdweird merged commit 5c0e272 into quattor:master Mar 29, 2018
@jrha jrha deleted the reposdir branch April 3, 2018 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants