Browse Source

Merge pull request #4272 from ashcrow/system-package-no-hardcode

Merged by openshift-bot
OpenShift Bot 7 years ago
parent
commit
ce90c55beb

+ 2 - 4
roles/docker/tasks/systemcontainer_docker.yml

@@ -102,7 +102,7 @@
         l_docker_image: "{{ l_docker_image_prepend }}/{{ openshift.docker.service_name }}:latest"
         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
 # 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 }}"
   command: "atomic pull --storage ostree {{ l_docker_image }}"
   changed_when: false
   changed_when: false
   environment:
   environment:
@@ -119,13 +119,11 @@
     path: "{{ docker_conf_dir }}"
     path: "{{ docker_conf_dir }}"
     state: directory
     state: directory
 
 
-- name: Install Container Enginer System Container
+- name: Install Container Engine System Container
   oc_atomic_container:
   oc_atomic_container:
     name: "{{ openshift.docker.service_name }}"
     name: "{{ openshift.docker.service_name }}"
     image: "{{ l_docker_image }}"
     image: "{{ l_docker_image }}"
     state: latest
     state: latest
-    values:
-      - "system-package=no"
 
 
 - name: Configure Container Engine Service File
 - name: Configure Container Engine Service File
   template:
   template:

+ 6 - 2
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):
 def _install(module, container, image, values_list):
     ''' install a container using atomic CLI.  values_list is the list of --set arguments.
     ''' 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. '''
     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)
     rc, out, err = module.run_command(args, check_rc=False)
     if rc != 0:
     if rc != 0:
         return rc, out, err, False
         return rc, out, err, False
@@ -157,7 +159,9 @@ def core(module):
         module.fail_json(rc=rc, msg=err)
         module.fail_json(rc=rc, msg=err)
         return
         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
     present = len(containers) > 0
     old_image = containers[0]["image_name"] if present else None
     old_image = containers[0]["image_name"] if present else None
 
 

+ 6 - 2
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):
 def _install(module, container, image, values_list):
     ''' install a container using atomic CLI.  values_list is the list of --set arguments.
     ''' 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. '''
     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)
     rc, out, err = module.run_command(args, check_rc=False)
     if rc != 0:
     if rc != 0:
         return rc, out, err, False
         return rc, out, err, False
@@ -93,7 +95,9 @@ def core(module):
         module.fail_json(rc=rc, msg=err)
         module.fail_json(rc=rc, msg=err)
         return
         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
     present = len(containers) > 0
     old_image = containers[0]["image_name"] if present else None
     old_image = containers[0]["image_name"] if present else None