Make sure tuned package is installed before calling tuned-adm
authorMichele Baldessari <michele@acksyn.org>
Wed, 18 Oct 2017 10:00:21 +0000 (12:00 +0200)
committerMichele Baldessari <michele@acksyn.org>
Thu, 19 Oct 2017 05:09:05 +0000 (07:09 +0200)
With https://review.openstack.org/#/c/511509 we start erroring out
properly on puppet errors.  One of the jobs that is now failing is:

http://logs.openstack.org/09/511509/7/check/legacy-tripleo-ci-centos-7-undercloud-containers/5d3fecc/logs/var/log/undercloud_install.txt.gz

Reason for this is that we include the tripleo::base::tuned profile which has:
  exec { 'tuned-adm':
    path => ['/bin', '/usr/bin', '/sbin', '/usr/sbin'],
    command => "tuned-adm profile ${profile}",
    unless => "tuned-adm active | grep -q '${profile}'"
  }

So if the tuned package is not installed by other means we get:
"Error: /Stage[main]/Tripleo::Profile::Base::Tuned/Exec[tuned-adm]: Could not evaluate: Could not find command 'tuned-adm'",

Let's add the package here in the profile instead of installing it
via tripleo.sh, that way also a split stack deployment is covered.

Change-Id: I130cdc59000e0c5e5fa7c542fbe6b782651a7eb7
Closes-Bug: #1724518
(cherry picked from commit 32ef340901027926ed3f77ae37d8e0d20e38e15d)

manifests/profile/base/tuned.pp

index 8dfcea0..48951bd 100644 (file)
 class tripleo::profile::base::tuned (
   $profile = 'throughput-performance'
 ) {
+  ensure_resource('package', 'tuned', { ensure => 'present' })
   exec { 'tuned-adm':
     path    => ['/bin', '/usr/bin', '/sbin', '/usr/sbin'],
     command => "tuned-adm profile ${profile}",
-    unless  => "tuned-adm active | grep -q '${profile}'"
+    unless  => "tuned-adm active | grep -q '${profile}'",
+    require => Package['tuned'],
   }
 }