Build the repo url when odl_version is passed 66/70266/6
authorManuel Buil <mbuil@suse.com>
Tue, 3 Apr 2018 08:21:15 +0000 (10:21 +0200)
committerManuel Buil <mbuil@suse.com>
Wed, 4 Apr 2018 09:41:42 +0000 (11:41 +0200)
XCI might pass the odl_version which should generate a repo url
pointing to different snaps repo. So far we were doing this at XCI
side but it makes more sense to do it here as the odl_version is
needed for template processing:

https://git.opendaylight.org/gerrit/#/c/70267/

Change-Id: I2c1cbb86060ce05c87442bcc247fc0679bc9587e
Signed-off-by: Manuel Buil <mbuil@suse.com>
tasks/add_odl_zypper_repo.yml
vars/main.yml

index 99332e6ccab6b3f186317a8db612e302c492ab6f..2f04e576e36bfa9e295deec01457eac3044bf125 100644 (file)
@@ -1,6 +1,21 @@
+- name: Add repo from file
+  block:
+   - name: Download ODL zypper repo
+     get_url:
+       url: "{{ suse_rpm_repo_url }}"
+       dest: /tmp/opendaylight.repo
+   - name: Add ODL zypper repo
+     zypper_repository:
+       repo: "/tmp/opendaylight.repo"
+       auto_import_keys: yes
+       disable_gpg_check: yes
+       runrefresh: yes
+  when: odl_version is defined
+
 - name: Add ODL zypper repo
   zypper_repository:
     repo: "{{ suse_rpm_repo_url }}"
     name: opendaylight
     auto_import_keys: yes
     runrefresh: yes
+  when: odl_version is undefined
index 020c5515c0cb33a52b38eae84089f2aa5c5eebc7..9202936618e89534fb4cb2907eddb82432019263 100755 (executable)
@@ -60,14 +60,22 @@ akka_remoting_port: 2550
 #   deb_path: Install ODL .deb from a local path or remote URL
 install_method: "rpm_repo"
 
+# We need this dictionary to translate from ODL version to the version number
+odl_version_dict:
+  master: 9
+  fluorine: 9
+  oxygen: 8
+  nitrogen: 7
+
 # URL of the .repo config to use when installing ODL from a repo
 # NB: This will only take effect when `install_method` is "rpm_repo"
-rpm_repo_url: "{{ odl_repo_url | default('https://git.opendaylight.org/gerrit/gitweb?p=integration/packaging.git;a=blob_plain;f=packages/rpm/example_repo_configs/opendaylight-8-devel.repo') }}"
-suse_rpm_repo_url: "{{ odl_repo_url | default('https://download.opensuse.org/repositories/Virtualization:/NFV/openSUSE_Leap_42.3/') }}"
+rpm_repo_url: "{% if odl_version is defined %}https://git.opendaylight.org/gerrit/gitweb?p=integration/packaging.git;a=blob_plain;f=packages/rpm/example_repo_configs/opendaylight-{{ odl_version_dict[odl_version] }}-devel.repo{% else %}https://git.opendaylight.org/gerrit/gitweb?p=integration/packaging.git;a=blob_plain;f=packages/rpm/example_repo_configs/opendaylight-8-devel.repo{% endif %}"
+suse_rpm_repo_url: "{% if odl_version is defined %}https://git.opendaylight.org/gerrit/gitweb?p=integration/packaging.git;a=blob_plain;f=packages/rpm/example_repo_configs/opendaylight-{{ odl_version_dict[odl_version] }}-opensuse-devel.repo{% else %}https://download.opensuse.org/repositories/Virtualization:/NFV/openSUSE_Leap_42.3/{% endif %}"
 
 # URL of the deb repository to use when installing ODL from a repo
 # NB: This will only take effect when `install_method` is "deb_repo"
-deb_repo_url: "{{ odl_repo_url | default('ppa:odl-team/oxygen') }}"
+# TODO: When deb snaps are built, point to a repo like rpm
+deb_repo_url: "ppa:odl-team/oxygen"
 
 # This will be passed as the `name` param to the Ansible `yum` module.
 # `name` param docs: "You can also pass a url or a local path to a rpm file."