Forum: CFEngine Help
Subject: linking file if source exist
Author: stchesmeli
Link to topic: https://cfengine.com/forum/read.php?3,24513,24513#msg-24513

Hello all,

(excuse my english i'm french)

i'm trying to write a promise to manage apache2 on ubuntu/debian.

On theses distributions you activate modules by linking files. You have a 
folder mane "mods_available" where you can find availabled module anf if you 
want activate a special module you have to link files in "mods_availabled" to 
"mods_enabled". But, depending of module, you have one file to link 
(modules.load) ou two file (modules.load and modules.conf).

For example:
alias module have a .load and a .conf file:

/etc/apache2/mods-enabled/alias.load -> /etc/apache2/mods-available/alias.load
/etc/apache2/mods-enabled/alias.conf -> /etc/apache2/mods-available/alias.conf

but for auth_basic there is only a .load file:

/etc/apache2/mods-enabled/auth_basic.load -> 
/etc/apache2/mods-available/auth_basic.load

In my promise i have a slist of module that i want to activate, so i link .load 
file for each module on each slist iteration, but i don't know when i have a 
conf file.
For now i use a body link_from for .conf file with:

when_no_source => "nop";

it work (doesn't make a link if source file is absent) but i have always have a 
warning message
"Source /etc/apache2/mods-available/module.conf for linking is absent"

So i think isn't very convergent (trying to make a link each time).

I have try to play with "filesexist" function and classes but i didn't 
succeed....

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

Reply via email to