Minor post-merge fixes
This commit is contained in:
commit
b09e69c557
@ -459,11 +459,11 @@ class UserManager(object):
|
|||||||
description=None, member_users=None):
|
description=None, member_users=None):
|
||||||
if member_users:
|
if member_users:
|
||||||
member_users = [User.safe_id(u) for u in member_users]
|
member_users = [User.safe_id(u) for u in member_users]
|
||||||
|
# NOTE(vish): try to associate a vpn ip and port first because
|
||||||
|
# if it throws an exception, we save having to
|
||||||
|
# create and destroy a project
|
||||||
|
Vpn.create(name)
|
||||||
with LDAPWrapper() as conn:
|
with LDAPWrapper() as conn:
|
||||||
# NOTE(vish): try to associate a vpn ip and port first because
|
|
||||||
# if it throws an exception, we save having to
|
|
||||||
# create and destroy a project
|
|
||||||
Vpn.create(name)
|
|
||||||
return conn.create_project(name,
|
return conn.create_project(name,
|
||||||
User.safe_id(manager_user),
|
User.safe_id(manager_user),
|
||||||
description,
|
description,
|
||||||
@ -524,15 +524,16 @@ class UserManager(object):
|
|||||||
with LDAPWrapper() as conn:
|
with LDAPWrapper() as conn:
|
||||||
user = User.safe_id(user)
|
user = User.safe_id(user)
|
||||||
result = conn.create_user(user, access, secret, admin)
|
result = conn.create_user(user, access, secret, admin)
|
||||||
if create_project:
|
if create_project:
|
||||||
# NOTE(vish): if the project creation fails, we delete
|
# NOTE(vish): if the project creation fails, we delete
|
||||||
# the user and return an exception
|
# the user and return an exception
|
||||||
try:
|
try:
|
||||||
conn.create_project(user, user, user)
|
conn.create_project(user, user, user)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
with LDAPWrapper() as conn:
|
||||||
conn.delete_user(user)
|
conn.delete_user(user)
|
||||||
raise
|
raise
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def delete_user(self, user, delete_project=True):
|
def delete_user(self, user, delete_project=True):
|
||||||
with LDAPWrapper() as conn:
|
with LDAPWrapper() as conn:
|
||||||
|
@ -127,8 +127,9 @@ class Vlan(datastore.BasicModel):
|
|||||||
@datastore.absorb_connection_error
|
@datastore.absorb_connection_error
|
||||||
def all(cls):
|
def all(cls):
|
||||||
set_name = cls._redis_set_name(cls.__name__)
|
set_name = cls._redis_set_name(cls.__name__)
|
||||||
for project,vlan in datastore.Redis.instance().hgetall(set_name):
|
elements = datastore.Redis.instance().hgetall(set_name)
|
||||||
yield cls(project, vlan)
|
for project in elements:
|
||||||
|
yield cls(project, elements[project])
|
||||||
|
|
||||||
@datastore.absorb_connection_error
|
@datastore.absorb_connection_error
|
||||||
def save(self):
|
def save(self):
|
||||||
@ -288,6 +289,7 @@ class BridgedNetwork(BaseNetwork):
|
|||||||
netmask
|
netmask
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
bridge_gets_ip = False
|
||||||
override_type = 'network'
|
override_type = 'network'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -529,6 +531,10 @@ def get_vlan_for_project(project_id):
|
|||||||
return Vlan.create(project_id, vnum)
|
return Vlan.create(project_id, vnum)
|
||||||
raise compute_exception.AddressNotAllocated("Out of VLANs")
|
raise compute_exception.AddressNotAllocated("Out of VLANs")
|
||||||
|
|
||||||
|
def get_network_by_interface(iface, security_group='default'):
|
||||||
|
vlan = iface.rpartition("br")[2]
|
||||||
|
return get_project_network(Vlan.dict_by_vlan().get(vlan), security_group)
|
||||||
|
|
||||||
def get_network_by_address(address):
|
def get_network_by_address(address):
|
||||||
logging.debug("Get Network By Address: %s" % address)
|
logging.debug("Get Network By Address: %s" % address)
|
||||||
for project in users.UserManager.instance().get_projects():
|
for project in users.UserManager.instance().get_projects():
|
||||||
|
Loading…
Reference in New Issue
Block a user