Re: Problem with definition of slist in CFEngine

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



Hi folks and Paul.

> Is there any chance that some elements of your info_list become larger
> than 4K size limit cfengine places on scalar variables?

Mayne the 4K limit ist not the problem here. I did some "shortcutting" and added one more "undefined" variable aaa.bbb.ccc:

# cat ./info.cf
bundle agent info
{
  vars:
    any::
      "info_list" slist => {
        "aaa.bbb.ccc ................ = $(aaa.bbb.ccc)",
        "includes.dir ............... = $(includes.dir)",
        "sys.arch ................... = $(sys.arch)",
        "sys.bindir ................. = $(sys.bindir)",
        "... 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";
      "r5: aaa.bbb.ccc ................ = $(aaa.bbb.ccc)";

}

Variables aaa.bbb.ccc and includes.dir are not defined and do not cause any problems:

# cf-agent -IK --file ./info.cf --bundlesequence info
    info: Using command line specified bundlesequence
R: r1: aaa.bbb.ccc ................ = $(aaa.bbb.ccc)
R: r1: includes.dir ............... = $(includes.dir)
R: r1: sys.arch ................... = x86_64
R: r1: sys.bindir ................. = /var/cfengine/bin
R: r1: ... BEGIN big shit ...............
R: r1: ... END big shit ...............
R: r4: holleri di dudeldoe
R: r5: aaa.bbb.ccc ................ = $(aaa.bbb.ccc)

Adding sys.inet6 leads to the problem:

# cat ./info.cf
bundle agent info
{
  vars:
    any::
      "info_list" slist => {
        "aaa.bbb.ccc ................ = $(aaa.bbb.ccc)",
        "includes.dir ............... = $(includes.dir)",
        "sys.arch ................... = $(sys.arch)",
        "sys.bindir ................. = $(sys.bindir)",
        "... 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";
      "r5: aaa.bbb.ccc ................ = $(aaa.bbb.ccc)";

}

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

Why is "r5:" shown but not "r2:" and "r3:"? Why isn't it possible to get the reports "r2:" and "r3:"? There is something special with variables sys.inet6 and sys.interfaces_data in my opinion.

Regards,

Meikel

Am 26.07.2018 um 22:01 schrieb Paul Heinlein:
On Thu, 26 Jul 2018, Meikel wrote:

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:").

Two related questions:

Is there any chance that some elements of your info_list become larger than 4K size limit cfengine places on scalar variables?

Similarly, I wonder if the 4K size limit comes into play when a list is interpolated into a string, as in your r1 report. I'm merely speculating; I don't know one way or the other.


Plus, I've never tried defining a slist with a comma after the final element. I assume that works for you, but I'll just note it for the record.

_______________________________________________
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