Allow full customization of ODL RPM repo 39/63239/11
authorDaniel Farrell <dfarrell@redhat.com>
Mon, 18 Sep 2017 17:12:38 +0000 (13:12 -0400)
committerTim Rozet <trozet@redhat.com>
Fri, 17 Nov 2017 16:14:24 +0000 (11:14 -0500)
Instead of assuming ODL's RPM should be installed from a CentOS CBS
repo, allow installing from any repo. This will allow us to install from
ODL's new fully-CD Nexus repos.

Param rpm_url is changed to be a baseurl var to configure ODL RPM .repo
config file to install from.

This is a backwards-incompatible API change.

Also now defaults to use Oxygen ODL and fixes an issue where auth tests
were failing due to odl-restconf not being available.  Although,
odl-restconf was specified in the test, it was not being loaded because
ODL does not respect subsequent changes to the karaf features file.
Therefore we need to load it during the initial ODL install.

Closes-Bug: https://jira.opendaylight.org/browse/INTPAK-11

Change-Id: Ibf49be1bf3ee780f9ca69894ffb0a1f3f5ac385c
Signed-off-by: Daniel Farrell <dfarrell@redhat.com>
Signed-off-by: Tim Rozet <trozet@redhat.com>
CHANGELOG
README.markdown
Rakefile
manifests/init.pp
manifests/params.pp
manifests/repos.pp
metadata.json
spec/classes/opendaylight_repos_spec.rb
spec/classes/opendaylight_spec.rb
spec/spec_helper.rb
spec/spec_helper_acceptance.rb

index 9abfc56c8074b8443e060ae77291946f28eaf8a7..741e513bb54ccc17bc1778356eb368aa9543dc05 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -47,4 +47,6 @@
 2017-08-14 Release 4.2.0
 - Add param to config SNAT mechanism
 2017-10-11 Release 5.0.0
-- Only support stateful security mode. Remove all related configs
\ No newline at end of file
+- Only support stateful security mode. Remove all related configs
+2017-11-15 Release 6.0.0
+- Allow full customization of ODL RPM repo
index bf9f434c43dd276850713ec00e326312f0526aa5..cb5b304407ebd788ae8158c866b9fa94cd5610d2 100644 (file)
@@ -96,21 +96,13 @@ OpenDaylight is installed from.
 
 ```puppet
 class { 'opendaylight':
-  rpm_repo => 'opendaylight-61-release',
+  rpm_repo => 'https://nexus.opendaylight.org/content/repositories/opendaylight-oxygen-epel-7-$basearch-devel',
 }
 ```
 
-The naming convention follows the naming convention of the CentOS Community
-Build System, which is where upstream ODL hosts its RPMs. The
-`opendaylight-61-release` example above would install OpenDaylight Carbon SR1
-6.1.0 from the [nfv7-opendaylight-61-release][2] repo. Repo names ending in
-`-release` will always contain well-tested, officially released versions of
-OpenDaylight. Repos ending in `-testing` contain frequent, but unstable and
-unofficial, releases. The ODL version given in repo names shows which major
-and minor version it is pinned to. The `opendaylight-61-release` repo will
-always provide OpenDaylight Carbon SR1 6.1, whereas `opendaylight-4-release`
-will provide the latest release with major version 6 (which could include
-Service Releases, like SR2 6.2).
+The URL should be formatted like a baseurl in RPM .repo config files. In
+particular, note the $basearch variable, which should be left form the
+package manager (yum, dnf) to populate.
 
 For additional information about ODL RPM repos, see the [Integration/Packaging
 RPM repositories documentation][3].
@@ -232,8 +224,7 @@ Valid options: A valid port number as a string or integer.
 
 ##### `rpm_repo`
 
-OpenDaylight CentOS CBS repo to install RPM from (opendaylight-6-testing,
-opendaylight-6-release, ...).
+Repo URL to install ODL RPM from, in .repo baseurl format.
 
 ##### `deb_repo`
 
index 2de9aa39959725e3f40b3bb7b723b99c7d98ceb2..8a2d0e59df6ddfa049b81f38425e04229cfdaf75 100644 (file)
--- a/Rakefile
+++ b/Rakefile
@@ -22,29 +22,37 @@ task :metadata_lint do
   sh "metadata-json-lint metadata.json"
 end
 
-# CentOS VMs
+# CentOS CBS VM
+desc "Beaker tests against CentOS 7 VM with latest Oxygen testing RPM from CentOS CBS repo"
+task :cent_8test_cbs_vm do
+  sh "RS_SET=centos-7 RPM_REPO='http://cbs.centos.org/repos/nfv7-opendaylight-8-testing/$basearch/os/' bundle exec rake beaker"
+end
 
