Purge nova services for deleted nodes
Deleted hosts create downed services in nova, which should be cleaned up on the next deploy cycle. Change-Id: Ie644062c9befec1745adcc8ca9e76a895cf0304c Depends-On: I01db215e77a3532a6fa7bf46ab7e20e281e8c165 Depends-On: I303ab218bc6a48cf2c60727feecc522040a80a68 Partial-Bug: #1471172
This commit is contained in:
parent
92bdb74d84
commit
c02971c21a
|
@ -0,0 +1,12 @@
|
|||
class osnailyfacter::astute::purge_service_entries {
|
||||
|
||||
notice('MODULAR: astute/purge_service_entries.pp')
|
||||
|
||||
####################################################################
|
||||
# Used as singular by post-deployment action to purge nova services
|
||||
# from deleted hosts
|
||||
#
|
||||
$deleted_hosts = hiera('deleted_nodes',[])
|
||||
ensure_resource('nova_service', $deleted_hosts, {'ensure' => 'purged'})
|
||||
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
include ::osnailyfacter::astute::purge_service_entries
|
|
@ -364,6 +364,7 @@
|
|||
data:
|
||||
yaql_exp: '{"deleted_nodes" => deleted($.network_metadata.nodes.values().fqdn)}.toYaml()'
|
||||
|
||||
|
||||
- id: copy_deleted_nodes
|
||||
type: copy_files
|
||||
version: 2.1.0
|
||||
|
@ -381,3 +382,17 @@
|
|||
dst: /etc/hiera/deleted_nodes.yaml
|
||||
permissions: '0600'
|
||||
dir_permissions: '0700'
|
||||
|
||||
- id: purge_service_entries
|
||||
version: 2.1.0
|
||||
type: puppet
|
||||
role: [primary-controller]
|
||||
condition:
|
||||
yaql_exp: *deleted_nodes
|
||||
requires: [post_deployment_start]
|
||||
required_for: [post_deployment_end]
|
||||
parameters:
|
||||
puppet_manifest: /etc/puppet/modules/osnailyfacter/modular/astute/purge_service_entries.pp
|
||||
puppet_modules: /etc/puppet/modules
|
||||
timeout: 180
|
||||
cwd: /
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
# ROLE: primary-controller
|
||||
# ROLE: controller
|
||||
|
||||
require 'spec_helper'
|
||||
require 'shared-examples'
|
||||
manifest = 'astute/purge_service_entries.pp'
|
||||
|
||||
describe manifest do
|
||||
shared_examples 'catalog' do
|
||||
|
||||
deleted_nodes = Noop.hiera('deleted_nodes', [])
|
||||
|
||||
if !deleted_nodes.empty?
|
||||
it 'should purge deleted nodes' do
|
||||
deleted_nodes.each do |deleted|
|
||||
is_expected.to contain_nova_service(deleted).with_ensure('absent')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
test_ubuntu_and_centos manifest
|
||||
end
|
Loading…
Reference in New Issue