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 service_name and package_name parameters #66

Merged
merged 2 commits into from
Dec 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
# @param package_source Local path to package file for file (not repo) based installation
# @param manage_repo Whether to manage the package manager repository
# @param status Service status
# @param service_name Service name
# @param package_name Package name
# @param kibana_user owner of kibana.yml
# @param kibana_group group of kibana.yml
#
Expand All @@ -34,6 +36,8 @@
Boolean $oss,
Optional[String] $package_source,
Kibana::Status $status,
String[1] $service_name = 'kibana',
String[1] $package_name = 'kibana',
String[1] $kibana_user = 'kibana',
String[1] $kibana_group = 'kibana',
) {
Expand Down
8 changes: 4 additions & 4 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
}
}

$_package_name = $kibana::oss ? {
true => 'kibana-oss',
default => 'kibana',
$_oss = $kibana::oss ? {
true => '-oss',
default => '',
}

package { 'kibana':
ensure => $kibana::ensure,
name => $_package_name,
name => "${kibana::package_name}${_oss}",
source => $kibana::package_source,
}
}
2 changes: 1 addition & 1 deletion manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
$_enable = false
}

service { 'kibana':
service { $kibana::service_name:
ensure => $_ensure,
enable => $_enable,
}
Expand Down
20 changes: 20 additions & 0 deletions spec/classes/kibana_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,17 @@
it { is_expected.to contain_file('/etc/kibana/kibana.yml').with(group: 'testgroup') }
end

describe 'kibana_service' do
let(:params) { { service_name: 'kibana-custom' } }

it 'enables and starts the custom service' do
expect(subject).to contain_service('kibana-custom').with(
ensure: true,
enable: true
)
end
end

describe 'manage_repo' do
let(:params) { { manage_repo: false } }

Expand Down Expand Up @@ -226,6 +237,15 @@
end
end
end

describe 'kibana_package_name' do
let(:params) { { package_name: 'kibana-custom' } }

it {
expect(subject).to contain_package('kibana').
with_name('kibana-custom')
}
end
end
end
end
Expand Down