From d7c5d539c65cd32749b3838f620414e4f36ca5d7 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Sat, 2 Apr 2016 15:18:59 +0200 Subject: [PATCH 1/7] lint cleanup align Gemfile and Rakefile to versions from example42-apache --- Gemfile | 24 ++++++++++++++---------- Rakefile | 8 +++++++- manifests/interface.pp | 4 ++-- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/Gemfile b/Gemfile index d609968..be1c34c 100644 --- a/Gemfile +++ b/Gemfile @@ -1,15 +1,19 @@ source 'https://rubygems.org' -gem 'rake' +puppetversion = ENV['PUPPET_VERSION'] + +is_ruby18 = RUBY_VERSION.start_with? '1.8' + +if is_ruby18 + gem 'rspec', "~> 3.1.0", :require => false + gem 'rake', '~> 10.5.0', :require => false +end +gem 'puppet', puppetversion, :require => false gem 'puppet-lint' +gem 'puppetlabs_spec_helper', '>= 0.1.0' gem 'rspec-puppet' -gem 'rspec-system-puppet' -gem 'puppetlabs_spec_helper' -gem 'travis' -gem 'travis-lint' -gem 'puppet-syntax' -gem 'puppet', ENV['PUPPET_VERSION'] || '~> 3.3.0' -gem 'vagrant-wrapper' -gem 'puppet-blacksmith' -gem "fog-google", :require => false +gem 'metadata-json-lint' +group :development do + gem 'puppet-blacksmith' +end diff --git a/Rakefile b/Rakefile index b60d53d..4c0c00d 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,13 @@ require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-lint/tasks/puppet-lint' require 'puppet-syntax/tasks/puppet-syntax' -require 'puppet_blacksmith/rake_tasks' + +# Blacksmith +begin + require 'puppet_blacksmith/rake_tasks' +rescue LoadError + puts "Blacksmith needed only to push to the Forge" +end PuppetLint.configuration.log_format = "%{path}:%{linenumber}:%{check}:%{KIND}:%{message}" PuppetLint.configuration.fail_on_warnings = false diff --git a/manifests/interface.pp b/manifests/interface.pp index e07f587..20e31dc 100644 --- a/manifests/interface.pp +++ b/manifests/interface.pp @@ -511,8 +511,8 @@ } } default: { - $create_ip_command = 'true' - $show_ip_command = 'true' + $create_ip_command = '/usr/bin/true' + $show_ip_command = '/usr/bin/true' } } exec { "create ipaddr ${title}": From 976a79448ac5aba5fca311d4038bf0c3f113a39f Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Tue, 5 Apr 2016 13:19:43 +0200 Subject: [PATCH 2/7] fixes for solaris add missing dependency remove wrong code snippet for host entry use cidr instead of netmask --- README.md | 3 +++ manifests/interface.pp | 9 ++------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index d50ba86..793885a 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ Refer to http://github.com/stdmod/ for complete documentation on the common para * PuppetLabs [stdlib module](https://github.com/puppetlabs/puppetlabs-stdlib) * PuppetLabs [concat module](https://github.com/puppetlabs/puppetlabs-concat) * StdMod [stdmod module](https://github.com/stdmod/stdmod) +* YELP [netstdlib module](https://github.com/Yelp/puppet-netstdlib) * Puppet version >= 2.7.x * Facter version >= 1.6.2 @@ -306,6 +307,8 @@ This is tested on these OS: - Debian 6 and 7 - Ubuntu 10.04, 12.04 and 14.04 - OpenSuse 12, SLES 11SP3 +- Solaris 10 and 11 +- OpenIndiana (OpenSolaris) 11 (Hipster release) ##Development diff --git a/manifests/interface.pp b/manifests/interface.pp index 20e31dc..953f665 100644 --- a/manifests/interface.pp +++ b/manifests/interface.pp @@ -506,7 +506,8 @@ $create_ip_command = "ipadm create-addr -T dhcp ${title}/dhcp" $show_ip_command = "ipadm show-addr ${title}/dhcp" } else { - $create_ip_command = "ipadm create-addr -T static -a ${ipaddress}/${netmask} ${title}/v4static" + $cidr = netmask_to_masklen($netmask) + $create_ip_command = "ipadm create-addr -T static -a ${ipaddress}/${cidr} ${title}/v4static" $show_ip_command = "ipadm show-addr ${title}/v4static" } } @@ -528,12 +529,6 @@ require => Exec["create ipaddr ${title}"], tag => 'solaris', } - host { $::fqdn: - ensure => present, - ip => $ipaddress, - host_aliases => [$::hostname], - require => File["hostname iface ${title}"], - } if ! defined(Service['svc:/network/physical:default']) { service { 'svc:/network/physical:default': ensure => running, From d7a854fb1e7d448b429905ece22471d76af2352d Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Tue, 5 Apr 2016 13:21:42 +0200 Subject: [PATCH 3/7] add dependencies to metadata.json --- metadata.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/metadata.json b/metadata.json index c6ff9ad..ec35272 100644 --- a/metadata.json +++ b/metadata.json @@ -88,6 +88,10 @@ { "name": "puppetlabs/concat", "version_requirement": ">= 1.0.0" + }, + { + "name": "yelp/netstdlib", + "version_requirement": ">= 0.0.1" } ] } From 11151e22ceb471fec3aafd9caae1444e0f812ff4 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Tue, 5 Apr 2016 13:38:11 +0200 Subject: [PATCH 4/7] fix spec tests --- .fixtures.yml | 1 + spec/defines/network_interface_solaris_spec.rb | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index c2a5c35..d668968 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -2,5 +2,6 @@ fixtures: repositories: stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib.git" concat: "git://github.com/puppetlabs/puppetlabs-concat.git" + netstdlib: "git://github.com/Yelp/puppet-netstdlib.git" symlinks: network: "#{source_dir}" diff --git a/spec/defines/network_interface_solaris_spec.rb b/spec/defines/network_interface_solaris_spec.rb index 7afd36c..35bbfd8 100644 --- a/spec/defines/network_interface_solaris_spec.rb +++ b/spec/defines/network_interface_solaris_spec.rb @@ -16,9 +16,6 @@ it 'should create a hostname file' do should contain_file('hostname iface eth0').with_content(/10.42.42.42/) end - it 'should create a host entry' do - should contain_host(node).with_ip('10.42.42.42') - end it 'should restart network service' do should contain_service('svc:/network/physical:default').with_ensure('running') end From 880a3f7472b99ba320091a8baa24185c3ac6c60a Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Tue, 5 Apr 2016 19:11:31 +0200 Subject: [PATCH 5/7] remove Yelp/puppet-netstdlib from metadata.json Add hint in Readme --- README.md | 6 +++++- metadata.json | 4 ---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 793885a..f8ce575 100644 --- a/README.md +++ b/README.md @@ -37,10 +37,14 @@ Refer to http://github.com/stdmod/ for complete documentation on the common para * PuppetLabs [stdlib module](https://github.com/puppetlabs/puppetlabs-stdlib) * PuppetLabs [concat module](https://github.com/puppetlabs/puppetlabs-concat) * StdMod [stdmod module](https://github.com/stdmod/stdmod) -* YELP [netstdlib module](https://github.com/Yelp/puppet-netstdlib) * Puppet version >= 2.7.x * Facter version >= 1.6.2 +ATTENTION: on Solaris an additional module is required: +* YELP [netstdlib module](https://github.com/Yelp/puppet-netstdlib) + +This module will not get loaded automatically when installing from forge. + ###Beginning with module network The main class arguments can be provided either via Hiera (from Puppet 3.x) or direct parameters: diff --git a/metadata.json b/metadata.json index ec35272..c6ff9ad 100644 --- a/metadata.json +++ b/metadata.json @@ -88,10 +88,6 @@ { "name": "puppetlabs/concat", "version_requirement": ">= 1.0.0" - }, - { - "name": "yelp/netstdlib", - "version_requirement": ">= 0.0.1" } ] } From 1935719d2716ef91b8c198601b11fd774dd7d2d6 Mon Sep 17 00:00:00 2001 From: Martin Alfke Date: Wed, 6 Apr 2016 08:25:20 +0200 Subject: [PATCH 6/7] dont install development gem on travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index fa27f14..972678d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ --- language: ruby +bundler_args: --without development before_install: rm Gemfile.lock || true rvm: - 2.1.4 From 843b2db54c1647b147e7a463e758c99568aeffb0 Mon Sep 17 00:00:00 2001 From: Alessandro Franceschi Date: Sun, 1 Apr 2018 09:52:27 +0200 Subject: [PATCH 7/7] Update network_interface_solaris_spec.rb --- spec/defines/network_interface_solaris_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/defines/network_interface_solaris_spec.rb b/spec/defines/network_interface_solaris_spec.rb index e2fed6b..4d4c2d5 100644 --- a/spec/defines/network_interface_solaris_spec.rb +++ b/spec/defines/network_interface_solaris_spec.rb @@ -21,7 +21,7 @@ it { is_expected.to contain_host(node).with_ip('10.42.42.42') } - } + end describe 'Test network::interface on Solaris' do it 'should create a hostname file' do