From 3001ebf7249de17ab733b1e6978b1ff372219a56 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Mon, 19 Jun 2017 14:43:51 +0100 Subject: Show error if destination path is not folder --- src/virtBootstrap/virt_bootstrap.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/virtBootstrap/virt_bootstrap.py') 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: -- cgit