Merge "Temporary UCSM mapping files should be opened with write mode"
[apex-tripleo-heat-templates.git] / puppet / extraconfig / all_nodes / neutron-ml2-cisco-nexus-ucsm.yaml
index cb8d498..9b900bc 100644 (file)
@@ -245,7 +245,9 @@ resources:
         for map_name in mappings:
           f_name = '/root/' + map_name
           map_data = os.getenv(map_name, "Nada")
-          with open(f_name, 'a') as f:
+          with os.fdopen(os.open(f_name,
+                                 os.O_CREAT | os.O_TRUNC | os.O_WRONLY, 0o644),
+                         'w') as f:
             f.write(map_data)
           if map_data is not "Nada":
             if map_name is not 'nexus_config':
@@ -260,7 +262,9 @@ resources:
             for mac in vals[1:]:
               mac2host[mac.lower()] = vals[0]
 
-        with open('/root/mac2host', 'a') as f:
+        with os.fdopen(os.open('/root/mac2host',
+                               os.O_CREAT | os.O_TRUNC | os.O_WRONLY, 0o644),
+                       'w') as f:
           f.write(str(mac2host))
 
         # now we have mac to host, map host to switchport in hieradata