Skip to content

Commit

Permalink
Merge pull request voxpupuli#80 from madelaney/freebsd-support
Browse files Browse the repository at this point in the history
Fixing package source not found on FreeBSD.
  • Loading branch information
carlossg authored Nov 21, 2016
2 parents 4ea0107 + 0e991d7 commit 14b00e6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
20 changes: 13 additions & 7 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,21 @@
) {

if $manage_package {
if $::kernel == 'Linux' {
if ! defined(Package['wget']) {
if !defined(Package['wget']) {
if $::kernel == 'Linux' {
package { 'wget': ensure => $version }
}
}

if $::kernel == 'FreeBSD' {
if ! defined(Package['ftp/wget']) {
package { 'ftp/wget': ensure => $version }
elsif $::kernel == 'FreeBSD' {
if versioncmp($::operatingsystemmajrelease, '10') >= 0 {
package { 'wget': ensure => $version }
}
else {
package { 'wget':
name => 'ftp/wget',
ensure => $version,
alias => 'wget';
}
}
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,13 @@
"12",
"13"
]
},
{
"operatingsystem": "FreeBSD",
"operatingsystemrelease": [
"9",
"10"
]
}
]
}
5 changes: 3 additions & 2 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@
context 'running on FreeBSD', :compile do
let(:facts) { {
:operatingsystem => 'FreeBSD',
:kernel => 'FreeBSD'
:kernel => 'FreeBSD',
:operatingsystemmajrelease => '10'
} }

it { should contain_package('ftp/wget') }
it { should contain_package('wget') }
end
end

0 comments on commit 14b00e6

Please sign in to comment.