Unsupported content

 

This version of the documentation is no longer supported. However, the documentation is available for your convenience. You will not be able to leave comments.

How to get the VPC to recognize non supported RPM-based Distros

This topic was edited by a BMC Contributor and has not been approved.  More information.

This has been tested in the 7.6.0 VPC and tested on later application server versions.  In 8.x the VPC has been removed for Linux patching, as RedHat, SLES and OEL support was rolled into the product as Patch Catalogs.  However, these catalogs are inflexible and will not work with distros like CentOS, Fedora. OpenSuSE or any other RPM-based distro.  While these distros are typically unsupported by the RSCD agent, the agent typically functions OK.

The examples below cover modifying the VPC for CentOS, but a similar procedure should work for other distros.

This is completely unsupported by BMC.  It is recommended that you make backups of any files that you are making changes to and systems that you are going to test this on. You may not be able to get this to work.  

Overview

We need to do two main things here. We need to tell the VPC how to identify the distro (CentOS), and we need to tell the VPC how to get the version or release of the distro. Luckily, this information is stored in a text file that is consistent for each distro. This is how the VPC figures out that RHEL is RHEL and SuSE is SuSE.  For 8.x application servers we need to install the VPC and then add the Linux VPC bits back, and they will use the common VPC framework that the VPC Installer lays down.

Install the VPC

On 7.6 install the VPC and the latest VPC patch normally.  You must install the perl-XML-Parser module on the application server and the RedHat helper system (where the repo is kept).  Also, java must be installed on your helper system.  The openjdk that ships with RHEL 5 is fine.

8.x VPC 

Installation

  1. On 8.x, install the VPC and choose 'HP-UX'.  Let the installer finish. 
  2. Apply the latest VPC patch.
  3. Grab the 7.6 VPC and 7.6 VPC hotfixes.
  4. In the patch-content directory, unzip the patchanalysis.zip file.
  5. Copy the linuxpu directory to the 8.x VPC install path, eg /opt/bmc/BladeLogic/8.1/NSH/patch
  6. Unzip the 7.6 VPC Hotfix into a temporary directory. Copy any files in the linuxpu directory to the 8.x VPC install path (overwriting what you just extracted from the 7.6 VPC)
  7. Copy the SupportFiles/RedHatRepositoryManager.zip file to the SupportFiles directory in the install path, eg_ /opt/bmc/BladeLogic/8.1/NSH/patch/SupportFiles_
  8. On UNIX, run the command chown -R bladmin:bladmin /opt/bmc/BladeLogic/8.0/NSH/patch/linuxpu

8.x VPC File Modifications

Comment out any lines in the following files that contain blcli.setAuthenticationType("BLSSO") or jli.setAuthenticationType("BLSSO") or_ jli.setAppServerHost(appserver)_ or blcli.setAppServerHost(hostname)

  • linuxpu/Scripts/Jython/linux-analysis.py
  • linuxpu/Scripts/Jython/get_blds_path.py
  • linuxpu/Scripts/Jython/loadAndDeployPatches.jli

In 8.1 and beyond, update the java class paths that are referenced in the following files:

  • linuxpu/Scripts/Jython/solpatch.py
  • linuxpu/Scripts/Jython/sharedPayload.py
  • linuxpu/Scripts/Jython/linux-analysis.py

For example, we find com.bladelogic.shared.comm in the linuxpu/Scripts/Jython/solpatch.jy.  We need to change that to:  com.bladelogic.om.infra.shared.comm.  Insert a om.infra after any occurance of com.bladelogic.

Change the bl_yum="/opt/bladelogic/blyum" line in linuxpu/Work/linux-anayze.sh and linuxpu/Work/linux-deploy.sh to:

bl_yum="`cat /usr/lib/rsc/HOME`/bin/blyum"

Common File Modifications

There are 3 files to modify here:

  • <OM>/patch/linuxpu/Scripts/Perl/linuxpc.pl
  • <OM>/patch/linuxpu/Scripts/Jython/linux-analysis-py
  • <OM>/patch/linuxpu/Work/linux-analyze.sh

linuxpc.pl

In the linuxpc.pl file find the section around line 700 that looks like:

if ( !( system_cmd("nexec $host 'sh -c \"test -f $redhat_relfile\"'") ) )
{
$os_vendor = "redhat";
$os_rel_file = $redhat_relfile;
}

if ( !( system_cmd("nexec $host 'sh -c \"test -f $suse_relfile\"'") ) )
{
$os_vendor = "suse";
$os_rel_file=$suse_relfile;
}

We need to tell the VPC how to figure out that this is CentOS. This can be done with an nexec to look for a particular RPM that should only exist on a CentOS system. The new section looks like:

if ( !( system_cmd("nexec $host 'sh -c \"test -f $redhat_relfile\"'") ) )
{
$os_vendor = "redhat";
$os_rel_file = $redhat_relfile;
}

if ( !( system_cmd("nexec $host 'sh -c \"test -f $suse_relfile\"'") ) )
{
$os_vendor = "suse";
$os_rel_file=$suse_relfile;
}

if ( !( system_cmd("nexec $host 'sh -c \"rpm -q centos-release\"'") ) )
{
$os_vendor = "cent";
$os_rel_file=$redhat_relfile;
}

Next we need to tell the VPC how to figure out the release of CentOS. Around line 720 there is a section that reads the version out of the /etc/redhat-release file. The CentOS file is in a different order than RedHat so we need to pull the release number from a different location in the line. The original section looks like this:

my @a = split( " ", $os_relstring );
if($os_vendor eq "redhat"){
$os_version = $a[6];
}elsif($os_vendor eq "suse") {
$os_version = $a[4];
}

$os_version=~s/.//gi;
$os_version =~ s/AS//g;

The modified version looks like this:

my @a = split( " ", $os_relstring );
if($os_vendor eq "redhat"){
$os_version = $a[6];
}elsif($os_vendor eq "suse") {
$os_version = $a[4];
}elsif($os_vendor eq "cent") {
$os_version = $a[2];
$os_version = int $os_version;
}

$os_version=~s/..*//gi;
$os_version =~ s/AS//g;

We're pulling the version from the 3rd position (array position 0 is the 1st position) here instead of the 7th or 4th.

The last modification is done to pull the name of the distribution from the /etc/redhat-release file. The original code block around line 770 looks like this:

if($os_relstring=~/Red Hat Linux Advanced Server release/gi){
$os_relstring='RHAS';
}elsif($os_relstring=~/Red Hat Enterprise Linux ES release/gi){
$os_relstring='RHES';
}elsif($os_relstring=~/Red Hat Enterprise Linux Server release/gi){
$os_relstring='RHES';
}elsif($os_relstring=~/SUSE LINUX Enterprise Server/gi){
$os_relstring='SLES';
}elsif($os_relstring=~/Red Hat Enterprise Linux AS release/gi){
$os_relstring='RHAS';
}elsif($os_relstring=~/Enterprise Linux Enterprise Linux AS release/gi){
$os_relstring='OELAS';
}elsif($os_relstring=~/Enterprise Linux Enterprise Linux Server release/gi){
$os_relstring='OELES';
}else{
display_err("($host) Unsupported Linux Release $os_relstring");
display_err("($host) Skipping this host");
print "($host) Exit Code 1n";
return 0;
}

We need to add a new section for CentOS based on the /etc/redhat-release file. The file contains something like

CentOS release 5.2 (Final)

so the 'release string' should be 'CentOS release'. The new section looks like:

...
}elsif($os_relstring=~/Enterprise Linux Enterprise Linux AS release/gi){
$os_relstring='OELAS';
}elsif($os_relstring=~/Enterprise Linux Enterprise Linux Server release/gi){
$os_relstring='OELES';
}elsif($os_relstring=~/CentOS release/gi){
$os_relstring='COS';
}else{
display_err("($host) Unsupported Linux Release $os_relstring");
display_err("($host) Skipping this host");
print "($host) Exit Code 1n";
return 0;
}

Note: In 7.6, after you modify this file, you must overwrite the file in the Depot with this file. You can copy it over the file in <FS>/storage/scripts or you can cut and paste the contents into the file in the CM GUI.  In 8.x we will be adding this to the depot later so you do not need to do anything yet.

linux-analysis.py

In this file we need to do something similar to what we did in the perl script above. First is the distribution name around line 450:

if os_relstr.count('Enterprise Linux Enterprise Linux Server release'):
os_release='OELES';

if not os_release:
print_error('Cannot resolve OS Release from /etc/redhat-release on host %s' %host)

We only need to add a line for CentOS:

if os_relstr.count('Enterprise Linux Enterprise Linux Server release'):
os_release='OELES';
if os_relstr.count('CentOS release'):
os_release='COS';

if not os_release:
print_error('Cannot resolve OS Release from /etc/redhat-release on host %s' %host)

Then we need to handle the version around line 460:

temp = os_relstr.split(' ')
if os_release == 'SLES': ver_indx = 4
else: ver_indx = 6

os_version = temp[ver_indx].strip()

if not os_version:
print_error('Cannot resolve OS Version from /etc/redhat-release on host %s' %host)
print_error('Skipping host %s' %host)

With the CentOS check, it looks like:

temp = os_relstr.split(' ')
if os_release == 'SLES': ver_indx = 4
if os_release == 'COS': ver_indx = 2
else: ver_indx = 6

os_version = temp[ver_indx].strip()
os_version = os_version.split(".")[0]

if not os_version:
print_error('Cannot resolve OS Version from /etc/redhat-release on host %s' %host)
print_error('Skipping host %s' %host)

In 8.2 you need to modify a blcli call as a command was removed.  Around line 230 find:

ret = blcli.run(['Job', 'getAssociatedInstanceBean'])
if not ret.success():
sys.stderr.write(str(ret.getError())+"\n")
sys.exit(1)
job_timeout = ret.returnValue.getFullyResolvedPropertyValueAsString('JOB_TIMEOUT')
job_part_timeout = ret.returnValue.getFullyResolvedPropertyValueAsString('JOB_PART_TIMEOUT')
job_timeout = str(int(job_timeout)*timeout_percentage/100)
job_part_timeout = str(int(job_part_timeout)*timeout_percentage/100)

change this to

job_timeout = blcli.run(['Job', 'getPropertyValueAsString', 'JOB_TIMEOUT']).returnValue
job_part_timeout = blcli.run(['Job', 'getPropertyValueAsString', 'JOB_PART_TIMEOUT']).returnValue
job_timeout = str(int(job_timeout)*timeout_percentage/100)
job_part_timeout = str(int(job_part_timeout)*timeout_percentage/100)

linux-analyze.sh

Again, we need to identify the CentOS name. Around line 145 we have:

release="RHAS"
return 0
fi

echo "$os_rel_str" | grep -qi "Enterprise Linux Enterprise Linux Server release"
if ["$?" "0"]; then
release="RHES"
return 0
fi

return 1
}

This needs an addition:

release="RHAS"
return 0
fi

echo "$os_rel_str" | grep -qi "Enterprise Linux Enterprise Linux Server release"
if ["$?" h1. "0"]; then
release="RHES"
return 0
fi

echo "$os_rel_str" | grep -qi "CentOS release"
if ["$?" "0"]; then
release="COS"
return 0
fi

return 1
}

linuxrepo.conf

The new shorthand identifier we've chosen is COS. Therefore in the linuxrepo.conf we should have a line like:
cos5=//blapp/u01/patch/cos53,COS5x86
That creates a repo tag for CentOS 5, stored in /u01/patch/cos53 on the server named 'blapp' for the x86 architecture. For x86_64 you would have something like:

cos5x64=//blapp/u01/patch/cos53,COS5x86_64

Creating NSH Scripts and NSH Script Jobs for 8.x

In the BMC Server Automation Workspace, create folders for the Linux VPC.  You should already have folders for HPUX or AIX depending on what was installed as required previously.  You can do this manually, or use this script:

#!/bin/nsh

blcli_setoption serviceProfileName defaultProfile
blcli_setoption roleName BLAdmins
blcli_connect

if [ `uname -s` = "WindowsNT" ]
then
RSC="/C/Windows/rsc/HOME"
else
RSC="/usr/lib/rsc/HOME"
fi
scriptLocation="`cat ${RSC}`/patch"

createDepotFolders()
{
# Depot Folders
blcli_execute DepotGroup createGroupWithParentName "Linux Patch Analysis" "/Patch Analysis Items"
blcli_execute DepotGroup addPermission "/Patch Analysis Items/Linux Patch Analysis" "Everyone" 'DepotFolder.*'
blcli_execute DepotGroup createGroupWithParentName "Patches" "/Patch Analysis Items/Linux Patch Analysis"
blcli_execute DepotGroup addPermission "/Patch Analysis Items/Linux Patch Analysis/Patches" "Everyone" 'DepotFolder.*'
blcli_execute DepotGroup createGroupWithParentName "BLPackages" "/Patch Analysis Items/Linux Patch Analysis/Patches"
blcli_execute DepotGroup addPermission "/Patch Analysis Items/Linux Patch Analysis/Patches/BLPackages" "Everyone" 'DepotFolder.*'
blcli_execute DepotGroup createGroupWithParentName "Scripts" "/Patch Analysis Items/Linux Patch Analysis"
blcli_execute DepotGroup addPermission "/Patch Analysis Items/Linux Patch Analysis/Scripts" "Everyone" 'DepotFolder.*'
}

createJobFolders()
{
# Job Folders
blcli_execute JobGroup createGroupWithParentName "Linux Patch Analysis" "/Patch Analysis Jobs"
blcli_execute JobGroup addPermission "/Patch Analysis Jobs/Linux Patch Analysis" "Everyone" 'JobFolder.*'
blcli_execute JobGroup createGroupWithParentName "Patch Analysis Jobs" "/Patch Analysis Jobs/Linux Patch Analysis"
blcli_execute JobGroup addPermission "/Patch Analysis Jobs/Linux Patch Analysis/Patch Analysis Jobs" "Everyone" 'JobFolder.*'
blcli_execute JobGroup createGroupWithParentName "Patch Deploy Jobs" "/Patch Analysis Jobs/Linux Patch Analysis"
blcli_execute JobGroup addPermission "/Patch Analysis Jobs/Linux Patch Analysis/Patch Deploy Jobs" "Everyone" 'JobFolder.*'
blcli_execute JobGroup createGroupWithParentName "Deploy" "/Patch Analysis Jobs/Linux Patch Analysis/Patch Deploy Jobs"
blcli_execute JobGroup addPermission "/Patch Analysis Jobs/Linux Patch Analysis/Patch Deploy Jobs/Deploy" "Everyone" 'JobFolder.*'
}

createNSHScript()
{
# NSH Scripts
blcli_execute NSHScript addNSHScriptToDepotByGroupName "/Patch Analysis Items/Linux Patch Analysis/Scripts" 3 "${scriptLocation}/linuxpu/Scripts/Perl/linuxpc.pl" "Linux Patch Analysis" "Linux Patch Analysis"
}

