Exemple #1
0
    def get_networks(self):
        '''Build a summary of the networks in the install_profile,
        returned as a list of strings

        '''
        network_summary = []

        # hostname belongs to 'identity' group
        if configure_group(SC_GROUP_IDENTITY):
            network_summary.append(_("  Computer name: %s") %
                                   self.sysconfig.system.hostname)

        if not configure_group(SC_GROUP_NETWORK):
            return network_summary

        nic = self.sysconfig.nic
        if nic.type == NetworkInfo.AUTOMATIC:
            network_summary.append(_("  Network Configuration: Automatic"))
        elif nic.type == NetworkInfo.NONE:
            network_summary.append(_("  Network Configuration: None"))
        elif nic.type == NetworkInfo.FROMGZ:
            network_summary.append(_("  Network Configuration:"
                                     " Mandated from global zone"))
        elif nic.type == NetworkInfo.MANUAL:
            network_summary.append(_("  Manual Configuration: %s")
                                   % NetworkInfo.get_nic_desc(nic.nic_iface))
            network_summary.append(_("IP Address: %s") % nic.ip_address)
            network_summary.append(_("Netmask: %s") % nic.netmask)
            if nic.gateway:
                network_summary.append(_("Router: %s") % nic.gateway)
        return network_summary
    def get_networks(self):
        '''Build a summary of the networks in the install_profile,
        returned as a list of strings

        '''
        network_summary = []

        # hostname belongs to 'identity' group
        if configure_group(SC_GROUP_IDENTITY):
            network_summary.append(_("  Computer name: %s") %
                                   self.sysconfig.system.hostname)

        if not configure_group(SC_GROUP_NETWORK):
            return network_summary

        nic = self.sysconfig.nic       
        if nic.type == NetworkInfo.AUTOMATIC:
            network_summary.append(_("  Network Configuration: Automatic"))
        elif nic.type == NetworkInfo.NONE:
            network_summary.append(_("  Network Configuration: None"))
        elif nic.type == NetworkInfo.FROMGZ:
            network_summary.append(_("  Network Configuration:"
                                     " Mandated from global zone"))
        elif nic.type == NetworkInfo.MANUAL:
            network_summary.append(_("  Manual Configuration: %s")
                                   % NetworkInfo.get_nic_desc(nic.nic_iface))
            network_summary.append(_("IP Address: %s") % nic.ip_address)
            network_summary.append(_("Netmask: %s") % nic.netmask)
            if nic.gateway:
                network_summary.append(_("Router: %s") % nic.gateway)
        return network_summary
