Allow set tty for containers

This change adds support to comfigure tty,
it was enabled by default but a recent patch
removed it. Some services such as Karaf in opendaylight
requires a TTY during startup.

Closes-Bug: #1806662
Change-Id: Ia4335523b727d0e45505cbb1efb40ccf04c27db7
This commit is contained in:
Eduardo Gonzalez 2018-12-05 10:04:52 +01:00
parent ef3df55228
commit 846c15d8e1
6 changed files with 20 additions and 2 deletions

View File

@ -173,6 +173,12 @@ options:
- running
- exited
- paused
tty:
description:
- Allocate TTY to container
required: False
default: False
type: bool
author: Sam Yaple
'''
@ -639,6 +645,7 @@ class DockerWorker(object):
'image': self.params.get('image'),
'name': self.params.get('name'),
'volumes': volumes,
'tty': self.params.get('tty'),
}
def create_container(self):
@ -842,7 +849,8 @@ def generate_module():
tls_cacert=dict(required=False, type='str'),
volumes=dict(required=False, type='list'),
volumes_from=dict(required=False, type='list'),
dimensions=dict(required=False, type='dict', default=dict())
dimensions=dict(required=False, type='dict', default=dict()),
tty=dict(required=False, type='bool', default=False),
)
required_if = [
['action', 'pull_image', ['image']],

View File

@ -14,6 +14,7 @@ opendaylight_services:
- "/etc/localtime:/etc/localtime:ro"
- "kolla_logs:/var/log/kolla/"
dimensions: "{{ opendaylight_dimensions }}"
tty: True
haproxy:
opendaylight_api:
enabled: "{{ enable_opendaylight }}"

View File

@ -12,6 +12,7 @@
volumes: "{{ service.volumes }}"
privileged: "{{ service.privileged | default(False) }}"
dimensions: "{{ service.dimensions }}"
tty: "{{ service.tty }}"
when:
- kolla_action != "config"
- service.enabled | bool

View File

@ -217,6 +217,7 @@
privileged: "{{ item.value.privileged | default(False) }}"
volumes: "{{ item.value.volumes }}"
dimensions: "{{ item.value.dimensions }}"
tty: "{{ item.value.tty }}"
register: check_opendaylight_containers
when:
- kolla_action != "config"

View File

@ -0,0 +1,5 @@
---
features:
- |
Added new parameter in kolla_docker to support configuring
TTY in containers, value is False by default

View File

@ -84,7 +84,8 @@ class ModuleArgsTest(base.BaseTestCase):
tls_cacert=dict(required=False, type='str'),
volumes=dict(required=False, type='list'),
volumes_from=dict(required=False, type='list'),
dimensions=dict(required=False, type='dict', default=dict())
dimensions=dict(required=False, type='dict', default=dict()),
tty=dict(required=False, type='bool', default=False),
)
required_if = [
['action', 'pull_image', ['image']],
@ -133,6 +134,7 @@ FAKE_DATA = {
'image': 'myregistrydomain.com:5000/ubuntu:16.04',
'name': 'test_container',
'volumes': None,
'tty': False,
},
'images': [