Add provisions for resolving a remote host

This commit is contained in:
Eric Torres 2019-04-23 23:17:42 -07:00
parent 841e05c3de
commit 42c0bf0597

View File

@ -12,6 +12,7 @@ Command-Line Arguments
--debug show debug messages
-n, --name name to give to the backup snapshot
-p, --port port that ssh on the destination is listening on
-r, --remote-host address/alias of remote machine to use
-s, --run-post-sync run sync syscall after backup
-u, --umask umask value to use while running backup process
-v, --verbose show info messages
@ -93,6 +94,12 @@ def parse_cmdline_arguments(**kwargs):
default=22,
help="port that ssh on the destination is listening on",
)
parser.add_argument(
"-r",
"--remote-host",
default=None,
help="address/alias of remote machine to use",
)
parser.add_argument(
"-s",
"--run-post-sync",
@ -118,9 +125,15 @@ def parse_cmdline_arguments(**kwargs):
if __name__ == "__main__":
args = parse_cmdline_arguments()
dest = (
args.repository
if args.remote_host is None
else f"{args.remote_host}@{os.getlogin()}:{args.port}{args.repository}"
)
try:
parsed_config = config.parse_configfile()
repo = Repository(args.repository)
repo = Repository(dest)
except PermissionError as e:
syslog.critical(e)
exit(E_PERMISSION)