def _build_widget(self, **kwargs): total_items = [] for _item in self.radio_items.keys(): desc = Color.string_input( Text(" {}".format( self.radio_items[_item][1])), focus_map='string_input focus') total_items.append( Color.string_input(self.radio_items[_item][0], focus_map='string_input focus')) total_items.append(AttrWrap(desc, 'input')) total_items.append(Divider('-')) self.input_lbox = ListBox(SimpleListWalker(total_items[:-1])) self.add_buttons() self.container_box_adapter = BoxAdapter(self.input_lbox, len(total_items)) self.container_lbox = ListBox( [self.container_box_adapter, Divider(), self.btn_pile]) return LineBox( BoxAdapter(self.container_lbox, height=len(total_items) + 3), title=self.title)
def __init__(self): self.text = Text(self.TITLE_TEXT) self.widget = Color.frame_header(self.text) w = [ Color.frame_header(self.widget), Color.frame_subheader(Text('(Q)uit', align='center')) ] super().__init__(Pile(w))
def __init__(self): w = [] w.append(Color.frame_header( Text("Ubuntu Openstack Installer - Software Installation"))) w.append(Color.frame_subheader(Text( '(Q)uit', align='center'))) w = Pile(w) super().__init__(w)
def _build_buttons(self): buttons = [ Color.button_primary(Button("Confirm", self.submit), focus_map='button_primary focus'), Color.button_secondary(Button("Cancel", self.cancel), focus_map='button_secondary focus') ] return Pile(buttons)
def __init__(self): help_text = [ Padding.line_break(""), Text("OpenStack Installer - Help \u21C5 Scroll (ESC) Close", align="center"), Divider('-', 1, 1), Text(""" For full documentation, please refer to http://openstack.astokes.org/guides """), Color.header_title(Text("Overview")), Divider('-'), Text(""" - Header The header shows a few common command keys for quick reference. - Main Table The main table has a row for each Juju service in the current environment, updated every ten seconds. Each row will contain a status icon indicator, agent state, ip address, machine type, and hardware specifications. There may also be an additional status field with information in the event of provisioning errors or additional status notifications. - Footer The footer displays a status message, and the URLs for the two web dashboards installed, one for OpenStack Horizon and the other for the Juju GUI. """), Color.header_title(Text("Command Reference")), Divider('-'), Text(""" - (R/F5) refreshes the displayed state immediately - (A/a/F6) brings up a dialog box for adding additional units. This is how to add compute units or a storage service. This dialog takes care of launching required dependencies, so for example, launching swift here will add a swift-proxy service and enough swift-storage nodes to meet the replica criterion (currently 3). - '(H/h/?)' displays this help screen. - 'q' quits. """), Color.header_title(Text("Troubleshooting")), Divider('-'), Text(""" The juju commands used to deploy the services listed are logged in ~/.cloud-install/commands.log Note: In a multi-install, MAAS may be unable to find machines that match the default constraints set for one of the services the installer deploys. This will be shown in the table under the service's heading, along with detail about what those constraints were. """)] w = Padding.center_79(SimpleList(help_text)) super().__init__(w)
def __init__(self): help_text = [ Padding.line_break(""), Text("OpenStack Installer - Help \u21C5 Scroll (ESC) Close", align="center"), Divider('-', 1, 1), Text("For full documentation, please refer to " "https://help.ubuntu.com/lts/clouddocs/installer/"), Color.header_title(Text("Overview")), Divider('-'), Text(""" - Header The header shows a few common command keys for quick reference. - Main Table The main table has a row for each Juju service in the current environment, updated every ten seconds. Each row will contain a status icon indicator, agent state, ip address, machine type, and hardware specifications. There may also be an additional status field with information in the event of provisioning errors or additional status notifications. - Footer The footer displays a status message, and the URLs for the two web dashboards installed, one for OpenStack Horizon and the other for the Juju GUI. """), Color.header_title(Text("Command Reference")), Divider('-'), Text(""" - (R/F5) refreshes the displayed state immediately - (A/a/F6) brings up a dialog box for adding additional units. This is how to add compute units or a storage service. This dialog takes care of launching required dependencies, so for example, launching swift here will add a swift-proxy service and enough swift-storage nodes to meet the replica criterion (currently 3). - '(H/h/?)' displays this help screen. - 'q' quits. """), Color.header_title(Text("Troubleshooting")), Divider('-'), Text(""" The juju commands used to deploy the services listed are logged in ~/.cloud-install/commands.log Note: In a multi-install, MAAS may be unable to find machines that match the default constraints set for one of the services the installer deploys. This will be shown in the table under the service's heading, along with detail about what those constraints were. """)] w = Padding.center_79(SimpleList(help_text)) super().__init__(w)
def __init__(self): self.text = Text(self.TITLE_TEXT) self.widget = Color.frame_header(self.text) w = [ Color.frame_header(self.widget), Color.frame_subheader(Text( '(Q)uit', align='center')) ] super().__init__(Pile(w))
def _build_buttons(self): buttons = [ Color.button_primary( Button("Confirm", self.submit), focus_map='button_primary focus'), Color.button_secondary( Button("Cancel", self.cancel), focus_map='button_secondary focus') ] return Pile(buttons)
def __init__(self): w = [] w.append( Color.frame_header( padding( Text("Ubuntu Openstack Installer - Software Installation")) )) w.append(Color.frame_subheader(Text('(Q)uit', align='center'))) w = Pile(w) super().__init__(w)
def _build_node_waiting(self): """ creates a loading screen if nodes do not exist yet """ text = [ Padding.line_break(""), Text(self.message, align="center"), Padding.line_break("") ] load_box = [ Color.pending_icon_on(Text("\u2581", align="center")), Color.pending_icon_on(Text("\u2582", align="center")), Color.pending_icon_on(Text("\u2583", align="center")), Color.pending_icon_on(Text("\u2584", align="center")), Color.pending_icon_on(Text("\u2585", align="center")), Color.pending_icon_on(Text("\u2586", align="center")), Color.pending_icon_on(Text("\u2587", align="center")), Color.pending_icon_on(Text("\u2588", align="center")) ] # Add loading boxes random.shuffle(load_box) loading_boxes = [] loading_boxes.append(('weight', 1, Text(''))) for i in load_box: loading_boxes.append( ('pack', load_box[random.randrange(len(load_box))])) loading_boxes.append(('weight', 1, Text(''))) loading_boxes = Columns(loading_boxes) return Filler(Pile(text + [loading_boxes]), valign="middle")
def _build_node_waiting(self): """ creates a loading screen if nodes do not exist yet """ text = [Padding.line_break(""), Text(self.message, align="center"), Padding.line_break("")] load_box = [ Color.pending_icon_on(Text("\u2581", align="center")), Color.pending_icon_on(Text("\u2582", align="center")), Color.pending_icon_on(Text("\u2583", align="center")), Color.pending_icon_on(Text("\u2584", align="center")), Color.pending_icon_on(Text("\u2585", align="center")), Color.pending_icon_on(Text("\u2586", align="center")), Color.pending_icon_on(Text("\u2587", align="center")), Color.pending_icon_on(Text("\u2588", align="center")), ] # Add loading boxes random.shuffle(load_box) loading_boxes = [] loading_boxes.append(("weight", 1, Text(""))) for i in load_box: loading_boxes.append(("pack", load_box[random.randrange(len(load_box))])) loading_boxes.append(("weight", 1, Text(""))) loading_boxes = Columns(loading_boxes) return Filler(Pile(text + [loading_boxes]), valign="middle")
def _build_widget(self, **kwargs): total_items = [ Padding.center_60(Text(self.title, align="center")), Padding.center_60( Divider("\N{BOX DRAWINGS LIGHT HORIZONTAL}", 1, 1)) ] if self.input_items: for item in self.input_items: key = item[0] caption = item[1] try: mask = item[2] except: mask = None self.input_selection[key] = StringEditor(caption="", mask=mask) col = Columns([ ("weight", 0.4, Text(caption, align="right")), Color.string_input(self.input_selection[key], focus_map="string_input focus") ]) total_items.append(Padding.center_60(col)) total_items.append( Padding.center_60( Divider("\N{BOX DRAWINGS LIGHT HORIZONTAL}", 1, 1))) total_items.append(Padding.center_20(self._build_buttons())) return Filler(Pile(total_items), valign='middle')
def _build_widget(self, **kwargs): total_items = [ Padding.center_60(Text(self.title, align="center")), Padding.center_60( Divider("\N{BOX DRAWINGS LIGHT HORIZONTAL}", 1, 1)) ] if self.input_items: for item in self.input_items: key = item[0] caption = item[1] try: mask = item[2] except: mask = None self.input_selection[key] = EditInput(caption="", mask=mask) col = Columns( [ ("weight", 0.4, Text(caption, align="right")), Color.string_input(self.input_selection[key], focus_map="string_input focus") ] ) total_items.append(Padding.center_60(col)) total_items.append( Padding.center_60( Divider("\N{BOX DRAWINGS LIGHT HORIZONTAL}", 1, 1))) total_items.append(Padding.center_20(self._build_buttons())) return Filler(Pile(total_items), valign='middle')
def _build_buttons(self): buttons = [ Color.button_secondary( cancel_btn(label="Quit", on_press=self.cancel), focus_map="button_secondary focus") ] return Pile(buttons)
def _build_buttons(self): buttons = [ Padding.line_break(""), Color.button_secondary(Button("Quit", self.cancel), focus_map='button_secondary focus'), ] return Pile(buttons)
def _build_buttons(self): buttons = [ Color.button_secondary(cancel_btn(label="Quit", on_press=self.cancel), focus_map="button_secondary focus") ] return Pile(buttons)
def _build_status_extra(self): return Color.frame_footer( Pile([ self._horizon_url, self._jujugui_url, self._openstack_rel, self._status_line ]))
def _build_buttons(self): buttons = [ Padding.line_break(""), Color.button_secondary( Button("Quit", self.cancel), focus_map='button_secondary focus'), ] return Pile(buttons)
def update(self): if self.show_add_units: add_unit_string = "(A)dd Services \N{BULLET}" else: add_unit_string = "" tw = Color.frame_subheader( Text(add_unit_string + " (H)elp \N{BULLET} " "(R)efresh \N{BULLET} (Q)uit", align="center") ) self.pile.contents[1] = (tw, self.pile.options())
def _build_status_extra(self): col = Columns([ ('weight', 0.3, self._horizon_url), ('weight', 0.3, self._jujugui_url), self._openstack_rel ], dividechars=1) return Color.frame_footer(Pile([ col, self._status_line ]))
def update(self): if self.show_add_units: add_unit_string = '(A)dd Services \N{BULLET}' else: add_unit_string = '' tw = Color.frame_subheader(Text(add_unit_string + ' (H)elp \N{BULLET} ' '(R)efresh \N{BULLET} (Q)uit', align='center')) self.pile.contents[1] = (tw, self.pile.options())
def update(self): if self.show_add_units: add_unit_string = '(A)dd Services \N{BULLET}' else: add_unit_string = '' tw = Color.frame_subheader( Text(add_unit_string + ' (H)elp \N{BULLET} ' '(R)efresh \N{BULLET} (Q)uit', align='center')) self.pile.contents[1] = (tw, self.pile.options())
def _build_widget(self, **kwargs): total_items = [] for _item in self.radio_items.keys(): desc = Color.string_input(Text(" {}".format( self.radio_items[_item][1])), focus_map='string_input focus') total_items.append( Color.string_input(self.radio_items[_item][0], focus_map='string_input focus')) total_items.append(AttrWrap(desc, 'input')) total_items.append(Divider('-')) self.input_lbox = ListBox(SimpleListWalker(total_items[:-1])) self.add_buttons() self.container_box_adapter = BoxAdapter(self.input_lbox, len(total_items)) self.container_lbox = ListBox( [self.container_box_adapter, Divider(), self.btn_pile]) return LineBox(BoxAdapter(self.container_lbox, height=len(total_items) + 3), title=self.title)
def _build_widget(self): total_items = [ Padding.center_60(Text(self.title, align="center")), Padding.center_60( Divider("\N{BOX DRAWINGS LIGHT HORIZONTAL}", 1, 1)) ] for item in self.radio_items.keys(): opt, desc = self.radio_items[item] col = Columns( [ ("weight", 0.4, opt), Color.body(Text(desc)) ], dividechars=1) total_items.append(Padding.center_60(col)) total_items.append( Padding.center_60( Divider("\N{BOX DRAWINGS LIGHT HORIZONTAL}", 1, 1))) total_items.append(Padding.center_20(self._build_buttons())) return Filler(Pile(total_items), valign='middle')
def _build_widget(self, **kwargs): total_items = [] for _item in self.input_items.keys(): total_items.append( Color.string_input(self.input_items[_item], focus_map='string_input focus')) self.input_lbox = ListBox(SimpleListWalker(total_items)) # Add buttons self.add_buttons() self.container_box_adapter = BoxAdapter(self.input_lbox, len(total_items)) self.container_lbox = ListBox( [self.container_box_adapter, Divider(), self.btn_pile]) return LineBox(BoxAdapter(self.container_lbox, height=len(total_items) + 1 + len(self.btn_pile.contents)), title=self.title)
def __init__(self, error): log.debug("showing error view for: {}".format(error)) bug_url = ("https://github.com/Ubuntu-Solutions-Engineering" "/openstack-installer/issues/new") body = [ Padding.center_60( Text("Oops, there was a problem with your install:", align="center")), Padding.center_95( Divider("\N{BOX DRAWINGS LIGHT HORIZONTAL}", 1, 1)), Padding.center_85(Text("Reason:")), Padding.center_80(Color.error_major(Text(error))), Padding.line_break(""), Padding.center_85( Text("Please file a bug with the above output and of " "~/.cloud-install/*.log at {}".format(bug_url))), Padding.line_break(""), Padding.center_95( Divider("\N{BOX DRAWINGS LIGHT HORIZONTAL}", 1, 1)), Padding.center_20(self._build_buttons()) ] super().__init__(Filler(Pile(body), valign="middle"))
def _build_widget(self, **kwargs): total_items = [] for _item in self.input_items.keys(): total_items.append(Color.string_input( self.input_items[_item], focus_map='string_input focus')) self.input_lbox = ListBox(SimpleListWalker(total_items)) # Add buttons self.add_buttons() self.container_box_adapter = BoxAdapter(self.input_lbox, len(total_items)) self.container_lbox = ListBox( [self.container_box_adapter, Divider(), self.btn_pile]) return LineBox( BoxAdapter(self.container_lbox, height=len(total_items) + 1 + len(self.btn_pile.contents)), title=self.title)
def __init__(self): self.title_widget = Color.frame_header(padding(Text(TITLE_TEXT))) self.pile = Pile([self.title_widget, Text("")]) self.set_show_add_units_hotkey(False) super().__init__(self.pile)
def _build_status_extra(self): return Color.frame_footer( Pile([ self._status_line ]))
def __init__(self): self.text = Text(self.TITLE_TEXT) self.widget = Color.frame_header(self.text) self.pile = Pile([self.widget, Text("")]) self.set_show_add_units_hotkey(False) super().__init__(self.pile)
def __init__(self, caption, **kwargs): self._edit = Edit(caption=caption, **kwargs) super().__init__( Color.string_input(self._edit, focus_map="string_input focus"))
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)
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)
def _build_status_extra(self): status = [] status.append(Pile([self._horizon_url, self._jujugui_url])) status.append(('pack', self._openstack_rel)) return Color.frame_footer(Columns(status))
def __init__(self, caption, **kwargs): self._edit = Edit(caption=caption, **kwargs) super().__init__(Color.string_input(self._edit, focus_map="string_input focus"))
def __init__(self): self.title_widget = Color.frame_header( Padding.center_96(Text(TITLE_TEXT))) self.pile = Pile([self.title_widget, Text("")]) self.set_show_add_units_hotkey(False) super().__init__(self.pile)
def _build_status_extra(self): return Color.frame_footer(Pile([self._status_line]))
def __init__(self): self.text = [] self.HELP_TEXT = [ """For full documentation, please refer to http://ubuntu-cloud-installer.readthedocs.org/en/latest/ """, ('header_title', "Overview"), """ - Header The header shows a few common command keys for quick reference. - Main Table The main table has a row for each Juju service in the current environment. It is updated every ten seconds. Each row will contain a status icon indicator, agent state, ip address, machine type, and hardware specifications. There may also be an additional status field with information in the event of provisioning errors or additional status notifications. - Footer The footer displays a status message, and the URLs for the two web dashboards installed, one for OpenStack Horizon and the other for the Juju GUI. """, ('header_title', "Command Reference"), """ - (R/F5) refreshes the displayed state immediately - (A/a/F6) brings up a dialog box for adding additional units. This is how to add compute units or a storage service. This dialog takes care of launching required dependencies, so for example, launching swift here will add a swift-proxy service and enough swift-storage nodes to meet the replica criterion (currently 3). - '(H/h/?)' displays this help screen. - 'q' quits. """, ('header_title', "Troubleshooting"), """ The juju commands used to deploy the services listed are logged in ~/.cloud-install/commands.log * In a multi-install, MAAS may be unable to find machines that match the default constraints set for one of the services the installer deploys. This will be shown in the table under the service's heading, along with detail about what those constraints were. """, ('header_title', "End of Help Screen")] w = self._create_text() w = Color.dialog(w) super().__init__(w)
def add(self, key, heading): self.columns[key] = Pile([Color.column_header(Text(heading))])