Forum: Cfengine Help
Subject: Re: Setting a variable conditionally, depending on a class?
Author: zzamboni
Link to topic: https://cfengine.com/forum/read.php?3,16796,16802#msg-16802

Just to confirm, I can achieve what I want by conditional execution of the 
corresponding editing promises. Here's the relevant portion from my policy:

  "/etc/inittab"
  handle => "inittab_add_ethtool",
  comment => "Ensure ethtool is run on startup to disable the TSO flag",
  create    => "false",
  edit_defaults => edit_nobackup,
  edit_line => append_if_no_line("tso:3:once:/usr/sbin/ethtool -K ${nics} tso 
off"),
  ifvarclass => "isgreen_${nics}";

So I don't need to assign the value to a variable, just condition the action to 
the corresponding classes. Sometimes I still have trouble thinking in 
cfenginese :-)

--Diego

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

Reply via email to