From: Tony Mack Date: Thu, 2 Nov 2006 14:57:25 +0000 (+0000) Subject: - if a node has no nodenetworks, make the first one added primary X-Git-Tag: pycurl-7_13_1~399 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=8683d5f85e9ca2510e8205a12eed0a4be54d133f;p=plcapi.git - if a node has no nodenetworks, make the first one added primary --- diff --git a/PLC/Methods/AddNodeNetwork.py b/PLC/Methods/AddNodeNetwork.py index a37ce400..34498a66 100644 --- a/PLC/Methods/AddNodeNetwork.py +++ b/PLC/Methods/AddNodeNetwork.py @@ -64,6 +64,9 @@ class AddNodeNetwork(Method): # Add node network nodenetwork = NodeNetwork(self.api, nodenetwork_fields) nodenetwork['node_id'] = node['node_id'] + # if this is the first node network, make it primary + if not node['nodenetwork_ids']: + nodenetwork['is_primary'] = True nodenetwork.sync() self.object_ids = [node['node_id'], nodenetwork['nodenetwork_id']]