Problem with definition of slist in CFEngine

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Hey folks,

I have a problem with the definition of a variable of type slist in CFEngine on

# uname -a ; cat /etc/redhat-release
Linux policyhub.example.com 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
CentOS Linux release 7.4.1708 (Core)

I'm not sure if its valid to ask CFEngine questions on this mailing list, but as far as I'm running on CentOS I hope that it is okay.

I'm logged in as user

# id
uid=0(root) gid=0(root) Gruppen=0(root) Kontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

and working on directory

# pwd
/var/cfengine/inputs

with software

# cf-agent -V
CFEngine Core 3.10.2

and the configuration file

# cat ./info.cf
bundle agent info
{
  vars:
    any::
      "info_list" slist => {
        "includes.dir ............... = $(includes.dir)",
        "sys.arch ................... = $(sys.arch)",
        "sys.bindir ................. = $(sys.bindir)",
        "sys.cdate .................. = $(sys.cdate)",
        "sys.cf_promises ............ = $(sys.cf_promises)",
        "sys.cf_version ............. = $(sys.cf_version)",
        "sys.cf_version_major ....... = $(sys.cf_version_major)",
        "sys.cf_version_minor ....... = $(sys.cf_version_minor)",
        "sys.cf_version_patch ....... = $(sys.cf_version_patch)",
        "sys.class .................. = $(sys.class)",
        "sys.cpus ................... = $(sys.cpus)",
        "sys.crontab ................ = $(sys.crontab)",
        "sys.date ................... = $(sys.date)",
        "sys.doc_root ............... = $(sys.doc_root)",
        "sys.domain ................. = $(sys.domain)",
        "sys.enterprise_version ..... = $(sys.enterprise_version)",
        "sys.expires ................ = $(sys.expires)",
        "sys.exports ................ = $(sys.exports)",
        "sys.failsafe_policy_path ... = $(sys.failsafe_policy_path)",
        "sys.flavor ................. = $(sys.flavor)",
        "sys.flavour ................ = $(sys.flavour)",
        "sys.fqhost ................. = $(sys.fqhost)",
        "sys.fstab .................. = $(sys.fstab)",
        "sys.hardware_addresses ..... = $(sys.hardware_addresses)",
        "sys.host ................... = $(sys.host)",
        "sys.inet ................... = $(sys.inet)",
        "sys.inputdir ............... = $(sys.inputdir)",
        "sys.interface .............. = $(sys.interface)",
        "sys.interfaces ............. = $(sys.interfaces)",
        "sys.interfaces_flags ....... = $(sys.interfaces_flags)",
        "sys.ip_addresses ........... = $(sys.ip_addresses)",
        "sys.ip2iface ............... = $(sys.ip2iface)",
        "sys.ipv4 ................... = $(sys.ipv4)",
        "sys.key_digest ............. = $(sys.key_digest)",
        "sys.last_policy_update ..... = $(sys.last_policy_update)",
        "sys.libdir ................. = $(sys.libdir)",
        "sys.local_libdir ........... = $(sys.local_libdir)",
        "sys.logdir ................. = $(sys.logdir)",
        "sys.license_owner .......... = $(sys.license_owner)",
        "sys.licenses_granted ....... = $(sys.licenses_granted)",
        "sys.long_arch .............. = $(sys.long_arch)",
        "sys.maildir ................ = $(sys.maildir)",
        "sys.masterdir .............. = $(sys.masterdir)",
        "sys.os ..................... = $(sys.os)",
        "sys.ostype ................. = $(sys.ostype)",
        "sys.piddir ................. = $(sys.piddir)",
        "sys.policy_hub ............. = $(sys.policy_hub)",
        "sys.policy_hub_port ........ = $(sys.policy_hub_port)",
        "sys.release ................ = $(sys.release)",
        "sys.resolv ................. = $(sys.resolv)",
        "sys.statedir ............... = $(sys.statedir)",
        "sys.sysday ................. = $(sys.sysday)",
        "sys.systime ................ = $(sys.systime)",
        "sys.update_policy_path ..... = $(sys.update_policy_path)",
        "sys.uptime ................. = $(sys.uptime)",
        "sys.user_data .............. = $(sys.user_data)",
        "sys.uqhost ................. = $(sys.uqhost)",
        "sys.version ................ = $(sys.version)",
        "sys.windir ................. = $(sys.windir)",
        "sys.winprogdir ............. = $(sys.winprogdir)",
        "sys.winprogdir86 ........... = $(sys.winprogdir86)",
        "sys.winsysdir .............. = $(sys.winsysdir)",
        "sys.workdir ................ = $(sys.workdir)",
        "... BEGIN big shit ...............",
#        "sys.inet6 .................. = $(sys.inet6)",
#        "sys.interfaces_data ........ = $(sys.interfaces_data)",
        "... END big shit ...............",
      };

  reports:
    any::
      "r1: $(info.info_list)";
      "r2: sys.inet6 .................. = $(sys.inet6)";
      "r3: sys.interfaces_data ........ = $(sys.interfaces_data)";
      "r4: holleri di dudeldoe";

}

