[CentOS] Problem with definition of slist in CFEngine

Paul Heinlein heinlein at madboa.com
Thu Jul 26 20:01:16 UTC 2018


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.

-- 
Paul Heinlein
heinlein at madboa.com
45°38' N, 122°6' W


More information about the CentOS mailing list