BBlack has submitted this change and it was merged.
Change subject: cpufrequtils: ensure configure governor is in use
......................................................................
cpufrequtils: ensure configure governor is in use
* Ensure the configured cpufreq governor is in effect, rather than rely on
Puppet event notification / boot-time setting.
* Add documentation.
* Use 'require_package' as a shorthand for making the package a requirement for
all the class's resources.
* Rename 'apply cpufrequtils' to 'set_cpufreq_governor', which is more
informative and does not contain whitespace.
Change-Id: I0a775fb9fb4a03142dc60946eb3ae0b5e6af606c
---
M modules/cpufrequtils/manifests/init.pp
1 file changed, 24 insertions(+), 14 deletions(-)
Approvals:
BBlack: Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/cpufrequtils/manifests/init.pp
b/modules/cpufrequtils/manifests/init.pp
index 62409f8..f0518da 100644
--- a/modules/cpufrequtils/manifests/init.pp
+++ b/modules/cpufrequtils/manifests/init.pp
@@ -1,14 +1,25 @@
-class cpufrequtils (
- $governor = 'performance',
-) {
- package { 'cpufrequtils':
- ensure => present,
- }
+# == Class: cpufrequtils
+#
+# This class installs the cpufrequtils package and ensures a configured
+# CPU frequency governor is set.
+#
+# === Parameters
+#
+# [*governor*]
+# Which governor to use. Defaults to 'performance'. Run 'cpufreq-info -g'
+# to obtain a list of available governors.
+#
+# === Examples
+#
+# class { 'cpufrequtils':
+# governor => 'powersave',
+# }
+#
+class cpufrequtils( $governor = 'performance' ) {
+ require_package('cpufrequtils')
- # start at boot
service { 'cpufrequtils':
- enable => true,
- require => Package['cpufrequtils'],
+ enable => true,
}
# Ubuntu's default initscripts package includes a service called "ondemand"
@@ -23,12 +34,11 @@
file { '/etc/default/cpufrequtils':
content => "GOVERNOR=${governor}\n",
- notify => Exec['apply cpufrequtils'],
- require => Package['cpufrequtils'],
+ notify => Exec['set_cpufreq_governor'],
}
- exec { 'apply cpufrequtils':
- command => '/etc/init.d/cpufrequtils start',
- refreshonly => true
+ exec { 'set_cpufreq_governor':
+ command => '/etc/init.d/cpufrequtils restart',
+ unless => "/usr/bin/cpufreq-info -p | /bin/grep -wq ${governor}",
}
}
--
To view, visit https://gerrit.wikimedia.org/r/209049
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0a775fb9fb4a03142dc60946eb3ae0b5e6af606c
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ori.livneh <[email protected]>
Gerrit-Reviewer: BBlack <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits