rhtyd commented on a change in pull request #2366: CLOUDSTACK-10168 - VR 
duplicate entries in /etc/hosts when reusing VM name
URL: https://github.com/apache/cloudstack/pull/2366#discussion_r157964380
 
 

 ##########
 File path: systemvm/patches/debian/config/opt/cloud/bin/cs_dhcp.py
 ##########
 @@ -18,17 +18,22 @@
 from pprint import pprint
 from netaddr import *
 
-
 def merge(dbag, data):
-
     # A duplicate ip address wil clobber the old value
     # This seems desirable ....
-    if "add" in data and data['add'] is False and \
-            "ipv4_adress" in data:
-        if data['ipv4_adress'] in dbag:
-            del(dbag[data['ipv4_adress']])
-        return dbag
+    if "add" in data and data['add'] is False and "ipv4_address" in data:
+        if data['ipv4_address'] in dbag:
+            del(dbag[data['ipv4_address']])
     else:
-        dbag[data['ipv4_adress']] = data
-    return dbag
+        remove_key = None
+        for key, entry in dbag.iteritems():
+            if key <> 'id' and entry['host_name'] == data['host_name']:
 
 Review comment:
   `<>` is deprecated and removed in Python 3.x, please use `!=` instead.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to