Remove compare_host_packages strategy
Now that the undercloud is containerized, there will be very few host packages to compare to, so there is a high risk that required package updates will be skipped. This is a strategy inherited from container-update.py that was intended to avoid unnecessary calls to yum update, however we now have a better approach using the repoquery, so host package comparison is no longer required, and probably causing some of the instances of bug Change-Id: Iab7b9d6377494001d904bb84b058ea293d73110c Partial-Bug: #1786764
This commit is contained in:
parent
cb535e91df
commit
c9d085729f
@ -24,7 +24,6 @@ A role to allow modification to container images built for the TripleO project.
|
||||
| `target_image` | `''` | See modify image variables |
|
||||
| `update_repo` | `''` | If set, packages from this repo will be updated. Other repos will only be used for dependencies of these updates.|
|
||||
| `yum_repos_dir_path` | `None` | Optional path of directory to be used as `/etc/yum.repos.d` during the update |
|
||||
| `compare_host_packages` | `False` | If `True`, skip yum update when package versions match host package versions |
|
||||
| `container_build_tool` | `docker` | See modify image variables |
|
||||
|
||||
## Requirements ##
|
||||
|
@ -1,3 +1,2 @@
|
||||
compare_host_packages: false
|
||||
update_repo: ''
|
||||
container_build_tool: 'docker'
|
||||
|
@ -1,33 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright 2018 Red Hat, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import json
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
host_packages = json.load(sys.stdin)
|
||||
rpm_output = subprocess.check_output(
|
||||
['rpm', '-qa', '--qf', '%{NAME} %{VERSION}-%{RELEASE}\n']).split('\n')
|
||||
|
||||
image_packages = dict(i.split(' ') for i in rpm_output if i)
|
||||
|
||||
for pkg, version in image_packages.items():
|
||||
host_version = host_packages.get(pkg)
|
||||
if host_version and version != host_version:
|
||||
print('%s-%s does not match host version %s' % (
|
||||
pkg, version, host_version))
|
||||
sys.exit(1)
|
||||
|
||||
print('No package version differences found')
|
@ -2,13 +2,6 @@
|
||||
|
||||
set -eux
|
||||
|
||||
if [ -f /tmp/host_packages.json ]; then
|
||||
if /tmp/compare-package-json.py < /tmp/host_packages.json ; then
|
||||
echo "Host package versions match, no update required"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
packages_for_update=
|
||||
if [ -n "$1" ] && command -v repoquery >/dev/null 2>&1; then
|
||||
installed=$(rpm -qa --qf "%{NAME}\n" | sort)
|
||||
|
@ -37,20 +37,6 @@
|
||||
chdir: "{{ modify_dir_path }}"
|
||||
when: yum_repos_dir_path is defined
|
||||
|
||||
|
||||
- name: Generate host package json file
|
||||
block:
|
||||
|
||||
- command: |
|
||||
rpm -qa --qf '"%{NAME}": "%{VERSION}-%{RELEASE}"\n'
|
||||
register: rpm_query_output
|
||||
|
||||
- copy:
|
||||
content: "{{ rpm_query_output.stdout | from_yaml | to_nice_json }}"
|
||||
dest: "{{ modify_dir_path }}/host_packages.json"
|
||||
|
||||
when: compare_host_packages
|
||||
|
||||
- name: Write Dockerfile to {{ modify_dir_path }}
|
||||
template:
|
||||
src: Dockerfile-yum.j2
|
||||
@ -62,12 +48,6 @@
|
||||
dest: "{{ modify_dir_path }}/yum_update.sh"
|
||||
mode: '0555'
|
||||
|
||||
- name: Write compare-package-json.py
|
||||
copy:
|
||||
src: compare-package-json.py
|
||||
dest: "{{ modify_dir_path }}/compare-package-json.py"
|
||||
mode: '0555'
|
||||
|
||||
- include_tasks: modify_image.yml
|
||||
|
||||
- name: Clean modify directory
|
||||
|
@ -4,7 +4,6 @@ LABEL modified_append_tag={{ modified_append_tag }}
|
||||
USER root
|
||||
|
||||
COPY yum_update.sh /tmp/
|
||||
COPY compare-package-json.py /tmp/
|
||||
|
||||
{% if yum_repos_dir_path is defined %}
|
||||
RUN rm -rf /etc/yum.repos.d/
|
||||
@ -12,10 +11,6 @@ COPY yum.repos.d /etc/yum.repos.d
|
||||
COPY repos /
|
||||
{% endif %}
|
||||
|
||||
{% if compare_host_packages %}
|
||||
COPY host_packages.json /tmp/
|
||||
{% endif %}
|
||||
|
||||
RUN /tmp/yum_update.sh "{{ update_repo }}"
|
||||
|
||||
USER "{{ original_user }}"
|
||||
|
Loading…
Reference in New Issue
Block a user