From tashi-commits-return-636-apmail-incubator-tashi-commits-archive=incubator.apache.org@incubator.apache.org Tue Jan 8 15:14:23 2013 Return-Path: X-Original-To: apmail-incubator-tashi-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-tashi-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C2FF0DFF5 for ; Tue, 8 Jan 2013 15:14:23 +0000 (UTC) Received: (qmail 24792 invoked by uid 500); 8 Jan 2013 15:14:23 -0000 Delivered-To: apmail-incubator-tashi-commits-archive@incubator.apache.org Received: (qmail 24779 invoked by uid 500); 8 Jan 2013 15:14:23 -0000 Mailing-List: contact tashi-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: tashi-dev@incubator.apache.org Delivered-To: mailing list tashi-commits@incubator.apache.org Received: (qmail 24770 invoked by uid 99); 8 Jan 2013 15:14:23 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Jan 2013 15:14:23 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Jan 2013 15:14:20 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id ABA7123888CD; Tue, 8 Jan 2013 15:13:59 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1430318 - in /incubator/tashi/trunk/src/zoni: agents/dhcpdns.py client/zoni-cli.py data/resourcequerysql.py extensions/m_extensions.py install/db/zoniDbSetup.py Date: Tue, 08 Jan 2013 15:13:59 -0000 To: tashi-commits@incubator.apache.org From: rgass@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130108151359.ABA7123888CD@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: rgass Date: Tue Jan 8 15:13:59 2013 New Revision: 1430318 URL: http://svn.apache.org/viewvc?rev=1430318&view=rev Log: Fixing some typos errors with the Mimos import. If this broke something, let me know. getconfig needs to use the zoni version and not tashi. Need to merge these two. adding the dhcpdns changes from tashi. Need to merge. Modified: incubator/tashi/trunk/src/zoni/agents/dhcpdns.py incubator/tashi/trunk/src/zoni/client/zoni-cli.py incubator/tashi/trunk/src/zoni/data/resourcequerysql.py incubator/tashi/trunk/src/zoni/extensions/m_extensions.py incubator/tashi/trunk/src/zoni/install/db/zoniDbSetup.py Modified: incubator/tashi/trunk/src/zoni/agents/dhcpdns.py URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/zoni/agents/dhcpdns.py?rev=1430318&r1=1430317&r2=1430318&view=diff ============================================================================== --- incubator/tashi/trunk/src/zoni/agents/dhcpdns.py (original) +++ incubator/tashi/trunk/src/zoni/agents/dhcpdns.py Tue Jan 8 15:13:59 2013 @@ -131,7 +131,7 @@ class DhcpDns(): ipSegments = map(int, ip.split(".")) ipSegments.reverse() reverseIpStr = ("%d.%d.%d.%d.in-addr.arpa" % (ipSegments[0], ipSegments[1], ipSegments[2], ipSegments[3])) - stdin.write("update add %s %d IN PTR %s.%s.\n" % (reverseIpStr, self.dnsExpire, name, self.dnsDomain)) + stdin.write("update add %s %d IN PTR %s.\n" % (reverseIpStr, self.dnsExpire, name)) stdin.write("\n") stdin.close() output = stdout.read() @@ -153,7 +153,7 @@ class DhcpDns(): (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 delete %s.%s A\n" % (name, self.dnsDomain)) + stdin.write("update delete %s A\n" % (name)) stdin.write("\n") if (self.reverseDns): hostInfo = socket.gethostbyaddr(name) @@ -190,7 +190,7 @@ class DhcpDns(): (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 CNAME %s.%s\n" % (name, self.dnsDomain, self.dnsExpire, hostName, self.dnsDomain)) + stdin.write("update add %s %d CNAME %s\n" % (name, self.dnsExpire, hostInfo[0])) stdin.write("\n") stdin.close() output = stdout.read() @@ -211,10 +211,11 @@ class DhcpDns(): cmd = "nsupdate" child = subprocess.Popen(args=cmd.split(), stdin=subprocess.PIPE, stdout=subprocess.PIPE) try: + hostInfo = socket.gethostbyaddr(name)[0] (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 delete %s.%s CNAME\n" % (name, self.dnsDomain)) + stdin.write("update delete %s CNAME\n" % (name)) stdin.write("\n") stdin.close() output = stdout.read() @@ -235,6 +236,18 @@ class DhcpDns(): newInstance.nics = instance.nics self.client.vmUpdate(instance.id, newInstance, None) + + def getFqdn(self, instance): + domainName = self.dnsDomain + subDomain = instance.hints.get("subDomain", None) + if subDomain != None: + domainName = "%s.%s" % (subDomain, self.dnsDomain) + + fqdn = "%s.%s" % (instance.name, domainName) + + return fqdn + + def preCreate(self, instance): if (len(instance.nics) < 1): return @@ -244,8 +257,8 @@ class DhcpDns(): nic.ip = ip try: if (i == 0): - self.log.info("Adding %s:{%s->%s} to DNS" % (instance.name, instance.name, ip)) - self.addDns(instance.name, ip) + self.log.info("Adding %s:{%s->%s} to DNS" % (instance.name, self.getFqdn(instance), ip)) + self.addDns(self.getFqdn(instance), ip) if (i == 0): dhcpName = instance.name else: @@ -277,6 +290,6 @@ class DhcpDns(): except Exception, e: self.log.exception("Failed to remove host %s from DHCP" % (instance.name)) try: - self.removeDns(instance.name) + self.removeDns(self.getFqdn(instance)) except Exception, e: self.log.exception("Failed to remove host %s from DNS" % (instance.name)) Modified: incubator/tashi/trunk/src/zoni/client/zoni-cli.py URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/zoni/client/zoni-cli.py?rev=1430318&r1=1430317&r2=1430318&view=diff ============================================================================== --- incubator/tashi/trunk/src/zoni/client/zoni-cli.py (original) +++ incubator/tashi/trunk/src/zoni/client/zoni-cli.py Tue Jan 8 15:13:59 2013 @@ -46,10 +46,10 @@ import zoni.hardware.systemmanagement from zoni.data import usermanagement from zoni.agents.dhcpdns import DhcpDns -from zoni.extra.util import validIp, validMac +from zoni.extra.util import validIp, validMac, getConfig from zoni.version import version, revision -from tashi.util import instantiateImplementation, getConfig +from tashi.util import instantiateImplementation #import zoni.data.usermanagement #from usermanagement import UserManagement @@ -65,7 +65,6 @@ def main(): rev = revision (configs, configFiles) = getConfig() - logging.config.fileConfig(configFiles) #log = logging.getLogger(os.path.basename(__file__)) #logit(configs['logFile'], "Starting Zoni client") Modified: incubator/tashi/trunk/src/zoni/data/resourcequerysql.py URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/zoni/data/resourcequerysql.py?rev=1430318&r1=1430317&r2=1430318&view=diff ============================================================================== --- incubator/tashi/trunk/src/zoni/data/resourcequerysql.py (original) +++ incubator/tashi/trunk/src/zoni/data/resourcequerysql.py Tue Jan 8 15:13:59 2013 @@ -33,7 +33,7 @@ from zoni.extra.util import createKey class ResourceQuerySql(InfoStore): def __init__(self, config, verbose=None): self.config = config - self.verbose = verbose + self.verbose = verbose self.host = config['dbHost'] self.user = config['dbUser'] self.passwd = config['dbPassword'] Modified: incubator/tashi/trunk/src/zoni/extensions/m_extensions.py URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/zoni/extensions/m_extensions.py?rev=1430318&r1=1430317&r2=1430318&view=diff ============================================================================== --- incubator/tashi/trunk/src/zoni/extensions/m_extensions.py (original) +++ incubator/tashi/trunk/src/zoni/extensions/m_extensions.py Tue Jan 8 15:13:59 2013 @@ -70,11 +70,11 @@ class mimos(InfoStore): return def getDestFile(self, configs, host): - therole = ("%s/01-%s" % (configs['tftpImageDir'], (host['mac_addr']).replace(":", "-").lower()) + therole = ("%s/01-%s" % (configs['tftpImageDir'], (host['mac_addr']).replace(":", "-").lower())) return therole def addRoletoNode(self, configs, host, thenode, roletemplate): - therole = ("%s/01-%s" % (configs['tftpImageDir'], (host['mac_addr']).replace(":", "-").lower()) + therole = ("%s/01-%s" % (configs['tftpImageDir'], (host['mac_addr']).replace(":", "-").lower())) self.log.info("Roles: addRole for %s" % thenode) srctpl = "%s/%s" % (configs['tftpTemplateDir'], roletemplate) if os.path.isfile(therole): @@ -106,7 +106,7 @@ class mimos(InfoStore): return 0 def removeRolefromNode(self, configs, host, thenode): - therole = ("%s/01-%s" % (configs['tftpImageDir'], (host['mac_addr']).replace(":", "-").lower()) + therole = ("%s/01-%s" % (configs['tftpImageDir'], (host['mac_addr']).replace(":", "-").lower())) self.log.info("Roles: removeRole for %s" % thenode) if not os.path.isfile(therole): mesg = "No Role File for %s! Exiting!" % thenode Modified: incubator/tashi/trunk/src/zoni/install/db/zoniDbSetup.py URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/zoni/install/db/zoniDbSetup.py?rev=1430318&r1=1430317&r2=1430318&view=diff ============================================================================== --- incubator/tashi/trunk/src/zoni/install/db/zoniDbSetup.py (original) +++ incubator/tashi/trunk/src/zoni/install/db/zoniDbSetup.py Tue Jan 8 15:13:59 2013 @@ -83,7 +83,7 @@ def CreateZoniDb(config, adminUser, admi try: conn = connectDb(host, port, adminUser, adminPassword) - except e: + except Exception, e: print "error here ", e exit() createDatabase(conn, adminUser, adminPassword, db)