SatelliteQE / satellite6-upgrade

Satellite 6 upgrade related tools
GNU General Public License v3.0
8 stars 23 forks source link

Handle RE AttributeError for version calculation of package #247

Open jyejare opened 5 years ago

jyejare commented 5 years ago

Upgrade fails with AttributeError: 'NoneType' object has no attribute 'group', if it unable to find the package and still trying to get its version.

Fix:

First check if the package exists and then attempt to calculate its version.

jyejare commented 5 years ago

Logs:

Traceback (most recent call last):
  File "/home/jenkins/shiningpanda/jobs/c664adfd/virtualenvs/d41d8cd9/lib/python2.7/site-packages/fabric/main.py", line 763, in main
    *args, **kwargs
  File "/home/jenkins/shiningpanda/jobs/c664adfd/virtualenvs/d41d8cd9/lib/python2.7/site-packages/fabric/tasks.py", line 427, in execute
    results['<local-only>'] = task.run(*args, **new_kwargs)
  File "/home/jenkins/shiningpanda/jobs/c664adfd/virtualenvs/d41d8cd9/lib/python2.7/site-packages/fabric/tasks.py", line 174, in run
    return self.wrapped(*args, **kwargs)
  File "/home/jenkins/workspace/upgrade-phase-6.5-rhel7/upgrade/runner.py", line 256, in product_upgrade
    'rhel7', puppet_clients7, puppet=True)
  File "/home/jenkins/workspace/upgrade-phase-6.5-rhel7/upgrade/client.py", line 204, in satellite6_client_upgrade
    host=docker_vm
  File "/home/jenkins/shiningpanda/jobs/c664adfd/virtualenvs/d41d8cd9/lib/python2.7/site-packages/fabric/tasks.py", line 387, in execute
    multiprocessing
  File "/home/jenkins/shiningpanda/jobs/c664adfd/virtualenvs/d41d8cd9/lib/python2.7/site-packages/fabric/tasks.py", line 277, in _execute
    return task.run(*args, **kwargs)
  File "/home/jenkins/shiningpanda/jobs/c664adfd/virtualenvs/d41d8cd9/lib/python2.7/site-packages/fabric/tasks.py", line 174, in run
    return self.wrapped(*args, **kwargs)
  File "/home/jenkins/workspace/upgrade-phase-6.5-rhel7/upgrade/client.py", line 263, in docker_clients_agent_version
    docker_execute_command(container, 'rpm -q {}'.format(agent)))
  File "/home/jenkins/workspace/upgrade-phase-6.5-rhel7/upgrade/helpers/tools.py", line 178, in version_filter
    return re.search(r'\d(\-\d|\.\d)*', rpm_name).group()
AttributeError: 'NoneType' object has no attribute 'group'