It was my regex if anyone was interested and I should have read the manual!!
The regex for package_installed_regex must match complete lines!!!
Type: string
Allowed input range: (arbitrary string)
Synopsis: Regular expression which matches packages that are already installed
Example:
body package_method yum
{
package_installed_regex => ".*installed.*";
}
Notes:
This regular expression must match complete lines in the output of the list
command that are actually installed packages (that is, the regex is anchored,
see Anchored vs. unanchored regular
expressions<http://www.cfengine.org/manuals/cf3-reference.html#Anchored-vs_002e-unanchored-regular-expressions>).
If all the lines match then the regex can be set of '.*', however most package
systems output prefix lines and a variety of human padding that needs to be
ignored.
Complete promise:-
body common control
{
bundlesequence => { "packages" };
}
#############################################
bundle agent packages
{
vars:
"package_name" string => "idsldap.cltbase61.rte";
packages:
"$(package_name)"
package_policy => "verify",
package_method => aix_lpp,
package_version => "6.1.0.3";
}
body package_method aix_lpp
{
aix::
package_changes => "individual";
package_list_command => "/usr/bin/lslpp -Or -cl";
package_list_name_regex => "^[^:]+\:([^\s:]+)";
package_list_version_regex => "^[^:]+\:[^:]+\:([^\s:]+)";
package_installed_regex => "^[^:]+\:[^:]+\:[^:]+\:\:(COMMITTED|APPLIED).*";
package_name_convention => "$(name)";
package_add_command => "/bin echo dummy";
package_delete_command => "/bin echo dummy";
package_verify_command => "/usr/bin/lppchk -fm3";
}
From: [email protected]
[mailto:[email protected]] On Behalf Of Jones, Stephen (MAS)
Sent: Monday, 14 February 2011 1:14 PM
To: [email protected]
Subject: Package Manager for AIX
All,
I've just started to use cfengine at my company and we have a mixture of Linux,
Solaris & AIX. I want to check for packages across all of these system and
examples are available for Linux & Solaris however not for AIX. Here is what I
have so far but it isn't working. I suspect it is something to do with my regex.
body common control
{
bundlesequence => { "packages" };
}
#############################################
bundle agent packages
{
vars:
"package_name" string => "idsldap.cltbase61.rte";
packages:
"$(package_name)"
package_policy => "verify",
package_method => aix_lpp,
package_version => "6.1.0.3";
}
#############################################
body package_method aix_lpp
{
aix::
package_changes => "individual";
package_list_command => "/usr/bin/lslpp -Or -cl";
package_list_name_regex => "^[^:]+\:([^\s:]+)";
package_list_version_regex => "^[^:]+\:[^:]+\:([^\s:]+)";
# package_installed_regex => "^[^:]+\:[^:]+\:[^:]+\:\:([^\s:]+)";
package_installed_regex => "^[^:]+\:[^:]+\:[^:]+\:\:(COMMITTED|APPLIED)";
package_name_convention => "$(name)";
package_add_command => "/bin echo dummy";
package_delete_command => "/bin echo dummy";
package_verify_command => "/usr/bin/lppchk -fm3";
}
The output of the package_list_command is as follows:-
# /usr/bin/lslpp -Or -cl | grep ids
/etc/objrepos:bos.rte.serv_aid:6.1.2.2::COMMITTED:F:Error Log Service Aids:
/etc/objrepos:bos.sysmgt.serv_aid:6.1.2.2::COMMITTED:F:Software Error Logging
and Dump Service Aids:
/etc/objrepos:bos.sysmgt.trace:6.1.2.4::COMMITTED:F:Software Trace Service Aids:
/etc/objrepos:idsldap.clt32bit61.rte:6.1.0.3::COMMITTED:I:Directory Server - 32
bit Client:
/etc/objrepos:idsldap.clt64bit61.rte:6.1.0.3::COMMITTED:I:Directory Server - 64
bit Client:
/etc/objrepos:idsldap.cltbase61.rte:6.1.0.3::COMMITTED:I:Directory Server -
Base Client:
#
To verify a package we have to use lppchk which by default has no output but
with the m3 flag produces the following if the package is ok.
# lppchk -fm3 idsldap.clt32bit61.rte
lppchk: 0504-230 28 files have been checked.
lppchk: 0504-230 0 files have been checked.
And the following if the package is not found
# lppchk -fm3 idsldap.clt32bit61.dummy
lppchk: 0504-226 No fileset entries were found that match the name -
idsldap.clt32bit61.dummy.
lppchk: 0504-227 No files were found that matched the file name given for
fileset idsldap.clt32bit61.dummy.
Not really sure how to deal with that?
Any cfengine gurus have any suggestions?
Thanks in advance.
Stephen Jones
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine