From ce5290a74c55b881aa24afccf2987e43fdcd87f2 Mon Sep 17 00:00:00 2001 From: Matteo Guadrini Date: Fri, 17 May 2019 16:20:53 +0200 Subject: [PATCH] Improved localhost connection; Other fix --- bb.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/bb.py b/bb.py index dc21911..923a828 100755 --- a/bb.py +++ b/bb.py @@ -1040,8 +1040,13 @@ def parse_arguments(): source_list = compose_source(args.action, args.type, srcs) else: source_list = [] - # Compose source @ format - cmd.append('{0}@{1}'.format(args.user, hostname).__add__(" ".join(source_list))) + # Check if hostname is localhost or 127.0.0.1 + if (hostname == "localhost") or (hostname == "LOCALHOST") or (hostname == "127.0.0.1"): + # Compose source with only path of folder list + cmd.append(" ".join(source_list)[1:]) + else: + # Compose source @ format + cmd.append('{0}@{1}'.format(args.user, hostname).__add__(" ".join(source_list))) # Compose destination bck_dst = compose_destination(hostname, args.destination) utility.write_log(log_args['status'], log_args['destination'], 'INFO', @@ -1070,6 +1075,7 @@ def parse_arguments(): args.type = get_restore_os() # Read catalog file restore_catalog = read_catalog(os.path.join(args.catalog, '.catalog.cfg')) + catalog_path = os.path.join(args.catalog, '.catalog.cfg') # Check if select backup-id or last backup if args.last: rhost = hostname @@ -1134,8 +1140,12 @@ def parse_arguments(): # Compose source cmd.append(os.path.join(rpath, src)) dst = src_dst[1] - # Compose destination @ format - cmd.append('{0}@{1}:'.format(args.user, rhost).__add__(dst)) + if (hostname == "localhost") or (hostname == "LOCALHOST") or (hostname == "127.0.0.1"): + # Compose destination only with path of folder + cmd.append('{}'.format(dst)) + else: + # Compose destination @ format + cmd.append('{0}@{1}:'.format(args.user, rhost).__add__(dst)) # Add command if utility.confirm("Want to do restore path {0}?".format(os.path.join(rpath, src))): cmds.append(' '.join(cmd))