Install and start acpid on virtual nodes
Some users may be running various nodes (including master node since 7.0) as virtual machines – acpid allows them to do graceful shutdown or reboot without using ssh. The commit introduces custom fact to check if ACPI is available via procfs on machine. acpid itself is only installed and started if node is not physical and has ACPI. Closes-Bug: 1470172 Change-Id: I4186b4a2fbb57a0c63123377f986f888c27aa13e Co-authored-by: Bartłomiej Piotrowski <bpiotrowski@mirantis.com>
This commit is contained in:
parent
37e1a0ee9f
commit
be35055538
5
deployment/puppet/nailgun/lib/facter/acpi_event.rb
Normal file
5
deployment/puppet/nailgun/lib/facter/acpi_event.rb
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
Facter.add('acpi_event') do
|
||||||
|
setcode do
|
||||||
|
File.exist?('/proc/acpi/event')
|
||||||
|
end
|
||||||
|
end
|
@ -126,4 +126,11 @@ $admin_iface = 'eth0',
|
|||||||
command => "sed -i -e 's|http://\(.*\):8000\(.*\)|https://\1:8443\2|g' /etc/issue",
|
command => "sed -i -e 's|http://\(.*\):8000\(.*\)|https://\1:8443\2|g' /etc/issue",
|
||||||
onlyif => 'grep -q 8000 /etc/issue',
|
onlyif => 'grep -q 8000 /etc/issue',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if $::acpi_event == 'true' and $::virtual != 'physical' {
|
||||||
|
service { 'acpid':
|
||||||
|
ensure => 'running',
|
||||||
|
enable => true,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,4 +20,5 @@ class nailgun::packages(
|
|||||||
nailgun_safe_package { "python-fuelclient": }
|
nailgun_safe_package { "python-fuelclient": }
|
||||||
nailgun_safe_package { "screen": }
|
nailgun_safe_package { "screen": }
|
||||||
nailgun_safe_package { "fuel-migrate": }
|
nailgun_safe_package { "fuel-migrate": }
|
||||||
|
nailgun_safe_package { "acpid": }
|
||||||
}
|
}
|
||||||
|
27
deployment/puppet/osnailyfacter/manifests/acpid.pp
Normal file
27
deployment/puppet/osnailyfacter/manifests/acpid.pp
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# == Class: osnailyfacter::acpid
|
||||||
|
#
|
||||||
|
# Allow to install and configure acpid.
|
||||||
|
#
|
||||||
|
# === Parameters
|
||||||
|
#
|
||||||
|
# [*service_enabled*]
|
||||||
|
# Enable acpid service, default to true.
|
||||||
|
#
|
||||||
|
# [*service_state*]
|
||||||
|
# Start acpid service, default to running.
|
||||||
|
#
|
||||||
|
class osnailyfacter::acpid (
|
||||||
|
$service_enabled = true,
|
||||||
|
$service_state = 'running',
|
||||||
|
){
|
||||||
|
|
||||||
|
package { 'acpid':
|
||||||
|
ensure => 'installed',
|
||||||
|
} ->
|
||||||
|
|
||||||
|
service { 'acpid':
|
||||||
|
ensure => $service_state,
|
||||||
|
enable => $service_enabled,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,9 +1,12 @@
|
|||||||
notice('MODULAR: tools.pp')
|
notice('MODULAR: tools.pp')
|
||||||
|
|
||||||
class { 'osnailyfacter::atop': }
|
class { 'osnailyfacter::atop': }
|
||||||
|
|
||||||
class { 'osnailyfacter::ssh': }
|
class { 'osnailyfacter::ssh': }
|
||||||
|
|
||||||
|
if $::virtual != 'physical' {
|
||||||
|
class { 'osnailyfacter::acpid': }
|
||||||
|
}
|
||||||
|
|
||||||
$tools = [
|
$tools = [
|
||||||
'screen',
|
'screen',
|
||||||
'tmux',
|
'tmux',
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
require File.join File.dirname(__FILE__), '../test_common.rb'
|
require File.join File.dirname(__FILE__), '../test_common.rb'
|
||||||
|
|
||||||
TOOLS = %w(
|
TOOLS = %w(
|
||||||
|
acpid
|
||||||
screen
|
screen
|
||||||
tmux
|
tmux
|
||||||
man
|
man
|
||||||
|
@ -2,6 +2,18 @@ require 'spec_helper'
|
|||||||
require 'shared-examples'
|
require 'shared-examples'
|
||||||
manifest = 'tools/tools.pp'
|
manifest = 'tools/tools.pp'
|
||||||
|
|
||||||
|
tools = [
|
||||||
|
'screen',
|
||||||
|
'tmux',
|
||||||
|
'man',
|
||||||
|
'htop',
|
||||||
|
'tcpdump',
|
||||||
|
'strace',
|
||||||
|
'fuel-misc'
|
||||||
|
]
|
||||||
|
|
||||||
|
puppet = Noop.hiera('puppet')
|
||||||
|
|
||||||
describe manifest do
|
describe manifest do
|
||||||
shared_examples 'catalog' do
|
shared_examples 'catalog' do
|
||||||
it "should contain ssh host keygen exec for Debian OS only" do
|
it "should contain ssh host keygen exec for Debian OS only" do
|
||||||
@ -15,6 +27,33 @@ describe manifest do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
shared_examples 'catalog' do
|
||||||
|
it 'should declare tools classes' do
|
||||||
|
should contain_class('osnailyfacter::atop')
|
||||||
|
should contain_class('osnailyfacter::ssh')
|
||||||
|
should contain_class('puppet::pull').with(
|
||||||
|
{'modules_source' => puppet['modules']},
|
||||||
|
{'manifests_source' => puppet['manifests']}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should declare osnailyfacter::acpid on virtual machines' do
|
||||||
|
facts[:virtual] = 'kvm'
|
||||||
|
should contain_class('osnailyfacter::acpid')
|
||||||
|
end
|
||||||
|
|
||||||
|
tools.each do |i|
|
||||||
|
it do
|
||||||
|
should contain_package(i).with({
|
||||||
|
'ensure' => 'present'})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
it do
|
||||||
|
should contain_package('cloud-init').with({
|
||||||
|
'ensure' => 'purged'})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
test_ubuntu_and_centos manifest
|
test_ubuntu_and_centos manifest
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user