update_repo to limit to packages in repo

Rather than updating every package, allow to limit to a single repo
This commit is contained in:
Steve Baker 2018-05-14 10:43:34 +12:00
parent 91e4555bde
commit 262e5497e0
4 changed files with 11 additions and 2 deletions

View File

@ -21,6 +21,8 @@ A role to allow modification to container images built for the TripleO project.
| `source_image` | `[undefined]` | See modify image variables | | `source_image` | `[undefined]` | See modify image variables |
| `modified_append_tag` | `date +-modified-%Y%m%d%H%M%S` | See modify image variables | | `modified_append_tag` | `date +-modified-%Y%m%d%H%M%S` | See modify image variables |
| `target_image` | `''` | See modify image variables | | `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 | | `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 | | `compare_host_packages` | `False` | If `True`, skip yum update when package versions match host package versions |

View File

@ -1 +1,2 @@
compare_host_packages: false compare_host_packages: false
update_repo: ''

View File

@ -8,5 +8,11 @@ if [ -f /tmp/host_packages.json ]; then
exit exit
fi fi
fi fi
yum -y update
packages_for_update=
if [ -n "$1" ]; then
packages_for_update=("$(repoquery --disablerepo='*' --enablerepo=$1 --qf %{NAME} -a)")
fi
yum -y update $packages_for_update
rm -rf /var/cache/yum rm -rf /var/cache/yum

View File

@ -15,6 +15,6 @@ COPY repos /
COPY host_packages.json /tmp/ COPY host_packages.json /tmp/
{% endif %} {% endif %}
RUN /tmp/yum_update.sh RUN /tmp/yum_update.sh "{{ update_repo }}"
USER "{{ original_user }}" USER "{{ original_user }}"