summaryrefslogtreecommitdiffstats
path: root/virt-bootstrap.py
diff options
context:
space:
mode:
authorRadostin Stoyanov <rstoyanov1@gmail.com>2017-04-13 15:06:33 +0100
committerCédric Bosdonnat <cbosdonnat@suse.com>2017-04-14 10:31:18 +0200
commit87fc188d5a210b406355d159ea3e84f90ff8cb38 (patch)
tree59a1cab55447bd01d293d24b27d95bad148c5d89 /virt-bootstrap.py
parentcc35b6e0736592bd2c20a9d4b1dcf12ae49c723a (diff)
downloadvirt-bootstrap.git-87fc188d5a210b406355d159ea3e84f90ff8cb38.tar.gz
virt-bootstrap.git-87fc188d5a210b406355d159ea3e84f90ff8cb38.tar.xz
virt-bootstrap.git-87fc188d5a210b406355d159ea3e84f90ff8cb38.zip
Handle error case when creating destination folder
`OSError: [Errno 17] File exists: ...` error occurs when trying to create the destination directory specified from the user without checking if it already exists.
Diffstat (limited to 'virt-bootstrap.py')
-rw-r--r--virt-bootstrap.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/virt-bootstrap.py b/virt-bootstrap.py
index 36902f5..8540d98 100644
--- a/virt-bootstrap.py
+++ b/virt-bootstrap.py
@@ -66,7 +66,8 @@ def set_root_password(rootfs, password):
def bootstrap(args):
source = get_source(args)
- os.makedirs(args.dest)
+ if not os.path.exists(args.dest):
+ os.makedirs(args.dest)
source.unpack(args.dest)
if args.root_password is not None: