help-cfengine
[Top][All Lists]
Advanced

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

resolve action and variable substitution


From: Sabrina Lautier
Subject: resolve action and variable substitution
Date: Thu, 18 Jul 2002 16:02:26 +0200

Hi !

I'm using cfengine version 2.0.1.

I wrote a cfengine script (network.conf) which updates the network 
configuration.

In this script, I try to update the resolv.conf file using the 
resolve action.
What I want to do is to replace the entire content of the file with 
another one.
You could tell me to use the 'copy' action (resolv.conf from the 
server to the client) but as some machines are very critical and 
absolutly need DNS access, my idea was to first add the new lines 
using the 'resolve' action and then with 'editfiles' remove the old 
remaining lines. Hoping that this way the cfengine clients will never 
loose DNS access.

Here is a part of the script:
**********************************
<snip>
control:
  actionsequence = (
                  resolve
                  editfiles
                  <snip>
                 )

  resolve:

    "domain toto.com"
    nameserver1_IP@
    nameserver2_IP@
    "search ..."
    "END"
  
  editfiles:

    { /etc/resolv.conf
        LocateLineMatching "END"
        DeleteLinesAfterThisMatching ".*"
        DeleteLinesContaining "END"
    }

<snip>
**********************************

I get the result I want except that I cannot specify a variable in 
the resolve comment line: I would like to use the variable $(endfile) 
instead of "END" but didn't manage to make it work:
**********************************
control:
  endline = ( "END" )

resolve:
      "domain toto.com"
      nameserver1_IP@
      nameserver2_IP@
      "search ..."
      "$(endline)"
**********************************
This inserts $(endline) in resolv.conf instead of END.
Any idea of how to insert a variable value with the resolve action ?

I've noticed that the resolve action adds the specified lines at the 
beginning of the resolv.conf file - ie before all the existing ones: 
is it the way it always act ?
Does all of this (resolve+editfiles) worth it, or will just a file 
copy be secure enough ?

I appreciate any insights.

Thanks,

Sabrina

---------------------------------------------
Powered by Alinto (http://www.alinto.net)
        for lavache.com (http://www.lavacheautomatique.com)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]