[lxc-devel] [lxd/master] make the target directory on recursive pull

tych0 on Github lxc-bot at linuxcontainers.org
Tue Sep 20 18:31:03 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 377 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160920/99d897aa/attachment.bin>
-------------- next part --------------
From 0f77459cdb1c457aee09a83aff8f8f18707541c6 Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho.andersen at canonical.com>
Date: Tue, 20 Sep 2016 12:30:29 -0600
Subject: [PATCH] make the target directory on recursive pull

Closes #2403

Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
 lxc/file.go | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lxc/file.go b/lxc/file.go
index 218c33e..d143a20 100644
--- a/lxc/file.go
+++ b/lxc/file.go
@@ -245,6 +245,10 @@ func (c *fileCmd) pull(config *lxd.Config, args []string) error {
 		}
 
 		if c.recursive {
+			if err := os.MkdirAll(target, 0755); err != nil && !os.IsExist(err) {
+				return err
+			}
+
 			if err := d.RecursivePullFile(container, pathSpec[1], target); err != nil {
 				return err
 			}


More information about the lxc-devel mailing list