def _build_node_columns(self, unit, charm_class): """ builds columns of node status """ node_cols = [] status_txt = "[{}] ".format(unit.agent_state) # unit.agent_state may be "pending" despite errors elsewhere, # so we check for error_info first. # if the agent_state is "error", _detect_errors returns that. error_info = self._detect_errors(unit, charm_class) if error_info: status = ("error_icon", "\N{TETRAGRAM FOR FAILURE} ") if unit.agent_state != "error": status_txt = "[{} (error)] ".format(unit.agent_state) elif unit.agent_state == "pending": pending_status = [("pending_icon", "\N{CIRCLED BULLET} "), ("pending_icon", "\N{CIRCLED WHITE BULLET} "), ("pending_icon_on", "\N{FISHEYE} ")] status = random.choice(pending_status) elif unit.agent_state == "installed": status = ("pending_icon", "\N{HOURGLASS} ") elif unit.agent_state == "started": status = ("success_icon", "\u2713 ") elif unit.agent_state == "stopped": status = ("error_icon", "\N{BLACK FLAG} ") elif unit.agent_state == "down": status = ("error_icon", "\N{DOWNWARDS BLACK ARROW} ") else: # shouldn't get here status = "? " node_cols.append(('pack', Text([status, status_txt]))) if unit.public_address: node_cols.append( ('pack', Text("{0:<12}".format(unit.public_address)))) elif error_info: node_cols.append(('pack', Text("{:<12}".format("Error")))) else: node_cols.append(('pack', Text("{:<12}".format("IP Pending")))) if error_info: infos = [('pack', Text(" | {}".format(error_info)))] else: hw_text = Text([" | "] + self._get_hardware_info(unit)) if 'glance-simplestreams-sync' in unit.unit_name: status_oneline = get_sync_status().replace("\n", " - ") sync_text = Text(' ' + status_oneline) infos = [hw_text, sync_text] else: infos = [hw_text] if self.config.getopt('show_logs'): log_text = Text([('label', self.get_log_text(unit.unit_name))]) infos.append(log_text) node_cols.append(Pile(infos)) return Columns(node_cols)
def update_ui_state(self, charm_class, unit, unit_w): """ Updates individual machine information """ unit_w.public_address.set_text(unit.public_address) unit_w.agent_state.set_text(unit.agent_state) unit_w.icon.set_text(self.status_icon_state(charm_class, unit)) # Special additional status text for these services if 'glance-simplestreams-sync' in unit.unit_name: status_oneline = get_sync_status().replace("\n", " - ") unit_w.workload_info.set_text(status_oneline) elif unit.is_horizon and unit.agent_state == "started": unit_w.workload_info.set_text( "Login: https://{}/horizon " "l:{} p:{}".format( unit.public_address, 'ubuntu', self.config.getopt('openstack_password'))) elif unit.is_jujugui and unit.agent_state == "started": unit_w.workload_info.set_text( "Login: https://{}/".format( unit.public_address)) else: unit_w.workload_info.set_text( " {} - {}".format(unit.extended_agent_state, unit.workload_info))
def update_ui_state(self, charm_class, unit, unit_w): """ Updates individual machine information """ unit_w.public_address.set_text(unit.public_address) unit_w.agent_state.set_text(unit.agent_state) unit_w.icon.set_text(self.status_icon_state(charm_class, unit)) extended_agent_state = unit.extended_agent_state if len(extended_agent_state) > 0 and \ extended_agent_state != 'idle': unit_w.display_name.set_text("{}: {} - {}".format( charm_class.display_name, extended_agent_state, unit.workload_info)) else: unit_w.display_name.set_text("{}".format(charm_class.display_name)) # Special additional status text for these services if 'glance-simplestreams-sync' in unit.unit_name: status_oneline = get_sync_status().replace("\n", " - ") unit_w.display_name.set_text("{} ({})".format( charm_class.display_name, status_oneline)) if unit.is_horizon and unit.agent_state == "started": unit_w.display_name.set_text( "{} - Login: https://{}/horizon " "l:{} p:{}".format(charm_class.display_name, unit.public_address, 'ubuntu', self.config.getopt('openstack_password'))) if unit.is_jujugui and unit.agent_state == "started": unit_w.display_name.set_text("{} - Login: https://{}/".format( charm_class.display_name, unit.public_address))
def _build_node_columns(self, unit, charm_class): """ builds columns of node status """ node_cols = [] status_txt = "[{}] ".format(unit.agent_state) # unit.agent_state may be "pending" despite errors elsewhere, # so we check for error_info first. # if the agent_state is "error", _detect_errors returns that. error_info = self._detect_errors(unit, charm_class) if error_info: status = ("error_icon", "\N{TETRAGRAM FOR FAILURE} ") if unit.agent_state != "error": status_txt = "[{} (error)] ".format(unit.agent_state) elif unit.agent_state == "pending": pending_status = [("pending_icon", "\N{CIRCLED BULLET} "), ("pending_icon", "\N{CIRCLED WHITE BULLET} "), ("pending_icon_on", "\N{FISHEYE} ")] status = random.choice(pending_status) elif unit.agent_state == "installed": status = ("pending_icon", "\N{HOURGLASS} ") elif unit.agent_state == "started": status = ("success_icon", "\u2713 ") elif unit.agent_state == "stopped": status = ("error_icon", "\N{BLACK FLAG} ") elif unit.agent_state == "down": status = ("error_icon", "\N{DOWNWARDS BLACK ARROW} ") else: # shouldn't get here status = "? " node_cols.append(('pack', Text([status, status_txt]))) if unit.public_address: node_cols.append( ('pack', Text("{0:<12}".format(unit.public_address)))) elif error_info: node_cols.append(('pack', Text("{:<12}".format("Error")))) else: node_cols.append( ('pack', Text("{:<12}".format("IP Pending")))) if error_info: node_cols.append(('pack', Text(" | {}".format(error_info)))) else: hw_text = Text([" | "] + self._get_hardware_info(unit)) if 'glance-simplestreams-sync' in unit.unit_name: status_oneline = get_sync_status().replace("\n", " - ") sync_text = Text(' ' + status_oneline) node_cols.append(Pile([hw_text, sync_text])) else: node_cols.append(hw_text) return Columns(node_cols)
def update_ui_state(self, charm_class, unit, unit_w): """ Updates individual machine information """ unit_w.public_address.set_text(unit.public_address) unit_w.agent_state.set_text(unit.agent_state) unit_w.icon.set_text(self.status_icon_state(charm_class, unit)) # Special additional status text for these services if "glance-simplestreams-sync" in unit.unit_name: status_oneline = get_sync_status().replace("\n", " - ") unit_w.display_name.set_text("{} ({})".format(charm_class.display_name, status_oneline)) if unit.is_horizon and unit.agent_state == "started": unit_w.display_name.set_text( "{} - Login: https://{}/horizon " "l:{} p:{}".format( charm_class.display_name, unit.public_address, "ubuntu", self.config.getopt("openstack_password") ) ) if unit.is_jujugui and unit.agent_state == "started": unit_w.display_name.set_text( "{} - Login: https://{}/ " "l:{} p:{}".format(charm_class.display_name, unit.public_address) )
def _build_node_columns(self, unit, charm_class): """ builds columns of node status """ node_cols = [] status_txt = "{:20}".format("[{}]".format(unit.agent_state)) # unit.agent_state may be "pending" despite errors elsewhere, # so we check for error_info first. # if the agent_state is "error", _detect_errors returns that. error_info = self._detect_errors(unit, charm_class) if error_info: status = Color.error_icon(Text("\N{TETRAGRAM FOR FAILURE} ")) if unit.agent_state != "error": status_txt = "{:20}".format("[{} (error)]" "".format(unit.agent_state)) elif unit.agent_state == "pending": pending_status = [ Color.pending_icon(Text("\N{CIRCLED BULLET} ")), Color.pending_icon(Text("\N{CIRCLED WHITE BULLET} ")), Color.pending_icon_on(Text("\N{FISHEYE} ")), ] status = random.choice(pending_status) elif unit.agent_state == "installed": status = Color.pending_icon(Text("\N{HOURGLASS} ")) elif unit.agent_state == "started": status = Color.success_icon(Text("\u2713 ")) elif unit.agent_state == "stopped": status = Color.error_icon(Text("\N{BLACK FLAG} ")) elif unit.agent_state == "down": status = Color.error_icon(Text("\N{DOWNWARDS BLACK ARROW} ")) else: # NOTE: Should not get here, if we do make sure we account # for that error type above. status = Color.error_icon(Text(unit.agent_state)) node_cols.append(("pack", status)) node_cols.append(("pack", Text(status_txt))) if unit.public_address: node_cols.append(("pack", Text("{0:<12}".format(unit.public_address)))) elif error_info: node_cols.append(("pack", Text("{:<12}".format("Error")))) else: node_cols.append(("pack", Text("{:<12}".format("IP Pending")))) if error_info: infos = [("pack", Text(" | {}".format(error_info)))] else: hw_text = Text([" | "] + self._get_hardware_info(unit)) if "glance-simplestreams-sync" in unit.unit_name: status_oneline = get_sync_status().replace("\n", " - ") sync_text = Text(" " + status_oneline) infos = [hw_text, sync_text] else: infos = [hw_text] if self.config.getopt("show_logs"): log_text = Text([("label", self.get_log_text(unit.unit_name))]) infos.append(log_text) node_cols.append(Pile(infos)) return Columns(node_cols)