Allow single list of Zookeeper and cassandra
Change-Id: I69ba8f17007eaad96a933fbd45c397cdc0c498eb
This commit is contained in:
		@@ -7,7 +7,8 @@ describe 'midonet::agent class' do
 | 
			
		||||
      pp = <<-EOS
 | 
			
		||||
      include ::midonet::repository
 | 
			
		||||
      class { 'midonet_openstack::role::nsdb':
 | 
			
		||||
        client_ip => '127.0.0.1'
 | 
			
		||||
        client_ip => '127.0.0.1',
 | 
			
		||||
        id        => 1
 | 
			
		||||
      }
 | 
			
		||||
      class { 'midonet::agent':
 | 
			
		||||
        zookeeper_hosts => [ { 'ip' => '127.0.0.1', 'port' => '2181' } ],
 | 
			
		||||
 
 | 
			
		||||
@@ -6,6 +6,10 @@ describe 'midonet::analytics class' do
 | 
			
		||||
    it 'should install the midonet analytics without any errors' do
 | 
			
		||||
      pp = <<-EOS
 | 
			
		||||
      include ::midonet::repository
 | 
			
		||||
      class { 'midonet_openstack::role::nsdb':
 | 
			
		||||
        client_ip => '127.0.0.1',
 | 
			
		||||
        id        => 1
 | 
			
		||||
      }
 | 
			
		||||
      class { 'midonet::analytics':
 | 
			
		||||
        is_mem            => false,
 | 
			
		||||
        manage_repo       => false,
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,8 @@ describe 'midonet::cluster class' do
 | 
			
		||||
      pp = <<-EOS
 | 
			
		||||
      include ::midonet::repository
 | 
			
		||||
      class { 'midonet_openstack::role::nsdb':
 | 
			
		||||
        client_ip => '127.0.0.1'
 | 
			
		||||
        client_ip => '127.0.0.1',
 | 
			
		||||
        id        => 1
 | 
			
		||||
      }
 | 
			
		||||
      class { 'midonet::cluster':
 | 
			
		||||
        zookeeper_hosts       => [{ 'ip' => '127.0.0.1', 'port' => '2181' }],
 | 
			
		||||
 
 | 
			
		||||
@@ -34,7 +34,13 @@
 | 
			
		||||
 | 
			
		||||
[zookeeper]
 | 
			
		||||
<%- zkarr = Array.new -%>
 | 
			
		||||
<%- @zookeeper_hosts.each do |s| -%>
 | 
			
		||||
<%- zk_hosts = Array.new -%>
 | 
			
		||||
<%- if @zookeeeper_hosts.class == Hash -%>
 | 
			
		||||
  <%- zk_hosts.push(@zookeeper_hosts) -%>
 | 
			
		||||
<%- else -%>
 | 
			
		||||
  <%- zk_hosts = @zookeeper_hosts -%>
 | 
			
		||||
<%- end -%>
 | 
			
		||||
<%- zk_hosts.each do |s| -%>
 | 
			
		||||
  <%- zkarr.push("#{s['ip']}:#{s['port'] ||= 2181 }") -%>
 | 
			
		||||
<%- end -%>
 | 
			
		||||
zookeeper_hosts = <%= zkarr.join(",") %>
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,13 @@
 | 
			
		||||
                                                                                                         │
 | 
			
		||||
[zookeeper]
 | 
			
		||||
<%- zkarr = Array.new -%>
 | 
			
		||||
<%- @zookeeper_hosts.each do |s| -%>
 | 
			
		||||
<%- zk_hosts = Array.new -%>
 | 
			
		||||
<%- if @zookeeeper_hosts.class == Hash -%>
 | 
			
		||||
  <%- zk_hosts.push(@zookeeper_hosts) -%>
 | 
			
		||||
<%- else -%>
 | 
			
		||||
  <%- zk_hosts = @zookeeper_hosts -%>
 | 
			
		||||
<%- end -%>
 | 
			
		||||
<%- zk_hosts.each do |s| -%>
 | 
			
		||||
  <%- zkarr.push("#{s['ip']}:#{s['port'] ||= 2181 }") -%>
 | 
			
		||||
<%- end -%>
 | 
			
		||||
zookeeper_hosts = <%= zkarr.join(",") %>
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,13 @@
 | 
			
		||||
                                                                                                         │
 | 
			
		||||
[zookeeper]
 | 
			
		||||
<%- zkarr = Array.new -%>
 | 
			
		||||
<%- @zookeeper_hosts.each do |s| -%>
 | 
			
		||||
<%- zk_hosts = Array.new -%>
 | 
			
		||||
<%- if @zookeeeper_hosts.class == Hash -%>
 | 
			
		||||
  <%- zk_hosts.push(@zookeeper_hosts) -%>
 | 
			
		||||
<%- else -%>
 | 
			
		||||
  <%- zk_hosts = @zookeeper_hosts -%>
 | 
			
		||||
<%- end -%>
 | 
			
		||||
<%- zk_hosts.each do |s| -%>
 | 
			
		||||
  <%- zkarr.push("#{s['ip']}:#{s['port'] ||= 2181 }") -%>
 | 
			
		||||
<%- end -%>
 | 
			
		||||
zookeeper_hosts = <%= zkarr.join(",") %>
 | 
			
		||||
 
 | 
			
		||||
@@ -11,14 +11,26 @@ which mn-conf > /dev/null || {
 | 
			
		||||
cat << EOF | mn-conf set -t default
 | 
			
		||||
zookeeper {
 | 
			
		||||
  <%- zkarr = Array.new -%>
 | 
			
		||||
  <%- @zookeeper_hosts.each do |s| -%>
 | 
			
		||||
  <%- zkarr.push("#{s['ip']}:#{s['port'] ||= 2181 }") -%>
 | 
			
		||||
  <%- zk_hosts = Array.new -%>
 | 
			
		||||
  <%- if @zookeeeper_hosts.class == Hash -%>
 | 
			
		||||
    <%- zk_hosts.push(@zookeeper_hosts) -%>
 | 
			
		||||
  <%- else -%>
 | 
			
		||||
    <%- zk_hosts = @zookeeper_hosts -%>
 | 
			
		||||
  <%- end -%>
 | 
			
		||||
  <%- zk_hosts.each do |s| -%>
 | 
			
		||||
    <%- zkarr.push("#{s['ip']}:#{s['port'] ||= 2181 }") -%>
 | 
			
		||||
  <%- end -%>
 | 
			
		||||
  zookeeper_hosts = "<%= zkarr.join(",") %>"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
cassandra {
 | 
			
		||||
  servers = "<%= @cassandra_servers.join(",") %>"
 | 
			
		||||
  <%- cass_hosts = Array.new -%>
 | 
			
		||||
  <%- if @cassandra_servers.class == String -%>
 | 
			
		||||
    <%- cass_hosts.push(@cassandra_servers) -%>
 | 
			
		||||
  <%- else -%>
 | 
			
		||||
    <%- cass_hosts = @cassandra_servers -%>
 | 
			
		||||
  <%- end -%>
 | 
			
		||||
  servers = "<%= cass_hosts.join(",") %>"
 | 
			
		||||
}
 | 
			
		||||
EOF
 | 
			
		||||
echo "cassandra.replication_factor : <%= @cassandra_rep_factor %>" | mn-conf set -t default
 | 
			
		||||
 
 | 
			
		||||
@@ -35,7 +35,13 @@ USE_SCREEN="True"
 | 
			
		||||
 | 
			
		||||
# ZK Hosts (comma delimited)
 | 
			
		||||
<%- zkarr = Array.new -%>
 | 
			
		||||
<%- @zookeeper_hosts.each do |s| -%>
 | 
			
		||||
<%- zk_hosts = Array.new -%>
 | 
			
		||||
<%- if @zookeeeper_hosts.class == Hash -%>
 | 
			
		||||
  <%- zk_hosts.push(@zookeeper_hosts) -%>
 | 
			
		||||
<%- else -%>
 | 
			
		||||
  <%- zk_hosts = @zookeeper_hosts -%>
 | 
			
		||||
<%- end -%>
 | 
			
		||||
<%- zk_hosts.each do |s| -%>
 | 
			
		||||
  <%- zkarr.push("#{s['ip']}:#{s['port'] ||= 2181 }") -%>
 | 
			
		||||
<%- end -%>
 | 
			
		||||
ZOOKEEPER_HOSTS=<%= zkarr.join(",") %>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user