Exemplo n.º 1
0
    def _customization(self):
        if self.environment[odockerccons.ConfigEnv.DOCKERC_CINDER] is None:
            self.environment[
                odockerccons.ConfigEnv.DOCKERC_CINDER] = dialog.queryBoolean(
                    dialog=self.dialog,
                    name='OVESETUP_CONFIG_DOCKERC_CINDER',
                    note=_('Deploy Cinder container on this host '
                           '(@VALUES@) [@DEFAULT@]: '),
                    prompt=True,
                    default=True,
                )
        if self.environment[odockerccons.ConfigEnv.DOCKERC_GLANCE] is None:
            self.environment[
                odockerccons.ConfigEnv.DOCKERC_GLANCE] = dialog.queryBoolean(
                    dialog=self.dialog,
                    name='OVESETUP_CONFIG_DOCKERC_GLANCE',
                    note=_('Deploy Glance container on this host '
                           '(@VALUES@) [@DEFAULT@]: '),
                    prompt=True,
                    default=True,
                )
        self._enabled = self.environment[
            odockerccons.ConfigEnv.DOCKERC_CINDER] or self.environment[
                odockerccons.ConfigEnv.DOCKERC_GLANCE]

        tag = ':' + self.environment[odockerccons.ConfigEnv.DOCKERC_CTAG]

        self._dimages = [{
            'image': odockerccons.Const.C_IMAGE_RABBITMQ + tag,
            'name': odockerccons.Const.C_NAME_RABBITMQ
        }, {
            'image': odockerccons.Const.C_IMAGE_MARIADBDATA + tag,
            'name': odockerccons.Const.C_NAME_MARIADBDATA
        }, {
            'image': odockerccons.Const.C_IMAGE_MARIADBAPP + tag,
            'name': odockerccons.Const.C_NAME_MARIADBAPP
        }, {
            'image': odockerccons.Const.C_IMAGE_KEYSTONE + tag,
            'name': odockerccons.Const.C_NAME_KEYSTONE
        }]

        if self.environment[odockerccons.ConfigEnv.DOCKERC_CINDER]:
            self._dimages.append({
                'image': odockerccons.Const.C_IMAGE_CINDER + tag,
                'name': odockerccons.Const.C_NAME_CINDER
            })

        if self.environment[odockerccons.ConfigEnv.DOCKERC_GLANCE]:
            self._dimages.extend([
                {
                    'image': odockerccons.Const.C_IMAGE_GLANCE_REG + tag,
                    'name': odockerccons.Const.C_NAME_GLANCE_REG
                },
                {
                    'image': odockerccons.Const.C_IMAGE_GLANCE_API + tag,
                    'name': odockerccons.Const.C_NAME_GLANCE_API
                },
            ])
        if self._enabled:
            self.environment[odockerccons.ConfigEnv.DOCKERC_NEEDED] = True
Exemplo n.º 2
0
    def _customization_upgrade(self):
        if True in [
                self._expired(
                    self._x509_load_cert(oenginecons.FileLocations.
                                         OVIRT_ENGINE_PKI_ENGINE_CA_CERT))
        ] + [
                self._ok_to_renew_cert(
                    os.path.join(
                        oenginecons.FileLocations.OVIRT_ENGINE_PKIKEYSDIR,
                        '%s.p12' % entry['name']), entry['name'],
                    entry['extract'])
                for entry in self.environment[oenginecons.PKIEnv.ENTITIES]
        ]:
            if self.environment[oenginecons.PKIEnv.RENEW] is None:
                self.environment[
                    oenginecons.PKIEnv.RENEW] = dialog.queryBoolean(
                        dialog=self.dialog,
                        name='OVESETUP_RENEW_PKI',
                        note=
                        _('One or more of the certificates should be renewed, '
                          'because they expire soon, or include an invalid '
                          'expiry date, or do not include the subjectAltName '
                          'extension, which can cause them to be rejected by '
                          'recent browsers and up to date hosts.\n'
                          'See {url} for more details.\n'
                          'Renew certificates? '
                          '(@VALUES@) [@DEFAULT@]: ').format(
                              url=self.environment[oenginecons.ConfigEnv.
                                                   PKI_RENEWAL_DOC_URL], ),
                        prompt=True,
                        default=None,
                    )

                if not self.environment[oenginecons.PKIEnv.RENEW]:
                    skip_renewal = dialog.queryBoolean(
                        dialog=self.dialog,
                        name='OVESETUP_SKIP_RENEW_PKI_CONFIRM',
                        note=_(
                            'Are you really sure that you want to skip the '
                            'PKI renewal process?\n'
                            'Please notice that recent openssl and gnutls '
                            'upgrades can lead hosts refusing this CA cert '
                            'making them unusable.\n'
                            'If you choose "Yes", setup will continue and you '
                            'will be asked again the next '
                            'time you run this Setup. Otherwise, this process '
                            'will abort and you will be expected to plan a '
                            'proper upgrade according to {url}.\n'
                            'Skip PKI renewal process? '
                            '(@VALUES@) [@DEFAULT@]: ').format(
                                url=self.environment[oenginecons.ConfigEnv.
                                                     PKI_RENEWAL_DOC_URL], ),
                        prompt=True,
                        default=False,
                    )
                    if not skip_renewal:
                        raise RuntimeError('Aborted by user')
Exemplo n.º 3
0
    def _customization(self):
        if self.environment[
            oengcommcons.ProvisioningEnv.POSTGRES_PROVISIONING_ENABLED
        ] is None:
            local = dialog.queryBoolean(
                dialog=self.dialog,
                name='OVESETUP_PROVISIONING_POSTGRES_LOCATION',
                note=_(
                    'Where is the Engine database located? '
                    '(@VALUES@) [@DEFAULT@]: '
                ),
                prompt=True,
                true=_('Local'),
                false=_('Remote'),
                default=True,
            )
            if local:
                self.environment[oenginecons.EngineDBEnv.HOST] = 'localhost'
                self.environment[
                    oenginecons.EngineDBEnv.PORT
                ] = oenginecons.Defaults.DEFAULT_DB_PORT

                # TODO:
                # consider creating database and role
                # at engine_@RANDOM@
                self.environment[
                    oengcommcons.ProvisioningEnv.POSTGRES_PROVISIONING_ENABLED
                ] = dialog.queryBoolean(
                    dialog=self.dialog,
                    name='OVESETUP_PROVISIONING_POSTGRES_ENABLED',
                    note=_(
                        'Setup can configure the local postgresql server '
                        'automatically for the engine to run. This may '
                        'conflict with existing applications.\n'
                        'Would you like Setup to automatically configure '
                        'postgresql and create Engine database, '
                        'or prefer to perform that '
                        'manually? (@VALUES@) [@DEFAULT@]: '
                    ),
                    prompt=True,
                    true=_('Automatic'),
                    false=_('Manual'),
                    default=True,
                )

            else:
                self.environment[
                    oengcommcons.ProvisioningEnv.POSTGRES_PROVISIONING_ENABLED
                ] = False

        self._enabled = self.environment[
            oengcommcons.ProvisioningEnv.POSTGRES_PROVISIONING_ENABLED
        ]
        if self._enabled:
            self._provisioning.applyEnvironment()
Exemplo n.º 4
0
    def _customization(self):
        enabled = self.environment[
            odwhcons.ProvisioningEnv.POSTGRES_PROVISIONING_ENABLED
        ]

        if not self.environment[odwhcons.CoreEnv.ENABLE]:
            enabled = False

        if enabled is None:
            local = dialog.queryBoolean(
                dialog=self.dialog,
                name='OVESETUP_DWH_PROVISIONING_POSTGRES_LOCATION',
                note=_(
                    'Where is the DWH database located? '
                    '(@VALUES@) [@DEFAULT@]: '
                ),
                prompt=True,
                true=_('Local'),
                false=_('Remote'),
                default=True,
            )
            if local:
                self.environment[odwhcons.DBEnv.HOST] = 'localhost'
                self.environment[
                    odwhcons.DBEnv.PORT
                ] = odwhcons.Defaults.DEFAULT_DB_PORT

                enabled = dialog.queryBoolean(
                    dialog=self.dialog,
                    name='OVESETUP_DWH_PROVISIONING_POSTGRES_ENABLED',
                    note=_(
                        'Setup can configure the local postgresql server '
                        'automatically for the DWH to run. This may '
                        'conflict with existing applications.\n'
                        'Would you like Setup to automatically configure '
                        'postgresql and create DWH database, '
                        'or prefer to perform that '
                        'manually? (@VALUES@) [@DEFAULT@]: '
                    ),
                    prompt=True,
                    true=_('Automatic'),
                    false=_('Manual'),
                    default=True,
                )

        if enabled:
            self._provisioning.applyEnvironment()

        self.environment[
            odwhcons.ProvisioningEnv.POSTGRES_PROVISIONING_ENABLED
        ] = self._enabled = enabled
Exemplo n.º 5
0
    def _validation(self):
        if (
            self.services.exists(
                name=oenginecons.Const.ENGINE_SERVICE_NAME
            ) and self.services.status(
                name=oenginecons.Const.ENGINE_SERVICE_NAME
            )
        ):
            if self.environment[
                oenginecons.CoreEnv.ENGINE_SERVICE_STOP
            ] is None:
                self.environment[
                    oenginecons.CoreEnv.ENGINE_SERVICE_STOP
                ] = dialog.queryBoolean(
                    dialog=self.dialog,
                    name='OVESETUP_CORE_ENGINE_STOP',
                    note=_(
                        'During execution engine service will be stopped '
                        '(@VALUES@) [@DEFAULT@]: '
                    ),
                    prompt=True,
                    true=_('OK'),
                    false=_('Cancel'),
                    default=True,
                )

            if not self.environment[oenginecons.CoreEnv.ENGINE_SERVICE_STOP]:
                raise RuntimeError(
                    _('Engine service is running, no approval to stop')
                )
Exemplo n.º 6
0
    def _customization(self):
        if self.environment[
            oengcommcons.ApacheEnv.CONFIGURE_ROOT_REDIRECTION
        ] is None:
            self.dialog.note(
                _(
                    'Setup can configure the default page of the '
                    'web server to present the application home page. '
                    'This may conflict with existing applications.'
                )
            )
            self.environment[
                oengcommcons.ApacheEnv.CONFIGURE_ROOT_REDIRECTION
            ] = dialog.queryBoolean(
                dialog=self.dialog,
                name='OVESETUP_APACHE_CONFIG_ROOT_REDIRECTION',
                note=_(
                    'Do you wish to set the application as the default page '
                    'of the web server? (@VALUES@) [@DEFAULT@]: '
                ),
                prompt=True,
                default=self.environment[
                    oengcommcons.ApacheEnv.CONFIGURE_ROOT_REDIRECTIOND_DEFAULT
                ],
            )

        self._enabled = self.environment[
            oengcommcons.ApacheEnv.CONFIGURE_ROOT_REDIRECTION
        ]
Exemplo n.º 7
0
    def _customization(self):
        """
        If the application mode is gluster don't ask to configure NFS.
        Else if not already configured, ask if you want to use NFS shares for
        ISO domain. If acknowledged, configure NFS related services.
        """
        if self.environment[osetupcons.ConfigEnv.APPLICATION_MODE] == "gluster":
            self.logger.info(_("NFS configuration skipped with application mode Gluster"))
            self._enabled = False
        else:
            enabled = self.environment[oenginecons.SystemEnv.NFS_CONFIG_ENABLED]
            if enabled is None:
                self._enabled = dialog.queryBoolean(
                    dialog=self.dialog,
                    name="NFS_CONFIG_ENABLED",
                    note=_(
                        "Configure an NFS share on this server to be used "
                        "as an ISO Domain? "
                        "(@VALUES@) [@DEFAULT@]: "
                    ),
                    prompt=True,
                    default=False,
                )
            else:
                self._enabled = enabled

        # expose to other modules
        self.environment[oenginecons.SystemEnv.NFS_CONFIG_ENABLED] = self._enabled
Exemplo n.º 8
0
    def _customization(self):
        if self.environment[
            osetupcons.RemoveEnv.REMOVE_ALL
        ]:
            self.environment[
                odwhcons.RemoveEnv.REMOVE_DATABASE
            ] = True

        if self.environment[
            odwhcons.RemoveEnv.REMOVE_DATABASE
        ] is None:
            self.environment[
                odwhcons.RemoveEnv.REMOVE_DATABASE
            ] = dialog.queryBoolean(
                dialog=self.dialog,
                name='OVESETUP_DWH_REMOVE_DATABASE',
                note=_(
                    'Do you want to remove DWH DB content? All data will '
                    'be lost (@VALUES@) [@DEFAULT@]: '
                ),
                prompt=True,
                true=_('Yes'),
                false=_('No'),
                default=False,
            )
        if self.environment[odwhcons.RemoveEnv.REMOVE_DATABASE]:
            self.environment[odwhcons.ConfigEnv.DWH_SERVICE_STOP_NEEDED] = True
Exemplo n.º 9
0
    def _customization(self):

        if self.services.status(name=odockerccons.Const.DOCKER_SERVICE_NANE, ):
            self.logger.info(_('Found a running docker daemon'))
        else:
            self.logger.info(_('Unable to find an active docker daemon'))
            if self.environment[odockerccons.ConfigEnv.DOCKERC_DAEMON] is None:
                self.environment[
                    odockerccons.ConfigEnv.
                    DOCKERC_DAEMON] = dialog.queryBoolean(
                        dialog=self.dialog,
                        name='OVESETUP_CONFIG_DOCKERC_DAEMON',
                        note=_(
                            'To continue with this setup the docker daemon '
                            'should be active.\n'
                            'Would you like to start it and continue with Setup? '
                            '(@VALUES@) [@DEFAULT@]: '),
                        prompt=True,
                        default=True,
                    )
            if self.environment[odockerccons.ConfigEnv.DOCKERC_DAEMON]:
                self.logger.info(_('Starting Docker'))
                self.services.state(
                    name=odockerccons.Const.DOCKER_SERVICE_NANE,
                    state=True,
                )
            else:
                raise RuntimeError(
                    _('Docker daemon is required to complete this setup'))
Exemplo n.º 10
0
    def _customization(self):
        if self.environment[
            oengcommcons.ApacheEnv.CONFIGURE_ROOT_REDIRECTION
        ] is None:
            self.dialog.note(
                _(
                    'Setup can configure the default page of the '
                    'web server to present the application home page. '
                    'This may conflict with existing applications.'
                )
            )
            self.environment[
                oengcommcons.ApacheEnv.CONFIGURE_ROOT_REDIRECTION
            ] = dialog.queryBoolean(
                dialog=self.dialog,
                name='OVESETUP_APACHE_CONFIG_ROOT_REDIRECTION',
                note=_(
                    'Do you wish to set the application as the default page '
                    'of the web server? (@VALUES@) [@DEFAULT@]: '
                ),
                prompt=True,
                default=self.environment[
                    oengcommcons.ApacheEnv.CONFIGURE_ROOT_REDIRECTIOND_DEFAULT
                ],
            )

        self._enabled = self.environment[
            oengcommcons.ApacheEnv.CONFIGURE_ROOT_REDIRECTION
        ]
Exemplo n.º 11
0
    def _validation(self):
        if self.environment[osetupcons.CoreEnv.REMOVE] is None:
            if self.environment[osetupcons.RemoveEnv.REMOVE_ALL]:
                cnote = _(
                    'All the installed ovirt components are about to be '
                    'removed, data will be lost (@VALUES@) [@DEFAULT@]: ')
            elif (self.environment[osetupcons.RemoveEnv.REMOVE_OPTIONS]
                  or self.environment[osetupcons.RemoveEnv.REMOVE_GROUPS]):
                cnote = _(
                    'The following components are about to be removed, data '
                    'will be lost:\n'
                    '{clist}'
                    '(@VALUES@) [@DEFAULT@]: ').format(clist=', '.join(
                        self.environment[osetupcons.RemoveEnv.REMOVE_OPTIONS] +
                        [
                            x.strip() for x in self.environment[
                                osetupcons.RemoveEnv.REMOVE_GROUPS].split(',')
                            if x
                        ]))
            else:
                raise RuntimeError(_('Nothing to remove'))

            self.environment[osetupcons.CoreEnv.REMOVE] = dialog.queryBoolean(
                dialog=self.dialog,
                name='OVESETUP_CORE_REMOVE',
                note=cnote,
                prompt=True,
                true=_('OK'),
                false=_('Cancel'),
                default=False,
            )

        if not self.environment[osetupcons.CoreEnv.REMOVE]:
            raise RuntimeError(_('Aborted by user'))
Exemplo n.º 12
0
 def _askUserToWaitForTasks(
     self,
     runningTasks,
     runningCommands,
     compensations,
 ):
     self.dialog.note(
         text=_('The following system tasks have been '
                'found running in the system:\n'
                '{tasks}').format(tasks='\n'.join(runningTasks), ))
     self.dialog.note(
         text=_('The following commands have been '
                'found running in the system:\n'
                '{commands}').format(commands='\n'.join(runningCommands), ))
     self.dialog.note(text=_('The following compensations have been '
                             'found running in the system:\n'
                             '{compensations}').format(
                                 compensations='\n'.join(compensations), ))
     if not dialog.queryBoolean(
             dialog=self.dialog,
             name='OVESETUP_WAIT_RUNNING_TASKS',
             note=_('Would you like to try to wait for that?\n'
                    '(Answering "no" will stop the upgrade (@VALUES@) '),
             prompt=True,
     ):
         raise RuntimeError(
             _('Upgrade cannot be completed; asynchronious tasks or '
               'commands or compensations are still running. Please '
               'make sure that there are no running tasks before you '
               'continue.'))
