def query(self, params, options): return self.context.call_sync( self.query_call, self.extra_query_params + params, extend(self.extra_query_options, options), timeout=self.call_timeout )
def get_one(self, name): return self.context.call_sync( self.query_call, self.extra_query_params + [(self.primary_key_name, '=', name)], extend(self.extra_query_options, {'single': True}), timeout=self.call_timeout )
def query(self, params, options): ret = super(DisksNamespace, self).query(params, options) allocations = self.context.call_sync('volume.get_disks_allocation', [d['id'] for d in ret]) return [extend(d, { 'allocation': allocations.get(d['id']) if d['online'] else None }) for d in ret]
def annotated(self): return extend(self.value, { 'origin': { 'directory': self.directory.name, 'cached_at': self.created_at, 'ttl': self.ttl } })
def annotate(user, directory, name_field, cache=None): return extend(user, { 'origin': { 'directory': directory.name, 'cached_at': None, 'ttl': None } })
def query(self, params, options): ret = super(DisksNamespace, self).query(params, options) disks = [d['path'] for d in ret] allocations = self.context.call_sync('volume.get_disks_allocation', disks) return [extend(d, { 'allocation': allocations.get(d['path']) if d['online'] else None }) for d in ret]
def fix_passwords(user): """ Warning: this function shall be called only within an RPC method context """ if not privileged(user['uid']): return extend(user, {'unixhash': '*', 'nthash': None, 'lmhash': None}) return user
def annotated(self): return extend(self.value, { 'origin': { 'directory': self.directory.name, 'domain': self.directory.domain_name, 'read_only': self.directory.plugin_type != 'local', 'cached_at': self.created_at, 'ttl': self.ttl } })
def annotate(user, directory, name_field, cache=None): return extend(user, { 'origin': { 'directory': directory.name, 'domain': directory.domain_name, 'read_only': directory.plugin_type != 'local', 'cached_at': None, 'ttl': None } })
def fix_passwords(user): """ Warning: this function shall be called only within an RPC method context """ if not privileged(user['uid']): return extend(user, { 'unixhash': '*', 'nthash': None, 'lmhash': None }) return user
def annotate(user, directory, name_field, cache=None): name = '{0}@{1}'.format(user[name_field], directory.domain_name) \ if directory.domain_name \ else user[name_field] return extend(user, { name_field: name, 'origin': { 'directory': directory.name, 'cached_at': None, 'ttl': None } })
def save(self, this, new=False): if new: newname = this.entity['id'] if len(newname.split('/')) < 2: raise CommandException(_("Please specify name as a relative path starting from the dataset's parent volume.")) self.context.submit_task( 'volume.dataset.create', extend(this.entity, {'volume': self.parent.entity['id']}), callback=lambda s, t: post_save(this, s, t) ) return self.context.submit_task( 'volume.dataset.update', this.orig_entity['id'], this.get_diff(), callback=lambda s, t: post_save(this, s, t) )
def __getstate__(self): return extend(include(self._dict, *self.__annotations__.keys()), {'%type': self.json_schema_name()})
def __getstate__(self): return extend( include(self._dict, *getattr(self, '__annotations__', {}).keys()), {'%type': self.__class__.__name__} )
def apply(obj, datastore): return extend(obj, {"last_name": obj["full_name"].split()[-1]})
def __getstate__(self): return extend( include(self._dict, *getattr(self, '__annotations__', {}).keys()), {'%type': self.__class__.__name__})
def query(self, params, options): return self.context.call_sync(self.query_call, self.extra_query_params + params, extend(self.extra_query_options, options), timeout=self.call_timeout)
def get_one(self, name): return self.context.call_sync( self.query_call, self.extra_query_params + [(self.primary_key_name, '=', name)], extend(self.extra_query_options, {'single': True}), timeout=self.call_timeout)