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/Gemfile b/Gemfile index 683560c..f35d319 100644 --- a/Gemfile +++ b/Gemfile @@ -145,4 +145,4 @@ gem 'coveralls', require: false # Semantic Puppet gem 'semantic_puppet', require: false gem 'puppet-blacksmith', require: false -# vim: syntax=ruby +# vim: syntax=ruby \ No newline at end of file diff --git a/README.md b/README.md index daaa086..4027ff4 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,11 @@ It manages hostname configuration and has hiera hash lookups to generate the fol * 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: @@ -453,8 +458,10 @@ Configuration of multiple static routes (using the newer ```network::mroute``` d This is tested on these OS: - RedHat osfamily 5, 6 and 7 - Debian 6, 7 and 8 -- Ubuntu 10.04, 12.04, 14.04, partly verified on Ubuntu 16.04 +- Ubuntu 10.04, 12.04, 14.04, 16.04 - OpenSuse 12, SLES 11SP3, SLES 12 SP1 (ifrule files are only supported on Suse with wicked >= 0.6.33) +- Solaris 10 and 11 +- OpenIndiana (OpenSolaris) 11 (Hipster release) ## Development diff --git a/manifests/interface.pp b/manifests/interface.pp index 4111048..85afa9d 100644 --- a/manifests/interface.pp +++ b/manifests/interface.pp @@ -754,13 +754,14 @@ $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" } } 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}": @@ -776,12 +777,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, diff --git a/spec/defines/network_interface_solaris_spec.rb b/spec/defines/network_interface_solaris_spec.rb index a40a9ff..4d4c2d5 100644 --- a/spec/defines/network_interface_solaris_spec.rb +++ b/spec/defines/network_interface_solaris_spec.rb @@ -21,11 +21,15 @@ it { is_expected.to contain_host(node).with_ip('10.42.42.42') } + end - it { - is_expected.to contain_service('svc:/network/physical:default').with_ensure('running') - } - + describe 'Test network::interface on Solaris' do + it 'should create a hostname file' do + should contain_file('hostname iface eth0').with_content(/10.42.42.42/) + end + it 'should restart network service' do + should contain_service('svc:/network/physical:default').with_ensure('running') + end end end