FIT IoT-Lab requires organization of new users: generate one from the urn
[sfa.git] / sfa / iotlab / iotlabshell.py
index c51a7d6..101de84 100644 (file)
@@ -138,11 +138,6 @@ class IotLABShell(object):
                            err.reason)
             return {'error': err.reason}
         for exp in experiments['items']:
-            # BUG IN OAR REST API : job with reservation didn't return
-            # resources attribute list. We use another request for
-            # finding job resources
-            exp_nodes = self.api.method('admin/experiments/%d' % exp['id'])
-            exp['resources'] = exp_nodes['nodes']
             # BUG ASAP jobs without date information
             if exp['date'] == "as soon as possible":
                 exp['date'] = 0
@@ -155,16 +150,22 @@ class IotLABShell(object):
         """
         # pylint:disable=E1123
         logger.warning("iotlashell add_user")
+        logger.warning("slice_user: %s" % slice_user)
+        if 'urn' in slice_user:
+            organization = slice_user['urn']
+        else:
+            organization = "SFA federation"
         # single account creation
         user = {"type": "SA",
                 "city": "To be defined",
                 "country": "To be defined",
-                "motivations": "SFA federation"}
+                "motivations": "SFA federation",
+                "organization": organization}
         email = slice_user['email']
         user['email'] = email
         user['sshPublicKey'] = slice_user['keys'][0]
         # ex : onelab.inria
-        user['structure'] = slice_user['slice_record']['authority']
+        user['structure'] = slice_user['urn'].split('+')[1].replace(':','.')
         email = (email.split('@'))[0]
         user['firstName'] = email.split('.')[0]
         try: