Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-17777

'ModelViolationError' update various actors to provide info about problematic config files

    • FutureFeature
    • rhel-sst-upgrades
    • None
    • False
    • Hide

      None

      Show
      None
    • None
    • Red Hat Enterprise Linux
    • None
    • None
    • None
    • x86_64
    • None

      updated description by pstodulk

      As a user or a person investigating the root cause of current ModelViolationError errors, I would like to have better information when possible about the root cause. Currently, usual reasons for these errors are:

      1. Real bug in some leapp actors
      2. Real bug in some leapp actors, caused by unknown / unexpected system configuration
      3. An invalid configuration file on the system

      The first two cases are very similar and it's discussable whether whether to split them. The difference is that the second one can be caused by some new or rare system outputs that original actor didn't count with and it would be nice to inform about the source of that unexpacted output/input.

      The last one is the most common so far. Despite the requirement that system must be in completely working state without having invalid configurations, it is consuming a time to discover what configuration files are actually invalid. Hence, actors processing the content in these files could print at least what file caused the issue so the discovery of the real root cause could be faster.

      This ticket is tracking currently know problems. See tickets attached to it. I am keeping the original description below as I am not reporter of this problem, but note that expectations of this ticket are set be the text above.

      original description from Pranav Lawate

      What were you trying to do that didn't work?

      Trying upgrade system with leapp. Due to some misconfigured file in system it failed with traceback of 'ModelViolationError'

      Please provide the package NVR for which bug is seen:

      Affects all leapp versions until leapp-0.16.0-2.el8.noarch.rpm

      How reproducible:

      100%

      Steps to reproduce

      1. Create a 'test.repo' file as follows:
      [test-rpms-repo]                       <---- Keep this uncommented 
      #name=Test Repo
      #gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
      #baseurl=https://10.85.92.77/repos/test-rpms-repo
      #enabled=1
      #gpgcheck=1
       # Run leapp preupgrade
       # It will fail with traceback that looks like this(taken from RHEL 7 reproducer):
      
      ====================== ERRO ====================
      
      
      ==> * pam_modules_scanner
              Scan the pam directory for services and modules used in them
      ====> * system_facts
              Provides data about many facts from system.
      Process Process-230:
      Traceback (most recent call last):
        File "/usr/lib64/python2.7/multiprocessing/process.py", line 258, in _bootstrap
          self.run()
        File "/usr/lib64/python2.7/multiprocessing/process.py", line 114, in run
          self._target(*self._args, **self._kwargs)
        File "/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.py", line 74, in _do_run
          actor_instance.run(*args, **kwargs)
        File "/usr/lib/python2.7/site-packages/leapp/actors/__init__.py", line 289, in run
          self.process(*args)
        File "/usr/share/leapp-repository/repositories/system_upgrade/common/actors/systemfacts/actor.py", line 57, in process
          self.produce(systemfacts.get_repositories_status())
        File "/usr/share/leapp-repository/repositories/system_upgrade/common/actors/systemfacts/libraries/systemfacts.py", line 220, in get_repositories_status
          return 
      
      RepositoriesFacts(repositories=repofileutils.get_parsed_repofiles())
        File "/usr/share/leapp-repository/repositories/system_upgrade/common/libraries/repofileutils.py", line 77, in get_parsed_repofiles
          repofile = parse_repofile(context.full_path(repofile_path))
        File "/usr/share/leapp-repository/repositories/system_upgrade/common/libraries/repofileutils.py", line 41, in parse_repofile
          data.append(_parse_repository(repoid, dict(cp.items(repoid))))
        File "/usr/share/leapp-repository/repositories/system_upgrade/common/libraries/repofileutils.py", line 26, in _parse_repository
          return RepositoryData(**prepared)
        File "/usr/lib/python2.7/site-packages/leapp/models/__init__.py", line 90, in __init__
          getattr(defined_fields[field], init_method)(kwargs, field, self)
        File "/usr/lib/python2.7/site-packages/leapp/models/fields/__init__.py", line 111, in from_initialization
          self._validate_model_value(value=source_value, name=name)
        File "/usr/lib/python2.7/site-packages/leapp/models/fields/__init__.py", line 180, in _validate_model_value
          super(BuiltinField, self)._validate_model_value(value, name)
        File "/usr/lib/python2.7/site-packages/leapp/models/fields/__init__.py", line 61, in _validate_model_value
          raise ModelViolationError('The value of "\{name}" field is None, but this is not allowed'.format(name=name))
      ModelViolationError: The value of "name" field is None, but this is not allowed
      
      
      =============================================================================================
      Actor system_facts unexpectedly terminated with exit code: 1 - Please check the above details
      =============================================================================================
      

      Expected results

       ModelViolationError should be handled better instead of traceback.

       If the 'name' parameter can be passed along the traceback , the filename test.repo should also be passed along.

      Actual results

      The test.repo file is not reported by traceback. 

       

      Additional information

      Reading following line we have to check all possible configs related to repository to find a single typo or sometimes missing key-value pair:

      
      repository/repositories/system_upgrade/common/libraries/repofileutils.py", line 26, in _parse_repository
      
      

              Unassigned Unassigned
              rhn-support-plawate Pranav Lawate
              leapp-notifications leapp-notifications
              RHEL Upgrades QE Team RHEL Upgrades QE Team
              Miriam Portman Miriam Portman
              Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated: