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 st...@apache.org on 2012/02/22 19:36:35 UTC
svn commit: r1292468 -
/incubator/tashi/branches/stroucki-irpbugs/src/tashi/agents/dhcpdns.py
Author: stroucki
Date: Wed Feb 22 19:36:35 2012
New Revision: 1292468
URL: http://svn.apache.org/viewvc?rev=1292468&view=rev
Log:
dhcpdns: revert to trunk version suggested by rgass
Modified:
incubator/tashi/branches/stroucki-irpbugs/src/tashi/agents/dhcpdns.py
Modified: incubator/tashi/branches/stroucki-irpbugs/src/tashi/agents/dhcpdns.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/stroucki-irpbugs/src/tashi/agents/dhcpdns.py?rev=1292468&r1=1292467&r2=1292468&view=diff
==============================================================================
--- incubator/tashi/branches/stroucki-irpbugs/src/tashi/agents/dhcpdns.py (original)
+++ incubator/tashi/branches/stroucki-irpbugs/src/tashi/agents/dhcpdns.py Wed Feb 22 19:36:35 2012
@@ -28,7 +28,8 @@ from tashi import boolean
class DhcpDns(InstanceHook):
def __init__(self, config, client, post=False):
InstanceHook.__init__(self, config, client, post)
- self.dnsKeyFile = self.config.get('DhcpDns', 'dnsKeyFile')
+ self.dnsKeyName = self.config.get('DhcpDns', 'dnsKeyName')
+ self.dnsSecretKey = self.config.get('DhcpDns', 'dnsSecretKey')
self.dnsServer = self.config.get('DhcpDns', 'dnsServer')
self.dnsDomain = self.config.get('DhcpDns', 'dnsDomain')
self.dnsExpire = int(self.config.get('DhcpDns', 'dnsExpire'))
@@ -113,6 +114,7 @@ class DhcpDns(InstanceHook):
except:
pass
cmd = "omshell"
+# XXXpipe: open omshell session
(stdin, stdout) = os.popen2(cmd)
stdin.write("server %s\n" % (self.dhcpServer))
if (self.dhcpSecretKey != ""):
@@ -130,6 +132,7 @@ class DhcpDns(InstanceHook):
def removeDhcp(self, name, ipaddr=None):
cmd = "omshell"
+# XXXpipe: open omshell session
(stdin, stdout) = os.popen2(cmd)
stdin.write("server %s\n" % (self.dhcpServer))
if (self.dhcpSecretKey != ""):
@@ -151,14 +154,12 @@ class DhcpDns(InstanceHook):
self.removeDns(name)
except:
pass
- if (self.dnsKeyFile != ""):
- cmd = "nsupdate -k %s" % (self.dnsKeyFile)
- else:
- cmd = "nsupdate"
+ cmd = "nsupdate"
child = subprocess.Popen(args=cmd.split(), stdin=subprocess.PIPE, stdout=subprocess.PIPE)
try:
(stdin, stdout) = (child.stdin, child.stdout)
stdin.write("server %s\n" % (self.dnsServer))
+ stdin.write("key %s %s\n" % (self.dnsKeyName, self.dnsSecretKey))
stdin.write("update add %s.%s %d A %s\n" % (name, self.dnsDomain, self.dnsExpire, ip))
stdin.write("\n")
if (self.reverseDns):
@@ -179,14 +180,12 @@ class DhcpDns(InstanceHook):
(pid, status) = os.waitpid(child.pid, os.WNOHANG)
def removeDns(self, name):
- if (self.dnsKeyFile != ""):
- cmd = "nsupdate -k %s" % (self.dnsKeyFile)
- else:
- cmd = "nsupdate"
+ cmd = "nsupdate"
child = subprocess.Popen(args=cmd.split(), stdin=subprocess.PIPE, stdout=subprocess.PIPE)
try:
(stdin, stdout) = (child.stdin, child.stdout)
stdin.write("server %s\n" % (self.dnsServer))
+ stdin.write("key %s %s\n" % (self.dnsKeyName, self.dnsSecretKey))
if (self.reverseDns):
ip = socket.gethostbyname(name)
ipSegments = map(int, ip.split("."))