Commits

Guillermo Szeliga  committed de79bd5 Draft

Shell account list method done

  • Participants
  • Parent commits 277c4b1

Comments (0)

Files changed (1)

File api/shelf/configuration/accounts.py

 
     def list(self):
 
-        name_pattern = re.compile('^' + self.__client_class.registry_metadata().unique_id() + "_")
+        name_expression = r"^"+ self.__client_class.registry_metadata().unique_id() + "_(\w*).json$"
+        name_expression_compiled = re.compile(name_expression)
 
-        #TODO Extract account name only (i.e ^box_\w*.json$)
+        account_file_names = self.__config_manager.list_defined_instances(name_expression_compiled)
 
-        return self.__config_manager.list_defined_instances(name_pattern)
+        account_ids = []
+
+        for account_name in account_file_names:
+            result = re.match(name_expression_compiled,account_name)
+            account_ids.append(result.group(1))
+
+        return account_ids