diff --git a/ansible/library/kolla_docker.py b/ansible/library/kolla_docker.py index a4d57f838a..6f5a940cd6 100644 --- a/ansible/library/kolla_docker.py +++ b/ansible/library/kolla_docker.py @@ -675,6 +675,8 @@ class DockerWorker(object): def generate_module(): + # NOTE(jeffrey4l): add empty string '' to choices let us use + # pid_mode: "{{ service.pid_mode | default ('') }}" in yaml argument_spec = dict( common_options=dict(required=False, type='dict', default=dict()), action=dict(required=True, type='str', @@ -695,10 +697,10 @@ def generate_module(): name=dict(required=False, type='str'), environment=dict(required=False, type='dict'), image=dict(required=False, type='str'), - ipc_mode=dict(required=False, type='str', choices=['host']), + ipc_mode=dict(required=False, type='str', choices=['host', '']), cap_add=dict(required=False, type='list', default=list()), security_opt=dict(required=False, type='list', default=list()), - pid_mode=dict(required=False, type='str', choices=['host']), + pid_mode=dict(required=False, type='str', choices=['host', '']), privileged=dict(required=False, type='bool', default=False), remove_on_exit=dict(required=False, type='bool', default=True), restart_policy=dict(required=False, type='str', choices=[ diff --git a/tests/test_kolla_docker.py b/tests/test_kolla_docker.py index 69e302765d..bc5e910e68 100644 --- a/tests/test_kolla_docker.py +++ b/tests/test_kolla_docker.py @@ -60,10 +60,10 @@ class ModuleArgsTest(base.BaseTestCase): name=dict(required=False, type='str'), environment=dict(required=False, type='dict'), image=dict(required=False, type='str'), - ipc_mode=dict(required=False, type='str', choices=['host']), + ipc_mode=dict(required=False, type='str', choices=['host', '']), cap_add=dict(required=False, type='list', default=list()), security_opt=dict(required=False, type='list', default=list()), - pid_mode=dict(required=False, type='str', choices=['host']), + pid_mode=dict(required=False, type='str', choices=['host', '']), privileged=dict(required=False, type='bool', default=False), remove_on_exit=dict(required=False, type='bool', default=True), restart_policy=dict(