r2lab is migrating from a previous depl. based on omf_sfa
[plcapi.git] / PLC / Methods / AddNetworkMethod.py
index c207e1d..11f3845 100644 (file)
@@ -2,7 +2,7 @@ from PLC.Faults import *
 from PLC.Method import Method
 from PLC.Parameter import Parameter, Mixed
 from PLC.NetworkMethods import NetworkMethod, NetworkMethods
-from PLC.Auth import PasswordAuth
+from PLC.Auth import Auth
 
 class AddNetworkMethod(Method):
     """
@@ -14,15 +14,16 @@ class AddNetworkMethod(Method):
     roles = ['admin']
 
     accepts = [
-        PasswordAuth(),
+        Auth(),
         NetworkMethod.fields['method']
         ]
 
     returns = Parameter(int, '1 if successful')
 
+
     def call(self, auth, name):
         network_method = NetworkMethod(self.api)
         network_method['method'] = name
-        network_method.sync()
+        network_method.sync(insert = True)
 
         return 1