def _GET(self, *param, **params): if self.is_mode_input(): return True else: self.view.hosts = findbyhostall(self.orm) self.view.application_uniqkey = karesansui.config['application.uniqkey'] if self.input.has_key('job_id') is True: self.view.job_id = self.input.job_id else: self.view.job_id = None return True
def _GET(self, *param, **params): models = findbyhostall(self.orm) uris = available_virt_uris() try: conf = env.get("KARESANSUI_CONF") _K2V = K2V(conf) config = _K2V.read() except (IOError, KaresansuiGadgetException): raise KaresansuiGadgetException self.view.application_uniqkey = config["application.uniqkey"] from karesansui.lib.file.configfile import LighttpdPortConf from karesansui.lib.const import LIGHTTPD_PORT_CONFIG try: conf_file = config["lighttpd.etc.dir"] + "/" + LIGHTTPD_PORT_CONFIG port_number = int(LighttpdPortConf(conf_file).read()) except: port_number = 443 try: hosts = [] for model in models: if model.attribute == 0 and model.hypervisor == 1: uri = uris["XEN"] elif model.attribute == 0 and model.hypervisor == 2: uri = uris["KVM"] else: uri = None self.kvc = KaresansuiVirtConnection(uri) host = MergeHost(self.kvc, model) host.info["model"].is_ssl = is_ssl(host.info["model"].hostname) # host.info['model'].is_ssl = is_ssl(host.info['model'].hostname,port_number) host.info["model"].port_number = port_number hosts.append(host) self.view.machines = hosts except KaresansuiVirtException: self.kvc.close() raise KaresansuiGadgetException return True
def _GET(self, *param, **params): models = findbyhostall(self.orm) uris = available_virt_uris() try: conf = env.get('KARESANSUI_CONF') _K2V = K2V(conf) config = _K2V.read() except (IOError, KaresansuiGadgetException): raise KaresansuiGadgetException self.view.application_uniqkey = config['application.uniqkey'] port_number = 443 try: hosts = [] for model in models: if model.attribute == 0 and model.hypervisor == 1: uri = uris["XEN"] elif model.attribute == 0 and model.hypervisor == 2: uri = uris["KVM"] else: uri = None self.kvc = KaresansuiVirtConnection(uri) host = MergeHost(self.kvc, model) host.info['model'].is_ssl = is_ssl(host.info['model'].hostname) #host.info['model'].is_ssl = is_ssl(host.info['model'].hostname,port_number) host.info['model'].port_number = port_number hosts.append(host) self.view.machines = hosts except KaresansuiVirtException: if hasattr(self, "kvc") is True: self.kvc.close() raise KaresansuiGadgetException return True