fixed_ip disassociate now also unsets mac_address_id
This commit is contained in:
@@ -171,17 +171,23 @@ class VpnCommands(object):
|
|||||||
def change(self, project_id, ip, port):
|
def change(self, project_id, ip, port):
|
||||||
"""Change the ip and port for a vpn.
|
"""Change the ip and port for a vpn.
|
||||||
|
|
||||||
|
this will update all networks associated with a project
|
||||||
|
not sure if that's the desired behavior or not, patches accepted
|
||||||
|
|
||||||
args: project, ip, port"""
|
args: project, ip, port"""
|
||||||
|
# TODO(tr3buchet): perhaps this shouldn't update all networks
|
||||||
|
# associated with a project in the future
|
||||||
project = self.manager.get_project(project_id)
|
project = self.manager.get_project(project_id)
|
||||||
if not project:
|
if not project:
|
||||||
print 'No project %s' % (project_id)
|
print 'No project %s' % (project_id)
|
||||||
return
|
return
|
||||||
admin = context.get_admin_context()
|
admin_context = context.get_admin_context()
|
||||||
network_ref = db.project_get_network(admin, project_id)
|
networks = db.project_get_networks(admin_context, project_id)
|
||||||
db.network_update(admin,
|
for network in networks:
|
||||||
network_ref['id'],
|
db.network_update(admin_context,
|
||||||
{'vpn_public_address': ip,
|
network['id'],
|
||||||
'vpn_public_port': int(port)})
|
{'vpn_public_address': ip,
|
||||||
|
'vpn_public_port': int(port)})
|
||||||
|
|
||||||
|
|
||||||
class ShellCommands(object):
|
class ShellCommands(object):
|
||||||
@@ -413,12 +419,13 @@ class ProjectCommands(object):
|
|||||||
def scrub(self, project_id):
|
def scrub(self, project_id):
|
||||||
"""Deletes data associated with project
|
"""Deletes data associated with project
|
||||||
arguments: project_id"""
|
arguments: project_id"""
|
||||||
ctxt = context.get_admin_context()
|
admin_context = context.get_admin_context()
|
||||||
network_ref = db.project_get_network(ctxt, project_id)
|
networks = db.project_get_networks(admin_context, project_id)
|
||||||
db.network_disassociate(ctxt, network_ref['id'])
|
for network in networks:
|
||||||
groups = db.security_group_get_by_project(ctxt, project_id)
|
db.network_disassociate(admin_context, network['id'])
|
||||||
|
groups = db.security_group_get_by_project(admin_context, project_id)
|
||||||
for group in groups:
|
for group in groups:
|
||||||
db.security_group_destroy(ctxt, group['id'])
|
db.security_group_destroy(admin_context, group['id'])
|
||||||
|
|
||||||
def zipfile(self, project_id, user_id, filename='nova.zip'):
|
def zipfile(self, project_id, user_id, filename='nova.zip'):
|
||||||
"""Exports credentials for project to a zip file
|
"""Exports credentials for project to a zip file
|
||||||
|
|||||||
@@ -588,13 +588,17 @@ class AuthManager(object):
|
|||||||
not been allocated for user.
|
not been allocated for user.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
network_ref = db.project_get_network(context.get_admin_context(),
|
networks = db.project_get_networks(context.get_admin_context(),
|
||||||
Project.safe_id(project), False)
|
Project.safe_id(project), False)
|
||||||
|
if not networks:
|
||||||
if not network_ref:
|
|
||||||
return (None, None)
|
return (None, None)
|
||||||
return (network_ref['vpn_public_address'],
|
|
||||||
network_ref['vpn_public_port'])
|
# TODO(tr3buchet): not sure what you guys plan on doing with this
|
||||||
|
# but it's possible for a project to have multiple sets of vpn data
|
||||||
|
# for now I'm just returning the first one
|
||||||
|
network = networks[0]
|
||||||
|
return (network['vpn_public_address'],
|
||||||
|
network['vpn_public_port'])
|
||||||
|
|
||||||
def delete_project(self, project):
|
def delete_project(self, project):
|
||||||
"""Deletes a project"""
|
"""Deletes a project"""
|
||||||
|
|||||||
Reference in New Issue
Block a user