Merge "Manage keystone initialization directly in t-h-t manifests"
[apex-tripleo-heat-templates.git] / puppet / extraconfig / all_nodes / neutron-ml2-cisco-nexus-ucsm.yaml
index c873ef3..2413f5a 100644 (file)
@@ -163,8 +163,17 @@ resources:
       config: |
         #!/bin/sh
         MACS=$(ifconfig  | grep ether | awk '{print $2}' | tr "\n" " ")
-        HOSTNAME=$(hostname -f)
-        echo "$HOSTNAME $MACS"
+        HOST_FQDN=$(hostname -f)
+        if [ -z "$HOST_FQDN" ]; then
+          HOSTNAME=$(hostname -s)
+          # hardcoding the domain name to avoid DNS lookup dependency
+          # same type of hardcoding appears elsewhere
+          # --ie. controller-puppet.yaml
+          # FIXME_HOSTNAME_DOMAIN_HARDCODE
+          echo "$HOSTNAME.localdomain $MACS"
+        else
+          echo "$HOST_FQDN $MACS"
+        fi
 
   CollectMacDeploymentsController:
     type: OS::Heat::SoftwareDeployments
@@ -256,11 +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']:
-                cur_swports = nexus_cp[nexus_switch]['servers'][mac2host[lmac]]
-                nexus_cp[nexus_switch]['servers'][mac2host[lmac]] = cur_swports + ',' + swport
+              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)