Bug 1318431

Summary: not_applicable modules are run anyway (and throw 'error' result)
Product: Red Hat Enterprise Linux 6 Reporter: Alois Mahdal <amahdal>
Component: preupgrade-assistantAssignee: Petr Stodulka <pstodulk>
Status: CLOSED ERRATA QA Contact: Tereza Cerna <tcerna>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.8CC: fkluknav, ovasik, phracek, pstodulk, tcerna, ttomecek
Target Milestone: rcKeywords: Extras
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: preupgrade-assistant-2.1.5-5.el6 Doc Type: If docs needed, set a value
Doc Text:
This is mainly used by modules. There was a condition which checks if package is installed and signed by Red Hat. Modules were executed even package was not installed. After a fix if package is not installed, then module is marked as NOT_APPLICABLE. The bug is not visible from customer point of view, I guess.
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-11 08:27:04 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Alois Mahdal 2016-03-16 21:08:50 UTC
Description of problem
======================

Python modules are run even if the relevant package is not present, which eventually leads to them failing with error result.

For example, *xccdf_preupg_rule_services_freeradius_check_script* would run even if *freeradius* package is not installed.


Version-Release number of selected component
============================================

preupgrade-assistant-2.1.5-3.el6.noarch.rpm


How reproducible
================

Always


Steps to Reproduce
==================

 1. Get a machine without freeradius package installed
 2. Run preupg
 3. Observe set of rules launched


Actual results
==============

*xccdf_preupg_rule_services_freeradius_check_script* rule is launched
(and fails, since it can't find its config file)


Expected results
================

*xccdf_preupg_rule_services_freeradius_check_script* rule is not launched
at all; the result for this rule is *not_applicable*


Additional info
===============

This can be reproduced with any Python module related to (`applies_to`)
not currently installed.

Bash modules are not affected.

Comment 1 Petr Stodulka 2016-03-16 21:14:10 UTC
Used opossite condition for evaluation if contents is not_applicable. Negation of the condition.

[0] https://github.com/phracek/preupgrade-assistant/commit/ab403ccc207bcee5c359f92f65409bbbdb5be3cd

Comment 4 Alois Mahdal 2016-04-08 16:56:21 UTC
This is from recent compose, RHEL-6.8-20160330.0 with p-a* components installed Brew:

    [0 root@qeos-27 ~]# rpm -qa preupg\* \*bind\* | sort
    bind-libs-9.8.2-0.47.rc1.el6.x86_64
    bind-utils-9.8.2-0.47.rc1.el6.x86_64
    preupgrade-assistant-2.1.5-4.el6.noarch
    preupgrade-assistant-el6toel7-0.6.45-1.el6.noarch
    preupgrade-assistant-el6toel7-data-0.20160406-1.el6.noarch
    preupgrade-assistant-tools-2.1.5-4.el6.noarch
    preupgrade-assistant-ui-2.1.5-4.el6.noarch
    rpcbind-0.2.0-12.el6.x86_64
    [0 root@qeos-27 ~]#

xccdf_preupg_rule_networking_bind_configuration_check_script is ran and fails with error:

    ERROR BIND: Cannot open the configuration file: "/etc/named.conf"

content.ini looks like this:

    [preupgrade]
    check_script = check_script.py
    content_description = Checks BIND9 configuration compatibility
    config_file = /etc/named.conf
    content_title = BIND9 configuration compatibility check
    author = Tomas Hozza <thozza>
    solution = solution.txt
    applies_to = bind
    binary_req = python

Comment 9 errata-xmlrpc 2016-05-11 08:27:04 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-1022.html