Perfect. That worked. The other problem appears to have been comments getting parsed as part of the packages command!
Here is what failed:
packages:
debian::
bind9
version=1\:9.5.1.dfsg.P2-1
cmp=eq
define=bind_installed
elsedefine=bind_not_installed
#version="0:9.3.4"
#version="1:9.5.1.dfsg.P2-1"
#version=1
#version=1:9.5.1.dfsg.P2-1
#version=9.3.4
#version=9.5.1
And here is what worked:
packages:
debian::
bind9
version=1\:9.5.1.dfsg.P2-1
cmp=ge
define=bind_installed
elsedefine=bind_not_installed
# version="0:9.3.4"
# version="1:9.5.1.dfsg.P2-1"
# version=1
# version=1:9.5.1.dfsg.P2-1
# version=9.3.4
# version=9.5.1
Before moving the comments I saw messages with version numbers coming from the
comments. :-/
Can anyone else confirm?
--
Daniel Ortmann <[email protected]>
612-518-3147 m, 651-455-1442 h, dortmann31415 Skype
Key fingerprint = 2605 DFA4 A828 F840 9EBF C3C4 20EB F2C7 ED34 E8B4
On Mon April 27 12:54:28 pm Eric Searcy wrote:
Daniel Ortmann wrote:
> Hello,
>
> Am I the only one having problems with package versions not being
recognized?
> I am running the recent jaunty ubuntu with the following bind9 installed as
> reported by dpkg --list bind9:
> 1:9.5.1.dfsg.P2-1
>
> Cfengine2 has a problem recognizing that bind9 is installed. The system
> architecture is x86_64 (i.e. Core2 Duo).
>
> I am running configurations modified from Nate Campi and Kirk Bauer's recent
> excellent book "Automating Linux and Unix System Administration".
>
> Note that DefaultPkgMgr = ( dpkg ) as in the book.
>
> I have tried the variations on the following packages section, including no
> version as well as all the other versions listed here and "ge" and "eq".
>
> packages:
> debian::
> bind9
> #version=1:9.5.1.dfsg.P2-1
> #version="1:9.5.1.dfsg.P2-1"
> version=9.3.4
I suspect this is a cf parsing issue rather than something going awry in
the package.c routine. The test that is done is based on the string in
the "Installed:" portion of "apt-cache policy pkgname." If it matches
exactly your version=, then cmp=le, cmp=ge, and cmp=eq will match. If
the string doesn't match (aside from the "(none)" case) it uses "dpkg
--compare-versions INSTALLEDVER {gt|lt} CFVER" to determine comparison.
So ...
There might be an issue with the colon here, which in some cases you
need to escape (like in shellcommands). So maybe:
version=1\:9.5.1.dfsg.P2-1
Unfortunately DPKGPackageCheck() never verbosely outputs the version
asked for, but you can find it in the debug promise output.
Here's a snippet from `cfagent -qdn -j packages':
> PROMISED PACKAGE CHECKS
>
> ExpandVarstring( httpd.x86_64 )
> Add |httpd.x86_64| to str, waiting at ||
> Returning varstring (httpd.x86_64)
> Package "httpd.x86_64" promises
> Search constraint body:
> Will have version ge 2.2.3-11.el5_2.centos.4
> Behaviour constraint body:
> Promise to install package
> Using Package database: rpm
> IfElapsed=0, ExpireAfter=120
> Define if matches
> ElseDefine if no match
> Rule from /var/cfengine/inputs/httpd at/before line 11
What do you have in there under "search constraint body" when you have
version=1:9.5.1.dfsg.P2-1, and does using a backslash help?
Eric
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Bug-cfengine mailing list [email protected] https://cfengine.org/mailman/listinfo/bug-cfengine
