You are viewing a plain text version of this content. The canonical link for it is here.
Posted to tashi-commits@incubator.apache.org by mr...@apache.org on 2009/07/08 18:49:09 UTC
svn commit: r792257 - /incubator/tashi/trunk/src/tashi/agents/dhcpdns.py
Author: mryan3
Date: Wed Jul 8 18:49:08 2009
New Revision: 792257
URL: http://svn.apache.org/viewvc?rev=792257&view=rev
Log:
Patch from Jim Cipar on tashi-dev@i.a.o
This patch ensures that entries are removed before being added to DHCP/
DNS
Modified:
incubator/tashi/trunk/src/tashi/agents/dhcpdns.py
Modified: incubator/tashi/trunk/src/tashi/agents/dhcpdns.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/agents/dhcpdns.py?rev=792257&r1=792256&r2=792257&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/agents/dhcpdns.py (original)
+++ incubator/tashi/trunk/src/tashi/agents/dhcpdns.py Wed Jul 8 18:49:08 2009
@@ -100,6 +100,8 @@
return ipString
def addDhcp(self, name, ipaddr, hwaddr):
+ self.removeDhcp(name)
+ self.removeDhcp(name, ipaddr)
cmd = "omshell"
(stdin, stdout) = os.popen2(cmd)
stdin.write("server %s\n" % (self.dhcpServer))
@@ -116,7 +118,7 @@
output = stdout.read()
stdout.close()
- def removeDhcp(self, name):
+ def removeDhcp(self, name, ipaddr=None):
cmd = "omshell"
(stdin, stdout) = os.popen2(cmd)
stdin.write("server %s\n" % (self.dhcpServer))
@@ -124,7 +126,10 @@
stdin.write("key %s %s\n" % (self.dhcpKeyName, self.dhcpSecretKey))
stdin.write("connect\n")
stdin.write("new \"host\"\n")
- stdin.write("set name = \"%s\"\n" % (name))
+ if (ipaddr == None):
+ stdin.write("set name = \"%s\"\n" % (name))
+ else:
+ stdin.write("set ip-address = %s\n"%(ipaddr))
stdin.write("open\n")
stdin.write("remove\n")
stdin.close()
@@ -132,6 +137,7 @@
stdout.close()
def addDns(self, name, ip):
+ self.removeDns(name)
if (self.dnsKeyFile != ""):
cmd = "nsupdate -k %s" % (self.dnsKeyFile)
else: