Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Calling Multiple OD scripts in one .ipl
System
Hi All,
Please guide me how can I add an IF condition to the following script which calls another script upon the success of one script.
here is the snippet:
my($tmplfilePathFn)="$OD_DIR/conf/my_opendeploy_test_WITH_DD.xml";
if ( ! (-r "$tmplfilePathFn") ) {
# -- Template file can not be accessed. Call back the task. Die.
my $comment = "Can't access the OpenDeploy template file, '$tmplfilePathFn'";
callBackAndDie($task, 1, $comment);
}
my $areaPath = $workarea;
if (! $testing ) {
$areaPath = $iwmount . $workarea;
}
# The path to TeamSite Perl.
my $iwperl = TeamSite::Config::iwgethome() . "/iw-perl/bin/iwperl";
my $deploy_cmd = "$iwperl $OD_DIR/solutions/perl/iwodstart.ipl my_opendeploy_test_WITH_DD -k area=$areaPath -k filelist=$filelist -k useNode=$useNode -k targetArea=$targetArea -inst $taskid ";
debug("$dbgInfo","deploy_cmd = '$deploy_cmd'\n");
my $resultsfile= "$iwhome/tmp/results.$wfid";
my $results = `$deploy_cmd > $resultsfile`;
open (RESULTS, "<$resultsfile");
while (<RESULTS>)
{
$results .= $_;
}
close RESULTS;
unlink($resultsfile);
$results =~ s|\n||;
debug("$dbgInfo", "results = '$results'\n");
my $comment;
if ($results =~ m|Status: Completed|)
{
$callback_result = 0;
$comment = " OpenDeploy SUCCESS.\n";
debug("$dbgInfo","$comment");
}
elsif ($results =~ m|Status: Failed|)
{
$callback_result = 1;
$comment = " OpenDeploy FAILED.\n";
debug("$dbgInfo","$comment");
}
else
{
$callback_result = 1;
$comment = " OpenDeploy Status Unknown. FAILED.\n";
debug("$dbgInfo","$comment");
}
.
.
.
.
the requirement:
Upon the succesful deployment of my_opendeploy_test_WITH_DD.xml another script called my_opendeploy_test_WITH_DD.xml should be called.
Your earliest help is highly appreciated.
Thanks in Advance.
Find more posts tagged with
Comments
Adam Stoller
I'm not sure I understand what issue you are having, but based on the code you posted, I have some comments - interspersed (several of which I've posted several times recently):
...
my $results = `$deploy_cmd > $resultsfile`;
my $results;
my $status = system("$deploy_cmd > $resultsfiles 2>&1");
open (RESULTS, "<$resultsfile");
while (<RESULTS>)
{
$results .= $_;
}
close RESULTS;
unlink($resultsfile);
if (open(RESULTS, "<$resultsfile")){
local $/;
$results = <RESULTS>;
close(RESULTS);
unlink($resultsfile);
}
else {
# report error and abort?
}
$results =~ s|\n||;
# no-need
debug("$dbgInfo", "results = '$results'\n");
my $comment;
if ($results =~ m|Status: Completed|)
{
$callback_result = 0;
$comment = " OpenDeploy SUCCESS.\n";
debug("$dbgInfo","$comment");
}
elsif ($results =~ m|Status: Failed|)
{
$callback_result = 1;
$comment = " OpenDeploy FAILED.\n";
debug("$dbgInfo","$comment");
}
else
{
$callback_result = 1;
$comment = " OpenDeploy Status Unknown. FAILED.\n";
debug("$dbgInfo","$comment");
}
if ($status || $results =~ /(Failed||ERROR)/s){
$calback_result = 1;
$comment = " OpenDeploy FAILED.\n";
debug("$dbgInfo", "$comment$results");
}
else {
$callback_result = 0;
$comment = " OpenDeploy SUCCESS.\n";
debug("$dbgInfo", "$comment");
}
Think about the above changes. Then, see if you can explain in more detail what issue you are trying to solve if the above doesn't resolve it for you.
--fish
(Interwoven Senior Technical Consultant)