Forum: CFEngine Help
Subject: Re: Trying to use a variable inside a regex
Author: neilhwatson
Link to topic: https://cfengine.com/forum/read.php?3,27490,27495#msg-27495

You might have a bug here.  Can you duplicate my results below? Made a wrapper 
to simulate getsebool.


#!/bin/sh

STRING=$*
printf "# getsebool %s\n" $STRING
printf "%s --> off\n" $STRING


policy:

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){


classes:

  "sebooloff" expression => regcmp(".*$(i)$", 
execresult("/home/newatson/bin/getsebool $(s)", "noshell"));

reports:

   sebooloff::
      "$(s) is off.";
}


result

R: virt_use_nfs is off.
 !! Method invoked repairs


   @@@      
   @@@      cf-agent
            
 @ @@@ @    CFEngine Core 3.4.0b1.9b03c64
 @ @@@ @    
 @ @@@ @    
 @     @    
   @@@      
   @ @      
   @ @      
   @ @      

Copyright (C) CFEngine AS 2008-2012
See Licensing at http://cfengine.com/3rdpartylicenses


_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to