yum reinstall

"[email protected]" <[email protected]>
Newsgroups gmane.comp.sysutils.cfengine.general
Message-ID <[email protected]>
Environment: lots of RHEL7 and RHEL8; CFE 3.15 (community); pkg maintenance 
via yum

The basic question: Getting CFEngine to reinstall (via yum) a damaged RPM.

The problem:  We have accumulated a lot of historical baggage and burden 
over the years.  In particular, the historical CFE-driven maintenance of 
"sudo" configuration had been to replace the main "/etc/sudoers" file.

The aim: It would be better if we could place our local config into a file 
within the subdirectory "/etc/sudoers.d/" (the easy bit) and let the main 
"/etc/sudoers" file simply be the RPM-supplied version (the difficult bit).

But how can we repair existing systems?  In particular, how can we then 
replace the main "/etc/sudoers" from the yum-managed RPM.

One minor, preliminary issue/wrinkle along the road with the underlying 
"yum":  a "yum reinstall sudo" doesn't replace that "/etc/sudoers" file.  
So it seems I need first to remove that file.  The "yum reinstall sudo" 
then successfully installs its clean version.  (But don't let that distract 
us too much here.)

But the main CFE problem is how to drive the "yum reinstall" from CFE.  I 
would have hoped that something like the following would work:
-----------------------------------------------------
  packages:
    etc_sudoers_mismatch::
      "sudo"
        package_policy => "reinstall",
        package_method => yum,
        package_version => "latest",
        action => immediate;
-----------------------------------------------------

But it seems not to work.  Output from "cf-agent -v ..." has two clauses.  
The first looks promising with its "decisive: MATCH"; but the second with 
its "returned NO_MATCH" seems to indicate a problem which blocks any 
reinstall:
-----------------------------------------------------
verbose: Comparing [installed] package (sudo,1.8.29-8.el8,x86_64) to [==] 
with given (sudo,*,*) [name,version,arch]^M
 verbose: Matched [installed] name 'sudo'^M
 verbose: Matched [installed] wildcard arch '*'^M
 verbose: Matched [installed] wildcard version '*'^M
 verbose: PackageMatch: package comparison for [installed] sudo was 
decisive: MATCH^M
 verbose: CheckPackageState: Installed package match for (sudo,*,*) 
[name,version,arch] was decisive: MATCH^M
 verbose: PackageMatch: looking for [available] (sudo,latest,*) 
[name,version,arch] in package manager /bin/rpm -qa --qf '%{name} %{arch} 
%{version}-%{release}\n'^M
...
 verbose: Comparing [available] package (sudo,1.8.29-8.el8,x86_64) to [==] 
with given (sudo,latest,*) [name,version,arch]^M
 verbose: Matched [available] name 'sudo'^M
 verbose: Matched [available] wildcard arch '*'^M
 verbose: Executing '/var/cfengine/bin/rpmvercmp '1.8.29-8.el8' eq 
'latest''^M
   debug: cf_pwait - waiting for process 4046273^M
   debug: cf_pwait - process 4046273 exited with code: 1^M
 verbose: returned: 1^M
 verbose: CompareVersions: Checked whether package version 1.8.29-8.el8 == 
latest: no^M
 verbose: Version comparison returned NO_MATCH for [available] package 
(sudo,1.8.29-8.el8,x86_64) to [==] with given (sudo,latest,*) 
[name,version,arch]^M
-----------------------------------------------------
and no re-installation happens.

(I have tried a few similar variants, but cannot find a magic formula.)

Any thoughts?  Any working model?

(Also, there seems almost no documentation about "reinstall" options.)

-- David Lee

-- 
You received this message because you are subscribed to the Google Groups "help-cfengine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/help-cfengine/081a321d-092b-4b74-bdb2-e8f90bd6578fn%40googlegroups.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.