Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1362722

Summary: preupg --list-rules prints extra info; hard to use for scripting
Product: Red Hat Enterprise Linux 6 Reporter: Alois Mahdal <amahdal>
Component: preupgrade-assistantAssignee: Petr Hracek <phracek>
Status: CLOSED ERRATA QA Contact: Alois Mahdal <amahdal>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.8CC: amahdal, fkluknav, jmazanek, phracek, pstodulk, tcerna
Target Milestone: rcKeywords: Extras
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: preupgrade-assistant-2.1.9-1.el6 Doc Type: Bug Fix
Doc Text:
Cause: preupg --list-rules prints relevant information with some mess Consequence: It is hard to parse the output by the script for testing propose Fix: preupg --list-rules prints ONLY information without mess. Result: Script is able to parse the output properly.
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-04 08:58:09 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:
Embargoed:
Bug Depends On:    
Bug Blocks: 1335121    

Description Alois Mahdal 2016-08-03 01:16:02 UTC
Description of problem
======================

preupg --list-rules currently prints:

    [0 root@qeos-90 fupath]# preupg --list-rules
    List of all available rules:
    RHEL6_7: xccdf_preupg_rule_others_configchanges_check
    RHEL6_7: xccdf_preupg_rule_others_rsyslog_check
    RHEL6_7: xccdf_preupg_rule_others_vcsrepos_check_script
    [...]
    RHEL6_7: xccdf_preupg_rule_networking_openldap_check
    RHEL6_7: xccdf_preupg_rule_networking_vsftpd_check
    RHEL6_7: xccdf_preupg_rule_networking_iptables_check_script

    [0 root@qeos-90 fupath]# 

Notice 3 kinds of extraneous output:

 *  "List of" message,
 *  "RHEL6_7: " prefix,
 *  empty line at the end.

This makes the command hard to use for scripted use (which was the reason
it was added in the first place).


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

preupgrade-assistant-2.1.8-2.el6


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

Always


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

 1. preupg --list-rules


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

As above


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

Only rule ids (`^xccdf_preupg_rule_`)


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

The "List of all" part is useless: since we've *asked* for list of rules,
we *know* what should be coming.

The RHEL6_7: prefix is arguably not necessary at all.  Under normal
operation, it's implied that only one upgrade path is in use; it would
make sense to assume this also when listing.

Comment 2 Petr Hracek 2016-08-22 10:37:07 UTC
Message like "List of all available rules" is questionable. I don't want to print only a lines of rules for only tests.

I would like to inform user about what we are doing right now. The sentence will remain.

In case of upgrade RHEL6->RHEL7 and RHEL6->RHEL8 you can have two sets of modules.
Therefore we should include upgrade path. This is also mandatory.

The last line is valid. I will remove it. The rest stuff is easy to either skip and truncate.

Comment 3 Alois Mahdal 2016-08-22 23:49:09 UTC
Why the needinfo?  Please state your question; I'd be happy to help but I'm not sure what exctly is needed from me. :)

Comment 4 Petr Hracek 2016-08-24 10:43:27 UTC
Upstream commit: https://github.com/upgrades-migrations/preupgrade-assistant/commit/b2fc8efca4b010f8fbd220fbe7b05e593639cb8b

Output now looks like:

[root@rhel6workstation ~]# preupg --list-rules
List of all available rules:
RHEL6_7:xccdf_preupg_rule_others_configchanges_check
RHEL6_7:xccdf_preupg_rule_others_rsyslog_check
RHEL6_7:xccdf_preupg_rule_others_vcsrepos_check_script
RHEL6_7:xccdf_preupg_rule_others_NoVersionChangeEtc_nochange
[snip]
RHEL6_7:xccdf_preupg_rule_networking_openldap_check
RHEL6_7:xccdf_preupg_rule_networking_vsftpd_check
RHEL6_7:xccdf_preupg_rule_networking_iptables_check_script
[root@rhel6workstation ~]#

Which is easy for passing.

Comment 7 Alois Mahdal 2016-08-31 21:55:52 UTC
(In reply to Petr Hracek from comment #4)
> Upstream commit:
> https://github.com/upgrades-migrations/preupgrade-assistant/commit/
> b2fc8efca4b010f8fbd220fbe7b05e593639cb8b
> 
> Output now looks like:
> 
> [root@rhel6workstation ~]# preupg --list-rules
> List of all available rules:
> RHEL6_7:xccdf_preupg_rule_others_configchanges_check
> RHEL6_7:xccdf_preupg_rule_others_rsyslog_check
> RHEL6_7:xccdf_preupg_rule_others_vcsrepos_check_script
> RHEL6_7:xccdf_preupg_rule_others_NoVersionChangeEtc_nochange
> [snip]
> RHEL6_7:xccdf_preupg_rule_networking_openldap_check
> RHEL6_7:xccdf_preupg_rule_networking_vsftpd_check
> RHEL6_7:xccdf_preupg_rule_networking_iptables_check_script
> [root@rhel6workstation ~]#
> 

Not exactly... the "List of..." line has been removed, as suggested in comment 0.  Also, note that the format is now `UPATH:ruleid`, not `UPATH: ruleid`, i.e. the space has also been dropped.

I have updated tests; the format works fine now.  Thanks!

Comment 9 errata-xmlrpc 2016-11-04 08:58:09 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-2616.html