setScriptOptions()
{
# NSH Scripts Options
blcli_execute NSHScript addNSHScriptParameterByGroupAndName "/Patch Analysis Items/Linux Patch Analysis/Scripts" "Linux Patch Analysis" "hosts" "Target servers to analyze" "f" "%f" "3"
blcli_execute NSHScript addNSHScriptParameterByGroupAndName "/Patch Analysis Items/Linux Patch Analysis/Scripts" "Linux Patch Analysis" "local directory" "Scripts directory" "w" "${scriptLocation}/linuxpu/Work" "7"
blcli_execute NSHScript addNSHScriptParameterByGroupAndName "/Patch Analysis Items/Linux Patch Analysis/Scripts" "Linux Patch Analysis" "Linux Patch Repository" "Linux Patch Repository" "l" "UPDATE-AFTER-INSTALL" "7"
blcli_execute NSHScript addNSHScriptParameterByGroupAndName "/Patch Analysis Items/Linux Patch Analysis/Scripts" "Linux Patch Analysis" "Analysis Type" "Analysis Type. Default to repo" "a" "repo" "7"
blcli_execute NSHScript addNSHScriptParameterByGroupAndName "/Patch Analysis Items/Linux Patch Analysis/Scripts" "Linux Patch Analysis" "script mode" "ap- for Analysis and Packaging and Creation of deploy jobs, a - for only analyis and p - for Only Packaging and delpoy job creation" "m" "ap" "7"
blcli_execute NSHScript addNSHScriptParameterByGroupAndName "/Patch Analysis Items/Linux Patch Analysis/Scripts" "Linux Patch Analysis" "Depot Patch Folder Name" "Depot Patch Folder Name to store patches" "D" "/Patch Analysis Items/Linux Patch Analysis/Patches" "7"
blcli_execute NSHScript addNSHScriptParameterByGroupAndName "/Patch Analysis Items/Linux Patch Analysis/Scripts" "Linux Patch Analysis" "Deploy Job Folder Name" "Deploy Job Folder Name to store Deploy Jobs" "J" "/Patch Analysis Jobs/Linux Patch Analysis/Patch Deploy Jobs" "7"
blcli_execute NSHScript addNSHScriptParameterByGroupAndName "/Patch Analysis Items/Linux Patch Analysis/Scripts" "Linux Patch Analysis" "Package exclude file" "NSH path to file (one package name per line) of packages to exclude from analysis." "e" "" "5"
blcli_execute NSHScript addNSHScriptParameterByGroupAndName "/Patch Analysis Items/Linux Patch Analysis/Scripts" "Linux Patch Analysis" "URL_TYPE" "URL Type" "T" "AGENT_COPY_AT_STAGING" "7"
blcli_execute NSHScript addNSHScriptParameterByGroupAndName "/Patch Analysis Items/Linux Patch Analysis/Scripts" "Linux Patch Analysis" "Network URL" "ftp/http URLs to the yummified Patch Repository" "U" "" "5"
blcli_execute NSHScript addNSHScriptParameterByGroupAndName "/Patch Analysis Items/Linux Patch Analysis/Scripts" "Linux Patch Analysis" "Policy Name" "Policy Name" "P" "Linux Patch Analysis" "7"
blcli_execute NSHScript addNSHScriptParameterByGroupAndName "/Patch Analysis Items/Linux Patch Analysis/Scripts" "Linux Patch Analysis" "Debug Mode" "Debug Mode (0/1)" "d" "0" "7"
blcli_execute NSHScript addNSHScriptParameterByGroupAndName "/Patch Analysis Items/Linux Patch Analysis/Scripts" "Linux Patch Analysis" "Auto-Execute Deploy Batch Job" "Enable/disable Auto-Execute Deploy Batch Job." "X" "0" "7"
blcli_execute NSHScript addNSHScriptParameterByGroupAndName "/Patch Analysis Items/Linux Patch Analysis/Scripts" "Linux Patch Analysis" "Multi Data Store mode" "Enable/Disable Multi Data Store mode(0/1)" "b" "0" "7"
blcli_execute NSHScript addNSHScriptParameterByGroupAndName "/Patch Analysis Items/Linux Patch Analysis/Scripts" "Linux Patch Analysis" "Shared Payload mode" "Enable/Disable Shared Payload mode(0/1)" "S" "0" "7"
blcli_execute NSHScript addNSHScriptParameterByGroupAndName "/Patch Analysis Items/Linux Patch Analysis/Scripts" "Linux Patch Analysis" "Max number of targets to process in parallel per platform" "Max number of targets to process in parallel per platform" "p" "10" "7"
blcli_execute NSHScript addNSHScriptParameterByGroupAndName "/Patch Analysis Items/Linux Patch Analysis/Scripts" "Linux Patch Analysis" "Update only flag" "Update only flag" "u" "1" "7"
blcli_execute NSHScript addNSHScriptParameterByGroupAndName "/Patch Analysis Items/Linux Patch Analysis/Scripts" "Linux Patch Analysis" "Errata Based Analysis" "Errata Based Analysis" "E" "0" "7"
}