The service cfengine3.service is inactive at the moment:

# systemctl is-active cfengine3.service
inactive

I have a problem with the definition of the stringlist/slist "info_list". In some cases it becomes some kind of "undefined" or at least I'm not able to print it out in a report (in "r1:"). In the configuration file above I marked some lines with "BEGIN/END big shit". Between the BEGIN/END I commented out two lines. If I "run" with that configuration file I see the reports "r1:" and "r4:" but not "r2:" and "r3:". It's not clear to me why I don't see reports "r2:" and "r3:", but I'm interested in the value of $(info.info_list)" in "r1:", I only have "r2:" and "r3:" here to maybe help to localize the problem which is described later. Definition of "info_list" works fine for now:

# cf-agent -IK --file ./info.cf --bundlesequence info
    info: Using command line specified bundlesequence
R: r1: includes.dir ............... = $(includes.dir)
R: r1: sys.arch ................... = x86_64
R: r1: sys.bindir ................. = /var/cfengine/bin
R: r1: sys.cdate .................. = Thu_Jul_26_16_09_20_2018
R: r1: sys.cf_promises ............ = "/var/cfengine/bin/cf-promises"
R: r1: sys.cf_version ............. = 3.10.2
R: r1: sys.cf_version_major ....... = 3
R: r1: sys.cf_version_minor ....... = 10
R: r1: sys.cf_version_patch ....... = 2
R: r1: sys.class .................. = linux
R: r1: sys.cpus ................... = 1
R: r1: sys.crontab ................ = /var/spool/cron/root
R: r1: sys.date ................... = Thu Jul 26 16:09:20 2018
R: r1: sys.doc_root ............... = /var/www/html
R: r1: sys.domain ................. = example.com
R: r1: sys.enterprise_version ..... = $(sys.enterprise_version)
R: r1: sys.expires ................ = $(sys.expires)
R: r1: sys.exports ................ = /etc/exports
R: r1: sys.failsafe_policy_path ... = /var/cfengine/inputs/failsafe.cf
R: r1: sys.flavor ................. = centos_7
R: r1: sys.flavour ................ = centos_7
R: r1: sys.fqhost ................. = policyhub.example.com
R: r1: sys.fstab .................. = /etc/fstab
R: r1: sys.hardware_addresses ..... = aa:aa:aa:aa:aa:aa
R: r1: sys.host ................... = policyhub.example.com
R: r1: sys.inet ................... = 37.187.93.254
R: r1: sys.inputdir ............... = /var/cfengine/inputs
R: r1: sys.interface .............. = eth0
R: r1: sys.interfaces ............. = eth0
R: r1: sys.interfaces_flags ....... = $(sys.interfaces_flags)
R: r1: sys.ip_addresses ........... = 11.22.33.44
R: r1: sys.ip2iface ............... = $(sys.ip2iface)
R: r1: sys.ipv4 ................... = 11.22.33.44
R: r1: sys.key_digest ............. = MD5=12345678123456781234567812345678
R: r1: sys.last_policy_update ..... = Thu Jul 26 14:45:33 2018
R: r1: sys.libdir ................. = /var/cfengine/inputs/lib
R: r1: sys.local_libdir ........... = lib
R: r1: sys.logdir ................. = /var/cfengine
R: r1: sys.license_owner .......... = $(sys.license_owner)
R: r1: sys.licenses_granted ....... = $(sys.licenses_granted)
R: r1: sys.long_arch .............. = linux_x86_64_3_10_0_693_el7_x86_64__1_SMP_Tue_Aug_22_21_09_27_UTC_2017
R: r1: sys.maildir ................ = /var/spool/mail
R: r1: sys.masterdir .............. = /var/cfengine/masterfiles
R: r1: sys.os ..................... = linux
R: r1: sys.ostype ................. = linux_x86_64
R: r1: sys.piddir ................. = /var/cfengine
R: r1: sys.policy_hub ............. = 11.22.33.44
R: r1: sys.policy_hub_port ........ = 5308
R: r1: sys.release ................ = 3.10.0-693.el7.x86_64
R: r1: sys.resolv ................. = /etc/resolv.conf
R: r1: sys.statedir ............... = /var/cfengine/state
R: r1: sys.sysday ................. = 17738
R: r1: sys.systime ................ = 1532614160
R: r1: sys.update_policy_path ..... = /var/cfengine/inputs/update.cf
R: r1: sys.uptime ................. = 14209
R: r1: sys.user_data .............. = 0
R: r1: sys.uqhost ................. = policyhub
R: r1: sys.version ................ = #1 SMP Tue Aug 22 21:09:27 UTC 2017
R: r1: sys.windir ................. = $(sys.windir)
R: r1: sys.winprogdir ............. = $(sys.winprogdir)
R: r1: sys.winprogdir86 ........... = $(sys.winprogdir86)
R: r1: sys.winsysdir .............. = $(sys.winsysdir)
R: r1: sys.workdir ................ = /var/cfengine
R: r1: ... BEGIN big shit ...............
R: r1: ... END big shit ...............
R: r4: holleri di dudeldoe

"r2:" and "r3:" are missing, but thats not a problem for me. Now I comment in one of those two lines, in this case th first one:

# cat ./info.cf
bundle agent info
{
  vars:
    any::
      "info_list" slist => {
        "includes.dir ............... = $(includes.dir)",
        "sys.arch ................... = $(sys.arch)",
        "sys.bindir ................. = $(sys.bindir)",
        "sys.cdate .................. = $(sys.cdate)",
        "sys.cf_promises ............ = $(sys.cf_promises)",
        "sys.cf_version ............. = $(sys.cf_version)",
        "sys.cf_version_major ....... = $(sys.cf_version_major)",
        "sys.cf_version_minor ....... = $(sys.cf_version_minor)",
        "sys.cf_version_patch ....... = $(sys.cf_version_patch)",
        "sys.class .................. = $(sys.class)",
        "sys.cpus ................... = $(sys.cpus)",
        "sys.crontab ................ = $(sys.crontab)",
        "sys.date ................... = $(sys.date)",
        "sys.doc_root ............... = $(sys.doc_root)",
        "sys.domain ................. = $(sys.domain)",
        "sys.enterprise_version ..... = $(sys.enterprise_version)",
        "sys.expires ................ = $(sys.expires)",
        "sys.exports ................ = $(sys.exports)",
        "sys.failsafe_policy_path ... = $(sys.failsafe_policy_path)",
        "sys.flavor ................. = $(sys.flavor)",
        "sys.flavour ................ = $(sys.flavour)",
        "sys.fqhost ................. = $(sys.fqhost)",
        "sys.fstab .................. = $(sys.fstab)",
        "sys.hardware_addresses ..... = $(sys.hardware_addresses)",
        "sys.host ................... = $(sys.host)",
        "sys.inet ................... = $(sys.inet)",
        "sys.inputdir ............... = $(sys.inputdir)",
        "sys.interface .............. = $(sys.interface)",
        "sys.interfaces ............. = $(sys.interfaces)",
        "sys.interfaces_flags ....... = $(sys.interfaces_flags)",
        "sys.ip_addresses ........... = $(sys.ip_addresses)",
        "sys.ip2iface ............... = $(sys.ip2iface)",
        "sys.ipv4 ................... = $(sys.ipv4)",
        "sys.key_digest ............. = $(sys.key_digest)",
        "sys.last_policy_update ..... = $(sys.last_policy_update)",
        "sys.libdir ................. = $(sys.libdir)",
        "sys.local_libdir ........... = $(sys.local_libdir)",
        "sys.logdir ................. = $(sys.logdir)",
        "sys.license_owner .......... = $(sys.license_owner)",
        "sys.licenses_granted ....... = $(sys.licenses_granted)",
        "sys.long_arch .............. = $(sys.long_arch)",
        "sys.maildir ................ = $(sys.maildir)",
        "sys.masterdir .............. = $(sys.masterdir)",
        "sys.os ..................... = $(sys.os)",
        "sys.ostype ................. = $(sys.ostype)",
        "sys.piddir ................. = $(sys.piddir)",
        "sys.policy_hub ............. = $(sys.policy_hub)",
        "sys.policy_hub_port ........ = $(sys.policy_hub_port)",
        "sys.release ................ = $(sys.release)",
        "sys.resolv ................. = $(sys.resolv)",
        "sys.statedir ............... = $(sys.statedir)",
        "sys.sysday ................. = $(sys.sysday)",
        "sys.systime ................ = $(sys.systime)",
        "sys.update_policy_path ..... = $(sys.update_policy_path)",
        "sys.uptime ................. = $(sys.uptime)",
        "sys.user_data .............. = $(sys.user_data)",
        "sys.uqhost ................. = $(sys.uqhost)",
        "sys.version ................ = $(sys.version)",
        "sys.windir ................. = $(sys.windir)",
        "sys.winprogdir ............. = $(sys.winprogdir)",
        "sys.winprogdir86 ........... = $(sys.winprogdir86)",
        "sys.winsysdir .............. = $(sys.winsysdir)",
        "sys.workdir ................ = $(sys.workdir)",
        "... BEGIN big shit ...............",
        "sys.inet6 .................. = $(sys.inet6)",
#        "sys.interfaces_data ........ = $(sys.interfaces_data)",
        "... END big shit ...............",
      };

  reports:
    any::
      "r1: $(info.info_list)";
      "r2: sys.inet6 .................. = $(sys.inet6)";
      "r3: sys.interfaces_data ........ = $(sys.interfaces_data)";
      "r4: holleri di dudeldoe";

}

I "run" again with that configuration file and in report "r1:" I can see that now the stringlist/slist "info_list" seems to be undefined and report "r1:" is empty and reports "r2:" and "r3:" are still missing:

# cf-agent -IK --file ./info.cf --bundlesequence info
    info: Using command line specified bundlesequence
R: r1: $(info.info_list)
R: r4: holleri di dudeldoe

My problem ist NOT that the reports "r2:" and "r3:" are not printed, my problem ist, that in some cases the slist is undefined. I'm using that slist to collect some system info and then printing out the report and it would NOT be a problem if some system informations were missing but it IS a problem that in some cases the whole slist becomes undefined and in that situation I receive a completly empty report "r1: ".

I would like to understand what circumstances lead to the slist be undefined and how I can prevent this.

Thanks in advance.

Regards, Meikel
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos



[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]


  Powered by Linux