The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/4395

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Closes #4394

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
From 46df12d9c75a8d560d0cde04d517feda30a65c57 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Tue, 3 Apr 2018 10:29:53 -0400
Subject: [PATCH] lxc/file: Fix pushing files to remote
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #4394

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
---
 lxc/file.go              | 9 ++++-----
 test/suites/filemanip.sh | 5 ++---
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/lxc/file.go b/lxc/file.go
index d441af234..b8f0f4ed4 100644
--- a/lxc/file.go
+++ b/lxc/file.go
@@ -351,7 +351,6 @@ func (c *cmdFilePush) Run(cmd *cobra.Command, args 
[]string) error {
        if len(pathSpec) != 2 {
                return fmt.Errorf(i18n.G("Invalid target %s"), target)
        }
-       container := pathSpec[0]
 
        targetIsDir := strings.HasSuffix(target, "/")
        // re-add leading / that got stripped by the SplitN
@@ -413,7 +412,7 @@ func (c *cmdFilePush) Run(cmd *cobra.Command, args 
[]string) error {
 
                        mode, uid, gid := shared.GetOwnerMode(finfo)
 
-                       err = c.file.recursiveMkdir(resource.server, container, 
targetPath, &mode, int64(uid), int64(gid))
+                       err = c.file.recursiveMkdir(resource.server, 
resource.name, targetPath, &mode, int64(uid), int64(gid))
                        if err != nil {
                                return err
                        }
@@ -421,7 +420,7 @@ func (c *cmdFilePush) Run(cmd *cobra.Command, args 
[]string) error {
 
                // Transfer the files
                for _, fname := range sourcefilenames {
-                       err := c.file.recursivePushFile(resource.server, 
container, fname, targetPath)
+                       err := c.file.recursivePushFile(resource.server, 
resource.name, fname, targetPath)
                        if err != nil {
                                return err
                        }
@@ -488,7 +487,7 @@ func (c *cmdFilePush) Run(cmd *cobra.Command, args 
[]string) error {
                                }
                        }
 
-                       err = c.file.recursiveMkdir(resource.server, container, 
path.Dir(fpath), nil, int64(uid), int64(gid))
+                       err = c.file.recursiveMkdir(resource.server, 
resource.name, path.Dir(fpath), nil, int64(uid), int64(gid))
                        if err != nil {
                                return err
                        }
@@ -534,7 +533,7 @@ func (c *cmdFilePush) Run(cmd *cobra.Command, args 
[]string) error {
                args.Type = "file"
 
                logger.Infof("Pushing %s to %s (%s)", f.Name(), fpath, 
args.Type)
-               err = resource.server.CreateContainerFile(container, fpath, 
args)
+               err = resource.server.CreateContainerFile(resource.name, fpath, 
args)
                if err != nil {
                        return err
                }
diff --git a/test/suites/filemanip.sh b/test/suites/filemanip.sh
index 26f238de7..b5bf5bb7a 100644
--- a/test/suites/filemanip.sh
+++ b/test/suites/filemanip.sh
@@ -48,7 +48,6 @@ test_filemanip() {
   rm -rf "${TEST_DIR}/dest"
 
   # Check that file permissions are not applied to intermediate directories
-
   lxc file push -p --mode=400 "${TEST_DIR}"/source/foo \
       filemanip/tmp/ptest/d1/d2/foo
 
@@ -100,8 +99,8 @@ test_filemanip() {
   [ "$(stat -c "%g" "${TEST_DIR}"/dest/source)" = "$(id -g)" ]
   [ "$(stat -c "%a" "${TEST_DIR}"/dest/source)" = "755" ]
 
-  lxc file push -p "${TEST_DIR}"/source/foo 
filemanip/tmp/this/is/a/nonexistent/directory/
-  lxc file pull filemanip/tmp/this/is/a/nonexistent/directory/foo "${TEST_DIR}"
+  lxc file push -p "${TEST_DIR}"/source/foo 
local:filemanip/tmp/this/is/a/nonexistent/directory/
+  lxc file pull local:filemanip/tmp/this/is/a/nonexistent/directory/foo 
"${TEST_DIR}"
   [ "$(cat "${TEST_DIR}"/foo)" = "foo" ]
 
   lxc file push -p "${TEST_DIR}"/source/foo filemanip/.
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to