Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm having issues with CFEngine's templating system. I install a package, ganglia in this specific case, that creates a default config file. Then I want to add lines to /etc/ganglia/gmond.conf depending on if its the the collection server or if its just feeding information out and whate colo the server is in. So I made a template and I'm using some variables for where I want different information.

When I manually remove /etc/ganglia/gmond.conf and run cfagent the template is expanded properly and looks correct.

When I run cfagent with the default config from the ganglia package in place it just appends the lines that don't exist to the bottom of the default config file.

Right now the expand_template block I'm using looks like:

    "/etc/ganglia/gmond.conf"
            comment         => "Expanding gmond.conf template",
            create          => "true",
            edit_line       => expand_template("$(g.inputfiles)/modules/ganglia/templates/gmond.conf");

I'm guessing there's something I want to use beside edit_line but my google-fu is failing me.

We are using the community editition of cfengine3 with just the standard library.

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

Try edit_defaults => empty in your promise. That will empty the file before the agent edits. The key word empty is a body fond in the cfengine standard library.

https://cfengine.com/docs/3.5/reference-promise-types-files.html#edit_defaults

share|improve this answer
    
apologies for the slow response this worked –  Tawm Sep 10 '13 at 23:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.