directory module doesn't -p
httpete opened this issue · comments
if I
directory { name => "Create Datadir",
target => "/opt/deep/down",
mode => "0755",
}
it doesn't work. I should be able to create a nested dir.
This one works for me:
$ cat > dir.in
directory { name => "Create Datadir",
target => "/opt/deep/down",
mode => "0755",
}
I run it, with sudo, because I need permission to write beneath /opt
:
$ sudo ./marionette dir.in
[sudo] password for skx:
Then the directory exists:
$ ls /opt/deep/down/
$
Do you see any output of note when you run with -debug
, or -verbose
? I checked the code and we use os.MkdirAll
rather than os.Mkdir
so I'd expect it to be doing the right thing.
I added a test-case to explicitly check that this works as expected, which confirmed my manual testing.
I think more details are needed here, because I can't reproduce the problem at all.
Yeah if you run marionette as "yourself" then you can use sudo for shell-commands, but things like files, directories and docker containers will all fail if they don't have the appropriate permissions.
Usually that should be obvious, as the error-message will look something like this:
$ ./marionette dir.in
Error:error running directory-module rule 'Create Datadir' mkdir /opt/down: permission denied
But I guess it is easy to miss if your input-files are long.
Could never reproduce this, closing on that basis.