Bug 2124332

Summary: Leapp does not recognize missing required answers when answerfile is missing
Product: Red Hat Enterprise Linux 8 Reporter: Petr Stodulka <pstodulk>
Component: leappAssignee: Petr Stodulka <pstodulk>
Status: CLOSED ERRATA QA Contact: Michal Macura <mmacura>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.6CC: lmiksik, mmacura
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: leapp-0.15.0-2.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2125263 (view as bug list) Environment:
Last Closed: 2022-11-08 09:46:56 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: 2125263    

Description Petr Stodulka 2022-09-05 17:47:05 UTC
Let's require answer `check_vdo.confirm`. Then..

If user provides an answer for `check_vdo.invalid_answer` and if the answerfile is
  a) missing
  b) or just does not containt the section `check_vdo`
  c) or the section `check_vdo` exists but contains anser `whatever = False` instead of confirm,

then leapp does not recognize the required answer for the particular section is missing
  1. if answer is answered using `leapp answer --add ...` in cases a,b
  2. just like that in case c) 

Reproducer:
-----------

  # dnf install -y leapp-upgrade lvm2
  # dnf remove -y  vdo 
  # rm -rf /var/log/leapp/answerfile*
  # leapp answer --section check_vdo.whatever=True --add
  # leapp preupgrade

Current results:
----------------

~~~
[snip]
====> * verify_check_results
        Check all generated results messages and notify user about them.

Debug output written to /var/log/leapp/leapp-preupgrade.log

============================================================
                           REPORT
============================================================

A report has been generated at /var/log/leapp/leapp-report.json
A report has been generated at /var/log/leapp/leapp-report.txt

============================================================
                       END OF REPORT
============================================================

Answerfile has been generated at /var/log/leapp/answerfile
~~~

In the output is clearly seen that the expected inhibitor about the missing answered question is missing.

Expected result:
----------------

The upgrade is always inhibited with the proper reason when the required answer is not provided.


~~~
============================================================
                     UPGRADE INHIBITED                      
============================================================

Upgrade has been inhibited due to the following problems:
    1. Inhibitor: Missing required answers in the answer file
Consult the pre-upgrade report for details and possible remediation.

============================================================
                     UPGRADE INHIBITED                      
============================================================

~~~

From the report file:
~~~
Risk Factor: high (inhibitor)
Title: Missing required answers in the answer file
Summary: One or more sections in answerfile are missing user choices: check_vdo.confirm
For more information consult https://leapp.readthedocs.io/en/latest/dialogs.html
Remediation: [hint] Please register user choices with leapp answer cli command or by manually editing the answerfile.
[command] leapp answer --section check_vdo.confirm=True
Key: 2f9802dc91315806c7cdc3c18d7b74f2a2383285
----------------------------------------

~~~



Additional note:
Based on how particular actor is written, the upgrade could be performed without any inhibitor, like in the first example above, despite the fact that required answer has not been delivered. With the new leapp-repository build, the upgrade will be inhibit, but because of little bit different reason and user will not be necessarily prompted to answer the question, so customers will not be aware they didn't provide the right answer. Also, running leapp multiple times, user could see later the proper inhibitor, but it could be pretty annoying to have basically several different outcomes when running leapp.

Comment 1 Petr Stodulka 2022-09-05 18:12:50 UTC
FYI, with the next planned leapp-repository build, the upgrade will be inhibited by a different report. However, user will not be prompted to answer the new question so there is additional bad UX.

Comment 3 Petr Stodulka 2022-09-06 15:04:06 UTC
This bug is going to be fixed in the upstrea by this PR:
  https://github.com/oamg/leapp/pull/797

Comment 15 errata-xmlrpc 2022-11-08 09:46:56 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 (leapp bug fix and enhancement update), 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://access.redhat.com/errata/RHBA-2022:7591