Browse Source

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
tags/8.0.0.0b1
Eduardo Gonzalez 5 months ago
parent
commit
846c15d8e1

+ 9
- 1
ansible/library/kolla_docker.py View File

@@ -173,6 +173,12 @@ options:
173 173
       - running
174 174
       - exited
175 175
       - paused
176
+  tty:
177
+    description:
178
+      - Allocate TTY to container
179
+    required: False
180
+    default: False
181
+    type: bool
176 182
 author: Sam Yaple
177 183
 '''
178 184
 
@@ -639,6 +645,7 @@ class DockerWorker(object):
639 645
             'image': self.params.get('image'),
640 646
             'name': self.params.get('name'),
641 647
             'volumes': volumes,
648
+            'tty': self.params.get('tty'),
642 649
         }
643 650
 
644 651
     def create_container(self):
@@ -842,7 +849,8 @@ def generate_module():
842 849
         tls_cacert=dict(required=False, type='str'),
843 850
         volumes=dict(required=False, type='list'),
844 851
         volumes_from=dict(required=False, type='list'),
845
-        dimensions=dict(required=False, type='dict', default=dict())
852
+        dimensions=dict(required=False, type='dict', default=dict()),
853
+        tty=dict(required=False, type='bool', default=False),
846 854
     )
847 855
     required_if = [
848 856
         ['action', 'pull_image', ['image']],

+ 1
- 0
ansible/roles/opendaylight/defaults/main.yml View File

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

+ 1
- 0
ansible/roles/opendaylight/handlers/main.yml View File

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

+ 1
- 0
ansible/roles/opendaylight/tasks/config.yml View File

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

+ 5
- 0
releasenotes/notes/support-tty-containers-c2d189f2e7c25dba.yaml View File

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

+ 3
- 1
tests/test_kolla_docker.py View File

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

Loading…
Cancel
Save