| Newsgroups |
gmane.comp.sysutils.cfengine.general |
| Message-ID |
<[email protected]> |
Thanks, Nick. My use of "package_method" was just a working trial, as that
seemed to offer "reinstall". Thanks for confirming it is deprecated.
Yes, I had wondered about two successive promises ("absent" then
"present"), even though it feels a little hacky and odd. But, further, a
quick manual trial to remove "sudo" had revealed an additional issue:
------------------------------------------
# yum remove sudo
Updating Subscription Management repositories.
Error:
Problem: The operation would result in removing the following protected
packages: sudo
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to
use not only best candidate packages)
#
------------------------------------------
In my years of RHEL-yum-tinkering, that is not a response from yum that I
had previously encountered. It seems to be trying to warn me off removing
it.
So would the sequence "absent-then-present" even work? And even if it did,
it looks like it might be walking along a cliff-edge in a hurricane.
At heart, what I'm after is a variant of promise-state "present" that is
"present and clean". But as I discovered above (see original message) "yum
reinstall sudo" isn't enough; it has to be preceded by "rm /etc/sudoers".
This is detectable-dirty in this particular use-case (my class
"etc_sudoers_mismatch"), but probably unable to be generalised for
arbitrary files in arbitrary RPMs.
-- David Lee
On Friday, 3 February 2023 at 15:48:48 UTC [email protected] wrote:
> The package_module based implementation of packages promises explicitly
> only supports a state (present or absent) not an action like re-install. If
> you want to do re-install, then you could promise absent and then promise
> present.
> https://docs.cfengine.com/docs/3.21/reference-promise-types-packages.html#policy
>
> In the above snippet I see that you are using the deprecated
> package_method based implementation. the package_version value *latest*
> is not something that is understood by package_method. *latest* is
> something that the package_module based implementation understands for a
> version. You can see that it's trying to compare 1.8.29-8.el8 to latest.
> Perhaps try an version number that rpmvercmp would understand or promise
> the two states that you want, first that the package is absent, and then
> that the package is present using the package_module based
> implementation.
>
--
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/c9db7a76-eded-4884-ac96-62f336385fa9n%40googlegroups.com.