Exemple #3
0
    def build_summary(self):
        '''Build a textual summary from solaris_install.sysconfig profile'''

        if self.sysconfig is None:
            return ""
        else:
            summary_text = []

            # display summary only for configured areas
            # locale and timezone belong to SC_GROUP_LOCATION group
            if configure_group(SC_GROUP_LOCATION):
                summary_text.append(self.get_tz_summary())

                summary_text.append("")
                summary_text.append(_("Language: *The following can be changed"
                                      " when logging in."))
                if self.sysconfig.system.locale is None:
                    self.sysconfig.system.determine_locale()
                summary_text.append(_("  Default language: %s") %
                                    self.sysconfig.system.actual_lang)

            # keyboard layout belongs to SC_GROUP_KBD group
            if configure_group(SC_GROUP_KBD):
                summary_text.append("")
                summary_text.append(_("Keyboard layout: *The following can be "
                                      "changed when logging in."))
                summary_text.append(_("  Default keyboard layout: %s") %
                                    self.sysconfig.system.keyboard)
                summary_text.append("")

            if hasattr(self.sysconfig.system, 'terminal_type'):
                summary_text.append(_("Terminal type: %s") %
                                    self.sysconfig.system.terminal_type)

            # user/root accounts belong to SC_GROUP_USERS group
            if configure_group(SC_GROUP_USERS):
                summary_text.append("")
                summary_text.append(_("Users:"))
                summary_text.extend(self.get_users())

            # network belongs to SC_GROUP_IDENTITY and SC_GROUP_NETWORK groups
            if configure_group(SC_GROUP_NETWORK) or \
               configure_group(SC_GROUP_IDENTITY):
                summary_text.append("")
                summary_text.append(_("Network:"))
                summary_text.extend(self.get_networks())
            if configure_group(SC_GROUP_NS):
                self._get_nameservice(summary_text)

            # support configuration
            if configure_group(SC_GROUP_SUPPORT):
                summary_text.append("")
                summary_text.append(_("Support configuration:"))
                summary_text.extend(self.get_support())

            return "\n".join(summary_text)
    def build_summary(self):
        '''Build a textual summary from solaris_install.sysconfig profile'''

        if self.sysconfig is None:
            return ""
        else:
            summary_text = []
        
            # display summary only for configured areas
            # locale and timezone belong to SC_GROUP_LOCATION group
            if configure_group(SC_GROUP_LOCATION):
                summary_text.append(self.get_tz_summary())

                summary_text.append("")
                summary_text.append(_("Language: *The following can be changed"
                                      " when logging in."))
                if self.sysconfig.system.locale is None:
                    self.sysconfig.system.determine_locale()
                summary_text.append(_("  Default language: %s") %
                                    self.sysconfig.system.actual_lang)

            # keyboard layout belongs to SC_GROUP_KBD group
            if configure_group(SC_GROUP_KBD):
                summary_text.append("")
                summary_text.append(_("Keyboard layout: *The following can be "
                                      "changed when logging in."))
                summary_text.append(_("  Default keyboard layout: %s") %
                                    self.sysconfig.system.keyboard)
                summary_text.append("")

            if hasattr(self.sysconfig.system, 'terminal_type'):
                summary_text.append(_("Terminal type: %s") %
                                    self.sysconfig.system.terminal_type)

            # user/root accounts belong to SC_GROUP_USERS group
            if configure_group(SC_GROUP_USERS):
                summary_text.append("")
                summary_text.append(_("Users:"))
                summary_text.extend(self.get_users())

            # network belongs to SC_GROUP_IDENTITY and SC_GROUP_NETWORK groups
            if configure_group(SC_GROUP_NETWORK) or \
               configure_group(SC_GROUP_IDENTITY):
                summary_text.append("")
                summary_text.append(_("Network:"))
                summary_text.extend(self.get_networks())
            if configure_group(SC_GROUP_NS):
                self._get_nameservice(summary_text)
        
            return "\n".join(summary_text)
Exemple #5
0
 def _show(self):
     '''Display the static paragraph WELCOME_TEXT and all
        applicable bullet items'''
     sc_options = get_sc_options_from_doc()
     max_width = self.win_size_x - WelcomeScreen.INDENT - 1
     text = convert_paragraph(WelcomeScreen.WELCOME_TEXT, max_width)
     # list configuration groups in a comma-separated list with
     # bullet on first line and indentation on subsequent lines
     grouplist = list()
     if configure_group(SC_GROUP_NETWORK):
         grouplist.append(_("network"))
     elif configure_group(SC_GROUP_IDENTITY):
         grouplist.append(_("system hostname"))
     if configure_group(SC_GROUP_LOCATION):
         grouplist.append(_("time zone"))
     if configure_group(SC_GROUP_DATETIME):
         grouplist.append(_("date and time"))
     if configure_group(SC_GROUP_USERS):
         grouplist.append(_("user and root accounts"))
     if configure_group(SC_GROUP_NS):
         grouplist.append(_("name services"))
     grouplist = ", ".join(grouplist)
     grouplist = convert_paragraph(grouplist,
                                   max_width - len(WelcomeScreen.BULLET))
     for ln in range(len(grouplist)):
         if ln == 0:
             text.append(WelcomeScreen.BULLET + grouplist[ln])
         else:
             text.append(WelcomeScreen.BULLET_INDENT + grouplist[ln])
     # display navigation instructions and profile path
     fmt = {"scprof": sc_options.profile}
     text.extend(convert_paragraph(WelcomeScreen.NAVIPRO_TEXT % fmt,
                                   max_width))
     # indent and align while bulletting
     for bullet in WelcomeScreen.BULLET_ITEMS:
         btext = convert_paragraph(bullet,
                                   max_width - len(WelcomeScreen.BULLET))
         for ln in range(len(btext)):
             if ln == 0:
                 text.append(WelcomeScreen.BULLET + btext[ln])
             else:
                 text.append(WelcomeScreen.BULLET_INDENT + btext[ln])
     # prepare welcome text in entire window for scrolling
     area = WindowArea(x_loc=0, y_loc=1, scrollable_lines=(len(text) + 1))
     area.lines = self.win_size_y - 1
     area.columns = self.win_size_x
     scroll_region = ScrollWindow(area, window=self.center_win)
     scroll_region.add_paragraph(text, start_x=WelcomeScreen.INDENT)
     self.center_win.activate_object(scroll_region)
 def _show(self):
     '''Display the static paragraph WELCOME_TEXT and all
        applicable bullet items'''
     sc_options = get_sc_options_from_doc()
     max_width = self.win_size_x - WelcomeScreen.INDENT - 1
     text = convert_paragraph(WelcomeScreen.WELCOME_TEXT, max_width)
     # list configuration groups in a comma-separated list with
     # bullet on first line and indentation on subsequent lines
     grouplist = list()
     if configure_group(SC_GROUP_NETWORK):
         grouplist.append(_("network"))
     elif configure_group(SC_GROUP_IDENTITY):
         grouplist.append(_("system hostname"))
     if configure_group(SC_GROUP_LOCATION):
         grouplist.append(_("time zone"))
     if configure_group(SC_GROUP_DATETIME):
         grouplist.append(_("date and time"))
     if configure_group(SC_GROUP_USERS):
         grouplist.append(_("user and root accounts"))
     if configure_group(SC_GROUP_NS):
         grouplist.append(_("name services"))
     grouplist = ", ".join(grouplist)
     grouplist = convert_paragraph(grouplist,
                                   max_width - len(WelcomeScreen.BULLET))
     for ln in range(len(grouplist)):
         if ln == 0:
             text.append(WelcomeScreen.BULLET + grouplist[ln])
         else:
             text.append(WelcomeScreen.BULLET_INDENT + grouplist[ln])
     # display navigation instructions and profile path
     fmt = {"scprof": sc_options.profile}
     text.extend(convert_paragraph(WelcomeScreen.NAVIPRO_TEXT % fmt,
                                   max_width))
     # indent and align while bulletting
     for bullet in WelcomeScreen.BULLET_ITEMS:
         btext = convert_paragraph(bullet,
                                   max_width - len(WelcomeScreen.BULLET))
         for ln in range(len(btext)):
             if ln == 0:
                 text.append(WelcomeScreen.BULLET + btext[ln])
             else:
                 text.append(WelcomeScreen.BULLET_INDENT + btext[ln])
     # prepare welcome text in entire window for scrolling
     area = WindowArea(x_loc=0, y_loc=1, scrollable_lines=(len(text) + 1))
     area.lines = self.win_size_y - 1
     area.columns = self.win_size_x
     scroll_region = ScrollWindow(area, window=self.center_win)
     scroll_region.add_paragraph(text, start_x=WelcomeScreen.INDENT)
     self.center_win.activate_object(scroll_region)
 def _show(self):
     ''' called upon display of a screen '''
     sc_profile = solaris_install.sysconfig.profile.from_engine()
     LOGGER.debug(sc_profile)
     # Skip naming services screens if user either wants automatic
     # networking configuration or no networking at all.
     if configure_group(SC_GROUP_NETWORK) and \
        (sc_profile.nic.type == NetworkInfo.AUTOMATIC or
         sc_profile.nic.type == NetworkInfo.NONE):
         raise SkipException
     if sc_profile.nameservice is None:
         # first time, assign sysconfig values to defaults found above
         LOGGER.debug('assigning NSV to sysconfig.profile')
         sc_profile.nameservice = NameServiceInfo()
         if hasattr(sc_profile, 'nic') and sc_profile.nic:
             nic = sc_profile.nic
             LOGGER.info("Found NIC:")
             LOGGER.info(nic)
             # if values were learned from the NIC, offer those as defaults
             if nic.domain:
                 sc_profile.nameservice.dns_search.append(nic.domain)
             if nic.dns_address:
                 sc_profile.nameservice.dns_server = nic.dns_address
     self.nameservice = sc_profile.nameservice