Actually isdir() would be best here perhaps. :)
M
Nakarin Phooripoom wrote:
> Alternatively, I would use a built-in function fileexists() to check there is
> a directory or not then execute commands.
>
> classes:
> "dir_exists" expression => fileexists("some/directory");
> "no_dir"
Alternatively, I would use a built-in function fileexists() to check there is a
directory or not then execute commands.
classes:
"dir_exists" expression => fileexists("some/directory");
"no_dir"not => fileexists("some/directory");
commands:
dir_exists::
"command_1";
no_dir::
Tom,
this can be achieved using the same classes if_repaired body
files:
"/desired/path/."
create => "true",
perms => mo("700", "www"),
classes => if_repaired("path_created");
...
commands:
path_created::
"command_X"
The concern is not the creation of the directory, which I agree can be
achieved with the "create => true" syntax.
My question is how can I get additional commands executed after noticing a
directory doesn't exist or after I create the directory.
On Jun 2, 2010 9:13pm, Daniel V Klein wrote:
I
Is one of the commands perhaps to create the directory you want? Why not use
the "create => true" attribute and just let the promises converge to the
desired state?
-Dan
> --===1770191284==
> Content-Type: multipart/alternative; boundary=0016e6470cf819ef39048813b6ae
>
> --0016e6470c
I am trying to write a promise config that will first check to see if a
directory exists. If it doesn't the run these commands. I am able to achieve
this with files incombination with the "classes => if_repaired(xyz);". Any
suggestions?
Thank you,
CFengine 3
files:
# directory example