Update repo for stackforge migration
* Add gerrit configuration * s/Puppetfile/Gemfile: puppetfile with this content is a mistake * Fix puppet modulefile (stackforge migration) * Add puppet-lint configuration like other puppet projects on stackforge * Add Gemlock file * And update gitingore * Solve lint issues, and minors improvments [lint issues] * class not documented * variable not enclosed in {} * double quoted string containing no variables * case statement without a default case * indentation of => is not properly aligned * soft and hard tabs [improvments] * Use a case instead of a if/if Change-Id: I58614f7995e6b8f3f7f6426269077810962cc682
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
*.swp
|
||||
spec/fixtures/modules/*
|
||||
spec/fixtures/manifests/*
|
||||
pkg
|
||||
|
4
.gitreview
Normal file
4
.gitreview
Normal file
@@ -0,0 +1,4 @@
|
||||
[gerrit]
|
||||
host=review.openstack.org
|
||||
port=29418
|
||||
project=stackforge/puppet-vswitch.git
|
@@ -1,7 +1,8 @@
|
||||
source :rubygems
|
||||
source 'https://rubygems.org'
|
||||
|
||||
group :development, :test do
|
||||
gem 'puppetlabs_spec_helper', :require => false
|
||||
gem 'puppet-lint', '~> 0.3.2'
|
||||
end
|
||||
|
||||
if puppetversion = ENV['PUPPET_GEM_VERSION']
|
41
Gemfile.lock
Normal file
41
Gemfile.lock
Normal file
@@ -0,0 +1,41 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
diff-lcs (1.2.4)
|
||||
facter (1.7.3)
|
||||
hiera (1.2.1)
|
||||
json_pure
|
||||
json_pure (1.8.1)
|
||||
metaclass (0.0.1)
|
||||
mocha (0.14.0)
|
||||
metaclass (~> 0.0.1)
|
||||
puppet (3.3.1)
|
||||
facter (~> 1.6)
|
||||
hiera (~> 1.0)
|
||||
rgen (~> 0.6.5)
|
||||
puppet-lint (0.3.2)
|
||||
puppetlabs_spec_helper (0.4.1)
|
||||
mocha (>= 0.10.5)
|
||||
rake
|
||||
rspec (>= 2.9.0)
|
||||
rspec-puppet (>= 0.1.1)
|
||||
rake (10.1.0)
|
||||
rgen (0.6.6)
|
||||
rspec (2.14.1)
|
||||
rspec-core (~> 2.14.0)
|
||||
rspec-expectations (~> 2.14.0)
|
||||
rspec-mocks (~> 2.14.0)
|
||||
rspec-core (2.14.6)
|
||||
rspec-expectations (2.14.3)
|
||||
diff-lcs (>= 1.1.3, < 2.0)
|
||||
rspec-mocks (2.14.4)
|
||||
rspec-puppet (0.1.6)
|
||||
rspec
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
puppet
|
||||
puppet-lint (~> 0.3.2)
|
||||
puppetlabs_spec_helper
|
@@ -1,8 +1,8 @@
|
||||
name 'puppet-vswitch'
|
||||
version '0.1.0'
|
||||
source 'https://github.com/CiscoSystems/puppet-vswitch'
|
||||
author 'Endre Karlson, Dan Bode, Ian Wells'
|
||||
source 'https://github.com/stackforge/puppet-vswitch'
|
||||
author 'Endre Karlson, Dan Bode, Ian Wells, Gilles Dubreuil'
|
||||
license 'Apache License 2.0'
|
||||
summary 'Puppet module for OpenVSwitch and other vSwitches'
|
||||
description 'Puppet module to install and configure the OpenVSwitch and other vSwitches'
|
||||
project_page 'https://github.com/CiscoSystems/puppet-vswitch'
|
||||
project_page 'https://github.com/stackforge/puppet-vswitch'
|
||||
|
6
Rakefile
6
Rakefile
@@ -1 +1,7 @@
|
||||
require 'puppetlabs_spec_helper/rake_tasks'
|
||||
require 'puppet-lint/tasks/puppet-lint'
|
||||
|
||||
PuppetLint.configuration.fail_on_warnings = true
|
||||
PuppetLint.configuration.send('disable_80chars')
|
||||
PuppetLint.configuration.send('disable_class_parameter_defaults')
|
||||
PuppetLint.configuration.send('disable_class_inherits_from_params_class')
|
||||
|
@@ -1,6 +1,32 @@
|
||||
# == Class: vswitch
|
||||
#
|
||||
# Install and configure vswitch (ovs and others) using puppet.
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*provider*]
|
||||
# Select vswitch to install
|
||||
#
|
||||
# === Examples
|
||||
#
|
||||
# class { 'vswitch':
|
||||
# provider => 'ovs',
|
||||
# }
|
||||
#
|
||||
# === Authors
|
||||
#
|
||||
# - Endre Karlson <endre.karlson@gmail.com>
|
||||
# - Dan Bode <dan@puppetlabs.com>
|
||||
# - Ian Wells <iawells@cisco.com>
|
||||
# - Gilles Dubreuil <gdubreui@redhat.com>
|
||||
#
|
||||
# === Copyright
|
||||
#
|
||||
# Apache License 2.0 (see LICENSE file)
|
||||
#
|
||||
class vswitch (
|
||||
$provider = $vswitch::params::provider
|
||||
) {
|
||||
$cls = "vswitch::$provider"
|
||||
$cls = "vswitch::${provider}"
|
||||
include $cls
|
||||
}
|
||||
|
@@ -1,3 +1,5 @@
|
||||
# vswitch: open-vswitch
|
||||
#
|
||||
class vswitch::ovs(
|
||||
$package_ensure = 'present'
|
||||
) {
|
||||
@@ -7,7 +9,7 @@ class vswitch::ovs(
|
||||
case $::osfamily {
|
||||
'Debian': {
|
||||
# OVS doesn't build unless the kernel headers are present.
|
||||
$kernelheaders_pkg = "linux-headers-$::kernelrelease"
|
||||
$kernelheaders_pkg = "linux-headers-${::kernelrelease}"
|
||||
if ! defined(Package[$kernelheaders_pkg]) {
|
||||
package { $kernelheaders_pkg: ensure => $package_ensure }
|
||||
}
|
||||
@@ -17,12 +19,12 @@ class vswitch::ovs(
|
||||
name => $::vswitch::params::ovs_service_name,
|
||||
hasstatus => false, # the supplied command returns true even if it's not running
|
||||
# Not perfect - should spot if either service is not running - but it'll do
|
||||
status => "/etc/init.d/openvswitch-switch status | fgrep 'is running'",
|
||||
status => '/etc/init.d/openvswitch-switch status | fgrep "is running"',
|
||||
}
|
||||
exec { 'rebuild-ovsmod':
|
||||
command => "/usr/sbin/dpkg-reconfigure openvswitch-datapath-dkms > /tmp/reconf-log",
|
||||
creates => "/lib/modules/$::kernelrelease/updates/dkms/openvswitch_mod.ko",
|
||||
require => [Package['openvswitch-datapath-dkms', $kernelheaders_pkg]],
|
||||
command => '/usr/sbin/dpkg-reconfigure openvswitch-datapath-dkms > /tmp/reconf-log',
|
||||
creates => "/lib/modules/${::kernelrelease}/updates/dkms/openvswitch_mod.ko",
|
||||
require => [Package['openvswitch-datapath-dkms', $kernelheaders_pkg]],
|
||||
before => Package['openvswitch-switch'],
|
||||
refreshonly => true
|
||||
}
|
||||
@@ -34,6 +36,9 @@ class vswitch::ovs(
|
||||
name => $::vswitch::params::ovs_service_name,
|
||||
}
|
||||
}
|
||||
default: {
|
||||
fail( "${::osfamily} not yet supported by puppet-vswitch")
|
||||
}
|
||||
}
|
||||
|
||||
package { $::vswitch::params::ovs_package_name:
|
||||
|
@@ -1,13 +1,19 @@
|
||||
# vswitch params
|
||||
#
|
||||
class vswitch::params {
|
||||
if $::osfamily == 'Redhat' {
|
||||
$ovs_package_name = 'openvswitch'
|
||||
$ovs_service_name = 'openvswitch'
|
||||
$provider = "ovs_redhat"
|
||||
} elsif $::osfamily == 'Debian' {
|
||||
$ovs_package_name = ['openvswitch-switch', 'openvswitch-datapath-dkms']
|
||||
$ovs_service_name = 'openvswitch-switch'
|
||||
$provider = "ovs"
|
||||
} else {
|
||||
fail("Unsupported osfamily ${$::osfamily}")
|
||||
}
|
||||
}
|
||||
case $::osfamily {
|
||||
'Redhat': {
|
||||
$ovs_package_name = 'openvswitch'
|
||||
$ovs_service_name = 'openvswitch'
|
||||
$provider = 'ovs_redhat'
|
||||
}
|
||||
'Debian': {
|
||||
$ovs_package_name = ['openvswitch-switch', 'openvswitch-datapath-dkms']
|
||||
$ovs_service_name = 'openvswitch-switch'
|
||||
$provider = 'ovs'
|
||||
}
|
||||
default: {
|
||||
fail " Osfamily ${::osfamily} not supported yet"
|
||||
}
|
||||
} # Case $::osfamily
|
||||
}
|
||||
|
Reference in New Issue
Block a user