Patching Job Automation and RPM rollback

Version 1

    This script automates running Patch Analysis Jobs and getting the results back.  In BSA 8.0 and 8.1 it can be used to call a Patching Job from a Batch Job and wait for the deploys to return.  In 8.2+ that is built in.  This can also be used to get a single aggregated email of results of the analysis and deploy jobs as well as relevant log files if the deploy fails.


    Additionally this can be used to allow RPM rollback on RedHat 5 with the use of the 'repackage' flag to yum.  This will not work with RedHat 6


    To install, get creds with blcred, run the 'install.nsh' with this script in the same directory like:

    nsh install.nsh <profile> <roleName>


    Usage: usage -d <level> --P <blProfile> -R <blRole>

    -d    <debug level>        Debug Log output, level 0-5.  Should be first option (int)

    -R    <blRole>             BladeLogic RBAC Role to authenticate as

    -P    <blProfile>           BladeLogic Authentication profile to authenticate as

    -j     <fqPatchJobName>    Fully qualified path of the patching job to run

    -o    <resultTo>            Email address to send rollup of deploy job status to

    -s    <targetServerList>    List of servers for adhoc run of patching job

    -t    <templateDeployJob> Template Deploy job for remediation job

    -b    <parent group>        Parent Depot Group to store blpackages in

    -g    <parent group>        Parent Job Group to store deploy jobs in

    -p    <per Server>        Create a single deploy job per server

    -r    <rpm rollback>        Make modifications to allow for rpm rollback

    -e    <fqRemJobname>        Fully qualified path of a remediation job to process results


    Script Modes are:

    useLatestRunForResult     -    Uses the latest job run and gets the result of all patching and deploy jobs.

                                   If the job was not an auto-remediate job you must pass the fully qualified

                                    path to the remediation job with the -e argument

    useLatestRunForGenerate     -     Uses the latest patching job result to generate deploy jobs

    useLatestRunForDeploy       -    Uses the latest patching job result to generate and run the deploy, cannot be

                                    passed a template job

    runPatchingJobForResult     -     Runs just the patching job and gets the result, no generate or deploy

    runPatchingJobForGenerate -    Runs the patching job and generates deploy jobs

    runPatchingJobForDeploy    -     Runs the patching job, generates the deploy and runs them



    For the RPM Rollback option (RedHat 5 only), you must put the line 'tsflags=repackage' in the NSH/share/patch/linux/

    file on all applicaiton servers, you can put it after the 'bootloader=1' line in that file.



    This is an extension of Patch Analysis Auto Remediation in a Batch Job Workaround