[virt-bootstrap PATCHv2 2/3] Use absolute destination path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In order to avoid issues, for example, when virt-sandbox might not
convert relative to absolute path, make sure that we always use
absolute destination path.

Reviewed-by: Cole Robinson <crobinso@xxxxxxxxxx>
Signed-off-by: Radostin Stoyanov <rstoyanov1@xxxxxxxxx>
---
 src/virtBootstrap/virt_bootstrap.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/virtBootstrap/virt_bootstrap.py b/src/virtBootstrap/virt_bootstrap.py
index 4bfa95d..cfe7aab 100755
--- a/src/virtBootstrap/virt_bootstrap.py
+++ b/src/virtBootstrap/virt_bootstrap.py
@@ -121,10 +121,11 @@ def bootstrap(uri, dest,
 
     uri = urlparse(uri)
     source = get_source(uri.scheme or 'file')
+    dest = os.path.abspath(dest)
 
     if not os.path.exists(dest):
         os.makedirs(dest)
-    elif os.path.abspath(dest) == "/":  # Don't overwrite root
+    elif dest == "/":  # Don't overwrite root
         logger.error("Unpack to root directory is not allowed")
         sys.exit(1)
     elif not os.path.isdir(dest):  # Show error if not directory
-- 
2.21.0

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list



[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux