Minor post-merge fixes
This commit is contained in:
commit
b09e69c557
@ -459,11 +459,11 @@ class UserManager(object):
|
||||
description=None, member_users=None):
|
||||
if 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:
|
||||
# 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,
|
||||
User.safe_id(manager_user),
|
||||
description,
|
||||
@ -524,15 +524,16 @@ class UserManager(object):
|
||||
with LDAPWrapper() as conn:
|
||||
user = User.safe_id(user)
|
||||
result = conn.create_user(user, access, secret, admin)
|
||||
if create_project:
|
||||
# NOTE(vish): if the project creation fails, we delete
|
||||
# the user and return an exception
|
||||
try:
|
||||
conn.create_project(user, user, user)
|
||||
except Exception:
|
||||
if create_project:
|
||||
# NOTE(vish): if the project creation fails, we delete
|
||||
# the user and return an exception
|
||||
try:
|
||||
conn.create_project(user, user, user)
|
||||
except Exception:
|
||||
with LDAPWrapper() as conn:
|
||||
conn.delete_user(user)
|
||||
raise
|
||||
return result
|
||||
raise
|
||||
return result
|
||||
|
||||
def delete_user(self, user, delete_project=True):
|
||||
with LDAPWrapper() as conn:
|
||||
|
@ -127,8 +127,9 @@ class Vlan(datastore.BasicModel):
|
||||
@datastore.absorb_connection_error
|
||||
def all(cls):
|
||||
set_name = cls._redis_set_name(cls.__name__)
|
||||
for project,vlan in datastore.Redis.instance().hgetall(set_name):
|
||||
yield cls(project, vlan)
|
||||
elements = datastore.Redis.instance().hgetall(set_name)
|
||||
for project in elements:
|
||||
yield cls(project, elements[project])
|
||||
|
||||
@datastore.absorb_connection_error
|
||||
def save(self):
|
||||
@ -288,6 +289,7 @@ class BridgedNetwork(BaseNetwork):
|
||||
netmask
|
||||
"""
|
||||
|
||||
bridge_gets_ip = False
|
||||
override_type = 'network'
|
||||
|
||||
@classmethod
|
||||
@ -529,6 +531,10 @@ def get_vlan_for_project(project_id):
|
||||
return Vlan.create(project_id, vnum)
|
||||
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):
|
||||
logging.debug("Get Network By Address: %s" % address)
|
||||
for project in users.UserManager.instance().get_projects():
|
||||
|
Loading…
Reference in New Issue
Block a user