Repository: dmwm/wmcore
Issue: ReqMgr2MS status API broken

It turns out I removed the `status` method on this PR:
https://github.com/dmwm/WMCore/pull/9296/files?file-filters%5B%5D=.py#diff-453996f14095b65d84d7db2d10e0260bL302

which makes the `/microservice/data/status` hit a `500 Internal Server Error`, as in the traceback below:
```
[01/Aug/2019:02:00:52] vocms0731.cern.ch 127.0.0.1 "GET /microservice/data/status HTTP/1.1" 500 Internal Server Error [data: 344 in 742 out 2276 us ] [auth: OK "" "" ] [ref: "" "ServerMonitor/2.0" ]
[01/Aug/2019:02:01:22]  SERVER OTHER ERROR __builtins__.AttributeError 3644ca5546ee3fe2af818f564ba8e2b8 ('MSManager' object has no attribute 'status')
[01/Aug/2019:02:01:22]    Traceback (most recent call last):
[01/Aug/2019:02:01:22]      File "/data/srv/beHG1908d/sw/slc7_amd64_gcc630/cms/reqmgr2ms/0.1.2.pre3/lib/python2.7/site-packages/WMCore/REST/Server.py", line 723, in default
[01/Aug/2019:02:01:22]        return self._call(RESTArgs(list(args), kwargs))
[01/Aug/2019:02:01:22]      File "/data/srv/beHG1908d/sw/slc7_amd64_gcc630/cms/reqmgr2ms/0.1.2.pre3/lib/python2.7/site-packages/WMCore/REST/Server.py", line 804, in _call
[01/Aug/2019:02:01:22]        obj = apiobj['call'](*safe.args, **safe.kwargs)
[01/Aug/2019:02:01:22]      File "/data/srv/beHG1908d/sw/slc7_amd64_gcc630/cms/reqmgr2ms/0.1.2.pre3/lib/python2.7/site-packages/WMCore/MicroService/Service/Data.py", line 91, in get
[01/Aug/2019:02:01:22]        res.update({'results': dict(status=self.mgr.status())})
[01/Aug/2019:02:01:22]    AttributeError: 'MSManager' object has no attribute 'status'
[01/Aug/2019:02:01:22] vocms0731.cern.ch 127.0.0.1 "GET /microservice/data/status HTTP/1.1" 500 Internal Server Error [data: 344 in 742 out 3008 us ] [auth: OK "" "" ] [ref: "" "ServerMonitor/2.0" ]
```

Changed files:
src/python/WMCore/MicroService/Unified/MSManager.py, src/python/WMCore/MicroService/Service/Data.py

diff --git a/src/python/WMCore/MicroService/Service/Data.py b/src/python/WMCore/MicroService/Service/Data.py
index 4e302ae55..cad05f605 100644
--- a/src/python/WMCore/MicroService/Service/Data.py
+++ b/src/python/WMCore/MicroService/Service/Data.py
@@ -24,6 +24,7 @@ import importlib
 import cherrypy
 
 # WMCore modules
+import WMCore
 from WMCore.REST.Server import RESTEntity, restcall
 from WMCore.REST.Tools import tools
 # from WMCore.REST.Validation import validate_rx, validate_str
@@ -63,14 +64,13 @@ class Data(RESTEntity):
 
         """
         if method == 'GET':
+            for prop in param.kwargs.keys():
+                safe.kwargs[prop] = param.kwargs.pop(prop)
             if len(param.args) == 1 and param.args[0] == 'status':
-                safe.args.append(param.args[0])
-                param.args.remove(param.args[0])
+                safe.args.append(param.args.pop(0))
 #                 validate_rx('request', param, safe, optional=True)
 #                 validate_str('_', param, safe, PAT_INFO, optional=True)
                 return True
-            if len(param.args) == 0:
-                return True
         elif method == 'POST':
             if not param.args or not param.kwargs:
                 return False
@@ -83,14 +83,12 @@ class Data(RESTEntity):
         Implement GET request with given uid or set of parameters
         All work is done by MicroServiceManager
         """
-        res = {'request': kwds, 'microservice': self.mgr.__class__.__name__}
+        res = {'request_args': args,
+               'request_kwargs': kwds,
+               'wmcore_microservice_version': WMCore.__version__,
+               'microservice': self.mgr.__class__.__name__}
         if 'status' in args:
-            if kwds:
-                res.update({'results': dict(status=self.mgr.status(**kwds))})
-            else:
-                res.update({'results': dict(status=self.mgr.status())})
-        else:
-            res.update({'results': dict(status={})})
+            res.update(dict(status=self.mgr.status(**kwds)))
         return results(res)
 
     @restcall(formats=[('application/json', JSONFormat())])
diff --git a/src/python/WMCore/MicroService/Unified/MSManager.py b/src/python/WMCore/MicroService/Unified/MSManager.py
index 3628de402..bb45ee068 100644
--- a/src/python/WMCore/MicroService/Unified/MSManager.py
+++ b/src/python/WMCore/MicroService/Unified/MSManager.py
@@ -159,3 +159,13 @@ class MSManager(object):
     def delete(self, request):
         "Delete request in backend"
         pass
+
+    def status(self, **kwargs):
+        """
+        Return current status for the MicroService Manager
+        Args:
+            **kwargs: it will be a request name in the future
+        """
+        # TODO: eventually give it the correct purpose like, given
+        # a request name, return its transfer status
+        return "OK"