From 5e51be1def4658c3528c27923b01c90482e43cb5 Mon Sep 17 00:00:00 2001 From: Steve Milner Date: Wed, 24 May 2017 09:52:09 -0400 Subject: oc_atomic_container: Hard code system-package=no --- roles/lib_openshift/library/oc_atomic_container.py | 4 +++- roles/lib_openshift/src/ansible/oc_atomic_container.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/roles/lib_openshift/library/oc_atomic_container.py b/roles/lib_openshift/library/oc_atomic_container.py index d2620b4cc..e19e5169e 100644 --- a/roles/lib_openshift/library/oc_atomic_container.py +++ b/roles/lib_openshift/library/oc_atomic_container.py @@ -73,7 +73,9 @@ from ansible.module_utils.basic import AnsibleModule def _install(module, container, image, values_list): ''' install a container using atomic CLI. values_list is the list of --set arguments. container is the name given to the container. image is the image to use for the installation. ''' - args = ['atomic', 'install', "--system", '--name=%s' % container] + values_list + [image] + # NOTE: system-package=no is hardcoded. This should be changed to an option in the future. + args = ['atomic', 'install', '--system', '--system-package=no', + '--name=%s' % container] + values_list + [image] rc, out, err = module.run_command(args, check_rc=False) if rc != 0: return rc, out, err, False diff --git a/roles/lib_openshift/src/ansible/oc_atomic_container.py b/roles/lib_openshift/src/ansible/oc_atomic_container.py index 20d75cb63..e80349572 100644 --- a/roles/lib_openshift/src/ansible/oc_atomic_container.py +++ b/roles/lib_openshift/src/ansible/oc_atomic_container.py @@ -9,7 +9,9 @@ from ansible.module_utils.basic import AnsibleModule def _install(module, container, image, values_list): ''' install a container using atomic CLI. values_list is the list of --set arguments. container is the name given to the container. image is the image to use for the installation. ''' - args = ['atomic', 'install', "--system", '--name=%s' % container] + values_list + [image] + # NOTE: system-package=no is hardcoded. This should be changed to an option in the future. + args = ['atomic', 'install', '--system', '--system-package=no', + '--name=%s' % container] + values_list + [image] rc, out, err = module.run_command(args, check_rc=False) if rc != 0: return rc, out, err, False -- cgit v1.2.3 From 4ece7ca92210a18879d6ceff2c54ae5563e1c7fc Mon Sep 17 00:00:00 2001 From: Steve Milner Date: Wed, 24 May 2017 09:53:07 -0400 Subject: Remove system-package=no from container-engine install --- roles/docker/tasks/systemcontainer_docker.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/roles/docker/tasks/systemcontainer_docker.yml b/roles/docker/tasks/systemcontainer_docker.yml index 3af3e00b2..8c899bf89 100644 --- a/roles/docker/tasks/systemcontainer_docker.yml +++ b/roles/docker/tasks/systemcontainer_docker.yml @@ -124,8 +124,6 @@ name: "{{ openshift.docker.service_name }}" image: "{{ l_docker_image }}" state: latest - values: - - "system-package=no" - name: Configure Container Engine Service File template: -- cgit v1.2.3 From cbad3cf9bb5a3f82ac9b328a64083e82caa1f661 Mon Sep 17 00:00:00 2001 From: Steve Milner Date: Thu, 25 May 2017 13:43:17 -0400 Subject: oc_atomic_container: Workaround for invalid json from atomic command When no other containers are present and one attempts to list containers via the atomic command with the --json flag an empty string is returned. If a json.loads is used on this value an error is raised. This change adds a workaround to fall back to '[]' when an empty string is returned from the atomic containers command. --- roles/lib_openshift/library/oc_atomic_container.py | 4 +++- roles/lib_openshift/src/ansible/oc_atomic_container.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/roles/lib_openshift/library/oc_atomic_container.py b/roles/lib_openshift/library/oc_atomic_container.py index e19e5169e..1e017a576 100644 --- a/roles/lib_openshift/library/oc_atomic_container.py +++ b/roles/lib_openshift/library/oc_atomic_container.py @@ -159,7 +159,9 @@ def core(module): module.fail_json(rc=rc, msg=err) return - containers = json.loads(out) + # NOTE: "or '[]' is a workaround until atomic containers list --json + # provides an empty list when no containers are present. + containers = json.loads(out or '[]') present = len(containers) > 0 old_image = containers[0]["image_name"] if present else None diff --git a/roles/lib_openshift/src/ansible/oc_atomic_container.py b/roles/lib_openshift/src/ansible/oc_atomic_container.py index e80349572..1a5ab6869 100644 --- a/roles/lib_openshift/src/ansible/oc_atomic_container.py +++ b/roles/lib_openshift/src/ansible/oc_atomic_container.py @@ -95,7 +95,9 @@ def core(module): module.fail_json(rc=rc, msg=err) return - containers = json.loads(out) + # NOTE: "or '[]' is a workaround until atomic containers list --json + # provides an empty list when no containers are present. + containers = json.loads(out or '[]') present = len(containers) > 0 old_image = containers[0]["image_name"] if present else None -- cgit v1.2.3 From 1898489b4c2bb63ee7a4e284a4f7c1b5710e8d5b Mon Sep 17 00:00:00 2001 From: Steve Milner Date: Thu, 25 May 2017 13:50:15 -0400 Subject: Remove typos that got reintroduced --- roles/docker/tasks/systemcontainer_docker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/docker/tasks/systemcontainer_docker.yml b/roles/docker/tasks/systemcontainer_docker.yml index 8c899bf89..f0f5a40dd 100644 --- a/roles/docker/tasks/systemcontainer_docker.yml +++ b/roles/docker/tasks/systemcontainer_docker.yml @@ -102,7 +102,7 @@ l_docker_image: "{{ l_docker_image_prepend }}/{{ openshift.docker.service_name }}:latest" # NOTE: no_proxy added as a workaround until https://github.com/projectatomic/atomic/pull/999 is released -- name: Pre-pull Container Enginer System Container image +- name: Pre-pull Container Engine System Container image command: "atomic pull --storage ostree {{ l_docker_image }}" changed_when: false environment: @@ -119,7 +119,7 @@ path: "{{ docker_conf_dir }}" state: directory -- name: Install Container Enginer System Container +- name: Install Container Engine System Container oc_atomic_container: name: "{{ openshift.docker.service_name }}" image: "{{ l_docker_image }}" -- cgit v1.2.3