-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
66 additions
and
13 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class { 'powertop': | ||
ensure => 'absent', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include powertop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,23 @@ | ||
# | ||
# @summary Manages powertop | ||
# | ||
class powertop { | ||
# @param ensure | ||
# Whether powertop should be present or absent. | ||
# | ||
class powertop ( | ||
Enum['present', 'absent'] $ensure = 'present', | ||
) { | ||
$pkg_name = 'powertop' | ||
|
||
package { $pkg_name: | ||
ensure => $ensure, | ||
} | ||
|
||
if $ensure == present { | ||
# powertop service unit tweaks values and then exits. There is no persistent daemon. | ||
service { 'powertop': | ||
enable => true, | ||
require => Package[$pkg_name], | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper_acceptance' | ||
|
||
describe 'powertop class' do | ||
context 'without any parameters' do | ||
include_examples 'the example', 'powertop_present.pp' | ||
|
||
describe package('powertop') do | ||
it { is_expected.to be_installed } | ||
end | ||
|
||
describe service('powertop') do | ||
it { is_expected.to be_enabled } | ||
end | ||
end | ||
|
||
context 'with parameters =>' do | ||
include_examples 'the example', 'powertop_absent.pp' | ||
|
||
describe package('powertop') do | ||
it { is_expected.not_to be_installed } | ||
end | ||
|
||
describe service('powertop') do | ||
it { is_expected.not_to be_enabled } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
describe 'powertop' do | ||
on_supported_os.each do |os, os_facts| | ||
context "on #{os}" do | ||
let(:facts) { os_facts } | ||
|
||
it { is_expected.to compile.with_all_deps } | ||
end | ||
end | ||
end |