Forum: Cfengine Help
Subject: package_policy => "verify" under freebsd
Author: Igor
Link to topic: https://cfengine.com/forum/read.php?3,19188,19188#msg-19188
Hi!
I want check for some packages, installed it or no:
====PACKAGES_verify.cf===
body common control
{
bundlesequence => { "packages_verify" };
}
bundle agent packages_verify
{
packages:
"sudo-1.7.4.4"
package_policy => "verify",
package_method => freebsd,
classes => satisfied("pkg_ok");
reports:
pkg_ok::
"sudo-1.7.4.4 installed";
}
body package_method freebsd
{
any::
package_changes => "individual";
# Could use rpm for this
package_list_command => "/usr/sbin/pkg_info";
# Remember to escape special characters like |
package_list_name_regex => "([^-]+).*";
package_list_version_regex => "[^-]+-([^\s]+).*";
package_name_regex => "([^-]+).*";
package_version_regex => "[^-]+-([^\s]+).*";
package_installed_regex => ".*";
package_name_convention => "$(name)-$(version)";
# package_name_convention => "${localpkgpath}/$(name)-$(version)";
package_verify_command => "/usr/sbin/pkg_info -qE";
package_add_command => "/usr/sbin/pkg_add";
package_delete_command => "/usr/sbin/pkg_delete -f";
package_update_command => "/usr/local/sbin/portupgrade -PP";
}
body classes satisfied(x)
{
promise_repaired => { "$(x)" };
persist_time => "0";
}
===============
body package_method freebsd taken from stdlib except package_verify_command
defined as pkg_info -qE.
Version sudo-1.7.4.3_1 installed on server. I want check installed new version
1.7.4.4 or not.
#cf-agent -I -K -f PACKAGES_verify.cf
Q:pkg_info -qE sudo-1. ...:
R: sudo-1.7.4.4 installed
#cf-agent -v -K -f PACKAGES_verify.cf
cf3 =========================================================
cf3 packages in bundle packages_verify (1)
cf3 =========================================================
cf3
cf3 Extended process options are only available with Cfengine Nova or above
cf3
cf3 .........................................................
cf3 Promise handle:
cf3 Promise made by: sudo-1.7.4.4
cf3 .........................................................
cf3
cf3 ???????????????????????????????????????????????????????????????
cf3 Reading package list from /usr/sbin/pkg_info
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 implicitly in promiser's name
cf3 -> Looking for (sudo,*,*)
cf3 -> Matched name sudo
cf3 -> Matched version *
cf3 -> Looking for (sudo,1.7.4.4,*)
cf3 -> Matched name sudo
cf3 -> Check for compatible versioning model in (1.7.4.4,1.7.4.3_1)
cf3 -> Verified that versioning models are compatible
cf3 -> Verified version constraint promise kept
cf3 -> 1 package(s) matching the name "sudo" already installed
cf3 -> 1 package(s) match the promise body's criteria fully
cf3 -> Package promises to refer to itself as "sudo-1.7.4.4" to the manager
cf3 -> Package version seems to match criteria
cf3 -> Schedule package for verification
cf3 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
cf3 Offering these package-promise suggestions to the managers
cf3 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
cf3 -> Deletion schedule...
cf3 -> Addition schedule...
cf3 -> Update schedule...
cf3 -> Patch schedule...
cf3 -> Verify schedule...
cf3 Execute scheduled package verification
cf3 Command prefix: /usr/sbin/pkg_info -qE
cf3 Executing /usr/sbin/pkg_info -qE sudo-1.7.4.4...
cf3 Q:pkg_info -qE sudo-1. ...:
cf3 Package schedule execution ok for sudo-1.7.4.4 (outcome cannot be promised
by cf-agent)
cf3 ?> defining promise result class pkg_ok
cf3
cf3 =========================================================
cf3 reports in bundle packages_verify (1)
cf3 =========================================================
cf3
cf3 Extended process options are only available with Cfengine Nova or above
cf3
cf3 .........................................................
cf3 Promise handle:
cf3 Promise made by: sudo-1.7.4.4 installed
cf3 .........................................................
cf3
cf3 Reporting about this...
cf3 R: sudo-1.7.4.4 installed
{skip}
So, i have wrong result. How i can use pkg_info for correct works with "verify"
package policy?
---
Igor
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine