skx / marionette

Something like puppet, for the localhost only.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hard coded file permissions

alexwhitman opened this issue · comments

The file module creates files with the permission value hardcoded to 0755: https://github.com/skx/marionette/blob/master/modules/module_file.go#L78

In the case that no mode is specified for the file, perhaps the default OS permissions should be applied which will take the umask into account?

Now you've reported this it seems like an obvious thing to fix!

I'll make an update shortly, unless you wish to submit a pull-request of your own. I imagine it would be something like this:

        // Get the (optional) mode
        mode := StringParam(args, "mode")

        if mode != "" {

            // if specified then change if necessary
            var changed bool

           changed, err = file.ChangeMode(target, mode)
           if err != nil {
                return false, err
           }
             if changed {
                 ret = true
           }
        }
`

Closed in #51 - thanks very much!

I'll make a new release tomorrow, just in case you spot anything else equally obvious that I've overlooked in the next 24 hours :)