IBM Support

How can the active OSLC configuration settings be refreshed on all servers in a load balanced ClearQuest environment?

Question & Answer


Question

How can the active OSLC configuration settings be refreshed on all servers in a load balanced ClearQuest environment?

Answer

In a load balanced ClearQuest environment that uses OSLC, configuration changes must be shared across all ClearQuest servers. However, when a configuration change is made, the change is initially visible only to the specific ClearQuest server that processed the change. For the load balanced environment to function as intended, the configuration change must be propagated to all ClearQuest Web servers in the environment. This update can be accomplished by logging into each ClearQuest server to refresh the settings.

You have the option to log into each server manually, or run an automated script that logs into each server. The following example provides a basic template for a Perl script that logs in and out. This script can be run after updating the configuration on any ClearQuest Web server in a load-balanced environment.


...


@servers = ('https://<lb.server.1>:9443' , 'https://<lb.server.2>:9443');
...
foreach(@servers){
...
$get_request = HTTP::Request->new(GET => $_.'/cqweb/oslc/repo/8.0.0/db/SAMPL'.'/refreshRepoConfig');
$get_request->authorization_basic($userName, $password);
$get_response = $user_agent->request($get_request);
...
$delete_request = HTTP::Request->new(DELETE => $_.'/cqweb/oslc/session');
$delete_request->header('OSLC-Core-Version'=>'2.0');
$delete_request->header(Cookie=>$jsession_id);
$delete_response = $user_agent->request($delete_request);
}

Internal Use Only

Here's the complete PERL script that refreshes the data:



#!/opt/rational/clearquest/bin/cqperl

# MODIFY THESE FOR YOUR ENVIRONMENT
$dbset='SQL_10';
$userdb='IMPTS';
@servers = ('https://rhel63-32b:9443' , 'https://lbcqweb.ibm.com:9443');

if($#ARGV != 1){
print 'usage: scriptname CQ_userName CQ_userPassword';
exit;
}

$userName=$ARGV[0];
$password=$ARGV[1];

use Net::SSL;
use LWP::UserAgent;
use Mozilla::CA;
#$ENV{HTTPS_DEBUG} = 1;
$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;
$user_agent = new LWP::UserAgent;
$user_agent->ssl_opts( SSL_ca_file => Mozilla::CA::SSL_ca_file() );

$get_suffix = '/cqweb/oslc/repo/'.$dbset.'/db/'.$userdb.'/refreshRepoConfig';
$delete_suffix = '/cqweb/oslc/session';

print "\n===Starting to update configurations===\n";
foreach(@servers){
$get_url = $_.$get_suffix;
$delete_url = $_.$delete_suffix;

$get_request = HTTP::Request->new(GET => $get_url);
$get_request->authorization_basic($userName, $password);
$get_response = $user_agent->request($get_request);
if($get_response->is_success){
print "\n".$_." configuration updated \n";
$set_cookie_header = $get_response->header('Set-Cookie');
$jsession_id = &parse_jsessionid($set_cookie_header);
if($jsession_id){
$delete_request = HTTP::Request->new(DELETE => $delete_url);
$delete_request->header('OSLC-Core-Version'=>'2.0');
$delete_request->header(Cookie=>$jsession_id);
$delete_response = $user_agent->request($delete_request);
if($delete_response->is_success){
print $_." session released\n";
}else{
print 'Error releasing session: '.$_.': '.$delete_response->status_line."\n";
}
}else{
print "The JSESSIONID could not be found in the GET response. This should not happen.\n Server: ".$_;
}
}else{
print 'Error: '.$_.': '.$get_response->status_line."\n";
print ' '.$get_response->as_string."\n";
}
}
print "\n===Finished updating configurations===\n\n";

sub parse_jsessionid{
my @split_set_cookie_header = split(/;/, $_[0]);
my $jsession_id;
foreach(@split_set_cookie_header){
if($_ =~ /JSESSIONID=(.+)/){
$jsession_id=$_;
last;
}
}
$jsession_id;
}

[{"Product":{"code":"SSSH5A","label":"Rational ClearQuest"},"Business Unit":{"code":"BU004","label":"Hybrid Cloud"},"Component":"--","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"8.0.1.1","Edition":""}]

Document Information

Modified date:
16 June 2018

UID

swg21644559