preupgrade-assistant-api(1)

NAME
preupgrade-assistant-api - The Preupgrade Assistant API provides a set of functions and variables which can be used for creating modules.

AVAILABLE FUNCTIONS
API provides a set of functions which can be used for better handling of your data. check_applies_to - The function can be used to detect a specific RPM package. If the RPM package does not exist, check the script exit with the exit_not_applicable return code. backup_config_file - The function backs up a config file to the /root/preupgrade directory. service_is_enabled - The function checks if the service provided by the chkconfig command is enabled.

COMMON_DATA
There are several log files gathered before the assessment: $VALUE_RPM_QA - all packages with RSA HEADER and php signature $VALUE_ALL_CHANGED - all changed package files $VALUE_CONFIGCHANGED - all changed configuration files $VALUE_RPM_RHSIGNED - all RPM Packages signed by Red Hat $VALUE_PASSWD - a file with all users $VALUE_GROUP - a file with all groups $VALUE_CHKCONFIG - a file with the chkconfig output $VALUE_TPM_PREUPGRADE - a directory used for storing your data (such as Kickstart and postupgrade.d directories) $VALUE_ALLMYFILES - all local files $VALUE_EXECUTABLES - all executables files $MIGRATE - set to 1 if the migration mode is specified by the module $UPGRADE - set to 1 if the upgrade mode is specified by the module There are several directories located in /root/preupgrade which are used by the preupg command kickstart - used for the Kickstart generation. etc - stored configuration files copied by modules. postupgrade.d - stored scripts which are executed after the upgrade. preupgrade-scripts - stored scripts which are executed before the upgrade. common - the results of long term commands gathered before the assessment

RETURN CODES
exit_pass - The test passed. Used if nothing "broken" was detected. exit_not_applicable - The rule did not apply to the test target (e.g., the package is not installed). exit_informational - The rule was evaluated by the checking engine but is not to be scored. Ideal for informational results, which have a "migration guide" chapter style. exit_fixed - The rule failed but was fixed later. Ideal if you automatically fixed some configuration file/incompatibility. No manual review is expected but the user should be notified.. exit_error - An error occurred and the test could not be completed because the script failed while doing its job. Should be used in an "assert way", not as a common result. exit_fail - The test failed. Moving to a new release with this configuration will result in malfunction. Use when you expect some action from the user - when the migration solution was not completed automatically. Your script should also tell the administrator how risky it is to upgrade your component. This can be done with api functions log_{slight,medium,high,extreme}_risk.

AVAILABLE RETURN CODES IN REPORTS
pass - The same as in RETURN CODES not_applicable - The rule did not apply to the test target (e.g., the package is not installed). informational - The rule was evaluated by the checking engine, but is not to be scored. Ideal for informational results, which have a "migration guide" chapter style. fixed - The rule failed but was fixed later. Ideal if you automatically fixed some configuration file/incompatibility. No manual review is expected but the user should be notified. error - An error occurred and the test could not be completed because the script failed while doing its job. Should be used in an "assert way", not as a common result. needs_inspection - The test failed with the exit_fail return code but the module developer added one of these logs (log_{slight|medium}_risk before exit_fail. needs_action - The test failed with the exit_fail return code but the module developer added the log_high_risk before exit_fail. fail - The test failed. The in-place upgrade is not recommended and marked as an EXTERME risk.

RISK ASSESSMENT LEVELS
The available risk assessment levels are: Slight - We assessed this field and have not found any issues. However, there is still a risk that not all variants have been covered. Medium - It is likely that the area will cause a problem in case of the in-place upgrade. It needs to be checked by the administrator after the in-place upgrade and after the system has been monitored for some time. High - The in-place upgrade cannot be used without the administrator's assistance. This typically involves some known broken scenario, existing 3rd party packages. After the administrator manually fixes the issue, it may be possible to perform the in-place upgrade, but it is not recommended. Extreme - We found an incompatibility which makes the in-place upgrade impossible. It is recommended to install a new system with the help of the Preupgrade Assistant remediations. The levels None, Slight and Medium change return code exit_fail to exit_needs_inspection. The level High changes exit_fail to exit_needs_action.

LOGGING
There are several functions which do logging: log_{debug,info,warning,error} <message> The function creates logs in the format: <SEVERITIES> <TIMESTAMP> <MESSAGE>

INI FILE EXAMPLE
Ini file example
 [preupgrade]
 content_title: <a title>
 content_description: <a description of the module>
 author: <the author's name and email>
 applies_to: <a package name (RPM) which is tested>

AUTHORS
Petr Hracek, <phracek@redhat.com> (man page)