Exemplo n.º 13
0
 def _customization(self):
     if self.environment[
         osetupcons.RemoveEnv.REMOVE_ALL
     ] is None:
         self.environment[
             osetupcons.RemoveEnv.REMOVE_ALL
         ] = dialog.queryBoolean(
             dialog=self.dialog,
             name='OVESETUP_REMOVE_ALL',
             note=_(
                 'Do you want to remove all components? '
                 '(@VALUES@) [@DEFAULT@]: '
             ),
             prompt=True,
             true=_('Yes'),
             false=_('No'),
             default=True,
         )
         if not self.environment[osetupcons.RemoveEnv.REMOVE_ALL]:
             self.logger.warn(_('Partial cleanup is not supported'))
             self.dialog.note(_(
                 'You will now be prompted for components to be removed, '
                 'but regardless of which ones you choose, the engine will '
                 'not be functional. Some parts of the configuration are '
                 'removed unconditionally. If unsure, stop this utility.'
             ))
Exemplo n.º 14
0
    def _validate_hosted_engine(self):
        # Prevent upgrade to 3.6 if we are running as a self-hosted-engine
        # and we have el6 hosts.
        have_el6_hosts = self._have_el6_hosted_engine_host()

        if self.environment[
            oenginecons.EngineDBEnv.UPGRADE_WITH_HE_EL6_HOSTS
        ] is None and have_el6_hosts:
            self.dialog.note(
                text=_(
                    'It seems like this engine is self-hosted, '
                    'and the operating system of some of its hosts is '
                    'el6 or a variant. Please upgrade the hosts to el7 '
                    'before upgrading the engine to 3.6.\n'
                    'Please check the log file for more details.\n'
                ),
            )
            self.environment[
                oenginecons.EngineDBEnv.UPGRADE_WITH_HE_EL6_HOSTS
            ] = dialog.queryBoolean(
                dialog=self.dialog,
                name='OVESETUP_PREVENT_HE_EL6_HOSTS',
                note=_(
                    'Replying "No" will abort Setup.\n'
                    'Continue? '
                    '(@VALUES@) [@DEFAULT@]: '
                ),
                prompt=True,
                default=False,
            )

        if not self.environment[
            oenginecons.EngineDBEnv.UPGRADE_WITH_HE_EL6_HOSTS
        ] and have_el6_hosts:
            raise RuntimeError(_('self hosted engine uses el6 hosts'))
Exemplo n.º 15
0
 def _query_install_ovn(self):
     return dialog.queryBoolean(dialog=self.dialog,
                                name='ovirt-provider-ovn',
                                note=_('Configure ovirt-provider-ovn '
                                       '(@VALUES@) [@DEFAULT@]: '),
                                prompt=True,
                                default=True)
Exemplo n.º 16
0
 def _customization(self):
     if self.environment[oenginecons.CoreEnv.ENABLE]:
         if self.environment[
             ovmpcons.ConfigEnv.VMCONSOLE_PROXY_CONFIG
         ] is None:
             self.environment[
                 ovmpcons.ConfigEnv.VMCONSOLE_PROXY_CONFIG
             ] = dialog.queryBoolean(
                 dialog=self.dialog,
                 name='OVESETUP_CONFIG_VMCONSOLE_PROXY',
                 note=_(
                     'Configure VM Console Proxy on this host '
                     '(@VALUES@) [@DEFAULT@]: '
                 ),
                 prompt=True,
                 default=True,
             )
         if self.environment[
             ovmpcons.ConfigEnv.VMCONSOLE_PROXY_CONFIG
         ]:
             self.environment[
                 ovmpcons.ConfigEnv.VMCONSOLE_PROXY_STOP_NEEDED
             ] = True
     else:
         self.logger.info(_(
             'Deploying VM Console Proxy on a separate '
             'host is not supported'
         ))
         self.environment[ovmpcons.ConfigEnv.VMCONSOLE_PROXY_CONFIG] = False
Exemplo n.º 17
0
    def _validation(self):
        self.logger.info(_('Checking the Engine database consistency'))
        violations, issues_found = self._checkDb()
        if issues_found:
            if self.environment[
                    oenginecons.EngineDBEnv.FIX_DB_VIOLATIONS] is None:
                self.logger.warn(
                    _('The following inconsistencies were found '
                      'in Engine database: {violations}. ').format(
                          violations=violations, ), )
                self.environment[
                    oenginecons.EngineDBEnv.
                    FIX_DB_VIOLATIONS] = dialog.queryBoolean(
                        dialog=self.dialog,
                        name='OVESETUP_FIX_DB_VALIDATIONS',
                        note=_('Would you like to automatically clear '
                               'inconsistencies before upgraing?\n'
                               '(Answering no will stop the upgrade): '),
                        prompt=True,
                    )

            if not self.environment[oenginecons.EngineDBEnv.FIX_DB_VIOLATIONS]:
                raise RuntimeError(
                    _('Upgrade aborted, database integrity '
                      'cannot be established.'))
Exemplo n.º 18
0
 def _customization(self):
     if self.environment[odwhcons.CoreEnv.ENABLE] is None:
         if self.environment[oenginecons.CoreEnv.ENABLE]:
             self.dialog.note(
                 text=_(
                     '\n* Please note * : Data Warehouse is required for '
                     'the engine.\n'
                     'If you choose to not configure it on this host, you '
                     'have to configure\n'
                     'it on a remote host, and then configure the engine '
                     'on this host so\n'
                     'that it can access the database of the remote Data '
                     'Warehouse host.'
                 )
             )
         self.environment[
             odwhcons.CoreEnv.ENABLE
         ] = dialog.queryBoolean(
             dialog=self.dialog,
             name='OVESETUP_DWH_ENABLE',
             note=_(
                 'Configure Data Warehouse on this host '
                 '(@VALUES@) [@DEFAULT@]: '
             ),
             prompt=True,
             default=True,
         )
     if self.environment[odwhcons.CoreEnv.ENABLE]:
         self.environment[odwhcons.ConfigEnv.DWH_SERVICE_STOP_NEEDED] = True
Exemplo n.º 19
0
    def _customization_is_requested(self):
        self._detected_managers = [
            m
            for m in self.environment[osetupcons.ConfigEnv.FIREWALL_MANAGERS]
            if m.selectable() and m.detect()
        ]

        if self.environment[
            osetupcons.ConfigEnv.UPDATE_FIREWALL
        ] is None:
            if not self._detected_managers:
                self.environment[osetupcons.ConfigEnv.UPDATE_FIREWALL] = False
            else:
                self.dialog.note(
                    text=_(
                        'Setup can automatically configure the firewall '
                        'on this system.\n'
                        'Note: automatic configuration of the firewall may '
                        'overwrite current settings.\n'
                    ),
                )
                self.environment[
                    osetupcons.ConfigEnv.UPDATE_FIREWALL
                ] = dialog.queryBoolean(
                    dialog=self.dialog,
                    name='OVESETUP_UPDATE_FIREWALL',
                    note=_(
                        'Do you want Setup to configure the firewall? '
                        '(@VALUES@) [@DEFAULT@]: '
                    ),
                    prompt=True,
                    true=_('Yes'),
                    false=_('No'),
                    default=True,
                )
Exemplo n.º 20
0
    def _customization(self):
        if self.environment[osetupcons.RemoveEnv.REMOVE_ALL]:
            self.environment[owspcons.RemoveEnv.REMOVE_WSP] = True

        if self.environment[owspcons.RemoveEnv.REMOVE_WSP] is None:
            self.environment[
                owspcons.RemoveEnv.REMOVE_WSP
            ] = dialog.queryBoolean(
                dialog=self.dialog,
                name='OVESETUP_REMOVE_WEBSOCKET_PROXY',
                note=_(
                    'Do you want to remove the WebSocket proxy? '
                    '(@VALUES@) [@DEFAULT@]: '
                ),
                prompt=True,
                true=_('Yes'),
                false=_('No'),
                default=False,
            )

        if self.environment[owspcons.RemoveEnv.REMOVE_WSP]:
            self.environment[osetupcons.RemoveEnv.REMOVE_OPTIONS].append(
                owspcons.Const.WEBSOCKET_PROXY_PACKAGE_NAME
            )
            self.environment[
                owspcons.ConfigEnv.WEBSOCKET_PROXY_STOP_NEEDED
            ] = True
Exemplo n.º 21
0
 def _validation(self):
     config = configfile.ConfigFile(
         (oenginecons.FileLocations.OVIRT_ENGINE_NOTIFIER_SERVICE_CONFIG,
          ), )
     filterStr = config.get('FILTER')
     self.logger.debug('filterStr: %s', filterStr)
     if filterStr is not None and 'VDS_GROUP' in filterStr:
         ans = dialog.queryBoolean(
             dialog=self.dialog,
             name='OVESETUP_WAIT_NOTIFIER_FILTER',
             note=_(
                 'Setup found filter/s in engine-notifier configuration '
                 'files in {conf}.d/*.conf containing the string '
                 '"VDS_GROUP".\n You must manually change "VDS_GROUP" to '
                 '"CLUSTER" throughout the notifier configuration in '
                 'order to get notified on cluster related events.\n Do '
                 'you want to continue?\n'
                 '(Answering "no" will stop the upgrade '
                 '(@VALUES@) [@DEFAULT@]:').format(
                     conf=(oenginecons.FileLocations.
                           OVIRT_ENGINE_NOTIFIER_SERVICE_CONFIG), ),
             prompt=True,
             default=False,
         )
         self.environment[
             oenginecons.ConfigEnv.IGNORE_VDS_GROUP_IN_NOTIFIER] = ans
         if not ans:
             raise RuntimeError(_('Aborted by user'))
Exemplo n.º 22
0
    def _customization(self):
        """
        If the application mode is gluster don't ask to configure NFS.
        Else if not already configured, ask if you want to use NFS shares for
        ISO domain. If acknowledged, configure NFS related services.
        """
        if self.environment[
                osetupcons.ConfigEnv.APPLICATION_MODE] == 'gluster':
            self.logger.info(
                _('NFS configuration skipped with application mode Gluster'))
            self._enabled = False
        else:
            enabled = self.environment[
                oenginecons.SystemEnv.NFS_CONFIG_ENABLED]
            if enabled is None:
                self._enabled = dialog.queryBoolean(
                    dialog=self.dialog,
                    name='NFS_CONFIG_ENABLED',
                    note=_('Configure an NFS share on this server to be used '
                           'as an ISO Domain? '
                           '(@VALUES@) [@DEFAULT@]: '),
                    prompt=True,
                    default=False,
                )
            else:
                self._enabled = enabled

        # expose to other modules
        self.environment[
            oenginecons.SystemEnv.NFS_CONFIG_ENABLED] = self._enabled
 def _setup(self):
     self.command.detect('sudo')
     self.command.detect('qemu-img')
     if self.environment[ohostedcons.CoreEnv.UPGRADING_APPLIANCE]:
         self._appliance_rpm_name = ohostedcons.Const.APPLIANCE40_RPM_NAME
     self.logger.info(_('Detecting available oVirt engine appliances'))
     self._detect_appliances()
     if not self._appliances:
         self.dialog.note(
             _('The engine appliance is now required to deploy '
               'hosted-engine.\n'
               'You could get it installing '
               '{appliance_rpm_name} rpm\n'
               'or provide a path to OVF archive at the '
               '\'VM Configuration\' stage.').format(
                   appliance_rpm_name=self._appliance_rpm_name, ))
         if self.environment[ohostedcons.VMEnv.
                             ACCEPT_DOWNLOAD_EAPPLIANCE_RPM] is not None:
             self._install_appliance = self.environment[
                 ohostedcons.VMEnv.ACCEPT_DOWNLOAD_EAPPLIANCE_RPM]
         else:
             self._install_appliance = dialog.queryBoolean(
                 dialog=self.dialog,
                 name='OVEHOSTED_INSTALL_OVIRT_ENGINE_APPLIANCE',
                 note=_('Do you want to install {appliance_rpm_name} rpm? '
                        '(@VALUES@) [@DEFAULT@]: ').format(
                            appliance_rpm_name=self._appliance_rpm_name, ),
                 prompt=True,
                 default=True,
             )
Exemplo n.º 24
0
 def _validation(self):
     config = configfile.ConfigFile(
         (
             oenginecons.FileLocations.OVIRT_ENGINE_NOTIFIER_SERVICE_CONFIG,
         ),
     )
     filterStr = config.get('FILTER')
     self.logger.debug('filterStr: %s', filterStr)
     if filterStr is not None and 'VDS_GROUP' in filterStr:
         ans = dialog.queryBoolean(
             dialog=self.dialog,
             name='OVESETUP_WAIT_NOTIFIER_FILTER',
             note=_(
                 'Setup found filter/s in engine-notifier configuration '
                 'files in {conf}.d/*.conf containing the string '
                 '"VDS_GROUP".\n You must manually change "VDS_GROUP" to '
                 '"CLUSTER" throughout the notifier configuration in '
                 'order to get notified on cluster related events.\n Do '
                 'you want to continue?\n'
                 '(Answering "no" will stop the upgrade '
                 '(@VALUES@) [@DEFAULT@]:'
             ).format(
                 conf=(
                     oenginecons.FileLocations.
                     OVIRT_ENGINE_NOTIFIER_SERVICE_CONFIG
                 ),
             ),
             prompt=True,
             default=False,
         )
         self.environment[
             oenginecons.ConfigEnv.IGNORE_VDS_GROUP_IN_NOTIFIER
         ] = ans
         if not ans:
             raise RuntimeError(_('Aborted by user'))
Exemplo n.º 25
0
    def _customization(self):
        if self.environment[
            osetupcons.RemoveEnv.REMOVE_ALL
        ]:
            self.environment[
                oreportscons.RemoveEnv.REMOVE_DATABASE
            ] = True

        if self.environment[
            oreportscons.RemoveEnv.REMOVE_DATABASE
        ] is None:
            self.environment[
                oreportscons.RemoveEnv.REMOVE_DATABASE
            ] = dialog.queryBoolean(
                dialog=self.dialog,
                name='OVESETUP_REPORTS_REMOVE_DATABASE',
                note=_(
                    'Do you want to remove Reports DB content? All data will '
                    'be lost (@VALUES@) [@DEFAULT@]: '
                ),
                prompt=True,
                true=_('Yes'),
                false=_('No'),
                default=False,
            )
        if self.environment[oreportscons.RemoveEnv.REMOVE_DATABASE]:
            self.environment[
                oreportscons.ConfigEnv.REPORTS_SERVICE_STOP_NEEDED
            ] = True
Exemplo n.º 26
0
    def _customization(self):
        if self.environment[
                oenginecons.EngineDBEnv.ENGINE_VACUUM_FULL] is not None:
            return

        self.environment[
            oenginecons.EngineDBEnv.ENGINE_VACUUM_FULL] = dialog.queryBoolean(
                dialog=self.dialog,
                name='ENGINE_VACUUM_FULL',
                # TODO try to supply some estimation on the amount
                # of space we will need to read/write/remove if possible.
                # some projects like check_postgres may supply that report
                # already. See https://github.com/bucardo/check_postgres
                note=_(
                    'Perform full vacuum on the engine database {db}@{host}?'
                    '\nThis operation may take a while'
                    ' depending on this setup health and the'
                    '\nconfiguration of the db vacuum process.'
                    '\nSee'
                    ' https://www.postgresql.org/docs/10/sql-vacuum.html'
                    '\n(@VALUES@) [@DEFAULT@]: ').format(
                        db=self.environment[oenginecons.EngineDBEnv.DATABASE],
                        host=self.environment[oenginecons.EngineDBEnv.HOST],
                    ),
                prompt=True,
                default=False)
Exemplo n.º 27
0
    def _customization(self):
        if not self.environment[oenginecons.CoreEnv.ENABLE]:
            self.logger.info(_(
                'Configuration of Image I/O Proxy is only allowed on the same'
                'machine as the oVirt Engine, not asking about this'
            ))
            return

        if self.environment[
            oipcons.ConfigEnv.IMAGEIO_PROXY_CONFIG
        ] is None:
            self.environment[
                oipcons.ConfigEnv.IMAGEIO_PROXY_CONFIG
            ] = dialog.queryBoolean(
                dialog=self.dialog,
                name='OVESETUP_CONFIG_IMAGEIO_PROXY',
                note=_(
                    'Configure Image I/O Proxy on this host '
                    '(@VALUES@) [@DEFAULT@]: '
                ),
                prompt=True,
                default=True,
            )
        self._enabled = self.environment[
            oipcons.ConfigEnv.IMAGEIO_PROXY_CONFIG
        ]
        if self._enabled:
            self.environment[
                oipcons.ConfigEnv.IMAGEIO_PROXY_STOP_NEEDED
            ] = True
Exemplo n.º 28
0
    def _customization_is_requested(self):
        self._detected_managers = [
            m for m in self.environment[osetupcons.ConfigEnv.FIREWALL_MANAGERS]
            if m.selectable() and m.detect()
        ]

        if self.environment[osetupcons.ConfigEnv.UPDATE_FIREWALL] is None:
            if not self._detected_managers:
                self.environment[osetupcons.ConfigEnv.UPDATE_FIREWALL] = False
            else:
                self.dialog.note(text=_(
                    'Setup can automatically configure the firewall '
                    'on this system.\n'
                    'Note: automatic configuration of the firewall may '
                    'overwrite current settings.\n'), )
                self.environment[
                    osetupcons.ConfigEnv.
                    UPDATE_FIREWALL] = dialog.queryBoolean(
                        dialog=self.dialog,
                        name='OVESETUP_UPDATE_FIREWALL',
                        note=_('Do you want Setup to configure the firewall? '
                               '(@VALUES@) [@DEFAULT@]: '),
                        prompt=True,
                        true=_('Yes'),
                        false=_('No'),
                        default=True,
                    )
Exemplo n.º 29
0
    def _customization(self):
        if self.environment[oengcommcons.ApacheEnv.CONFIGURE_SSL] is None:
            self.dialog.note(
                _('Setup can configure apache to use SSL using a '
                  'certificate issued from the internal CA.'))
            self.environment[
                oengcommcons.ApacheEnv.CONFIGURE_SSL] = dialog.queryBoolean(
                    dialog=self.dialog,
                    name='OVESETUP_APACHE_CONFIG_SSL',
                    note=_('Do you wish Setup to configure that, or prefer to '
                           'perform that manually? (@VALUES@) [@DEFAULT@]: '),
                    prompt=True,
                    true=_('Automatic'),
                    false=_('Manual'),
                    default=True,
                )

        self._enabled = self.environment[oengcommcons.ApacheEnv.CONFIGURE_SSL]

        if self._enabled:
            if not self._file_exists:
                self.logger.warning(
                    _("Automatic Apache SSL configuration was requested. "
                      "However, SSL configuration file '{file}' was not "
                      "found. Disabling automatic Apache SSL configuration."))
                self._enabled = False
Exemplo n.º 30
0
 def _customization_upgrade(self):
     if True in [
             self._expired(
                 self._x509_load_cert(oenginecons.FileLocations.
                                      OVIRT_ENGINE_PKI_ENGINE_CA_CERT))
     ] + [
             self._ok_to_renew_cert(
                 os.path.join(
                     oenginecons.FileLocations.OVIRT_ENGINE_PKIKEYSDIR,
                     '%s.p12' % entry['name']), entry['name'],
                 entry['extract'])
             for entry in self.environment[oenginecons.PKIEnv.ENTITIES]
     ]:
         if self.environment[oenginecons.PKIEnv.RENEW] is None:
             self.environment[oenginecons.PKIEnv.RENEW] = dialog.queryBoolean(
                 dialog=self.dialog,
                 name='OVESETUP_RENEW_PKI',
                 note=_(
                     'One or more of the certificates should be renewed, '
                     'because they expire soon, or include an invalid '
                     'expiry date, or do not include the subjectAltName '
                     'extension, which can cause them to be rejected by '
                     'recent browsers.\n'
                     'If you choose "No", you will be asked again the next '
                     'time you run Setup.\n'
                     'See {url} for more details.\n'
                     'Renew certificates? '
                     '(@VALUES@) [@DEFAULT@]: ').format(
                         url=self.environment[
                             oenginecons.ConfigEnv.PKI_RENEWAL_DOC_URL], ),
                 prompt=True,
                 default=None,
             )
Exemplo n.º 31
0
    def _validation(self):
        self._content = (
            "# ovirt-engine configuration.\n"
            "kernel.shmmax = %s\n"
        ) % self.environment[oengcommcons.SystemEnv.SHMMAX]

        interactive = self.environment[osetupcons.CoreEnv.DEVELOPER_MODE]

        while True:
            shmmax = self._get_shmmax()

            if shmmax >= self.environment[oengcommcons.SystemEnv.SHMMAX]:
                break
            else:
                self.logger.debug(
                    'sysctl shared memory is %s lower than %s' % (
                        shmmax,
                        self.environment[oengcommcons.SystemEnv.SHMMAX],
                    )
                )

                if not interactive:
                    self._enabled = True
                    break
                else:
                    self.logger.warning(_('Manual intervention is required'))
                    self.dialog.note(
                        text=_(
                            "Current shared memory setting is too low.\n"
                            "Unable to set while running unprivileged.\n"
                            "Please write the following file: '{file}', "
                            "with the following content:\n"
                            "---\n"
                            "{content}"
                            "---\n"
                            "Then execute the following command as root:\n"
                            "{sysctl} -p {file}"
                        ).format(
                            file=(
                                oengcommcons.FileLocations.OVIRT_ENGINE_SYSCTL
                            ),
                            content=self._content,
                            sysctl=self.command.get('sysctl'),
                        )
                    )

                    if not dialog.queryBoolean(
                        dialog=self.dialog,
                        name='OVESETUP_SYSTEM_SYSCTL_SHMEM',
                        note=_(
                            'Proceed? (@VALUES@) [@DEFAULT@]: '
                        ),
                        prompt=True,
                        true=_('OK'),
                        false=_('Cancel'),
                        default=True,
                    ):
                        raise RuntimeError(
                            _('Aborted by user')
                        )
Exemplo n.º 32
0
    def _customization(self):
        if self.environment[osetupcons.RemoveEnv.REMOVE_ALL]:
            self.environment[owspcons.RemoveEnv.REMOVE_WSP] = True

        if self.environment[owspcons.RemoveEnv.REMOVE_WSP] is None:
            self.environment[
                owspcons.RemoveEnv.REMOVE_WSP
            ] = dialog.queryBoolean(
                dialog=self.dialog,
                name='OVESETUP_REMOVE_WEBSOCKET_PROXY',
                note=_(
                    'Do you want to remove the WebSocket proxy? '
                    '(@VALUES@) [@DEFAULT@]: '
                ),
                prompt=True,
                true=_('Yes'),
                false=_('No'),
                default=False,
            )

        if self.environment[owspcons.RemoveEnv.REMOVE_WSP]:
            self.environment[osetupcons.RemoveEnv.REMOVE_OPTIONS].append(
                owspcons.Const.WEBSOCKET_PROXY_PACKAGE_NAME
            )
            self.environment[
                owspcons.ConfigEnv.WEBSOCKET_PROXY_STOP_NEEDED
            ] = True
Exemplo n.º 33
0
    def _customization(self):
        self.dialog.note(
            text=_('\n--== CONFIGURATION PREVIEW ==--\n\n'),
        )
        shown = set()
        for c in sum(
            [
                constobj.__dict__['__osetup_attrs__']
                for constobj in self.environment[
                    osetupcons.CoreEnv.SETUP_ATTRS_MODULES
                ]
            ],
            [],
        ):
            for k in c.__dict__.values():
                if hasattr(k, '__osetup_attrs__'):
                    attrs = k.__osetup_attrs__
                    if (
                        attrs['summary'] and
                        attrs['summary_condition'](self.environment)
                    ):
                        env = k.fget(None)
                        value = self.environment.get(env)
                        if value is not None and env not in shown:
                            shown.add(env)
                            self.dialog.note(
                                text=_('{key:40}: {value}').format(
                                    key=(
                                        attrs['description']
                                        if attrs['description'] is not None
                                        else env
                                    ),
                                    value=value,
                                ),
                            )

        confirmed = self.environment[
            osetupcons.DialogEnv.CONFIRM_SETTINGS
        ]
        if confirmed is None:
            confirmed = dialog.queryBoolean(
                dialog=self.dialog,
                name='OVESETUP_DIALOG_CONFIRM_SETTINGS',
                note=_(
                    '\n'
                    'Please confirm installation settings '
                    '(@VALUES@) [@DEFAULT@]: '
                ),
                prompt=True,
                true=_('OK'),
                false=_('Cancel'),
                default=True,
            )

        if not confirmed:
            raise RuntimeError(_('Configuration was rejected by user'))

        self.environment[
            osetupcons.DialogEnv.CONFIRM_SETTINGS
        ] = True
Exemplo n.º 34
0
    def _customization(self):
        if self.environment[
            osetupcons.RemoveEnv.REMOVE_ALL
        ]:
            self.environment[
                oreportscons.RemoveEnv.REMOVE_JASPER_ARTIFACTS
            ] = True

        if self.environment[
            oreportscons.RemoveEnv.REMOVE_JASPER_ARTIFACTS
        ] is None:
            self.environment[
                oreportscons.RemoveEnv.REMOVE_JASPER_ARTIFACTS
            ] = dialog.queryBoolean(
                dialog=self.dialog,
                name='OVESETUP_REPORTS_REMOVE_JASPER_ARTIFACTS',
                note=_(
                    'Do you want to remove Reports Jasper artifacts? '
                    '(@VALUES@) [@DEFAULT@]: '
                ),
                prompt=True,
                true=_('Yes'),
                false=_('No'),
                default=False,
            )
Exemplo n.º 35
0
 def _check_existing_pki(self):
     pki_files_to_check = (
         oenginecons.FileLocations.OVIRT_ENGINE_PKI_ENGINE_SSH_KEY,
         oenginecons.FileLocations.OVIRT_ENGINE_PKI_ENGINE_STORE,
         oenginecons.FileLocations.OVIRT_ENGINE_PKI_ENGINE_TRUST_STORE,
     )
     if True in [os.path.exists(f) for f in pki_files_to_check]:
         ans = dialog.queryBoolean(
             dialog=self.dialog,
             name='OVESETUP_PKI_VERIFY_MISSING_CA_PEM',
             note=_(
                 'Found existing PKI files, but {capem} is missing. If '
                 'you continue, Setup will overwrite existing PKI files '
                 'with new ones, including {capem}. After Setup completes '
                 'you must reinstall or re-enroll certificates for all '
                 'your hosts.\n\n'
                 'If {capem} was accidentally deleted, stop Setup, restore '
                 '{capem} from backup ({certs}/ca.der), and then run '
                 'Setup again.\n\n'
                 'Continue with Setup and overwrite existing PKI files? '
                 '(@VALUES@) [@DEFAULT@]: ').format(
                     capem=(oenginecons.FileLocations.
                            OVIRT_ENGINE_PKI_ENGINE_CA_CERT),
                     certs=(oenginecons.FileLocations.
                            OVIRT_ENGINE_PKICERTSDIR),
                 ),
             prompt=True,
             default=False,
         )
         if not ans:
             raise RuntimeError('Aborted by user')
Exemplo n.º 36
0
 def _query_default_credentials(self, user):
     return dialog.queryBoolean(
         dialog=self.dialog,
         name='ovirt-provider-ovn-default-credentials',
         note=_('Use default credentials (%s) for '
                'ovirt-provider-ovn (@VALUES@) [@DEFAULT@]: ' % user),
         prompt=True,
         default=True)
Exemplo n.º 37
0
    def _init(self):

        self.environment.setdefault(
            osetupcons.CoreEnv.GENERATED_BY_VERSION,
            None
        )

        self.environment[
            osetupcons.CoreEnv.ORIGINAL_GENERATED_BY_VERSION
        ] = self.environment[
            osetupcons.CoreEnv.GENERATED_BY_VERSION
        ]

        self.environment[
            osetupcons.CoreEnv.GENERATED_BY_VERSION
        ] = osetupcons.Const.PACKAGE_VERSION

        self.environment.setdefault(
            osetupcons.CoreEnv.DEVELOPER_MODE,
            None
        )
        self.environment.setdefault(
            osetupcons.CoreEnv.UPGRADE_SUPPORTED_VERSIONS,
            '4.1,4.2,4.3'
        )

        self.logger.debug(
            'Package: %s-%s (%s)',
            osetupcons.Const.PACKAGE_NAME,
            osetupcons.Const.PACKAGE_VERSION,
            osetupcons.Const.DISPLAY_VERSION,
        )

        if self.environment[osetupcons.CoreEnv.DEVELOPER_MODE] is None:
            self.environment[osetupcons.CoreEnv.DEVELOPER_MODE] = False
            if os.geteuid() != 0:
                if not dialog.queryBoolean(
                    dialog=self.dialog,
                    name='OVESETUP_SYSTEM_UNPRIVILEGED',
                    note=_(
                        'Setup was run under unprivileged user '
                        'this will produce development installation '
                        'do you wish to proceed? (@VALUES@) [@DEFAULT@]: '
                    ),
                    prompt=True,
                    default=False,
                ):
                    raise RuntimeError(_('Aborted by user'))
                self.environment[osetupcons.CoreEnv.DEVELOPER_MODE] = True

        if (
            not self.environment[osetupcons.CoreEnv.DEVELOPER_MODE] and
            os.geteuid() != 0
        ):
            raise RuntimeError(
                _('Running as non root and not in development mode')
            )
Exemplo n.º 38
0
 def _check_upgrade_versions(self):
     supported = True
     if not self._e_version:
         self.logger.warning(_('Unable to detect engine version'))
         supported = False
     else:
         if (self._e_version
                 not in ohostedcons.Const.UPGRADE_SUPPORTED_SOURCES):
             supported = False
     if not self.environment[ohostedcons.VMEnv.APPLIANCE_VERSION]:
         self.logger.warning(_('Unable to detect appliance version'))
         supported = False
     else:
         a_version = '.'.join(
             self.environment[ohostedcons.VMEnv.APPLIANCE_VERSION].split(
                 '-')[0].split('.')[:2])
         if a_version not in ohostedcons.Const.UPGRADE_SUPPORTED_TARGETS:
             supported = False
     if not supported:
         self.logger.warning(_('Unsupported upgrade path'))
         self.dialog.note(
             _('This procedure has been designed and tested only for '
               'upgrading the engine VM from {sources} to {targets}.\n'
               'Any other usage is highly experimental and potentially '
               'dangerous:\n'
               '  Current engine: {e_version}\n'
               '  Selected appliance: {a_version}').format(
                   sources=ohostedcons.Const.UPGRADE_SUPPORTED_SOURCES,
                   targets=ohostedcons.Const.UPGRADE_SUPPORTED_TARGETS,
                   e_version=self._e_version
                   if self._e_version else _('unknown'),
                   a_version=self.environment[
                       ohostedcons.VMEnv.APPLIANCE_VERSION]
                   if self.environment[ohostedcons.VMEnv.APPLIANCE_VERSION]
                   else _('unknown'),
               ))
         if self.environment[ohostedcons.Upgrade.
                             UPGRADE_ABORT_ON_UNSUPPORTED_VER] is None:
             self.environment[
                 ohostedcons.Upgrade.
                 UPGRADE_ABORT_ON_UNSUPPORTED_VER] = dialog.queryBoolean(
                     dialog=self.dialog,
                     name='UPGRADE_ABORT_ON_UNSUPPORTED_VER',
                     note=_('Do you want to abort the upgrade process? '
                            '(@VALUES@) [@DEFAULT@]: '),
                     prompt=True,
                     default=True,
                 )
         if self.environment[
                 ohostedcons.Upgrade.UPGRADE_ABORT_ON_UNSUPPORTED_VER]:
             raise RuntimeError(
                 _('Upgrade aborted due to unsupported version'))
         else:
             self.logger.warning(
                 _('Proceeding on an unsupported and highly experimental path'
                   ))
Exemplo n.º 39
0
 def _query_install_ovn(self):
     return dialog.queryBoolean(
         dialog=self.dialog,
         name='ovirt-provider-ovn',
         note=_('Configure ovirt-provider-ovn and set the Default '
                'cluster\'s default network provider to ovirt-provider-ovn '
                '(non-Default clusters may be configured with an OVN '
                'provider after installation) (@VALUES@) [@DEFAULT@]: '),
         prompt=True,
         default=True)
Exemplo n.º 40
0
    def _customization(self):
        enabled = self.environment[
            odwhcons.ProvisioningEnv.POSTGRES_PROVISIONING_ENABLED]

        if not self.environment[odwhcons.CoreEnv.ENABLE]:
            enabled = False

        if enabled is None:
            local = dialog.queryBoolean(
                dialog=self.dialog,
                name='OVESETUP_DWH_PROVISIONING_POSTGRES_LOCATION',
                note=_('Where is the DWH database located? '
                       '(@VALUES@) [@DEFAULT@]: '),
                prompt=True,
                true=_('Local'),
                false=_('Remote'),
                default=True,
            )
            if local:
                self.environment[odwhcons.DBEnv.HOST] = 'localhost'
                self.environment[
                    odwhcons.DBEnv.PORT] = odwhcons.Defaults.DEFAULT_DB_PORT

                enabled = dialog.queryBoolean(
                    dialog=self.dialog,
                    name='OVESETUP_DWH_PROVISIONING_POSTGRES_ENABLED',
                    note=_('Setup can configure the local postgresql server '
                           'automatically for the DWH to run. This may '
                           'conflict with existing applications.\n'
                           'Would you like Setup to automatically configure '
                           'postgresql and create DWH database, '
                           'or prefer to perform that '
                           'manually? (@VALUES@) [@DEFAULT@]: '),
                    prompt=True,
                    true=_('Automatic'),
                    false=_('Manual'),
                    default=True,
                )

        self.environment[
            odwhcons.ProvisioningEnv.
            POSTGRES_PROVISIONING_ENABLED] = self._enabled = enabled
Exemplo n.º 41
0
    def _customization(self):
        enabled = self.environment[oreportscons.ProvisioningEnv.POSTGRES_PROVISIONING_ENABLED]

        if not self.environment[oreportscons.CoreEnv.ENABLE]:
            enabled = False

        if enabled is None:
            local = dialog.queryBoolean(
                dialog=self.dialog,
                name="OVESETUP_REPORTS_PROVISIONING_POSTGRES_LOCATION",
                note=_("Where is the Reports database located? " "(@VALUES@) [@DEFAULT@]: "),
                prompt=True,
                true=_("Local"),
                false=_("Remote"),
                default=True,
            )
            if local:
                self.environment[oreportscons.DBEnv.HOST] = "localhost"
                self.environment[oreportscons.DBEnv.PORT] = oreportscons.Defaults.DEFAULT_DB_PORT

                enabled = dialog.queryBoolean(
                    dialog=self.dialog,
                    name="OVESETUP_REPORTS_PROVISIONING_POSTGRES_ENABLED",
                    note=_(
                        "Setup can configure the local postgresql server "
                        "automatically for the Reports to run. This may "
                        "conflict with existing applications.\n"
                        "Would you like Setup to automatically configure "
                        "postgresql and create Reports database, "
                        "or prefer to perform that "
                        "manually? (@VALUES@) [@DEFAULT@]: "
                    ),
                    prompt=True,
                    true=_("Automatic"),
                    false=_("Manual"),
                    default=True,
                )

        if enabled:
            self._provisioning.applyEnvironment()

        self.environment[oreportscons.ProvisioningEnv.POSTGRES_PROVISIONING_ENABLED] = self._enabled = enabled
Exemplo n.º 42
0
    def _customization(self):
        if self.environment[
            oreportscons.ConfigEnv.ADMIN_PASSWORD
        ] is None:
            valid = False
            password = None
            while not valid:
                password = self.dialog.queryString(
                    name='OVESETUP_REPORTS_CONFIG_JASPER_ADMIN_PASSWORD',
                    note=_('Reports power users password: '******'OVESETUP_REPOTS_CONFIG_JASPER_ADMIN_PASSWORD',
                    note=_('Confirm Reports power users password: '******'Passwords do not match'))
                else:
                    try:
                        import cracklib
                        cracklib.FascistCheck(password)
                        valid = True
                    except ImportError:
                        # do not force this optional feature
                        self.logger.debug(
                            'cannot import cracklib',
                            exc_info=True,
                        )
                        valid = True
                    except ValueError as e:
                        self.logger.warning(
                            _('Password is weak: {error}').format(
                                error=e,
                            )
                        )
                        valid = dialog.queryBoolean(
                            dialog=self.dialog,
                            name=(
                                'OVESETUP_REPORTS_CONFIG_WEAK_JASPER_PASSWORD'
                            ),
                            note=_(
                                'Use weak password? '
                                '(@VALUES@) [@DEFAULT@]: '
                            ),
                            prompt=True,
                            default=False,
                        )

            self.environment[oreportscons.ConfigEnv.ADMIN_PASSWORD] = password
Exemplo n.º 43
0
 def _customization_already_configured(self):
     self._enabled = dialog.queryBoolean(
         dialog=self.dialog,
         name='OVESETUP_APACHE_RECONFIG_SSL',
         note=_('Apache httpd SSL was already configured in the past, '
                'but some needed changes are missing there.\n'
                'Configure again? (@VALUES@) [@DEFAULT@]: '),
         prompt=True,
         true=_('Yes'),
         false=_('No'),
         default=True,
     )
Exemplo n.º 44
0
 def _customization(self):
     if (
         self.environment[
             oenginecons.RemoveEnv.REMOVE_ENGINE
         ] is None and
         self.environment[
             oenginecons.CoreEnv.ENABLE
         ]
     ):
         self.environment[
             oenginecons.RemoveEnv.REMOVE_ENGINE
         ] = dialog.queryBoolean(
             dialog=self.dialog,
             name='OVESETUP_REMOVE_ENGINE',
             note=_(
                 'Do you want to remove the engine? '
                 '(@VALUES@) [@DEFAULT@]: '
             ),
             prompt=True,
             true=_('Yes'),
             false=_('No'),
             default=False,
         )
         if self.environment[oenginecons.RemoveEnv.REMOVE_ENGINE]:
             self.environment[osetupcons.RemoveEnv.REMOVE_OPTIONS].append(
                 oenginecons.Const.ENGINE_PACKAGE_NAME
             )
             # TODO: avoid to hard-coded group names here.
             # we should modify all groups with some engine prefix so we
             # know what they are, then just iterate based on prefix.
             # alternatively have a group of groups.
             # Put as much information within uninstall so that the
             # uninstall will be as stupid as we can have.
             # as uninstall will be modified after upgrade, new groups will
             # be available there anyway... so we can modify names.
             # also, if there is some kind of a problem we can have
             # temporary mapping between old and new.
             # anything that will require update of both setup and remove
             # on regular basis.
             self.environment[
                 osetupcons.RemoveEnv.REMOVE_SPEC_OPTION_GROUP_LIST
             ].extend(
                 [
                     'ca_pki',
                     'exportfs',
                     'nfs_config',
                     'ca_pki',
                     'iso_domain',
                     'ca_config',
                     'ssl',
                     'versionlock',
                 ]
             )
Exemplo n.º 45
0
 def _constomization(self):
     if self.environment[oliveconst.CoreEnv.CONFIGURE] is None:
         self.environment[oliveconst.CoreEnv.CONFIGURE] = dialog.queryBoolean(
             dialog=self.dialog,
             name="OVESETUP_AIO_CONFIGURE",
             note=_("Configure VDSM on this host? " "(@VALUES@) [@DEFAULT@]: "),
             prompt=True,
             default=True,
         )
     if self.environment[oliveconst.CoreEnv.CONFIGURE]:
         self.environment[osetupcons.ConfigEnv.FQDN_REVERSE_VALIDATION] = True
         self.environment[osetupcons.ConfigEnv.FQDN_NON_LOOPBACK_VALIDATION] = True
Exemplo n.º 46
0
 def _query_install_ovn(self):
     return dialog.queryBoolean(
         dialog=self.dialog,
         name='ovirt-provider-ovn',
         note=_(
             '\nConfiguring ovirt-provider-ovn also sets the Default '
             'cluster\'s default network provider to ovirt-provider-ovn.\n'
             'Non-Default clusters may be configured with an OVN after '
             'installation.\n'
             'Configure ovirt-provider-ovn (@VALUES@) [@DEFAULT@]: '),
         prompt=True,
         default=True)
Exemplo n.º 47
0
    def _validation(self):
        if self.environment[
            osetupcons.CoreEnv.REMOVE
        ] is None:
            if self.environment[osetupcons.RemoveEnv.REMOVE_ALL]:
                cnote = _(
                    'All the installed ovirt components are about to be '
                    'removed, data will be lost (@VALUES@) [@DEFAULT@]: '
                )
            elif (
                self.environment[osetupcons.RemoveEnv.REMOVE_OPTIONS] or
                self.environment[osetupcons.RemoveEnv.REMOVE_GROUPS]
            ):
                cnote = _(
                    'The following components are about to be removed, data '
                    'will be lost:\n'
                    '{clist}'
                    '(@VALUES@) [@DEFAULT@]: '
                ).format(
                    clist=', '.join(
                        self.environment[
                            osetupcons.RemoveEnv.REMOVE_OPTIONS
                        ] + [
                            x.strip()
                            for x in self.environment[
                                osetupcons.RemoveEnv.REMOVE_GROUPS
                            ].split(',')
                            if x
                        ]
                    )
                )
            else:
                raise RuntimeError(
                    _('Nothing to remove')
                )

            self.environment[
                osetupcons.CoreEnv.REMOVE
            ] = dialog.queryBoolean(
                dialog=self.dialog,
                name='OVESETUP_CORE_REMOVE',
                note=cnote,
                prompt=True,
                true=_('OK'),
                false=_('Cancel'),
                default=False,
            )

        if not self.environment[osetupcons.CoreEnv.REMOVE]:
            raise RuntimeError(
                _('Aborted by user')
            )
Exemplo n.º 48
0
    def _validation(self):
        self._statement = database.Statement(
            dbenvkeys=oenginecons.Const.ENGINE_DB_ENV_KEYS,
            environment=self.environment,
        )
        self._db_dwh_hostname = engine_db_timekeeping.getValueFromTimekeeping(
            statement=self._statement,
            name=engine_db_timekeeping.DB_KEY_HOSTNAME
        )
        db_dwh_uuid = engine_db_timekeeping.getValueFromTimekeeping(
            statement=self._statement,
            name=engine_db_timekeeping.DB_KEY_UUID
        )

        if (
            db_dwh_uuid and
            db_dwh_uuid != self.environment[odwhcons.CoreEnv.UUID]
        ):
            if self.environment[
                odwhcons.DBEnv.DISCONNECT_EXISTING_DWH
            ] is None:
                self.environment[
                    odwhcons.DBEnv.DISCONNECT_EXISTING_DWH
                ] = dialog.queryBoolean(
                    dialog=self.dialog,
                    name='OVESETUP_DWH_DISCONNECT_EXISTING',
                    note=_(
                        'An existing DWH is configured to work with this '
                        'engine.\n'
                        'Its hostname is {hostname}.\n'
                        'A positive answer to the following question will '
                        'cause the existing DWH to be permanently '
                        'disconnected from the engine.\n'
                        'A negative answer will stop Setup.\n'
                        'Do you want to permanently disconnect this DWH from '
                        'the engine? '
                        '(@VALUES@) [@DEFAULT@]: '
                    ).format(
                        hostname=self._db_dwh_hostname,
                    ),
                    prompt=True,
                    true=_('Yes'),
                    false=_('No'),
                    default=False,
                )
            if not self.environment[
                odwhcons.DBEnv.DISCONNECT_EXISTING_DWH
            ]:
                raise RuntimeError(
                    _('An existing DWH found - Setup cancelled by user')
                )
Exemplo n.º 49
0
 def _configureSANWipeAfterDelete(self):
     if self.environment[SAN_WIPE_AFTER_DELETE] is None:
         # Value for SAN_WIPE_AFTER_DELETE is not forced.
         sanWipeAfterDelete = dialog.queryBoolean(
             dialog=self.dialog,
             name='OVESETUP_CONFIG_SAN_WIPE_AFTER_DELETE',
             note=_(
                 'Default SAN wipe after delete '
                 '(@VALUES@) [@DEFAULT@]: '
             ),
             prompt=True,
             default=False,
         )
         self.environment[SAN_WIPE_AFTER_DELETE] = sanWipeAfterDelete
Exemplo n.º 50
0
 def _askUserToWaitForTasks(
     self,
     runningTasks,
     runningCommands,
     compensations,
 ):
     self.dialog.note(
         text=_(
             'The following system tasks have been '
             'found running in the system:\n'
             '{tasks}'
         ).format(
             tasks='\n'.join(runningTasks),
         )
     )
     self.dialog.note(
         text=_(
             'The following commands have been '
             'found running in the system:\n'
             '{commands}'
         ).format(
             commands='\n'.join(runningCommands),
         )
     )
     self.dialog.note(
         text=_(
             'The following compensations have been '
             'found running in the system:\n'
             '{compensations}'
         ).format(
             compensations='\n'.join(compensations),
         )
     )
     if not dialog.queryBoolean(
         dialog=self.dialog,
         name='OVESETUP_WAIT_RUNNING_TASKS',
         note=_(
             'Would you like to try to wait for that?\n'
             '(Answering "no" will stop the upgrade (@VALUES@) '
         ),
         prompt=True,
     ):
         raise RuntimeError(
             _(
                 'Upgrade cannot be completed; asynchronious tasks or '
                 'commands or compensations are still running. Please '
                 'make sure that there are no running tasks before you '
                 'continue.'
             )
         )
Exemplo n.º 51
0
 def _customization(self):
     if self.environment[
         ovmpcons.ConfigEnv.VMCONSOLE_PROXY_CONFIG
     ] is None:
         self.environment[
             ovmpcons.ConfigEnv.VMCONSOLE_PROXY_CONFIG
         ] = dialog.queryBoolean(
             dialog=self.dialog,
             name='OVESETUP_CONFIG_VMCONSOLE_PROXY',
             note=_(
                 'Configure VM Console Proxy on this host '
                 '(@VALUES@) [@DEFAULT@]: '
             ),
             prompt=True,
             default=True,
         )
Exemplo n.º 52
0
 def _customization(self):
     if self.environment[
         osetupcons.RemoveEnv.REMOVE_ALL
     ] is None:
         self.environment[
             osetupcons.RemoveEnv.REMOVE_ALL
         ] = dialog.queryBoolean(
             dialog=self.dialog,
             name='OVESETUP_REMOVE_ALL',
             note=_(
                 'Do you want to remove all components? '
                 '(@VALUES@) [@DEFAULT@]: '
             ),
             prompt=True,
             true=_('Yes'),
             false=_('No'),
             default=True,
         )
Exemplo n.º 53
0
 def _customization(self):
     if self.environment[
         oenginecons.RemoveEnv.REMOVE_ENGINE_DATABASE
     ] is None:
         self.environment[
             oenginecons.RemoveEnv.REMOVE_ENGINE_DATABASE
         ] = dialog.queryBoolean(
             dialog=self.dialog,
             name='OVESETUP_ENGINE_DB_REMOVE',
             note=_(
                 'Do you want to remove Engine database content? '
                 'All data will be lost (@VALUES@) [@DEFAULT@]: '
             ),
             prompt=True,
             true=_('Yes'),
             false=_('No'),
             default=False,
         )
Exemplo n.º 54
0
 def _customization(self):
     if self.environment[oreportscons.CoreEnv.ENABLE] is None:
         self.environment[
             oreportscons.CoreEnv.ENABLE
         ] = dialog.queryBoolean(
             dialog=self.dialog,
             name='OVESETUP_REPORTS_ENABLE',
             note=_(
                 'Configure Reports on this host '
                 '(@VALUES@) [@DEFAULT@]: '
             ),
             prompt=True,
             default=True,
         )
     if self.environment[oreportscons.CoreEnv.ENABLE]:
         self.environment[oengcommcons.ApacheEnv.ENABLE] = True
         self.environment[
             oreportscons.ConfigEnv.REPORTS_SERVICE_STOP_NEEDED
         ] = True
Exemplo n.º 55
0
    def _customization(self):
        if self.environment[
            oengcommcons.ApacheEnv.CONFIGURE_SSL
        ] is None:
            self.dialog.note(
                _(
                    'Setup can configure apache to use SSL using a '
                    'certificate issued from the internal CA.'
                )
            )
            self.environment[
                oengcommcons.ApacheEnv.CONFIGURE_SSL
            ] = dialog.queryBoolean(
                dialog=self.dialog,
                name='OVESETUP_APACHE_CONFIG_SSL',
                note=_(
                    'Do you wish Setup to configure that, or prefer to '
                    'perform that manually? (@VALUES@) [@DEFAULT@]: '
                ),
                prompt=True,
                true=_('Automatic'),
                false=_('Manual'),
                default=True,
            )

        self._enabled = self.environment[
            oengcommcons.ApacheEnv.CONFIGURE_SSL
        ]

        if self._enabled:
            if not os.path.exists(
                self.environment[
                    oengcommcons.ApacheEnv.HTTPD_CONF_SSL
                ]
            ):
                self.logger.warning(
                    _(
                        "Automatic Apache SSL configuration was requested. "
                        "However, SSL configuration file '{file}' was not "
                        "found. Disabling automatic Apache SSL configuration."
                    )
                )
                self._enabled = False
Exemplo n.º 56
0
    def _continueSetupWithoutAIO(self):
        if self.environment[oliveconst.CoreEnv.CONTINUE_WITHOUT_AIO] is None:
            self.environment[oliveconst.CoreEnv.CONTINUE_WITHOUT_AIO] = dialog.queryBoolean(
                dialog=self.dialog,
                name="OVESETUP_CONTINUE_WITHOUT_AIO",
                note=_(
                    "Disabling all-in-one plugin because hardware "
                    "supporting virtualization could not be detected. "
                    "Do you want to continue setup without AIO plugin? "
                    "(@VALUES@) [@DEFAULT@]: "
                ),
                prompt=True,
                default=False,
            )

        if self.environment[oliveconst.CoreEnv.CONTINUE_WITHOUT_AIO]:
            self._enabled = False
            self.environment[oliveconst.CoreEnv.CONFIGURE] = False
        else:
            raise RuntimeError(_("Aborted by user."))
Exemplo n.º 57
0
    def _aia(self):
        x509 = X509.load_cert(
            file=oenginecons.FileLocations.OVIRT_ENGINE_PKI_ENGINE_CA_CERT,
            format=X509.FORMAT_PEM,
        )

        try:
            authorityInfoAccess = x509.get_ext(
                'authorityInfoAccess'
            ).get_value()

            self.logger.warning(_('AIA extension found in CA certificate'))
            self.dialog.note(
                text=_(
                    'Please note:\n'
                    'The certificate for the CA contains the\n'
                    '"Authority Information Access" extension pointing\n'
                    'to the old hostname:\n'
                    '{aia}'
                    'Currently this is harmless, but it might affect future\n'
                    'upgrades. In version 3.3 the default was changed to\n'
                    'create new CA certificate without this extension. If\n'
                    'possible, it might be better to not rely on this\n'
                    'program, and instead backup, cleanup and setup again\n'
                    'cleanly.\n'
                    '\n'
                    'More details can be found at the following address:\n'
                    'http://www.ovirt.org/Changing_Engine_Hostname\n'
                ).format(
                    aia=authorityInfoAccess,
                ),
            )
            if not dialog.queryBoolean(
                dialog=self.dialog,
                name='OVESETUP_RENAME_AIA_BYPASS',
                note=_('Do you want to continue? (@VALUES@) [@DEFAULT@]: '),
                prompt=True,
            ):
                raise RuntimeError(_('Aborted by user'))
        except LookupError:
            pass
Exemplo n.º 58
0
 def _customization_upgrade(self):
     if True in [
         self._expired(
             X509.load_cert(
                 oenginecons.FileLocations.OVIRT_ENGINE_PKI_ENGINE_CA_CERT
             )
         )
     ] + [
         self._ok_to_renew_cert(
             os.path.join(
                 oenginecons.FileLocations.OVIRT_ENGINE_PKIKEYSDIR,
                 '%s.p12' % entry['name']
             ),
             entry['name'],
             entry['extract']
         )
         for entry in self._PKI_ENTRIES
     ]:
         if self.environment[oenginecons.PKIEnv.RENEW] is None:
             self.environment[
                 oenginecons.PKIEnv.RENEW
             ] = dialog.queryBoolean(
                 dialog=self.dialog,
                 name='OVESETUP_RENEW_PKI',
                 note=_(
                     'One or more of the certificates should be renewed, '
                     'because they expire soon or include an invalid '
                     'expiry date, which is rejected by recent browsers.\n'
                     'If you choose "No", you will be asked again the next '
                     'time you run Setup.\n'
                     'See {url} for more details.\n'
                     'Renew certificates? '
                     '(@VALUES@) [@DEFAULT@]: '
                 ).format(
                     url=self.environment[
                         oenginecons.ConfigEnv.PKI_RENEWAL_DOC_URL
                     ],
                 ),
                 prompt=True,
                 default=None,
             )