Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FreeBSD 12 support #179

Merged
merged 11 commits into from
Jul 28, 2019
7 changes: 7 additions & 0 deletions data/family/FreeBSD.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
grafana::cfg_location: '/usr/local/etc/grafana.ini'
grafana::data_dir: '/var/db/grafana'
grafana::install_method: 'repo'
grafana::manage_package_repo: false
grafana::package_name: 'grafana6'
grafana::service_name: 'grafana'
13 changes: 13 additions & 0 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@
require => Package['fontconfig'],
}
}
'FreeBSD': {
package { 'grafana':
ensure => present,
name => $grafana::package_name,
provider => 'pkgng',
}
}
default: {
fail("${facts['os']['family']} not supported")
}
Expand Down Expand Up @@ -143,6 +150,12 @@
name => $grafana::package_name,
}
}
'FreeBSD': {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this package required? It doesn't sound like anything grafana specific. Is the FreeBSD package for grafana lacking a dependency? If this is a generic package, it might be already managed by other modules which results in a duplicate resource error.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the dependency already exists in the package. I just duplicated the previous entries (other distributions have no valid dependencies in grafana? I'll fix it now

package { 'grafana':
ensure => 'present', # pkgng provider doesn't have feature versionable
name => $grafana::package_name,
}
}
default: {
fail("${facts['os']['name']} not supported")
}
Expand Down
6 changes: 6 additions & 0 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@
},
{
"operatingsystem": "Archlinux"
},
{
"operatingsystem": "FreeBSD",
"operatingsystemrelease": [
"12"
]
}
],
"requirements": [
Expand Down
19 changes: 17 additions & 2 deletions spec/classes/grafana_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,23 @@
it { is_expected.to contain_user('grafana').that_comes_before('File[/usr/share/grafana]') }
end

describe 'create data_dir' do
it { is_expected.to contain_file('/var/lib/grafana').with_ensure('directory') }
case facts[:osfamily]
when 'Archlinux'
describe 'create data_dir' do
it { is_expected.to contain_file('/var/lib/grafana').with_ensure('directory') }
end
when 'Debian'
describe 'create data_dir' do
it { is_expected.to contain_file('/var/lib/grafana').with_ensure('directory') }
end
when 'FreBSD'
describe 'create data_dir' do
it { is_expected.to contain_file('/var/db/grafana').with_ensure('directory') }
end
when 'RedHat'
describe 'create data_dir' do
it { is_expected.to contain_file('/var/lib/grafana').with_ensure('directory') }
end
end

describe 'manage install_dir' do
Expand Down