def update_user(auth, id, **fields): user = authenticate(username=auth.get('username'), password=auth.get('password')) auth['tenant'] = user.site.login_base users = User.objects.filter(id=id) if not users: return user = users[0] nova_fields = {} if 'email' in fields: nova_fields['name'] = fields['email'][:self.email.find('@')] nova_fields['email'] = fields['email'] if 'password' in fields: nova_fields['password'] = fields['password'] if 'enabled' in fields: nova_fields['enabled'] = fields['enabled'] sites = _get_sites(fields.get('site')) if sites: fields['site'] = sites[0] user.os_manager = OpenStackManager(auth=auth, caller = user) for (k,v) in fields.items(): setattr(user, k, v) user.save() return user
def update_user(auth, id, **fields): user = authenticate(username=auth.get('username'), password=auth.get('password')) auth['tenant'] = user.site.login_base users = User.objects.filter(id=id) if not users: return user = users[0] nova_fields = {} if 'email' in fields: nova_fields['name'] = fields['email'][:self.email.find('@')] nova_fields['email'] = fields['email'] if 'password' in fields: nova_fields['password'] = fields['password'] if 'enabled' in fields: nova_fields['enabled'] = fields['enabled'] sites = _get_sites(fields.get('site')) if sites: fields['site'] = sites[0] user.os_manager = OpenStackManager(auth=auth, caller=user) for (k, v) in fields.items(): setattr(user, k, v) user.save() return user
def get_slices(auth, filter={}): user = authenticate(username=auth.get('username'), password=auth.get('password')) if 'site' in filter: sites = _get_sites(filter.get('site')) if sites: filter['site'] = sites[0] slices = _get_slices(filter) return slices
def add_user(auth, fields): user = authenticate(username=auth.get('username'), password=auth.get('password')) auth['tenant'] = user.site.login_base sites = _get_sites(fields.get('site')) if sites: fields['site'] = sites[0] user = User(**fields) user.os_manager = OpenStackManager(auth=auth, caller=user) user.save() return user
def add_user(auth, fields): user = authenticate(username=auth.get('username'), password=auth.get('password')) auth['tenant'] = user.site.login_base sites = _get_sites(fields.get('site')) if sites: fields['site'] = sites[0] user = User(**fields) user.os_manager = OpenStackManager(auth=auth, caller = user) user.save() return user
def add_slice(auth, fields): user = authenticate(username=auth.get('username'), password=auth.get('password')) auth['tenant'] = user.site.login_base login_base = fields['name'][:fields['name'].find('_')] sites = _get_sites(login_base) if sites: fields['site'] = sites[0] slice = Slice(**fields) slice.os_manager = OpenStackManager(auth=auth, caller=user) slice.save() return slice
def update_slice(auth, id, **fields): user = authenticate(username=auth.get('username'), password=auth.get('password')) auth['tenant'] = user.site.login_base slices = _get_slices(id) if not slices: return slice = slices[0] sites = _get_sites(fields.get('site')) if sites: fields['site'] = sites[0] slice.os_manager = OpenStackManager(auth=auth, caller=user) for (k, v) in fields.items(): setattr(slice, k, v) slice.save() return slice