aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWojciech Dec <wdec@cisco.com>2018-01-30 14:35:45 +0100
committerFeng Pan <fpan@redhat.com>2018-06-10 21:19:52 -0400
commit2dd7507d2e7b1be052ad8301f951b50422ee51f0 (patch)
treebf78eeabba48e7615f087ec5f734d373abf39e72
parent13398d85161374a062b958dbf30596b29b8629e5 (diff)
Change fdio repo configuration.
- Install repo config only when explicitly passed. This implies that when puppet-fdio is used stand alone, it is expected that user will supply a valid repo_branch parameter. Change-Id: Ic2485a66d4ce4fb921304a39fe65f79abed781f0 Signed-off-by: Wojciech Dec <wdec@cisco.com> Signed-off-by: Feng Pan <fpan@redhat.com>
-rw-r--r--manifests/init.pp5
-rw-r--r--manifests/install.pp30
-rw-r--r--manifests/params.pp2
-rw-r--r--spec/acceptance/fdio_spec.rb4
-rw-r--r--spec/classes/fdio_spec.rb31
5 files changed, 50 insertions, 22 deletions
diff --git a/manifests/init.pp b/manifests/init.pp
index 704a526..36c37a4 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -5,8 +5,9 @@
# === Parameters:
# [*repo_branch*]
# (optional) fd.io repo branch.
-# Valid values are 'release', 'master' and stable branch like 'stable.1609'.
-# Defaults to 'release'.
+# Valid values are undef, 'none', 'release', 'master' and stable branch like
+# 'stable.1609'. When set to undef or 'none', repo will not be installed.
+# Defaults to undef.
#
# [*vpp_exec_commands*]
# (optional) array of VPP startup exec commands
diff --git a/manifests/install.pp b/manifests/install.pp
index bad8ec4..7a30594 100644
--- a/manifests/install.pp
+++ b/manifests/install.pp
@@ -3,26 +3,30 @@
# Manages the installation of fdio.
#
class fdio::install {
- $base_url = $fdio::repo_branch ? {
- 'release' => 'https://nexus.fd.io/content/repositories/fd.io.centos7/',
- 'master' => 'https://nexus.fd.io/content/repositories/fd.io.master.centos7/',
- default => "https://nexus.fd.io/content/repositories/fd.io.${fdio::repo_branch}.centos7/",
- }
- # Add fdio's Yum repository
- yumrepo { "fdio-${fdio::repo_branch}":
- baseurl => $base_url,
- descr => "FD.io ${fdio::repo_branch} packages",
- enabled => 1,
- gpgcheck => 0,
+ if !empty($fdio::repo_branch) and $fdio::repo_branch != 'none' {
+ $base_url = $fdio::repo_branch ? {
+ 'release' => 'https://nexus.fd.io/content/repositories/fd.io.centos7/',
+ 'master' => 'https://nexus.fd.io/content/repositories/fd.io.master.centos7/',
+ default => "https://nexus.fd.io/content/repositories/fd.io.${fdio::repo_branch}.centos7/",
+ }
+
+ # Add fdio's Yum repository
+ yumrepo { "fdio-${fdio::repo_branch}":
+ baseurl => $base_url,
+ descr => "FD.io ${fdio::repo_branch} packages",
+ enabled => 1,
+ gpgcheck => 0,
+ notify => Package['vpp'],
+ }
}
# Install the VPP RPM
package { 'vpp':
- ensure => present,
- require => Yumrepo["fdio-${fdio::repo_branch}"],
+ ensure => present,
}
+
if $fdio::vpp_dpdk_support {
package { 'vpp-plugins':
ensure => present,
diff --git a/manifests/params.pp b/manifests/params.pp
index c312d88..70e4450 100644
--- a/manifests/params.pp
+++ b/manifests/params.pp
@@ -3,7 +3,7 @@
# This class manages the default params for the fdio class.
#
class fdio::params {
- $repo_branch = 'release'
+ $repo_branch = undef
$vpp_exec_commands = undef
$vpp_exec_file = '/etc/vpp/vpp-exec'
$vpp_dpdk_support = true
diff --git a/spec/acceptance/fdio_spec.rb b/spec/acceptance/fdio_spec.rb
index 400641b..2f3a8e7 100644
--- a/spec/acceptance/fdio_spec.rb
+++ b/spec/acceptance/fdio_spec.rb
@@ -7,7 +7,7 @@ describe 'fdio' do
it 'should work with no errors' do
pp= <<-EOS
class { '::fdio':
- repo_branch => 'stable.1710'
+ repo_branch => 'release'
}
EOS
@@ -34,7 +34,7 @@ describe 'fdio' do
it 'should work with no errors' do
pp= <<-EOS
class { '::fdio':
- repo_branch => 'stable.1710',
+ repo_branch => 'release',
vpp_cpu_main_core => '1',
vpp_cpu_corelist_workers => '2',
vpp_vhostuser_coalesce_frames => 32,
diff --git a/spec/classes/fdio_spec.rb b/spec/classes/fdio_spec.rb
index c14fe87..aa56d1d 100644
--- a/spec/classes/fdio_spec.rb
+++ b/spec/classes/fdio_spec.rb
@@ -3,7 +3,8 @@ require 'spec_helper'
describe 'fdio' do
let :params do
- {}
+ { :repo_branch => 'release'
+ }
end
shared_examples_for 'fdio - default' do
@@ -33,7 +34,7 @@ describe 'fdio' do
'enabled' => 1,
)
}
- it { should contain_package('vpp').that_requires('Yumrepo[fdio-release]') }
+ it { should contain_package('vpp') }
context 'with stable 16.09 branch' do
let(:params) {{:repo_branch => 'stable.1609'}}
@@ -42,11 +43,33 @@ describe 'fdio' do
should contain_yumrepo('fdio-stable.1609').with(
'baseurl' => 'https://nexus.fd.io/content/repositories/fd.io.stable.1609.centos7/',
'enabled' => 1,
- )
+ ).that_notifies('Package[vpp]')
+ }
+ it { should contain_package('vpp') }
+ it { should contain_package('vpp-plugins').that_requires('Package[vpp]') }
+ end
+
+ context 'with empty repo' do
+ let(:params) {{:repo_branch => ''}}
+
+ it {
+ is_expected.not_to contain_class('yumrepo')
}
- it { should contain_package('vpp').that_requires('Yumrepo[fdio-stable.1609]') }
+ it { should contain_package('vpp') }
it { should contain_package('vpp-plugins').that_requires('Package[vpp]') }
end
+
+ context 'with none repo' do
+ let(:params) {{:repo_branch => 'none'}}
+
+ it {
+ is_expected.not_to contain_class('yumrepo')
+ }
+ it { should contain_package('vpp') }
+ it { should contain_package('vpp-plugins').that_requires('Package[vpp]') }
+ end
+
+
end
shared_examples_for 'fdio - config' do