Michael Pasternak has uploaded a new change for review. Change subject: cli: Implement Session-TTL header support #928314 ......................................................................
cli: Implement Session-TTL header support #928314 https://bugzilla.redhat.com/show_bug.cgi?id=928314 Change-Id: I4a404493235255d795c3554af4ffe7db471f2cc1 Signed-off-by: Michael Pasternak <[email protected]> --- M ovirt-engine-cli.spec.in M setup.py M src/cli/settings.py M src/ovirtcli/command/connect.py M src/ovirtcli/context.py M src/ovirtcli/options.py M src/ovirtcli/settings.py M src/ovirtcli/shell/connectcmdshell.py 8 files changed, 42 insertions(+), 20 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine-cli refs/changes/31/14031/1 diff --git a/ovirt-engine-cli.spec.in b/ovirt-engine-cli.spec.in index 848e7bd..5b4436d 100644 --- a/ovirt-engine-cli.spec.in +++ b/ovirt-engine-cli.spec.in @@ -15,7 +15,7 @@ BuildArch: noarch Requires: python -Requires: ovirt-engine-sdk >= 3.2.0.10 +Requires: ovirt-engine-sdk >= 3.2.0.11 Requires: pexpect Requires: python-setuptools Requires: python-ply diff --git a/setup.py b/setup.py index c2e093b..66e02e6 100755 --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ 'ovirtcli.platform', 'ovirtcli.platform.posix', 'ovirtcli.platform.windows', 'ovirtcli.shell', 'ovirtcli.utils', 'cli', 'cli.command', 'cli.platform', 'cli.platform.posix'], - install_requires=[ 'ovirt-engine-sdk >= 3.2.0.10-SNAPSHOT', 'pexpect-u >= 2.3', 'ply >= 3.3', 'kitchen >= 1' ], + install_requires=[ 'ovirt-engine-sdk >= 3.2.0.11-SNAPSHOT', 'pexpect-u >= 2.3', 'ply >= 3.3', 'kitchen >= 1' ], entry_points={ 'console_scripts': [ 'ovirt-shell = ovirtcli.main:main' ] }, **version_info ) diff --git a/src/cli/settings.py b/src/cli/settings.py index ff23b4d..773cf7b 100644 --- a/src/cli/settings.py +++ b/src/cli/settings.py @@ -153,10 +153,10 @@ os.rename(ftmp, fname) def set_file_permissions(self, f): - #Set UID bit - #Owner has read permission - #Owner has write permission - #Do not dump the file. + # Set UID bit + # Owner has read permission + # Owner has write permission + # Do not dump the file. os.chmod(f, stat.S_ISGID | stat.S_IRUSR | diff --git a/src/ovirtcli/command/connect.py b/src/ovirtcli/command/connect.py index bebe2b5..9620268 100644 --- a/src/ovirtcli/command/connect.py +++ b/src/ovirtcli/command/connect.py @@ -44,16 +44,17 @@ The arguments are: - * url - The URL to connect to (http[s]://server[:port]/api). - * username - The user to connect as. (user@domain). - * password - The password to use. - * [key-file] - The client PEM key file to use. - * [cert-file] - The client PEM certificate file to use. - * [ca-file] - The server CA certificate file to use. - * [filter] - Enables user permission based filtering. - * [insecure] - Allow connecting to SSL sites without certificates. - * [port] - The port to use (if not specified in url). - * [timeout] - The request timeout. + * url - The URL to connect to (http[s]://server[:port]/api). + * username - The user to connect as. (user@domain). + * password - The password to use. + * [key-file] - The client PEM key file to use. + * [cert-file] - The client PEM certificate file to use. + * [ca-file] - The server CA certificate file to use. + * [filter] - Enables user permission based filtering. + * [insecure] - Allow connecting to SSL sites without certificates. + * [port] - The port to use (if not specified in url). + * [timeout] - The request timeout. + * [session-timeout] - The authentication session timeout (0 disables session expiry). """ def execute(self): @@ -69,6 +70,7 @@ ca_file = self.xNoneType(settings.get('ovirt-shell:ca_file')) port = settings.get('ovirt-shell:port') timeout = settings.get('ovirt-shell:timeout') + session_timeout = settings.get('ovirt-shell:session_timeout') debug = settings.get('cli:debug') insecure = settings.get('ovirt-shell:insecure') dont_validate_cert_chain = settings.get('ovirt-shell:dont_validate_cert_chain') @@ -104,6 +106,7 @@ filter=filter_, port=port if port != -1 else None, timeout=timeout if timeout != -1 else None, + session_timeout=session_timeout if session_timeout != -1 else None, debug=debug), url=url) diff --git a/src/ovirtcli/context.py b/src/ovirtcli/context.py index a48e1e6..0c789d4 100644 --- a/src/ovirtcli/context.py +++ b/src/ovirtcli/context.py @@ -143,4 +143,8 @@ self.settings['ovirt-shell:insecure'] = False self.settings['ovirt-shell:port'] = -1 self.settings['ovirt-shell:timeout'] = -1 - self.settings['cli:debug'] = False + self.settings['ovirt-shell:session_timeout'] = -1 + # do not reset 'debug' on /disconnect as it loaded + # from the .rc config file and not set-able via /connect + # command + # self.settings['cli:debug'] = False diff --git a/src/ovirtcli/options.py b/src/ovirtcli/options.py index e7b67c6..446e544 100644 --- a/src/ovirtcli/options.py +++ b/src/ovirtcli/options.py @@ -47,7 +47,8 @@ self.add_option('-F', '--filter', help='enables user permission based filtering', action='store_true') self.add_option('-P', '--port', help='specify port') - self.add_option('-T', '--timeout', help='specify timeout') + self.add_option('-T', '--timeout', help='specify request timeout') + self.add_option('-S', '--session-timeout', help='specify authentication session timeout (0 disables session expiry)') self.add_option('-c', '--connect', action='store_true', help='automatically connect') self.add_option('-f', '--file', metavar='FILE', diff --git a/src/ovirtcli/settings.py b/src/ovirtcli/settings.py index 241c1cd..f0ac0dd 100644 --- a/src/ovirtcli/settings.py +++ b/src/ovirtcli/settings.py @@ -58,6 +58,7 @@ ('ovirt-shell:filter', boolean, False), ('ovirt-shell:port', int, -1), ('ovirt-shell:timeout', int, -1), + ('ovirt-shell:session_timeout', int, -1), ('ovirt-shell:input_format', enum('xml'), 'xml'), ('ovirt-shell:output_format', enum('xml', 'text'), 'text'), ('ovirt-shell:wide', boolean, False), @@ -85,5 +86,6 @@ 'ovirt-shell:insecure', 'ovirt-shell:dont_validate_cert_chain', 'ovirt-shell:filter', - 'ovirt-shell:timeout' + 'ovirt-shell:timeout', + 'ovirt-shell:session_timeout' ] diff --git a/src/ovirtcli/shell/connectcmdshell.py b/src/ovirtcli/shell/connectcmdshell.py index c3b404b..44806f0 100644 --- a/src/ovirtcli/shell/connectcmdshell.py +++ b/src/ovirtcli/shell/connectcmdshell.py @@ -24,7 +24,19 @@ class ConnectCmdShell(CmdShell): NAME = 'connect' - OPTIONS = [ 'url', 'user', 'password', 'key-file', 'cert-file', 'ca-file', 'insecure', 'filter', 'port', 'timeout'] + OPTIONS = [ + 'url', + 'user', + 'password', + 'key-file', + 'cert-file', + 'ca-file', + 'insecure', + 'filter', + 'port', + 'timeout', + 'session-timeout' + ] def __init__(self, context, parser): CmdShell.__init__(self, context, parser) -- To view, visit http://gerrit.ovirt.org/14031 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4a404493235255d795c3554af4ffe7db471f2cc1 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine-cli Gerrit-Branch: cli_3.2 Gerrit-Owner: Michael Pasternak <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
