MCPcopy Create free account
hub / github.com/apache/cloudstack / call_maas

Method call_maas

extensions/MaaS/maas.py:99–114  ·  view source on GitHub ↗
(self, method, path, data=None, ignore_404=False)

Source from the content-addressed store, hash-verified

97 )
98
99 def call_maas(self, method, path, data=None, ignore_404=False):
100 if not path.startswith("/"):
101 path = "/" + path
102 url = f"{self.data['endpoint']}:5240/MAAS/api/2.0{path}"
103 resp = self.session.request(method, url, data=data)
104
105 if resp.status_code == 404 and ignore_404:
106 return None
107
108 if not resp.ok:
109 fail(f"MAAS API error: {resp.status_code} {resp.text}")
110
111 try:
112 return resp.json() if resp.text else {}
113 except ValueError:
114 return {}
115
116 def prepare(self):
117 machines = self.call_maas("GET", "/machines/")

Callers 7

prepareMethod · 0.95
createMethod · 0.95
deleteMethod · 0.95
startMethod · 0.95
stopMethod · 0.95
rebootMethod · 0.95
statusMethod · 0.95

Calls 2

failFunction · 0.70
requestMethod · 0.45

Tested by

no test coverage detected