def usage(self): #if no interfaces at all - display error and go to advanced if len(self._get_filtered_ifnames()) == 0: self.console.msgbox("Error", "No network adapters detected") return "usage" #if interfaces but no default - display error and go to networking ifname = self._get_default_nic() if not ifname: self.console.msgbox("Error", "Networking is not yet configured") return "networking" #display usage key = CONFIG.get("appliance_key", "") if not key: key = "NOT SET, PLEASE CONFIGURE" t = file(get_configuration_path("usage.txt"), 'r').read() text = Template(t).substitute( hostname=ifutil.get_hostname().capitalize(), appname=self.appname, ipaddr=ifutil.get_ipconf(ifname)[0], key=key ) retcode, choice = self.console.menu("Usage", text, self._get_advmenu(), no_cancel=True) if retcode is not self.OK: self.running = False fn = choice.lower() fn = "_adv_" + fn.replace(" ", "_") return fn
def _adv_view_settings(self): ip = ifutil.get_ipconf(self._get_default_nic())[0] agg_url = CONFIG.get("aggregator", "") if not agg_url: agg_url = "NOT SET, PLEASE CONFIGURE" port = CONFIG.get("remote_agent_port", "") if not port: port = "6000" agent_address = "%s:%s" % (ip, port) t = file(get_configuration_path("info.txt"), 'r').read() text = Template(t).substitute( agent_address=agent_address, agg_url=agg_url ) choice = self.console.msgbox("View Settings", text) return "usage"