def module_apply(self, instance, modules): """Apply modules to an instance.""" url = "/instances/%s/modules" % base.getid(instance) body = {"modules": self._get_module_list(modules)} resp, body = self.api.client.post(url, body=body) common.check_for_exceptions(resp, body, url) return [core_modules.Module(self, module, loaded=True) for module in body['modules']]
def _modules_get(self, instance, from_guest=None, include_contents=None): url = "/instances/%s/modules" % base.getid(instance) query_strings = {} if from_guest is not None: query_strings["from_guest"] = from_guest if include_contents is not None: query_strings["include_contents"] = include_contents url = common.append_query_strings(url, **query_strings) resp, body = self.api.client.get(url) common.check_for_exceptions(resp, body, url) return [core_modules.Module(self, module, loaded=True) for module in body['modules']]
def cluster_instance_modules(self): return [[modules.Module(None, mod)] for mod in self.fake_cluster_instance_modules]