diff options
author | Radostin Stoyanov <rstoyanov1@gmail.com> | 2017-06-19 14:43:51 +0100 |
---|---|---|
committer | Cédric Bosdonnat <cbosdonnat@suse.com> | 2017-06-19 16:39:32 +0200 |
commit | 3001ebf7249de17ab733b1e6978b1ff372219a56 (patch) | |
tree | 12eacf1841ca50d93328ab82f8c751ab8d3c8b23 /src | |
parent | dfbfc0f2613bf746948da871e3aa0ec054f6bd4f (diff) | |
download | virt-bootstrap.git-3001ebf7249de17ab733b1e6978b1ff372219a56.tar.gz virt-bootstrap.git-3001ebf7249de17ab733b1e6978b1ff372219a56.tar.xz virt-bootstrap.git-3001ebf7249de17ab733b1e6978b1ff372219a56.zip |
Show error if destination path is not folder
Diffstat (limited to 'src')
-rwxr-xr-x | src/virtBootstrap/virt_bootstrap.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/virtBootstrap/virt_bootstrap.py b/src/virtBootstrap/virt_bootstrap.py index 2ee505e..1befaae 100755 --- a/src/virtBootstrap/virt_bootstrap.py +++ b/src/virtBootstrap/virt_bootstrap.py @@ -26,7 +26,7 @@ import gettext import sys import os from textwrap import dedent -from logging import getLogger, DEBUG, INFO, WARNING +from logging import getLogger, DEBUG, INFO, WARNING, error from subprocess import CalledProcessError, Popen, PIPE try: from urlparse import urlparse @@ -93,6 +93,10 @@ def bootstrap(args): source = get_source(args) if not os.path.exists(args.dest): os.makedirs(args.dest) + elif not os.path.isdir(args.dest): # Show error if not directory + error("Destination path '%s' is not directory.", args.dest) + sys.exit(1) + source.unpack(args.dest) if args.root_password is not None: |