-desc "Beaker tests against CentOS 7 VM with latest Carbon testing RPM"
-task :cent_6test_vm do
-  sh "RS_SET=centos-7 RPM_REPO='opendaylight-7-testing' bundle exec rake beaker"
+# CentOS CBS Container
+desc "Beaker tests against CentOS 7 container with latest Oxygen testing RPM from CentOS CBS repo"
+task :cent_8test_cbs_dock do
+  sh "RS_SET=centos-7-docker RPM_REPO='http://cbs.centos.org/repos/nfv7-opendaylight-8-testing/$basearch/os/' bundle exec rake beaker"
 end
 
-# CentOS Containers
+# CentOS Nexus VM
+desc "Beaker tests against CentOS 7 VM with latest Oxygen testing RPM from ODL Nexus repo"
+task :cent_8test_nexus_vm do
+  sh "RS_SET=centos-7 RPM_REPO='https://nexus.opendaylight.org/content/repositories/opendaylight-oxygen-epel-7-$basearch-devel' bundle exec rake beaker"
+end
 
-desc "Beaker tests against CentOS 7 container with latest Carbon testing RPM"
-task :cent_6test_dock do
-  sh "RS_SET=centos-7-docker RPM_REPO='opendaylight-7-testing' bundle exec rake beaker"
+# CentOS Nexus Container
+desc "Beaker tests against CentOS 7 container with latest Oxygen testing RPM from ODL Nexus repo"
+task :cent_8test_nexus_dock do
+  sh "RS_SET=centos-7-docker RPM_REPO='https://nexus.opendaylight.org/content/repositories/opendaylight-oxygen-epel-7-$basearch-devel' bundle exec rake beaker"
 end
 
 # Ubuntu VMs
-
 desc "Beaker tests against Ubuntu 16.04 Container with Boron release Deb"
 task :ubuntu_6test_vm do
   sh "RS_SET=ubuntu-16 DEB_REPO='ppa:odl-team/carbon' bundle exec rake beaker"
 end
 
 # Ubuntu Containers
-
 desc "Beaker tests against Ubuntu 16.04 Container with Boron release Deb"
 task :ubuntu_6test_dock do
   sh "RS_SET=ubuntu-16-docker DEB_REPO='ppa:odl-team/carbon' bundle exec rake beaker"
