Open aka7 opened 7 months ago
I think you could extend the existing type
field (which presently accepts f
or d
) to also have an 'a' option standing for 'absent'. Unfortunately some of the other fields, e.g. owner and perms, are mandatory and would be confusing in this context.
There are a number of issues with dirperm/symlink such as the handling of duplicates (last one added to list wins) and more crucially, what happens if you add a file /foo/bar/baz
and then later add an entry for /foo
, as well as potential conflicts between dirperm and symlink. There was an idea to merge both of these into a new component, ncm-path, that would handle these by processing all paths in a shortest to longest order, erroring on duplicates and could then also be extended to handle file absence. Unfortunately I don't think we even got as far as agreeing a schema that cover so many use cases! :(
We have discussed having "this path must not exist" functionality before, I'm very much for it. Ideally it would in the new ncm-path
, but pragmatically it could be added to dirperm with all the above caveats @ned21 highlighted.
not sure if any component provide this, but I would like to control deletion of a file using ncm. so if a give path exists in the system it should remove it.
So, it would be neat if ncm-dirperm can provide this support, so have a option in the line of
ensure: string = "present" with match (SELF, '^(absent|present)$')
if set to absent, it should remove the file if it exists. if directory, then remove dir recursively?