Skip to content

Commit

Permalink
Closes-Bug: #1541112 - Duplicate declaration errors in SM Kilo parall…
Browse files Browse the repository at this point in the history
…el provision

Three duplication declarations fixed:
1. Augeas conf set changed as it used key as title.
2. Two conflicting Resources called in config only if node not same as openstack node
3. Augeas conf ins modified as it might cause duplicate declaration if inserting same key in two files

Patch 2:
Missed out define of host_roles in neutron/server.pp

Patch 3:
Chnaged augeas_conf_ins to avoid duplicate declaration

Change-Id: I58681efa940be5803e653a5ef0aa986f2971f796
  • Loading branch information
nitishkrishna committed Feb 3, 2016
1 parent 2b356e0 commit 8575d05
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 44 deletions.
Expand Up @@ -145,8 +145,7 @@
contrail_collector_config { 'REDIS/password': value => $redis_password; }
contrail_query_engine_config { 'REDIS/password': value => $redis_password; }
$redis_config = { 'redis_conf' => { 'requirepass' => $redis_password,},}
$redis_conf_keys = keys($redis_config['redis_conf'])
contrail::lib::augeas_conf_set { $redis_conf_keys:
contrail::lib::augeas_conf_set { 'redis_conf_keys':
config_file => $redis_config_file,
settings_hash => $redis_config['redis_conf'],
lens_to_use => $redis_augeas_lens_to_use,
Expand Down
Expand Up @@ -269,7 +269,7 @@
if inline_template('<%= @operatingsystem.downcase %>') == 'centos' {
# Ensure modprobe.conf file is present with right content.
$modprobe_conf_file = '/etc/modprobe.conf'
contrail::lib::augeas_conf_set { ['alias']:
contrail::lib::augeas_conf_set { 'alias':
config_file => $modprobe_conf_file,
settings_hash => {'alias' => 'bridge off',},
lens_to_use => 'spacevars.lns',
Expand Down
Expand Up @@ -208,9 +208,8 @@
},
}

$log4j_properties_keys = keys($log4j_properties_config['log4j_properties'])
$log4j_augeas_lens_to_use = 'properties.lns'
contrail::lib::augeas_conf_set { $log4j_properties_keys:
contrail::lib::augeas_conf_set { 'log4j_properties_keys':
config_file => $log4j_properties_file,
settings_hash => $log4j_properties_config['log4j_properties'],
lens_to_use => $log4j_augeas_lens_to_use,
Expand All @@ -224,9 +223,8 @@
# Ensure authorization.properties file is present with right content.
$authorizaion_properties_file = '/etc/ifmap-server/authorization.properties'
$authorizaion_properties_config = { 'authorizaion_properties' => {'reader' => 'ro',},}
$authorizaion_properties_keys = keys($authorizaion_properties_config['authorizaion_properties'])
$authorizaion_augeas_lens_to_use = 'properties.lns'
contrail::lib::augeas_conf_set { $authorizaion_properties_keys:
contrail::lib::augeas_conf_set { 'authorizaion_properties_keys':
config_file => $authorizaion_properties_file,
settings_hash => $authorizaion_properties_config['authorizaion_properties'],
lens_to_use => $authorizaion_augeas_lens_to_use,
Expand Down Expand Up @@ -257,9 +255,8 @@
'control-node-10' => 'control-node-10--1870931930-1',
},
}
$publisher_properties_keys = keys($publisher_properties_config['publisher_properties'])
$publisher_augeas_lens_to_use = 'properties.lns'
contrail::lib::augeas_conf_set { $publisher_properties_keys:
contrail::lib::augeas_conf_set { 'publisher_properties_keys':
config_file => $publisher_properties_file,
settings_hash => $publisher_properties_config['publisher_properties'],
lens_to_use => $publisher_augeas_lens_to_use,
Expand Down
Expand Up @@ -102,9 +102,8 @@
},
}

$kafka_server_properties_keys = keys($kafka_server_properties_config['kafka_server_properties'])
$kafka_server_augeas_lens_to_use = 'properties.lns'
contrail::lib::augeas_conf_set { $kafka_server_properties_keys:
contrail::lib::augeas_conf_set { 'kafka_server_properties_keys':
config_file => $kafka_server_properties_file,
settings_hash => $kafka_server_properties_config['kafka_server_properties'],
lens_to_use => $kafka_server_augeas_lens_to_use,
Expand All @@ -131,15 +130,14 @@
'log4j.appender.controllerAppender.MaxBackupIndex' => '10',
},
}
$kafka_log4j_properties_keys = keys($kafka_log4j_properties_config['kafka_log4j_properties'])
$kafka_log4j_augeas_lens_to_use = 'properties.lns'
contrail::lib::augeas_conf_ins { ['kafka.logs.dir']:
contrail::lib::augeas_conf_ins { 'setting_kafka.logs.dir':
key => 'kafka.logs.dir',
value => 'logs',
config_file => $kafka_log4j_properties_file,
settings_hash => {'kafka.logs.dir' => 'logs',},
lens_to_use => $kafka_log4j_augeas_lens_to_use,

}
contrail::lib::augeas_conf_set { $kafka_log4j_properties_keys:
contrail::lib::augeas_conf_set { 'kafka_log4j_properties_keys':
config_file => $kafka_log4j_properties_file,
settings_hash => $kafka_log4j_properties_config['kafka_log4j_properties'],
lens_to_use => $kafka_log4j_augeas_lens_to_use,
Expand Down
Expand Up @@ -8,8 +8,7 @@
'autopurge.purgeInterval' => "3",
},
}
$zk_cfg_keys = keys($zk_cfg['zk_cfg'])
contrail::lib::augeas_conf_set { $zk_cfg_keys:
contrail::lib::augeas_conf_set { 'zk_cfg_keys':
config_file => '/etc/zookeeper/conf/zoo.cfg',
settings_hash => $zk_cfg['zk_cfg'],
lens_to_use => 'properties.lns',
Expand Down
Expand Up @@ -2,21 +2,22 @@
## Example of call:
## $redis_config_file = '/etc/redis/redis.conf'
## $redis_config = { 'redis_conf' => <key, value hash> }
## $redis_conf_keys = keys($redis_config['redis_conf'])
## contrail::lib::augeas_conf_set { $redis_conf_keys:
## $key = <key>
## $value = <value>
## contrail::lib::augeas_conf_ins { 'inserting_${key}_in_${config_file}':
## key => $key,
## value => $value,
## config_file => $redis_config_file,
## settings_hash => $redis_config['redis_conf'],
## lens_to_use => 'spacevars.lns', ## based on separator, whether conf file has section, etc
## }
##
define contrail::lib::augeas_conf_ins(
$key = $title,
$settings_hash,
$key,
$value,
$config_file,
$lens_to_use,
)
{
$value = $settings_hash[$key]
augeas {"${config_file}_setting_${key}":
incl => "${config_file}",
lens => "${lens_to_use}",
Expand Down
Expand Up @@ -2,26 +2,27 @@
## Example of call:
## $redis_config_file = '/etc/redis/redis.conf'
## $redis_config = { 'redis_conf' => <key, value hash> }
## $redis_conf_keys = keys($redis_config['redis_conf'])
## contrail::lib::augeas_conf_set { $redis_conf_keys:
## contrail::lib::augeas_conf_set { 'redis_conf':
## config_file => $redis_config_file,
## settings_hash => $redis_config['redis_conf'],
## lens_to_use => 'spacevars.lns', ## based on separator, whether conf file has section, etc
## }
##
define contrail::lib::augeas_conf_set(
$key = $title,
$settings_hash,
$config_file,
$lens_to_use,
)
{
$value = $settings_hash[$key]
augeas {"${config_file}_setting_${key}":
$keys_list = keys($settings_hash)
$key_and_values = join_keys_to_values($settings_hash, " \"")
$prefix = prefix($key_and_values, "set ")
$change_set = suffix($prefix, "\"")
augeas {"${config_file}_setting_${title}":
incl => "${config_file}",
lens => "${lens_to_use}",
context => "/files${config_file}",
changes => "set ${key} \"${value}\"",
onlyif => "match ${key} not_include ${value}",
}
changes => $change_set,
}
notify {"change_set = ${change_set}":;}
}
@@ -1,7 +1,10 @@
# The profile to set up the neutron server on Config node
class contrail::profile::neutron::server {

openstack::resources::database { 'neutron': }

class contrail::profile::neutron::server(
$host_roles = $::contrail::params::host_roles
)
{
if (!("openstack" in $host_roles)) {
openstack::resources::database { 'neutron': }
}
include ::contrail::config::neutron
}
18 changes: 10 additions & 8 deletions contrail/environment/modules/neutron/manifests/server.pp
Expand Up @@ -177,7 +177,7 @@
$log_file = undef,
$report_interval = undef,
) {

$host_roles = $::contrail::params::host_roles
include neutron::params
require keystone::python

Expand Down Expand Up @@ -288,13 +288,15 @@
}

if ($::neutron::params::server_package) {
Package['neutron-server'] -> Neutron_api_config<||>
Package['neutron-server'] -> Neutron_config<||>
Package['neutron-server'] -> Service['neutron-server']
package { 'neutron-server':
ensure => $package_ensure,
name => $::neutron::params::server_package,
}
if (!("openstack" in $host_roles)) {
Package['neutron-server'] -> Neutron_api_config<||>
Package['neutron-server'] -> Neutron_config<||>
Package['neutron-server'] -> Service['neutron-server']
package { 'neutron-server':
ensure => $package_ensure,
name => $::neutron::params::server_package,
}
}
} else {
# Some platforms (RedHat) does not provide a neutron-server package.
# The neutron api config file is provided by the neutron package.
Expand Down

0 comments on commit 8575d05

Please sign in to comment.