From a6f5b2bdd8ab5e1d8feb79a2acc01573e23aa835 Mon Sep 17 00:00:00 2001 From: Alex Ruiz Estradera Date: Tue, 13 Dec 2016 16:37:34 +0100 Subject: [PATCH] Fix Some Bugs on Puppet Midonet - Pin version of package elasticsearh - Send proper format to midonet config - Check for duplicate midonet.conf file creation Change-Id: I8b13dcb1c82be3fa6d61daad1ddcad664420f2e2 --- Puppetfile | 2 +- manifests/analytics/quickstart.pp | 13 ++++++++----- manifests/cluster/run.pp | 2 +- spec/classes/midonet_cluster_run_spec.rb | 2 +- templates/cluster/mn-cluster_config.sh.erb | 4 ++-- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Puppetfile b/Puppetfile index a45516b..cc954ba 100644 --- a/Puppetfile +++ b/Puppetfile @@ -22,7 +22,7 @@ mod 'deric/zookeeper' , '0.6.1' mod 'locp/cassandra' , '1.25.2' mod 'puppetlabs/concat' mod 'TubeMogul/curator' -mod 'elasticsearch/elasticsearch' +mod 'elasticsearch/elasticsearch' , '0.13.2' mod 'elasticsearch/logstash' mod 'electrical/file_concat' mod 'richardc/datacat' diff --git a/manifests/analytics/quickstart.pp b/manifests/analytics/quickstart.pp index 1986508..2652934 100644 --- a/manifests/analytics/quickstart.pp +++ b/manifests/analytics/quickstart.pp @@ -47,11 +47,14 @@ class midonet::analytics::quickstart ( path => '/etc/midonet', owner => 'root', mode => '0755', - } -> + } - file { 'set_config': - ensure => present, - path => $config_path, - content => template('midonet/analytics/midonet.conf.erb'), + if !defined(File['set_config']) { + file { 'set_config': + ensure => present, + path => $config_path, + content => template('midonet/analytics/midonet.conf.erb'), + require => File['midonet folder'] + } } } diff --git a/manifests/cluster/run.pp b/manifests/cluster/run.pp index 19be5b98..a33d209 100644 --- a/manifests/cluster/run.pp +++ b/manifests/cluster/run.pp @@ -126,7 +126,7 @@ class midonet::cluster::run ( exec { '/bin/bash /tmp/mn-cluster_config.sh': } - file { 'cluster_config': + file { 'set_config': ensure => present, path => $cluster_config_path, content => template('midonet/cluster/midonet.conf.erb'), diff --git a/spec/classes/midonet_cluster_run_spec.rb b/spec/classes/midonet_cluster_run_spec.rb index e11d08f..3cd1c24 100644 --- a/spec/classes/midonet_cluster_run_spec.rb +++ b/spec/classes/midonet_cluster_run_spec.rb @@ -21,7 +21,7 @@ describe 'midonet::cluster::run' do end it { is_expected.to contain_exec('/bin/bash /tmp/mn-cluster_config.sh') } it { is_expected.to contain_file('/tmp/mn-cluster_config.sh').with_ensure('present') } - it { is_expected.to contain_file('cluster_config').with( + it { is_expected.to contain_file('set_config').with( 'ensure' => 'present', 'path' => '/etc/midonet/midonet.conf', ) } diff --git a/templates/cluster/mn-cluster_config.sh.erb b/templates/cluster/mn-cluster_config.sh.erb index bbb468c..7a6009e 100644 --- a/templates/cluster/mn-cluster_config.sh.erb +++ b/templates/cluster/mn-cluster_config.sh.erb @@ -44,13 +44,13 @@ cluster.auth { keystone.tenant_name = "<%= @keystone_tenant_name %>" keystone.admin_token = "<%= @keystone_admin_token %>" keystone.host = "<%= @keystone_host %>" - keystone.port = "<%= @keystone_port %>" + keystone.port = <%= @keystone_port %> keystone.protocol = "<%= @keystone_protocol %>" keystone.domain_name = "<%= @keystone_domain_name %>" keystone.domain_id = "<%= @keystone_domain_id %>" keystone.user_name = "<%= @keystone_user_name %>" keystone.user_password = "<%= @keystone_user_password %>" - keystone.version = "<%= @keystone_keystone_version %>" + keystone.version = <%= @keystone_keystone_version %> } cluster.rest_api { http_host = <%= @cluster_host %>