def call(self, auth, name, description):
# Create node group
nodegroup = NodeGroup(self.api, {'name': name, 'description': description})
- nodegroup.flush()
+ nodegroup.sync()
return nodegroup['nodegroup_id']
can_update = lambda (field, value): field in \
['ip', 'mac', 'gateway', 'network', 'broadcast', 'netmask',
'dns1', 'dns2', 'hostname', 'bwlimit', 'is_primary']
- update_fields = dict(filter(can_update, NodeNetwork.all_fields.items()))
+ update_fields = dict(filter(can_update, NodeNetwork.fields.items()))
accepts = [
PasswordAuth(),
nodenetwork = NodeNetwork(self.api, optional_vals)
nodenetwork['method'] = method
nodenetwork['type'] = type
- nodenetwork.flush(commit = False)
+ nodenetwork.sync(commit = False)
# Associate node network with node
node.add_node_network(nodenetwork, commit = False)
person['first_name'] = first_name
person['last_name'] = last_name
person['enabled'] = False
- person.flush()
+ person.sync()
return person['person_id']
site['name'] = name
site['abbreviated_name'] = abbreviated_name
site['login_base'] = login_base
- site.flush()
+ site.sync()
return site['site_id']
accepts = [
PasswordAuth(),
Mixed(Node.fields['node_id'],
- Node.fields['hostname'])
+ Node.fields['hostname'])
]
- returns = [NodeNetwork.all_fields]
+ returns = [NodeNetwork.fields]
def call(self, auth, node_id_or_hostname):
# Authenticated function
NodeGroup.fields['name'])
]
- returns = NodeGroup.join_fields['node_ids']
+ returns = NodeGroup.fields['node_ids']
def call(self, auth, nodegroup_id_or_name):
# Get nodes in this nodegroup
NodeGroup.fields['name'])]
]
- returns = [NodeGroup.all_fields]
+ returns = [NodeGroup.fields]
def call(self, auth, nodegroup_id_or_name_list = None):
# Get node group details
# Filter out password and deleted fields
can_return = lambda (field, value): field not in ['password', 'deleted']
- default_fields = dict(filter(can_return, Person.default_fields.items()))
- return_fields = dict(filter(can_return, Person.all_fields.items()))
+ return_fields = dict(filter(can_return, Person.fields.items()))
returns = [return_fields]
def __init__(self, *args, **kwds):
Method.__init__(self, *args, **kwds)
# Update documentation with list of default fields returned
- self.__doc__ += os.linesep.join(self.default_fields.keys())
+ self.__doc__ += os.linesep.join(self.return_fields.keys())
def call(self, auth, person_id_or_email_list = None, return_fields = None):
# Make sure that only valid fields are specified
Site.fields['login_base'])
]
- returns = Site.all_fields['person_ids']
+ returns = Site.fields['person_ids']
def call(self, auth, site_id_or_login_base):
# Authenticated function
# Filter out deleted fields
can_return = lambda (field, value): field not in ['deleted']
- return_fields = dict(filter(can_return, Site.all_fields.items()))
+ return_fields = dict(filter(can_return, Site.fields.items()))
returns = [return_fields]
def __init__(self, *args, **kwds):
Method.__init__(self, *args, **kwds)
# Update documentation with list of default fields returned
- self.__doc__ += os.linesep.join(Site.default_fields.keys())
+ self.__doc__ += os.linesep.join(self.return_fields.keys())
def call(self, auth, site_id_or_login_base_list = None, return_fields = None):
# Make sure that only valid fields are specified
raise PLCPermissionDenied, "Not allowed to enable specified account"
person['enabled'] = enabled
- person.flush()
+ person.sync()
return 1
if node['site_id'] not in self.caller['site_ids']:
raise PLCPermissionDenied, "Not allowed to delete nodes from specified site"
- # Check if we can update this account
- node = nodes.values()[0]
- if not self.caller.can_update(node):
- raise PLCPermissionDenied, "Not allowed to update specified account"
-
node.update(update_fields)
- node.flush()
+ node.sync()
return 1
}
nodegroup.update(update_fields)
- nodegroup.flush()
+ nodegroup.sync()
return 1
# Update node network
nodenetwork.update(update_fields)
- nodenetwork.flush()
+ nodenetwork.sync()
return 1
raise PLCPermissionDenied, "Not allowed to update specified account"
person.update(update_fields)
- person.flush()
+ person.sync()
return 1
can_update = lambda (field, value): field in \
['name', 'abbreviated_name',
'is_public', 'latitude', 'longitude', 'url',
- 'organization_id', 'ext_consortium_id',
- 'max_slices', 'site_share']
- update_fields = dict(filter(can_update, Site.all_fields.items()))
+ 'max_slices']
+ update_fields = dict(filter(can_update, Site.fields.items()))
accepts = [
PasswordAuth(),
raise PLCInvalidArgument, "Only admins can update max_slices"
site.update(update_fields)
- site.flush()
+ site.sync()
return 1