diff --git a/zunclient/api_versions.py b/zunclient/api_versions.py index 4907e9a8..326242e3 100644 --- a/zunclient/api_versions.py +++ b/zunclient/api_versions.py @@ -31,7 +31,7 @@ if not LOG.handlers: HEADER_NAME = "OpenStack-API-Version" SERVICE_TYPE = "container" MIN_API_VERSION = '1.1' -MAX_API_VERSION = '1.35' +MAX_API_VERSION = '1.36' DEFAULT_API_VERSION = '1.latest' _SUBSTITUTIONS = {} diff --git a/zunclient/v1/containers.py b/zunclient/v1/containers.py index 2b8bb02b..14ed1f2b 100644 --- a/zunclient/v1/containers.py +++ b/zunclient/v1/containers.py @@ -26,7 +26,7 @@ CREATION_ATTRIBUTES = ['name', 'image', 'command', 'cpu', 'memory', 'security_groups', 'hints', 'nets', 'auto_remove', 'runtime', 'hostname', 'mounts', 'disk', 'availability_zone', 'auto_heal', 'privileged', - 'exposed_ports', 'healthcheck', 'registry'] + 'exposed_ports', 'healthcheck', 'registry', 'tty'] class Container(base.Resource): @@ -97,6 +97,7 @@ class ContainerManager(base.Manager): def create(self, **kwargs): self._process_command(kwargs) self._process_mounts(kwargs) + self._process_tty(kwargs) new = {} for (key, value) in kwargs.items(): @@ -121,6 +122,12 @@ class ContainerManager(base.Manager): if mount.get('type') == 'bind': mount['source'] = utils.encode_file_data(mount['source']) + def _process_tty(self, kwargs): + tty_microversion = api_versions.APIVersion("1.36") + if self.api_version >= tty_microversion: + if 'interactive' in kwargs and 'tty' not in kwargs: + kwargs['tty'] = kwargs['interactive'] + def delete(self, id, **kwargs): return self._delete(self._path(id), qparams=kwargs) @@ -179,6 +186,7 @@ class ContainerManager(base.Manager): def run(self, **kwargs): self._process_command(kwargs) self._process_mounts(kwargs) + self._process_tty(kwargs) if not set(kwargs).issubset(CREATION_ATTRIBUTES): raise exceptions.InvalidAttribute(