summaryrefslogtreecommitdiffstats
path: root/puppet/extraconfig/all_nodes
diff options
context:
space:
mode:
authortiswanso <tiswanso@cisco.com>2015-10-06 11:33:05 -0400
committertiswanso <tiswanso@cisco.com>2015-10-15 12:15:55 -0400
commit588430a7f278c9534f8a80cb5d3463867e11760b (patch)
tree10edeac67aefde229e8a77afb650fb87469ee5c5 /puppet/extraconfig/all_nodes
parentd29003ac6d1c61db65b4ca3272ecbde3ea0942be (diff)
Cisco Nexus ML2 MD: Need unique key for server level keys in hieradata
Due to a limitation in the puppet version used in RHEL7 there is no simple way to scope a 2nd level hiera hash key with the create_resources + defined types pattern. Lack of the .each method support prior to puppet 4.0 is the problem here. This template change works around the problem by explicitly adding the hostname to the hieradata for a server under a nexus switch. The duplicate server names under different switches is needed for vPC config scenarios. Closes-bug: #1506546 Change-Id: I03b866fb440e968c9f86ae93942b687e7165a065
Diffstat (limited to 'puppet/extraconfig/all_nodes')
-rw-r--r--puppet/extraconfig/all_nodes/neutron-ml2-cisco-nexus-ucsm.yaml10
1 files changed, 7 insertions, 3 deletions
diff --git a/puppet/extraconfig/all_nodes/neutron-ml2-cisco-nexus-ucsm.yaml b/puppet/extraconfig/all_nodes/neutron-ml2-cisco-nexus-ucsm.yaml
index d08a1692..2413f5a4 100644
--- a/puppet/extraconfig/all_nodes/neutron-ml2-cisco-nexus-ucsm.yaml
+++ b/puppet/extraconfig/all_nodes/neutron-ml2-cisco-nexus-ucsm.yaml
@@ -265,10 +265,14 @@ resources:
for (mac,swport) in nexus[nexus_switch]['servers'].iteritems():
lmac=mac.lower()
if lmac in mac2host:
- if mac2host[lmac] in nexus_cp[nexus_switch]['servers']:
- nexus_cp[nexus_switch]['servers'][mac2host[lmac]]['ports'] += ',' + swport['ports']
+ hostname = mac2host[lmac]
+ # for puppet we need a unique title even at the 2nd key level
+ serv_key = nexus_switch + "::" + hostname
+ if serv_key in nexus_cp[nexus_switch]['servers']:
+ nexus_cp[nexus_switch]['servers'][serv_key]['ports'] += ',' + swport['ports']
else:
- nexus_cp[nexus_switch]['servers'][mac2host[lmac]] = swport
+ nexus_cp[nexus_switch]['servers'][serv_key] = swport
+ nexus_cp[nexus_switch]['servers'][serv_key]['hostname'] = hostname
del nexus_cp[nexus_switch]['servers'][mac]
# Note this echo means you can view the data via heat deployment-show
print json.dumps(nexus_cp)