Skip to content

Commit

Permalink
Improved localhost connection;
Browse files Browse the repository at this point in the history
Other fix
  • Loading branch information
MatteoGuadrini committed May 17, 2019
1 parent 179a4ff commit ce5290a
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions bb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1040,8 +1040,13 @@ def parse_arguments():
source_list = compose_source(args.action, args.type, srcs)
else:
source_list = []
# Compose source <user>@<hostname> 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 <user>@<hostname> 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',
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1134,8 +1140,12 @@ def parse_arguments():
# Compose source
cmd.append(os.path.join(rpath, src))
dst = src_dst[1]
# Compose destination <user>@<hostname> 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 <user>@<hostname> 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))
Expand Down

0 comments on commit ce5290a

Please sign in to comment.