Bug #654025: nova-manage project zip and nova-manage vpn list broken by change in DB semantics when networks are missing

Catch exception.NotFound when getting project VPN data.  This is in two places:
nova-manage as part of its vpn list command, and
auth.manager.AuthManager.get_credentials.

Also, document the behaviour of db.api.project_get_network.
This commit is contained in:
Ewan Mellor
2010-10-03 13:12:32 +01:00
parent 27473e075b
commit 7a482d9fe1
2 changed files with 11 additions and 3 deletions

View File

@@ -88,11 +88,16 @@ class VpnCommands(object):
def list(self):
"""Print a listing of the VPNs for all projects."""
print "%-12s\t" % 'project',
print "%-12s\t" % 'ip:port',
print "%-20s\t" % 'ip:port',
print "%s" % 'state'
for project in self.manager.get_projects():
print "%-12s\t" % project.name,
print "%s:%s\t" % (project.vpn_ip, project.vpn_port),
try:
s = "%s:%s" % (project.vpn_ip, project.vpn_port)
except exception.NotFound:
s = "None"
print "%-20s\t" % s,
vpn = self._vpn_for(project.id)
if vpn:

View File

@@ -653,7 +653,10 @@ class AuthManager(object):
zippy.writestr(FLAGS.credential_key_file, private_key)
zippy.writestr(FLAGS.credential_cert_file, signed_cert)
(vpn_ip, vpn_port) = self.get_project_vpn_data(project)
try:
(vpn_ip, vpn_port) = self.get_project_vpn_data(project)
except exception.NotFound:
vpn_ip = None
if vpn_ip:
configfile = open(FLAGS.vpn_client_template, "r")
s = string.Template(configfile.read())