Skip to content

Commit

Permalink
Merge pull request #612 from smortex/freebsd
Browse files Browse the repository at this point in the history
Add support for FreeBSD
  • Loading branch information
bastelfreak authored May 5, 2021
2 parents 91c32e2 + 237d7a0 commit 3c31b13
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
15 changes: 10 additions & 5 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
}

$pythondev = $facts['os']['family'] ? {
'AIX' => "${python}-devel",
'RedHat' => "${python}-devel",
'Debian' => "${python}-dev",
'Suse' => "${python}-devel",
'Gentoo' => undef,
'AIX' => "${python}-devel",
'Debian' => "${python}-dev",
'FreeBSD' => undef,
'Gentoo' => undef,
'RedHat' => "${python}-devel",
'Suse' => "${python}-devel",
}

$pip_ensure = $python::pip ? {
Expand Down Expand Up @@ -225,6 +226,10 @@
$pip_category = undef
$pip_package = 'python2-pip'
$pip_provider = pip2
} elsif $facts['os']['family'] == 'FreeBSD' {
$pip_category = undef
$pip_package = "py${python::version}-pip"
$pip_provider = 'pip'
} elsif $facts['os']['family'] == 'Gentoo' {
$pip_category = 'dev-python'
$pip_package = 'pip'
Expand Down
2 changes: 1 addition & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
class python::params {
# Module compatibility check
unless $facts['os']['family'] in ['Debian', 'RedHat', 'Suse', 'Gentoo', 'AIX',] {
unless $facts['os']['family'] in ['AIX', 'Debian', 'FreeBSD', 'Gentoo', 'RedHat', 'Suse'] {
fail("Module is not compatible with ${facts['os']['name']}")
}

Expand Down
8 changes: 8 additions & 0 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@
"10"
]
},
{
"operatingsystem": "FreeBSD",
"operatingsystemrelease": [
"11",
"12",
"13"
]
},
{
"operatingsystem": "Gentoo"
},
Expand Down
2 changes: 1 addition & 1 deletion spec/defines/requirements_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
it { is_expected.to contain_package('gunicorn') }
it { is_expected.to contain_file('/requirements.txt').with_owner('root').with_group('root') }

if facts[:os]['name'] == 'Gentoo'
if %w[FreeBSD Gentoo].include?(facts[:os]['name'])
it { is_expected.not_to contain_package('python-dev') }
else
it { is_expected.to contain_package('python-dev') }
Expand Down

0 comments on commit 3c31b13

Please sign in to comment.