From c245713675efef226ffb69e7efa165800503f0ac Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotjagov Date: Sun, 14 Apr 2019 12:30:45 +0300 Subject: [PATCH] Fix image fetching process for leap 15 This patch fixes suse 15 container_image file retrievment process, as aria2c does not save image under the correct name as it's a metafile. This reverts commit 6c9e26e965b98b7c1d38a3003a5a2c018f896db6. Change-Id: I45647062c5766f1f9d4dd098f107e91caf52a3d7 --- tasks/lxc_install_zypper.yml | 9 +++++++++ vars/suse.yml | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tasks/lxc_install_zypper.yml b/tasks/lxc_install_zypper.yml index fd7a5047..e8cb43ec 100644 --- a/tasks/lxc_install_zypper.yml +++ b/tasks/lxc_install_zypper.yml @@ -63,3 +63,12 @@ enabled: "yes" tags: - lxc_hosts-config + +- name: Determine latest openSUSE container build information (Leap 15) + # NOTE(hwoarang) The build ID changes all the time so we need to have a hack to determine the latest one + # NOTE(evrardjp) You can still build using your own image by setting lxc_hosts_container_image_url in user_variables. + # NOTE(noonedeadpunk) While suse has static metalink which allows to get to the most recent build, + # aria2c do not save files provided by metalinks under expected names, as --out do not work for them. + shell: | + curl -s {{ _lxc_hosts_container_image_url_base }} | grep -P -o '{{ ansible_architecture }}.*?lxc.*?Build.*?xz' | head -n 1 + register: _lxc_opensuse_image_build_info diff --git a/vars/suse.yml b/vars/suse.yml index 6e0912ae..4402820d 100644 --- a/vars/suse.yml +++ b/vars/suse.yml @@ -15,7 +15,9 @@ # limitations under the License. _lxc_hosts_container_image_url_base: "https://download.opensuse.org/repositories/Virtualization:/containers:/images:/openSUSE-Leap-{{ ansible_distribution_version }}/containers/" -_lxc_hosts_container_image_url: "{{ _lxc_hosts_container_image_url_base }}opensuse-leap-image.x86_64-lxc.tar.xz" +# If you want to specify your own image when using SUSE, please override +# in your extra variables lxc_hosts_container_image_url. +_lxc_hosts_container_image_url: "{{ _lxc_hosts_container_image_url_base }}opensuse-leap-image.{{ _lxc_opensuse_image_build_info.stdout }}" _lxc_cache_map: distro: opensuse