createScriptJob()
{
# NSH Script Job
blcli_execute NSHScriptJob createNSHScriptJob "/Patch Analysis Jobs/Linux Patch Analysis/Patch Analysis Jobs" "Linux Patch Analysis Job" "Linux Patch Analysis" "/Patch Analysis Items/Linux Patch Analysis/Scripts" "Linux Patch Analysis" "`hostname`" 30
blcli_execute NSHScriptJob getDBKeyByGroupAndName "/Patch Analysis Jobs/Linux Patch Analysis/Patch Analysis Jobs" "Linux Patch Analysis Job"
blcli_storeenv jobKey
blcli_execute Job clearTargetServers ${jobKey}
blcli_execute NSHScriptJob createNSHScriptJob "/Patch Analysis Jobs/Linux Patch Analysis" "Apply Return Codes" "Apply Return Codes" "/Patch Analysis Items" "Apply Return Codes" "`hostname`" 30
blcli_execute NSHScriptJob getDBKeyByGroupAndName "/Patch Analysis Jobs/Linux Patch Analysis" "Apply Return Codes"
blcli_storeenv jobKey
blcli_execute Job clearTargetServers ${jobKey}
}

setJobOptions()
{
# NSH Script Options
blcli_execute NSHScriptJob addNSHScriptParameterValueByGroupAndName "/Patch Analysis Jobs/Linux Patch Analysis" "Apply Return Codes" 1 "Linux"
blcli_execute NSHScriptJob addNSHScriptParameterValueByGroupAndName "/Patch Analysis Jobs/Linux Patch Analysis" "Apply Return Codes" 2 "/Patch Analysis Items/Linux Patch Analysis/Patches"
blcli_execute NSHScriptJob addNSHScriptParameterValueByGroupAndName "/Patch Analysis Jobs/Linux Patch Analysis" "Apply Return Codes" 3 "%f"
}

createEO()
{
blcli_execute ExtendedObjectClass createExtendedObject "Linux Patch Analysis Results" "Linux Patch Analysis" "perl \"${scriptLocation}/linux_cust.pl\" '??TARGET.NAME??'" csv.gm Linux false
}

createDepotFolders
createJobFolders
createNSHScript
setScriptOptions
createScriptJob
setJobOptions
createEO

Workspace Folders

Depot:

  • /Patch Analysis Items/Linux Patch Analysis
  • /Patch Analysis Items/Linux Patch Analysis/Patches
  • /Patch Analysis Items/Linux Patch Analysis/Patches/BLPackages
  • /Patch Analysis Items/Linux Patch Analysis/Scripts

Jobs:

  • /Patch Analysis Jobs/Linux Patch Analysis
  • /Patch Analysis Jobs/Linux Patch Analysis/Patch Analysis Jobs
  • /Patch Analysis Jobs/Linux Patch Analysis/Patch Deploy Jobs
  • /Patch Analysis Jobs/Linux Patch Analysis/Patch Deploy Jobs/Deploy

NSH Script and Script Job Creation

  • Create a new NSH Script object in the Depot Workspace /Patch Analysis Items/Linux Patch Analysis/Scripts named Linux Patch Analysis using the linuxpc.pl script.
  • This should be a Type 4 script (Execute the script using the PERL interpreter...)
  • Create the following options on the nsh script    
    • The -w option should match your install directory
    • The -l option should contain the repositories defined in the linuxrepo.conf file
    • The -P option should be the "Policy Name" that you want to show up in Reporting.

Extended Object

To view the VPC results, you must manually create the Extended Object in the Configuration Object Dictionary.

  • Change the path to match your particular installation path.

Create the Repository

Getting the files

The RedHatDownload Manager will not download CentOS or other RPMS. It will however yummify the repositories just fine.

There are some options to download the repos:

Yummify the Repo

Copy the RedhatRepositoryManager.zip from the <install>/patch/SupportFiles directory to your RedHat helper system.  Extract this somewhere on the system.  Make sure your java executable is in your path.

After you download the repos you must run the RedHatRepositoryManager -yummifyrepo against the repo, the VPC creates its own custom metadata files that are separate from the standard files that createrepo generates (they are named differently but contain the same content).  For example if your repository is stored in /u01/patch/cos53 you would runRedHatRepositoryManager -yummifyrepo -repoLocation /u01/patch/cos53.

Was this page helpful? Yes No Submitting... Thank you

Comments