Forum: CFEngine Help
Subject: Re: Trying to use a variable inside a regex
Author: daveseff
Link to topic: https://cfengine.com/forum/read.php?3,27490,27494#msg-27494
What's even more strange, is if I take your example, and use my bundle it
prints both reports:
# REgex test
body common control {
bundlesequence => {
"main",
};
inputs => {
"cfengine_stdlib.cf",
};
}
bundle agent main {
methods:
"virt_use_nfs" usebundle => set_selinux_boolean ( "virt_use_nfs", "off");
}
bundle agent set_selinux_boolean(s, i){
vars:
classes:
"sebooloff" expression => regcmp(".*$(i)$", execresult("/usr/sbin/getsebool
$(s)", "noshell"));
"seboolon" expression => regcmp(".*$(i)$", execresult("/usr/sbin/getsebool
$(s)", "noshell"));
reports:
sebooloff::
"$(s) is off";
seboolon::
"$(s) is on";
}
# cfagent -IKf regtest.cf
R: virt_use_nfs is off
R: virt_use_nfs is on
Why is it doing that?
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine