Adjust order of entries in /etc/hosts

Order of all entries will be fqdn before prefix-fqdn.

Change-Id: Ia203c457e76cc45b70532674f6366928acc09b48
Closes-bug: #1624143
This commit is contained in:
R. Berwald 2016-09-30 10:44:06 +02:00 committed by Stanislaw Bogatkin
parent 1daefd235a
commit 9382a3eb5f
1 changed files with 7 additions and 2 deletions

View File

@ -7,7 +7,6 @@ class osnailyfacter::hosts::hosts {
$messaging_prefix = hiera('node_name_prefix_for_messaging')
$host_resources = network_metadata_to_hosts($network_metadata)
$messaging_host_resources = network_metadata_to_hosts($network_metadata, 'mgmt/messaging', $messaging_prefix)
$host_hash = merge($host_resources, $messaging_host_resources)
$deleted_nodes = hiera('deleted_nodes', [])
$deleted_messaging_nodes = prefix($deleted_nodes, $messaging_prefix)
@ -16,8 +15,14 @@ class osnailyfacter::hosts::hosts {
target => $hosts_file
}
create_resources(host, $host_hash)
# Bug LP1624143 : hosts should be consistently ordered
create_resources(host, $host_resources, { tag => 'host_resources' } )
create_resources(host, $messaging_host_resources, { tag => 'messaging_host_resources' } )
Host<| tag == 'host_resources' |> -> Host<| tag == 'messaging_host_resources' |>
if !empty($deleted_nodes) {
ensure_resource(host, unique(concat($deleted_nodes, $deleted_messaging_nodes)), {ensure => absent})
}
}