openshift/openshift-extras — pull request #508 by dobbymoodge (2014-12-03 21:50:20+00:00)
Title: yum-validator: avoid content overrides if possible, bail on fail

Adds logic to check if an override exists for a repo attribute and only
sets the new value via content override if an override already is in
place. Also added the `SubscriptionManagerError` exception so
`oo-admin-yum-validator` will bail with return code=2 if a call to
`subscription-manager` fails

Enterprise bug: 1166270
https://bugzilla.redhat.com/show_bug.cgi?id=1166270

yum-validator: rewrite priorities messaging

Since instructions to the user must now be grouped according to
overrides and non-overrides for RHSM repos, the `verify_priorities` and
`find_package_conflicts` methods have been more closely coupled in
method `run_priority_checks`. Repo priority changes are now deferred
until after both `verify_priorities` and `find_package_conflicts` have
been run, when appropriate (`_commit_resolved_pris`)

yum-validator: add check for yum-config-manager ver

To account for broken versions of `yum-config-manager`, added
`ycm_works` method, which checks for a minimum known-working
`yum-config-manager` version and caches the result

yum-validator: Update messaging to handle more cases

This change updates the output for each check to account for settings
which are stored as content overrides and to yield less error-prone
`yum-config-manager`-based instructions if a suitable version is
available.

Also:

* cleans up/unifies some of the output
* adds more intelligent quoting
* fixes the incorrect syntax identified in Bug 1167247
* eliminates redundant priority setting instructions

Enterprise bug: 1167247
https://bugzilla.redhat.com/show_bug.cgi?id=1167247
Enterprise bug: 1166270
https://bugzilla.redhat.com/show_bug.cgi?id=1166270
Enterprise bug: 1166276
https://bugzilla.redhat.com/show_bug.cgi?id=1166276
Enterprise bug: 1166277
https://bugzilla.redhat.com/show_bug.cgi?id=1166277

yum-validator: improve RHSM repo detection

This changes `repo_is_rhsm` so that the RHSM `RepoActionInvoker` method
`is_managed` is used instead of comparing the filename. This will work
even on systems where `manage_repos = 0` is set in `rhsm.conf` but a
valid subscription exists and repos from entitlements are provided from
a file other than `redhat.repo`

Also, `is_managed` is used to prevent repo overrides from being set on
systems that have that feature disabled.