SUSE: Fix repo setup on container cache

We need to delete all repos which do not match the expected ones so
we need an 'AND' conditional instead of 'OR'. Moreoever, all containers
are expected to have the cloud repository present. This is normally
being installed in the pip_install role but if the host has it already
then preserve that as well.

Change-Id: I44bdc79a07afa315e3d037ff05a06f5c79e1f738
This commit is contained in:
Markos Chandras 2017-09-25 14:45:42 +01:00
parent 1d60bd548c
commit e3d25ebff4

View File

@ -57,7 +57,7 @@ lxc_cache_map:
echo "nameserver {{ resolver }}" >> /etc/resolv.conf echo "nameserver {{ resolver }}" >> /etc/resolv.conf
{% endfor %} {% endfor %}
# Wipe default repositories and recreate them # Wipe default repositories and recreate them
find /etc/zypp/repos.d/*.repo -type f ! -name "repo-oss.repo" -o ! -name "repo-update.repo" -delete find /etc/zypp/repos.d/*.repo -type f ! -name "repo-oss.repo" -a ! -name "repo-update.repo" -a ! -name "OBS:Cloud:OpenStack:Pike.repo"-delete
# In case the host didn't have any of these two repos then create it (althought that indicates that the host is not in a good state!) # In case the host didn't have any of these two repos then create it (althought that indicates that the host is not in a good state!)
[[ ! -e /etc/zypp/repos.d/repo-oss.repo ]] && zypper --quiet ar {{ lxc_hosts_opensuse_mirror_url }}/distribution/leap/{{ ansible_distribution_version }}/repo/oss repo-oss [[ ! -e /etc/zypp/repos.d/repo-oss.repo ]] && zypper --quiet ar {{ lxc_hosts_opensuse_mirror_url }}/distribution/leap/{{ ansible_distribution_version }}/repo/oss repo-oss
[[ ! -e /etc/zypp/repos.d/repo-update.repo ]] && zypper --quiet ar {{ lxc_hosts_opensuse_mirror_url }}/update/leap/{{ ansible_distribution_version }}/oss/ repo-update [[ ! -e /etc/zypp/repos.d/repo-update.repo ]] && zypper --quiet ar {{ lxc_hosts_opensuse_mirror_url }}/update/leap/{{ ansible_distribution_version }}/oss/ repo-update