Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pypodman: Don't use $HOST and $USER variables for remote #1824

Merged
merged 1 commit into from
Nov 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contrib/python/pypodman/docs/man1/pypodman.1
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ overwriting earlier. Any missing items are ignored.
.IP \[bu] 2
From \f[C]\-\-config\-home\f[] command line option + \f[C]pypodman/pypodman.conf\f[]
.IP \[bu] 2
From environment variable, for example: RUN_DIR
From environment variable prefixed with PODMAN_, for example: PODMAN_RUN_DIR
.IP \[bu] 2
From command line option, for example: \[en]run\-dir
.PP
Expand Down
15 changes: 8 additions & 7 deletions contrib/python/pypodman/pypodman/lib/podman_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def reqattr(name, value):
reqattr(
'run_dir',
getattr(args, 'run_dir')
or os.environ.get('RUN_DIR')
or os.environ.get('PODMAN_RUN_DIR')
or config['default'].get('run_dir')
or str(Path(args.xdg_runtime_dir, 'pypodman'))
) # yapf: disable
Expand All @@ -161,39 +161,40 @@ def reqattr(name, value):
args,
'host',
getattr(args, 'host')
or os.environ.get('HOST')
afbjorklund marked this conversation as resolved.
Show resolved Hide resolved
or os.environ.get('PODMAN_HOST')
or config['default'].get('host')
) # yapf:disable

reqattr(
'username',
getattr(args, 'username')
or os.environ.get('PODMAN_USER')
or config['default'].get('username')
or os.environ.get('USER')
or os.environ.get('LOGNAME')
or config['default'].get('username')
or getpass.getuser()
) # yapf:disable

reqattr(
'port',
getattr(args, 'port')
or os.environ.get('PORT')
afbjorklund marked this conversation as resolved.
Show resolved Hide resolved
or os.environ.get('PODMAN_PORT')
or config['default'].get('port', None)
or 22
) # yapf:disable

reqattr(
'remote_socket_path',
getattr(args, 'remote_socket_path')
or os.environ.get('REMOTE_SOCKET_PATH')
or os.environ.get('PODMAN_REMOTE_SOCKET_PATH')
or config['default'].get('remote_socket_path')
or '/run/podman/io.podman'
) # yapf:disable

reqattr(
'log_level',
getattr(args, 'log_level')
or os.environ.get('LOG_LEVEL')
or os.environ.get('PODMAN_LOG_LEVEL')
or config['default'].get('log_level')
or logging.WARNING
) # yapf:disable
Expand All @@ -202,7 +203,7 @@ def reqattr(name, value):
args,
'identity_file',
getattr(args, 'identity_file')
or os.environ.get('IDENTITY_FILE')
or os.environ.get('PODMAN_IDENTITY_FILE')
or config['default'].get('identity_file')
or os.path.expanduser('~{}/.ssh/id_dsa'.format(args.username))
) # yapf:disable
Expand Down