@@ -63,19 +71,21 @@ task :test => [
 desc "Quick and important tests"
 task :sanity=> [
   :test,
-  :cent_6test_dock,
+  :cent_8test_cbs_dock,
 ]
 
+# TODO: Add cent_8test_nexus_vm when INTPAK-10 is fixed
 desc "All tests, use VMs for Beaker tests"
 task :acceptance_vm => [
   :test,
   :ubuntu_6test_vm,
-  :cent_6test_vm,
+  :cent_8test_cbs_vm,
 ]
 
+# TODO: Add cent_8test_nexus_dock when INTPAK-10 is fixed
 desc "All tests, use containers for Beaker tests"
 task :acceptance_dock => [
   :test,
   :ubuntu_6test_dock,
-  :cent_6test_dock,
+  :cent_8test_cbs_dock,
 ]
index 1547e1a08a7a8e6bb4a82361c5d551d6d0a848a9..25d9ec3a82e07b7245830e8f2cde336b0c85bd15 100644 (file)
@@ -13,8 +13,7 @@
 # [*odl_bind_ip *]
 #   IP for ODL northbound REST interface to bind to.
 # [*rpm_repo*]
-#   OpenDaylight CentOS CBS repo to install RPM from (opendaylight-4-testing,
-#   opendaylight-40-release, ...).
+#   Repo URL to install ODL RPM from, in .repo baseurl format.
 # [*deb_repo*]
 #   OpenDaylight Launchpad PPA repo to install .deb from (ppa:odl-team/boron,
 #   ppa:odl-team/carbon, ...).
index 84805522b0dced005d528291b57d2d4ea5d384aa..6edb4ce3667059446e0f8f0f9f57ef52ccb856a4 100644 (file)
@@ -12,7 +12,7 @@ class opendaylight::params {
   $extra_features = []
   $odl_rest_port = '8080'
   $odl_bind_ip = '0.0.0.0'
-  $rpm_repo = 'opendaylight-6-testing'
+  $rpm_repo = 'http://cbs.centos.org/repos/nfv7-opendaylight-8-testing/$basearch/os/'
   $deb_repo = 'ppa:odl-team/carbon'
   $log_levels = {}
   $enable_ha = false
index 2ef35114f61bafcb3d90aae069a874a3864b1dd8..e1d2be47aa48e0c6d77f1c1142a422ed67acc8e7 100644 (file)
@@ -1,24 +1,24 @@
 # == Class: opendaylight::repos
 #
-# Manages the installation of the OpenDaylight repositories for RedHat and
-# Debian
+# Manages installation of OpenDaylight repositories for RPMs and Debs.
 #
 # === Parameters
 #
 # [*deb_repo*]
-#  The name of the debppa repo to configure. Ignored if on a RHEL based system.
+#  Deb PPA repo to install ODL from. Ignored if on a RPM-based system.
 #  Defaults to $::opendaylight::deb_repo
 #
 # [*rpm_repo*]
-#  The name of the rpm repo to configure. Ignored if on a Debian based system
+#  Repo URL to install ODL RPM from, in .repo baseurl format. Ignored if on a
+#  Debian-based system.
 #  Defaults to $::opendaylight::rpm_repo
 #
 # [*rpm_repo_enabled*]
-#  Flag to indicate if the the rpm repo should be enabled or disabled.
+#  Flag to indicate if the the RPM repo should be enabled or disabled.
 #  Defualts to 1.
 #
 # [*rpm_repo_gpgcheck*]
-#  Flag to indicate if the rpm repo should be configured with gpgcheck.
+#  Flag to indicate if the RPM repo should be configured with gpgcheck.
 #  Defaults to 0.
 #
 class opendaylight::repos (
@@ -29,12 +29,9 @@ class opendaylight::repos (
 ) inherits ::opendaylight {
   if $::osfamily == 'RedHat' {
     # Add OpenDaylight's Yum repository
-    yumrepo { $rpm_repo:
-      # 'ensure' isn't supported with Puppet <3.5
-      # Seems to default to present, but docs don't say
-      # https://docs.puppetlabs.com/references/3.4.0/type.html#yumrepo
-      # https://docs.puppetlabs.com/references/3.5.0/type.html#yumrepo
-      baseurl  => "http://cbs.centos.org/repos/nfv7-${rpm_repo}/\$basearch/os/",
+    yumrepo { 'opendaylight':
+      ensure   => present,
+      baseurl  => $rpm_repo,
       descr    => 'OpenDaylight SDN Controller',
       enabled  => $rpm_repo_enabled,
       # NB: RPM signing is an active TODO, but is not done. We will enable
index 713b3ef3f602ac5fdc4d11b655b8acf9f6908639..30aafb1fe7a1e7daab9c27aa727e23145f681fcd 100644 (file)
@@ -1,6 +1,6 @@
 {
     "name": "opendaylight-opendaylight",
-    "version": "5.0.0",
+    "version": "6.0.0",
     "author": "Daniel Farrell",
     "summary": "Puppet module that installs and configures the OpenDaylight SDN controller",
     "license": "BSD-2-Clause",
index 50c5561a1dbb27f4add48141de9b314ed57f9963..17796ad45c6a75ace1885959a563aad4c0e8b85a 100644 (file)
@@ -20,8 +20,8 @@ describe 'opendaylight::repos' do
     context "with defaults" do
       it { should contain_class('opendaylight::repos') }
       it {
-        should contain_yumrepo('opendaylight-6-testing').with(
-          :baseurl  => 'http://cbs.centos.org/repos/nfv7-opendaylight-6-testing/$basearch/os/',
+        should contain_yumrepo('opendaylight').with(
+          :baseurl  => 'http://cbs.centos.org/repos/nfv7-opendaylight-8-testing/$basearch/os/',
           :enabled  => 1,
           :gpgcheck => 0,
         )
@@ -31,14 +31,14 @@ describe 'opendaylight::repos' do
     context "with custom rpm repo options" do
       let(:params) do
         {
-          :rpm_repo => 'testing',
+          :rpm_repo => 'foo_fake_repo',
           :rpm_repo_enabled => 0,
           :rpm_repo_gpgcheck => 1,
         }
       end
       it {
-        should contain_yumrepo('testing').with(
-          :baseurl  => 'http://cbs.centos.org/repos/nfv7-testing/$basearch/os/',
+        should contain_yumrepo('opendaylight').with(
+          :baseurl  => 'foo_fake_repo',
           :enabled  => 0,
           :gpgcheck => 1,
         )
index 0b6f2fe5c100a9a74d2bd600d0066d72b696c420..79c62086e808bb89d168783cf34b85f531a89048 100644 (file)
@@ -636,7 +636,7 @@ describe 'opendaylight' do
       operatingsystemrelease = '7.0'
       operatingsystemmajrelease = '7'
 
-      context 'installing default RPM' do
+      context 'installing from default repo' do
         let(:facts) {{
           :osfamily => osfamily,
           :operatingsystem => operatingsystem,
@@ -652,8 +652,8 @@ describe 'opendaylight' do
         rpm_install_tests
       end
 
-      context 'installing Beryllium RPM' do
-        rpm_repo = 'opendaylight-40-release'
+      context 'installing from Nexus repo' do
+        rpm_repo = 'https://nexus.opendaylight.org/content/repositories/opendaylight-oxygen-epel-7-$basearch-devel'
         let(:facts) {{
           :osfamily => osfamily,
           :operatingsystem => operatingsystem,
index b241eb74e6843034425d50b4180712578d713c8f..f0355eb3bf74e2d19f521e5d6c511b193ed98889 100644 (file)
@@ -228,28 +228,28 @@ end
 
 def rpm_install_tests(options = {})
   # Extract params
-  rpm_repo = options.fetch(:rpm_repo, 'opendaylight-6-testing')
+  rpm_repo = options.fetch(:rpm_repo, 'http://cbs.centos.org/repos/nfv7-opendaylight-8-testing/$basearch/os/')
   java_opts = options.fetch(:java_opts, '-Djava.net.preferIPv4Stack=true')
 
   # Default to CentOS 7 Yum repo URL
 
   # Confirm presence of RPM-related resources
-  it { should contain_yumrepo(rpm_repo) }
+  it { should contain_yumrepo('opendaylight') }
   it { should contain_package('opendaylight') }
 
   # Confirm relationships between RPM-related resources
-  it { should contain_package('opendaylight').that_requires("Yumrepo[#{rpm_repo}]") }
-  it { should contain_yumrepo(rpm_repo).that_comes_before('Package[opendaylight]') }
+  it { should contain_package('opendaylight').that_requires('Yumrepo[opendaylight]') }
+  it { should contain_yumrepo('opendaylight').that_comes_before('Package[opendaylight]') }
 
   # Confirm properties of RPM-related resources
   # NB: These hashes don't work with Ruby 1.8.7, but we
   #   don't support 1.8.7 so that's okay. See issue #36.
   it {
-    should contain_yumrepo(rpm_repo).with(
+    should contain_yumrepo('opendaylight').with(
       'enabled'     => '1',
       'gpgcheck'    => '0',
       'descr'       => 'OpenDaylight SDN Controller',
-      'baseurl'     => "http://cbs.centos.org/repos/nfv7-#{rpm_repo}/$basearch/os/",
+      'baseurl'     => "#{rpm_repo}",
     )
   }
   it {
@@ -292,7 +292,7 @@ end
 def unsupported_os_tests(options = {})
   # Extract params
   expected_msg = options.fetch(:expected_msg)
-  rpm_repo = options.fetch(:rpm_repo, 'opendaylight-6-testing')
+  rpm_repo = options.fetch(:rpm_repo, 'http://cbs.centos.org/repos/nfv7-opendaylight-8-testing/$basearch/os/')
 
   # Confirm that classes fail on unsupported OSs
   it { expect { should contain_class('opendaylight') }.to raise_error(Puppet::Error, /#{expected_msg}/) }
@@ -301,7 +301,7 @@ def unsupported_os_tests(options = {})
   it { expect { should contain_class('opendaylight::service') }.to raise_error(Puppet::Error, /#{expected_msg}/) }
 
   # Confirm that other resources fail on unsupported OSs
-  it { expect { should contain_yumrepo(rpm_repo) }.to raise_error(Puppet::Error, /#{expected_msg}/) }
+  it { expect { should contain_yumrepo('opendaylight') }.to raise_error(Puppet::Error, /#{expected_msg}/) }
   it { expect { should contain_package('opendaylight') }.to raise_error(Puppet::Error, /#{expected_msg}/) }
   it { expect { should contain_service('opendaylight') }.to raise_error(Puppet::Error, /#{expected_msg}/) }
   it { expect { should contain_file('org.apache.karaf.features.cfg') }.to raise_error(Puppet::Error, /#{expected_msg}/) }
index 46b2b6302d739e45963233f4df7144ad5c4d90ca..92d4fe0dc17bbd39e9f8f154bbeaaf9c1d40dfba 100644 (file)
@@ -51,7 +51,7 @@ def install_odl(options = {})
   #   class, which are defined in opendaylight::params
   # TODO: Remove this possible source of bugs^^
   # Extract params if given, defaulting to odl class defaults if not
-  extra_features = options.fetch(:extra_features, [])
+  extra_features = options.fetch(:extra_features, ['odl-restconf'])
   default_features = options.fetch(:default_features, ['standard', 'wrap', 'ssh'])
   odl_rest_port = options.fetch(:odl_rest_port, 8080)
   odl_bind_ip = options.fetch(:odl_bind_ip, '0.0.0.0')
@@ -343,7 +343,7 @@ end
 def rpm_validations()
   rpm_repo = ENV['RPM_REPO']
 
-  describe yumrepo(rpm_repo) do
+  describe yumrepo('opendaylight') do
     it { should exist }
     it { should be_enabled }
   end