Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / pybind / mgr / restful / api / server.py
1 from pecan import expose
2 from pecan.rest import RestController
3
4 from restful import module
5 from restful.decorators import auth
6
7
8 class ServerFqdn(RestController):
9     def __init__(self, fqdn):
10         self.fqdn = fqdn
11
12
13     @expose(template='json')
14     @auth
15     def get(self, **kwargs):
16         """
17         Show the information for the server fqdn
18         """
19         return module.instance.get_server(self.fqdn)
20
21
22
23 class Server(RestController):
24     @expose(template='json')
25     @auth
26     def get(self, **kwargs):
27         """
28         Show the information for all the servers
29         """
30         return module.instance.list_servers()
31
32
33     @expose()
34     def _lookup(self, fqdn, *remainder):
35         return ServerFqdn(fqdn), remainder