fix: support nested subdirs in remote templates (#482)

For some reason when a node in the git in-memory file system is
Stat()ed, if it's a directory the mode bits are 0644 which is not
correct, and causes a failure when trying to write the templates.
This commit explicitly sets the file mode for all directories to
0755.

Signed-off-by: Lance Ball <lball@redhat.com>
This commit is contained in:
Lance Ball 2021-08-17 11:30:17 -04:00 committed by GitHub
parent a21252ac93
commit fcf9e77cb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 6 deletions

View File

@ -194,12 +194,10 @@ func copy(src, dest string, accessor filesystem) (err error) {
} }
func copyNode(src, dest string, accessor filesystem) (err error) { func copyNode(src, dest string, accessor filesystem) (err error) {
node, err := accessor.Stat(src) // Ideally we should use the file mode of the src node
if err != nil { // but it seems the git module is reporting directories
return // as 0644 instead of 0755. For now, just do it this way.
} err = os.MkdirAll(dest, 0755)
err = os.MkdirAll(dest, node.Mode())
if err != nil { if err != nil {
return return
} }