Closed eehret closed 11 months ago
For now I'll use nxScript to achieve what I need. Hoping there will be a way to use nxFile for this scenario in the future though :)
Thanks @eehret for the suggestion - we will look into how we can deliver this and get back to you. Thanks for your active engagement in the repo!
@jodi-boone Happy to help. Thanks for taking a look :)
Details of the scenario you tried and the problem that is occurring
Natively linux supports the ability to
chmod -R
at the directory level, and tell it to set X on the directory but not files within. This is discussed here: https://superuser.com/questions/757806/give-execution-permission-to-directories-but-not-to-filesI've fiddled with nxFiles a bit trying to get it to do this, but no success. Either it isn't possible or it isn't clear enough how to accomplish this, as there are no such examples in the documentation or comments.
To make matters worse, if I specify
Type = File
and try to use a wildcard inDestinationPath
, although at a low level this does fetch the properties of all the files in the directory, one of the higher nx classes seems unable to interpret this and it complains about the type of the file system resource being "File File" instead of "File" , probably because it received an array from one of the lower level classes and it isn't written to handle that scenario.Verbose logs showing the problem
n/a
Suggested solution to the issue
It would be great if you could specify an nxFile at the directory level (type = Directory), and provide a desired file mode using symbolic notation that supports the uppercase 'X', which is explained in the man pages for chmod.
Without this, I think the 'Recurse' functionality of nxFile is of limited utility.
If that isn't feasible, then maybe fix the code so that it can handle an array of file properties when you try to use a wildcard in the
DestinationPath
property withType = File
The DSC configuration that is used to reproduce the issue (as detailed as possible)
I've tried this:
And this:
And variations using symbolic notation also instead of octal notation. So far I've either gotten errors, or the incorrect result.
The operating system the target node is running
Ubuntu 20.04 LTS
Version and build of PowerShell the target node is running
7.3.7
Version of the DSC module that was used
1.2.0