Hi,
Just getting started with cfengine. I am trying to verify that a
certain package is installed (rpm on a SLES9 system), and if it’s not,
install it from an rpm file stored in /usr/src/packages/RPMS. From my
understanding of the documentation, package_file_repositories in the
package_method body should do this:
package_file_repositories => { “/usr/src/packages/RPMS” };
However, this is doing nothing – cfengine is still trying to execute
the rpm command with the plain package specifier, without preceding it
by the appropriate path. Doing a simple search through the source
code, it seems the code to read package_file_repositories is there,
but there is no code that seems to _do_ something with it:
./attributes.c:p.package_file_repositories =
GetListConstraint("package_file_repositories",pp);
./cf3.defs.h: struct Rlist *package_file_repositories;
./verify_packages.c:if (a.packages.package_list_command == NULL &&
a.packages.package_file_repositories == NULL)
./mod_packages.c: {"package_file_repositories",cf_slist,"","A list
of machine-local directories to search for packages"},
Is this option currently not implemented? Am I doing something wrong?
I am using 3.0.3 community version.
As a workaround, I tried specifying the directory in package_add_command, i.e.
package_add_command => "/bin/rpm -i /usr/src/packages/RPMS/";
but cfengine seems to add a space automatically after the command, so
it also does not work.
Any ideas?
Thank you very much,
--Diego
ps. For completeness, here’s the example I am trying to run. The file
SysInfo-2.20.11.noarch.rpm is stored in /usr/src/packages/RPMS. Below
is the output I get.
#
# Package managment
#
body common control
{
bundlesequence => { "packages" };
}
#############################################
bundle agent packages
{
vars:
"exact_package" slist => {
"SysInfo"
};
"version[SysInfo]" string => "2.20.11";
# "packagefiles" string => "/usr/src/packages/RPMS";
packages:
"$(exact_package)"
package_policy => "add",
package_method => rpm,
package_select => ">=",
package_architectures => { "noarch" },
package_version => "$(version[$(exact_package)])";
}
#############################################
body package_method rpm
{
package_changes => "individual";
package_list_command => "/bin/rpm -qa --queryformat \"i | repos |
%{name} | %{version}-%{release} | %{arch}\n\"";
package_file_repositories => { "/usr/src/packages/RPMS" };
# Remember to escape special characters like |
package_list_name_regex => "[^|]+\|[^|]+\|\s+([^\s|]+).*";
package_list_version_regex => "[^|]+\|[^|]+\|[^|]+\|\s+([^\s|]+).*";
package_list_arch_regex => "[^|]+\|[^|]+\|[^|]+\|[^|]+\|\s+([^\s]+).*";
package_installed_regex => "i.*";
package_name_convention => "$(name)-$(version).$(arch).rpm";
package_add_command => "/bin/rpm -i ";
package_delete_command => "/bin/rpm -e --nodeps";
package_verify_command => "/bin/rpm -V";
package_noverify_regex => ".*[^\s].*";
}
-------------------
cftest1:~/cfengine-3.0.3/src # cf-agent -Kv -f
/var/cf-masterfiles/config/branches/cf3/inputs/test_packages.cf
cf3 Cfengine - autonomous configuration engine - commence
self-diagnostic prelude
cf3 ------------------------------------------------------------------------
cf3 Work directory is /var/cfengine
cf3 Making sure that locks are private...
cf3 Checking integrity of the state database
cf3 Checking integrity of the module directory
cf3 Checking integrity of the PKI directory
cf3 Looking for a source of entropy in /var/cfengine/randseed
cf3 Loaded /var/cfengine/ppkeys/localhost.priv
cf3 Loaded /var/cfengine/ppkeys/localhost.pub
cf3 Setting cfengine default port to 5308 = 5308
cf3 Reference time set to Wed Jan 13 16:08:23 2010
cf3 Cfengine - 3.0.3 (C) Cfengine AS 2008-
cf3 ------------------------------------------------------------------------
cf3 Host name is: cftest1
cf3 Operating System Type is linux
cf3 Operating System Release is 2.6.5-7.308-default
cf3 Architecture = i686
cf3 Using internal soft-class linux for host cftest1
cf3 The time is now Wed Jan 13 16:08:23 2010
cf3 ------------------------------------------------------------------------
cf3 # Extended system discovery is only available in version Nova and above
cf3 Additional hard class defined as: 32_bit
cf3 Additional hard class defined as: linux_2_6_5_7_308_default
cf3 Additional hard class defined as: linux_i686
cf3 Additional hard class defined as: linux_i686_2_6_5_7_308_default
cf3 GNU autoconf class from compile time: compiled_on_linux_gnu
cf3 Address given by nameserver: 127.0.0.2
cf3 Interface 1: lo
cf3 Interface 2: eth0
cf3 Trying to locate my IPv6 address
cf3 Found IPv6 address fe80::20c:29ff:feca:88a3
cf3 Looking for environment from cf-monitor...
cf3 Unable to detect environment from cfMonitord
cf3 This appears to be a SuSE system.
cf3 Looking for SuSE enterprise info in "SUSE LINUX Enterprise Server 9 (i586)"
cf3 This appears to be a LSB compliant system.
cf3 ***********************************************************
cf3 Loading persistent classes
cf3 ***********************************************************
cf3 ***********************************************************
cf3 Loaded persistent memory
cf3 ***********************************************************
cf3 > Parsing file
/var/cf-masterfiles/config/branches/cf3/inputs/test_packages.cf
cf3 Initiate variable convergence...
cf3 Initiate variable convergence...
cf3 # Knowledge map reporting feature is only available in version
Nova and above
cf3 -> Defined hard classes = { any verbose_mode Wednesday Hr16
Afternoon Min08 Min05_10 Q1 Hr16_Q1 Day13 January Yr2010 Lcycle_0
GMT_Hr0 linux cftest1_local local cftest1 32_bit
linux_2_6_5_7_308_default i686 linux_i686
linux_i686_2_6_5_7_308_default
linux_i686_2_6_5_7_308_default__1_Mon_Dec_10_11_36_40_UTC_2007
compiled_on_linux_gnu net_iface_lo net_iface_eth0 192_168_58_134
ipv4_192_168_58_134 ipv4_192_168_58 ipv4_192_168 ipv4_192
fe80__20c_29ff_feca_88a3 cfengine_3_0_3 cfengine_3_0 cfengine_3 SuSE
SLES9 lsb_compliant suse suse_n/a suse_9 agent }
cf3 -> Negated Classes = { }
cf3 Initiate variable convergence...
cf3 Initiate control variable convergence...
cf3 -> Bundlesequence => {'packages'}
cf3
cf3 *****************************************************************
cf3 BUNDLE packages
cf3 *****************************************************************
cf3
cf3
cf3 =========================================================
cf3 vars in bundle packages (1)
cf3 =========================================================
cf3
cf3 Verifying SQL table promises is only available with Cfengine Nova or above
cf3
cf3 + Private classes augmented:
cf3
cf3 - Private classes diminished:
cf3
cf3
cf3
cf3 =========================================================
cf3 packages in bundle packages (1)
cf3 =========================================================
cf3
cf3 Verifying SQL table promises is only available with Cfengine Nova or above
cf3
cf3 .........................................................
cf3 Promise handle:
cf3 Promise made by: SysInfo
cf3 .........................................................
cf3
cf3 ???????????????????????????????????????????????????????????????
cf3 Reading package list from /bin/rpm
cf3 ???????????????????????????????????????????????????????????????
cf3 # Software reporting feature is only available in version Nova and above
cf3 # Patch reporting feature is only available in version Nova and above
cf3 ???????????????????????????????????????????????????????????????
cf3 Done checking packages and patches
cf3 ???????????????????????????????????????????????????????????????
cf3 -> Package version specified explicitly in promise body
cf3 ... trying listed arch noarch
cf3 -> Looking for (SysInfo,*,*)
cf3 !! Unsatisfied constraints in promise (SysInfo,*,*)
cf3 -> Looking for (SysInfo,2.20.11,noarch)
cf3 !! Unsatisfied constraints in promise (SysInfo,2.20.11,noarch)
cf3 -> 0 package(s) matching the name "SysInfo" already installed
cf3 -> 0 package(s) match the promise body's criteria fully
cf3 -> Package promises to refer to itself as
"SysInfo-2.20.11.noarch.rpm" to the manager
cf3 -> Package version seems to match criteria
cf3 -> Schedule package for addition
cf3 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
cf3 Offering these package-promise suggestions to the managers
cf3 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
cf3 -> Deletion schedule...
cf3 -> Addition schedule...
cf3 Execute scheduled package addition
cf3 Command prefix: /bin/rpm -i
cf3 Executing /bin/rpm -i SysInfo-2.20.11.noarch.rpm...
cf3 Q:rpm -i SysInfo-2.20 ...:error: open of
SysInfo-2.20.11.noarch.rpm failed: No such file or directory
cf3 Q:rpm -i SysInfo-2.20 ...:
cf3 Package schedule execution ok for SysInfo-2.20.11.noarch.rpm
(outcome cannot be promised by cf-agent)
cf3 -> Update schedule...
cf3 -> Patch schedule...
cf3 -> Verify schedule...
cf3
cf3 + Private classes augmented:
cf3
cf3 - Private classes diminished:
cf3
cf3
cf3
cf3 =========================================================
cf3 packages in bundle packages (2)
cf3 =========================================================
cf3
cf3 Verifying SQL table promises is only available with Cfengine Nova or above
cf3
cf3 + Private classes augmented:
cf3
cf3 - Private classes diminished:
cf3
cf3
cf3
cf3 =========================================================
cf3 packages in bundle packages (3)
cf3 =========================================================
cf3
cf3 Verifying SQL table promises is only available with Cfengine Nova or above
cf3 Outcome of version (not specified) (agent-0): Promises observed to
be kept 50%, Promises repaired 50%, Promises not repaired 0%
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine