Bug 1332792

Summary: content creator: default value in prompt is not picked on Enter
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, bancinco, fkluknav, jmazanek, ovasik, phracek, pstodulk, tcerna, ttomecek
Target Milestone: rcKeywords: Extras
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: preupgrade-assistant-2.1.10-6.el6 Doc Type: Bug Fix
Doc Text:
When the preupg-content-creator utility asks users to select a value and offers them a default value, users can now accept the default value by pressing Enter.
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-04 08:57:20 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-05-04 05:59:02 UTC
Description of problem
======================

When preupg-content-creator asks if you want to specify description:

    # preupg-content-creator
    Specify a upgrade path (like RHEL6_7) where a content will be stored: MY3_4
    Specify a group name which content belongs to (like database): hello
    Specify a module name which will be created (like mysql): kitty
    Specify a script name which will be used for assessment: (check.sh) 
    Specify a solution file which will be shown in report: (solution.txt) 
    Specify a content title: Kitty
    Would you like to specify a content description? ([y]/n)? 
    You have to type [y]es or [n]o.
    Would you like to specify a content description? ([y]/n)? y
    Write down a content description: 
    [...]

the prompt suggests that 'y' is the default, but does not behave like
that.


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

preupgrade-assistant-el6toel7-0.6.48-1.el6


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

Always


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

 1. run preupg-content-creator
 2. when prompt suggests a default value, don't enter
    anything, just press Enter


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

At some questions, p-c-c will not choose the default value


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

p-c-c should always accept the value denoted as default

Comment 5 Alois Mahdal 2016-10-07 23:01:31 UTC
This has been fixed for the 'description', but upstream has added new question which suffers from the same:

    [0 root@qeos-231 ~]# preupg-content-creator 
    Specify the upgrade path (like RHEL6_7) where the module will be stored: RHEL6_7
    Specify the group name which the module belongs to [system]: 
    Specify the module name which will be created [packages]: 
    Would you like to create a BASH or Python check script? [sh/py] Bash is default. 
    Select either 'sh or 'py'.
    Would you like to create a BASH or Python check script? [sh/py] Bash is default. sh
    sh
    Specify the script name which will be used for the assessment: [check.sh] 
    ....

Comment 6 Alois Mahdal 2016-10-07 23:06:30 UTC
Another thing, I have noticed that the Doc text is inacurrate.

This bug is not just about the one question but about the behavior in general; when there is a denoted default value, pressing Enter should mean accepting that value (otherwise there's no point in having a "default" value).

Can you please update the text?

Comment 11 Alois Mahdal 2016-10-12 21:04:27 UTC
Tested with preupgrade-assistant-2.1.10-6.el6.  All options with default values are now correctly applied on Enter:

    [0 root@qeos-29 ~]# preupg-content-creator
    Specify the upgrade path (like RHEL6_7) where the module will be stored: RHEL6_7
    The path RHEL6_7 already exists.
    Do you want to create a module there? [Y/n]? ^C
     Content creation was interrupted by user.

    [0 root@qeos-29 ~]# rm -rf RHEL6_7
    [0 root@qeos-29 ~]# preupg-content-creator
    Specify the upgrade path (like RHEL6_7) where the module will be stored: RHEL6_7
    Specify the group name which the module belongs to [system]: 
    Specify the module name which will be created [packages]: 
    Would you like to create a BASH or Python check script? [sh/py] Bash is default. 
    Specify the script name which will be used for the assessment: [check.sh] 
    Specify the solution file which will be shown in the report: [solution.txt] 
    Specify the module title: haha
    Would you like to specify the module description? [Y/n]? 
    Write the module description: zz
    preupg-content-creator generated these files to be updated:
    - the module was created in the /root/RHEL6_7/system/packages directory.
    - the INI file which defines the module is RHEL6_7/system/packages/packages.ini.
    - the check script which provides an assessment is RHEL6_7/system/packages/check.sh. Update it before you use it.
    - the solution text which informs about incompatilibies is RHEL6_7/system/packages/solution.txt. Update it before you use it.

    For testing content run these two commands:
    - preupg-create-group-xml RHEL6_7/system/packages to create XML file
    - preupg -c RHEL6_7-results/system/packages/all-xccdf.xml
    [0 root@qeos-29 ~]# ll


The actual module content meets expectations as well:

    [0 root@qeos-29 ~]# head RHEL6_7/system/packages/*
    ==> RHEL6_7/system/packages/check.sh <==
    #!/bin/bash

    . /usr/share/preupgrade/common.sh

    #END GENERATED SECTION

    ### For more information see 'man preupg-content-creator' or 'man preupgrade-assistant-api'.


    ==> RHEL6_7/system/packages/packages.ini <==
    [preupgrade]
    check_script = check.sh
    content_description = zz
    solution = solution.txt
    content_title = haha


    ==> RHEL6_7/system/packages/solution.txt <==
    [0 root@qeos-29 ~]#

Comment 13 errata-xmlrpc 2016-11-04 08:57:20 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