Forum: Cfengine Help Subject: Classes, methods: bug or what is wrong? Author: absinfo_...@yahoo.com Link to topic: https://cfengine.com/forum/read.php?3,18517,18517#msg-18517
Hi, I'm an Cfengine newbie, tried to use classes for achieving "per-host" or "per-farm" promises, but something goes wrong. >From the following code, isn't it supposed that bundle2 should not run if the >agent executing the promise is not from "ONE" class? Many thanks in advance! /Eduard Content for /tmp/1.cf body common control { bundlesequence => { "one" }; } bundle agent one { classes: "ONE" or => { "someserver", "Saturday" }; methods: "ONE" usebundle => bundle2 ("234"); } bundle agent bundle2 (p1) { reports: debian:: "$(p1)"; } The results: depsrv1 ~ # cf-agent -f /tmp/1.cf -I -K R: 234 depsrv1 ~ # And the verbose output: depsrv1 ~ # cf-agent -f /tmp/1.cf -I -K -v 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 Tue Sep 28 08:15:33 2010 cf3 Cfengine - 3.0.5p1 (C) Cfengine AS 2008- cf3 ------------------------------------------------------------------------ cf3 Host name is: depsrv1 cf3 Operating System Type is linux cf3 Operating System Release is 2.6.26-2-amd64 cf3 Architecture = x86_64 cf3 Using internal soft-class linux for host depsrv1 cf3 The time is now Tue Sep 28 08:15:33 2010 cf3 ------------------------------------------------------------------------ cf3 # Extended system discovery is only available in version Nova and above cf3 Additional hard class defined as: 64_bit cf3 Additional hard class defined as: linux_2_6_26_2_amd64 cf3 Additional hard class defined as: linux_x86_64 cf3 Additional hard class defined as: linux_x86_64_2_6_26_2_amd64 cf3 GNU autoconf class from compile time: compiled_on_linux_gnu cf3 Address given by nameserver: 192.168.2.49 cf3 Interface 1: lo cf3 Interface 2: bond0 cf3 Adding alias depsrv1.. cf3 Trying to locate my IPv6 address cf3 Found IPv6 address fe80::219:b9ff:fef7:b5f7 cf3 Looking for environment from cf-monitor... cf3 Loading environment... cf3 Environment data loaded cf3 This appears to be a debian system. cf3 Looking for Debian version... cf3 This appears to be a Debian 5.0 system. cf3 This appears to be a Debian 5 system. cf3 This system seems to have the aptitude package system cf3 *********************************************************** cf3 Loading persistent classes cf3 *********************************************************** cf3 Persistent class cfengine_out_high_ldt for 0 more minutes cf3 Adding persistent class cfengine_out_high_ldt to heap cf3 Persistent class messages_high_dev2 for 2 more minutes cf3 Adding persistent class messages_high_dev2 to heap cf3 Persistent class messages_high_ldt for 2 more minutes cf3 Adding persistent class messages_high_ldt to heap cf3 Persistent class ssh_out_high_ldt for 0 more minutes cf3 Adding persistent class ssh_out_high_ldt to heap cf3 *********************************************************** cf3 Loaded persistent memory cf3 *********************************************************** cf3 > Verifying the syntax of the inputs... cf3 > Parsing file /tmp/1.cf cf3 Initiate variable convergence... cf3 Initiate variable convergence... cf3 # Knowledge map reporting feature is only available in version Nova and above cf3 -> Defined classes = { 192_168_2_49 64_bit Day28 GMT_Hr8 Hr08 Hr08_Q2 Lcycle_0 Min15 Min15_20 Morning Q2 September Tuesday Yr2010 agent any be2_de cfengine_3 cfengine_3_0 cfengine_3_0_5p1 cfengine_out_high_ldt community_edition compiled_on_linux_gnu de debian debian_5 debian_5_0 debian_lenny depsrv1 depsrv1_be2_de entropy_cfengine_in_low entropy_dns_in_low entropy_dns_out_low entropy_ftp_in_low entropy_ftp_out_low entropy_icmp_in_low entropy_icmp_out_low entropy_irc_in_low entropy_irc_out_low entropy_misc_in_low entropy_misc_out_low entropy_netbiosdgm_in_low entropy_netbiosdgm_out_low entropy_netbiosns_in_low entropy_netbiosns_out_low entropy_netbiosssn_in_low entropy_netbiosssn_out_low entropy_nfsd_in_low entropy_nfsd_out_low entropy_smtp_in_low entropy_smtp_out_low entropy_tcpack_in_low entropy_tcpack_out_low entropy_tcpfin_in_low entropy_tcpfin_out_low entropy_tcpsyn_in_low entropy_tcpsyn_out_low entropy_udp_in_low entropy_udp_out_low entropy_www_in_low entropy_www_ou t_low entropy_wwws_in_low entropy_wwws_out_low fe80__219_b9ff_fef7_b5f7 have_aptitude inform_mode ipv4_192 ipv4_192_168 ipv4_192_168_2 ipv4_192_168_2_49 linux linux_2_6_26_2_amd64 linux_x86_64 linux_x86_64_2_6_26_2_amd64 linux_x86_64_2_6_26_2_amd64__1_SMP_Sun_Jun_20_20_16_30_UTC_2010 messages_high_dev2 messages_high_ldt messages_high_normal net_iface_bond0 ssh_out_high_ldt ssh_out_low_normal syslog_high_normal verbose_mode x86_64 } cf3 -> Negated Classes = { } cf3 Initiate variable convergence... cf3 -> Immunizing against parental death cf3 -> Bundlesequence => {'one'} cf3 cf3 ***************************************************************** cf3 BUNDLE one cf3 ***************************************************************** cf3 cf3 cf3 ========================================================= cf3 classes in bundle one (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 methods in bundle one (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: ONE cf3 ......................................................... cf3 cf3 cf3 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * cf3 BUNDLE bundle2( {'234'} ) cf3 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * cf3 cf3 ? Augment scope bundle2 with p1 cf3 cf3 + Private classes augmented: cf3 cf3 - Private classes diminished: cf3 cf3 cf3 cf3 ========================================================= cf3 reports in bundle bundle2 (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: 234 cf3 ......................................................... cf3 cf3 Reporting about this... cf3 R: 234 cf3 cf3 + Private classes augmented: cf3 cf3 - Private classes diminished: cf3 cf3 cf3 cf3 ========================================================= cf3 reports in bundle bundle2 (2) cf3 ========================================================= cf3 cf3 Verifying SQL table promises is only available with Cfengine Nova or above cf3 -> This promise has already been verified cf3 cf3 + Private classes augmented: cf3 cf3 - Private classes diminished: cf3 cf3 cf3 cf3 ========================================================= cf3 reports in bundle bundle2 (3) cf3 ========================================================= cf3 cf3 Verifying SQL table promises is only available with Cfengine Nova or above cf3 -> This promise has already been verified cf3 -> Method invoked successfully cf3 cf3 ========================================================= cf3 classes in bundle one (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 methods in bundle one (2) cf3 ========================================================= cf3 cf3 Verifying SQL table promises is only available with Cfengine Nova or above cf3 cf3 ========================================================= cf3 classes in bundle one (3) 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 methods in bundle one (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 33%, Promises repaired 67%, Promises not repaired 0% cf3 Estimated system complexity as touched objects = 0, for 7 promises cf3 -> Writing last-seen observations _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine