Exemplo n.º 1
0
    def process(self):
        os_data_file = '/etc/os-release'
        os_data = {}

        try:
            with open(os_data_file) as f:
                os_data = dict(l.strip().split('=', 1) for l in f.readlines()
                               if '=' in l)
        except IOError as e:
            self.produce(
                Inhibitor(summary='Error while collecting system OS facts',
                          details=str(e),
                          solutions=None))
            return

        self.produce(
            OSReleaseFacts(id=os_data.get('ID', '').strip('"'),
                           name=os_data.get('NAME', '').strip('"'),
                           pretty_name=os_data.get('PRETTY_NAME',
                                                   '').strip('"'),
                           version=os_data.get('VERSION', '').strip('"'),
                           version_id=os_data.get('VERSION_ID', '').strip('"'),
                           variant=os_data.get('VARIANT', '').strip('"')
                           or None,
                           variant_id=os_data.get('VARIANT_ID', '').strip('"')
                           or None))
Exemplo n.º 2
0
    def process(self):
        details = "NFS is currently not supported by the inplace upgrade.\n" \
                  "We have found NFS usage at the following locations:\n"
        nfs_found = False

        for storage in self.consume(StorageInfo):
            # Check fstab
            for fstab in storage.fstab:
                if fstab.fs_vfstype == "nfs":
                    nfs_found = True
                    details += "- One or more NFS entries in /etc/fstab\n"
                    break

            # Check mount
            for mount in storage.mount:
                if mount.tp == "nfs":
                    nfs_found = True
                    details += "- Currently mounted NFS shares\n"
                    break

            # Check systemd-mount
            for systemdmount in storage.systemdmount:
                if systemdmount.fs_type == "nfs":
                    nfs_found = True
                    details += "- One or more configured NFS mounts in systemd-mount\n"
                    break

        if nfs_found:
            self.produce(
                Inhibitor(
                    summary="Use of NFS detected. Upgrade can't proceed.",
                    details=details,
                    solutions=
                    "Disable NFS temporarily for the upgrade if possible."))
Exemplo n.º 3
0
 def process(self):
     if platform.machine() != 'x86_64':
         self.produce(
             Inhibitor(
                 summary='Unsupported arch',
                 details=
                 'Upgrade process is only supported on x86_64 systems',
                 solutions='There is no current solution for this problem'))
Exemplo n.º 4
0
    def process(self):
        skip_check = os.getenv('LEAPP_SKIP_CHECK_OS_RELEASE')
        if skip_check:
            self.produce(
                CheckResult(
                    severity='Warning',
                    result='Not Applicable',
                    summary='Skipped OS release check',
                    details=
                    'OS release check skipped via LEAPP_SKIP_CHECK_OS_RELEASE env var',
                    solutions=None))
            return

        min_supported_version = {'rhel': '7.6'}

        for facts in self.consume(OSReleaseFacts):
            if facts.id not in min_supported_version.keys():
                self.produce(
                    Inhibitor(
                        summary='Unsupported OS id',
                        details='Supported OS ids for upgrade process: ' +
                        ','.join(min_supported_version.keys()),
                        solutions=None))
                return

            min_version = [
                int(x) for x in min_supported_version[facts.id].split('.')
            ]
            os_version = [int(x) for x in facts.version_id.split('.')]

            for current, minimal in zip(os_version, min_version):
                if current > minimal:
                    break

                if current < minimal:
                    self.produce(
                        Inhibitor(
                            summary='Unsupported OS version',
                            details=
                            'Minimal supported OS version for upgrade process: '
                            + min_supported_version[facts.id],
                            solutions=None))
                    return
Exemplo n.º 5
0
 def process(self):
     for storage_info in self.consume(StorageInfo):
         for blk in storage_info.lsblk:
             if blk.tp == 'crypt':
                 self.produce(Inhibitor(
                     summary='LUKS encrypted partition detected',
                     details='Upgrading system with encrypted partitions is not supported',
                     solutions='If the encrypted partition is not system one and the system '
                               'is not depending on it, you can remove/blacklist it from '
                               'the system'))
                 break
Exemplo n.º 6
0
 def process(self):
     for data in self.consume(PCIDevices):
         for device in data.devices:
             if 'SCSI' in device.dev_cls and 'LSI Logic' in device.vendor:
                 self.produce(Inhibitor(
                     summary='LSI Logic SCSI Controller is not supported',
                     details='Kernel driver necessary for LSI Logic SCSI Controller (mpt*) '
                             'is not available in Red Hat Enterprise Linux 8. Since this '
                             'would prevent controller from working properly upgrade process '
                             'will be inhibited.',
                     solutions='Please consider disabling LSI Logic SCSI Controller if '
                               'possible.'))
Exemplo n.º 7
0
 def process(self):
     for fact in self.consume(ActiveKernelModulesFacts):
         for active_module in fact.kernel_modules:
             if active_module.filename == 'btrfs':
                 self.produce(
                     Inhibitor(
                         summary='Btrfs removed on next major version',
                         details=
                         'The Btrfs file system was introduced as Technology Preview with the initial release '
                         'of Red Hat Enterprise Linux 6 and Red Hat Enterprise Linux 7. As of versions 6.6 and '
                         '7.4 this technology has been deprecated and will be removed in next major version',
                         solutions=
                         'Please consider migrating your Btrfs mount point(s) to a different filesystem '
                         'before next upgrade attempt. If no Btrfs filesystem is in use, please unload '
                         'btrfs kernel module running "# rmmod btrfs"'))
                 break
Exemplo n.º 8
0
    def process(self):
        ''' based on a decision maker Actor, it disables firewall services '''
        self.log.info("Starting to get decision on FirewallD.")
        for decision in self.consume(FirewallDecisionM):
            if decision.disable_choice == 'Y':
                self.log.info("Disabling Firewall.")
                for facts in self.consume(FirewallsFacts):
                    if facts.iptables.enabled:
                        self.log.info("- IPTables.")
                        self.disable_iptables()
                        break
                    elif facts.firewalld.enabled:
                        self.log.info("- FirewallD.")
                        self.disable_firewalld()
                        break
                    else:
                        continue

                self.log.info("Firewalls are disabled.")
                self.produce(
                    CheckResult(
                        severity='Info',
                        result='Pass',
                        summary='Firewalls are disabled',
                        details=
                        'FirewallD and/or IPTables services are disabled.',
                        solutions=None))
                return
            elif decision.disable_choice == 'N':
                self.log.info(
                    "Interrupting the upgrade process due the current user choice to take care for Firewall manually."
                )
                return
            elif decision.disable_choice == 'S':
                self.log.info("Skipping - all should be disabled.")
                return
        else:
            self.log.info(
                "Interrupting: There was nothing to consume regarding the Firewall decision."
            )
            self.produce(
                Inhibitor(summary='No message to consume',
                          details='No decision message to consume.',
                          solutions=None))
            return
Exemplo n.º 9
0
 def process(self):
     self.log.info("Starting to get FirewallD decision.")
     for facts in self.consume(FirewallsFacts):
         # FIXME: checked only whether services are disabled. But in case
         # + there is another service/proces/... that starts firewalls during
         # + boot we will not catch it in this way. Shouldn't we check and
         # + print warning message in case the firewalls are active but
         # + services are disabled? To reflect possible risk, e.g. that user
         # + will not be able to connect to the upgraded system through ssh.
         # + Fix it later.
         if facts.firewalld.enabled or facts.iptables.enabled:
             answer = self.request_answers(self.dialogs[0]).get(
                 'continue_fw', False)
             self.produce(
                 FirewallDecisionM(disable_choice='Y' if answer else 'N'))
             if not answer:
                 self.produce(
                     Inhibitor(
                         summary=
                         'Firewall interrupts upgrade process request',
                         details='SA user chose to interrupt the upgrade.',
                         solutions=None))
             return
         else:
             # FIXME: See the fixme above
             self.log.info("Firewall is disabled. Nothing to decide.")
             self.produce(FirewallDecisionM(disable_choice='S'))
             self.produce(
                 CheckResult(severity='Info',
                             result='Pass',
                             summary='Firewall disabled',
                             details='Firewall service is disabled.',
                             solutions=None))
             return
     else:
         self.log.info(
             "No message to consume for the Firewall decision. Quitting..")
     return
Exemplo n.º 10
0
def inhibit_upgrade(avail_bytes):
    additional_mib_needed = (MIN_AVAIL_BYTES_FOR_BOOT - avail_bytes) / 2**20
    api.produce(Inhibitor(
        summary='Not enough space on /boot',
        details='/boot needs additional {0} MiB to be able to accomodate the upgrade initramfs and new kernel.'
                .format(additional_mib_needed)))