Bug 1253682

Summary: [RFE] Preupgrade-assistant-tools package should provide preupg-content-creator
Product: Red Hat Enterprise Linux 6 Reporter: Petr Hracek <phracek>
Component: preupgrade-assistantAssignee: Petr Hracek <phracek>
Status: CLOSED ERRATA QA Contact: Tereza Cerna <tcerna>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 6.8CC: fkluknav, mflitter, ovasik, phracek, pstodulk, salmy, tcerna, ttomecek
Target Milestone: rcKeywords: Extras, FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: preupgrade-assistant-2.1.5-3.el6 Doc Type: Enhancement
Doc Text:
Addition of preupg-content-creator to preupgrade-assistant-tools The preupg-content-creator utility is designed to help content developers with kickstarting a new module for preupgrade-assistant. This update makes the utility available in preupgrade-assistant-tools.
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-11 08:26:12 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:

Description Petr Hracek 2015-08-14 12:52:44 UTC
Description of problem:

Nowadays users who want to create a content from scratch doesn't have a information how to do it.

It would be good to create preupg-content-creator script which will prepare a content with all needed stuff like INI file, basic check script, solution file, etc.

This script should be a part of preupgrade-assistant-tools package.

Also preupgrade-assistant-tools package could provide a set of templates and guide how to pack a content or even set of contents.

Comment 2 Petr Hracek 2015-10-07 10:24:37 UTC
Upstream finally provided a preupg-content-creator which is able to generate a content based on input.

Upstream commit is: https://github.com/phracek/preupgrade-assistant/commit/486b56091979c3f5ff9f43860a2f3530aecfd93e

Sentences which are used by preupg-content-creator are:
Specify a group name which content belongs to (like database):
Specify a module name which will be created (like mysql):
Specify a script name which will be used for assessment:
Specify a solution file which will be shown in report:
Specify a content title:
Would you like to specify a content description?
Write down a content description:
Specify a upgrade path (like RHEL6_7) where a content will be stored:
preupg-content-creator generates these files which should be updated:
- content was created in directory %s.
- ini file which defines a content is %s.
- check script which does an assessment is %s. Update it before an usage
- solution text which informs about incompatilibies is %s. Update it before an usage
File %s already exists. Do you want to replace the file?

Comment 3 Petr Hracek 2015-10-07 10:25:33 UTC
Would you please review texts mentioned in https://bugzilla.redhat.com/show_bug.cgi?id=1253682#c2

Comment 9 Tereza Cerna 2016-03-08 13:38:02 UTC
Thank you for fixing mistakes from comment#7.

1] Manual pages for preupg, preupg-content-creator and preupgrade-assistant-api are existing.

# rpm -ql preupgrade-assistant{,-tools} | grep man/
/usr/share/man/man1/preupg.1.gz
/usr/share/man/man1/preupg-content-creator.1.gz
/usr/share/man/man1/preupgrade-assistant-api.1.gz

2] Directory with content, which was stopped during creation, was deleted. There is no zombie content. Thanks.

# preupg-content-creator
Specify a upgrade path (like RHEL6_7) where a content will be stored: RHEL6_7
Path RHEL6_7 already exists.
Do you want to create a content there? ([y]/n)? y
Specify a group name which content belongs to (like database): networking
Specify a module name which will be created (like mysql): nfs
Specify a script name which will be used for assessment : (check.sh) check.sh
Specify a solution file which will be shown in report: (solution.txt) ^C
Content creation was interrupted by user.

# find RHEL6_7/
RHEL6_7/
RHEL6_7/networking

3] There are message which helps to user with testing and running newly created content.

# preupg-content-creator
...
For testing content run these two commands:
- preupg-create-group-xml RHEL6_7/networking/nfs to create XML file
- preupg -c RHEL6_7-results/networking/nfs/all-xccdf.xml

Comment 10 Tereza Cerna 2016-03-09 13:28:47 UTC
Manual test: PASS
-----------------

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

CREATE NEW CONTENT

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

preupg-content-creator generates these files which should be updated:
- content was created in directory /root/RHEL6_7/database/test-module.
- ini file which defines a content is RHEL6_7/database/test-module/test-module.ini.
- check script which does an assessment is RHEL6_7/database/test-module/check.sh. Update it before an usage
- solution text which informs about incompatilibies is RHEL6_7/database/test-module/solution.txt. Update it before an usage

For testing content run these two commands:
- preupg-create-group-xml RHEL6_7/database/test-module to create XML file
- preupg -c RHEL6_7-results/database/test-module/all-xccdf.xml

# find RHEL6_7
RHEL6_7
RHEL6_7/database
RHEL6_7/database/test-module
RHEL6_7/database/test-module/solution.txt
RHEL6_7/database/test-module/test-module.ini
RHEL6_7/database/test-module/check.sh
RHEL6_7/database/group.ini

FILL SOMETHING INTO SCRIPT CHECK.SH

# echo "exit_pass" >> RHEL6_7/database/test-module/check.sh 

CREATE XML FILE

# preupg-create-group-xml RHEL6_7/database/test-module
Generated report file for preupgrade-assistant is: RHEL6_7-results/database/test-module/all-xccdf.xml

RUN AND TEST NEW CONTENT

# preupg --help | grep "\-\-contents"
  -c CONTENTS, --contents=CONTENTS

# preupg -c RHEL6_7-results/database/test-module/all-xccdf.xml
...
Assessment of the system, running checks / SCE scripts:
001/001 ...done    (test-module)
Assessment finished (time 00:01s)
Result table with checks and their results for main contents:
--------------------------
|test-module      |pass  |
--------------------------
Tarball with results is stored here /root/preupgrade-results/preupg_results-160309043310.tar.gz .
The latest assessment is stored in directory /root/preupgrade .
Upload results to UI by command:
e.g. preupg -u http://127.0.0.1:8099/submit/ -r /root/preupgrade-results/preupg_results-160309043310.tar.gz .

-->> PASS <<--

Comment 11 Tereza Cerna 2016-04-08 13:39:32 UTC
Automated test /CoreOS/preupgrade-assistant/6to7/assistant/creation-of-new-content was created.
It tests:
 - creation of new content
 - run this content with `preupg -c`
 - copy this content to /usr/share/preupgrade/RHEL6_7 and run this content in real run

Result: PASS

# rpm -q preupgrade-assistant
preupgrade-assistant-2.1.5-1.el6.noarch

Comment 13 errata-xmlrpc 2016-05-11 08:26:12 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