update_fields
]
- returns = Parameter(int, '1 if successful')
+ returns = Parameter(int, 'New node_id (> 0) if successful')
def call(self, auth, site_id_or_login_base, hostname, boot_state, optional_vals = {}):
if filter(lambda field: field not in self.update_fields, optional_vals):
site = sites.values()[0]
- # Get site node group information
- nodegroups = NodeGroups(self.api, [site['nodegroup_id']])
- if not nodegroups:
- raise PLCAPIError, "Site %d does not have a nodegroup" % site['site_id']
-
- nodegroup = nodegroups.values()[0]
-
# Authenticated function
assert self.caller is not None
node = Node(self.api, optional_vals)
node['hostname'] = hostname
node['boot_state'] = boot_state
- node.flush(commit = False)
-
- # Now associate the node with the site
- nodegroup.add_node(node, commit = True)
+ node['site_id'] = site['site_id']
+ node.sync(commit = False)
return node['node_id']