<externaltask name="Deployment" owner = "__INSERT__($jobOwner);" description="Deployment To Webserver" > <areavpath v = "__INSERT__($vpath);"/> <successors> <successorset description = "Successful deployment to Webserver"> <succ v = "End Task"/> </successorset> <successorset description="Deployment Error"> <succ v="Fix Deployment Problem"/> </successorset> </successors> <command v="__INSERT__($deploy_cmd); __TAG__('iw_deploy_to');"/></externaltask>
iw_deploy_to => [ html => <INPUT TYPE='checkbox' NAME='DeployTo' id='dev' VALUE='dev'><label for='dev'> <strong>Development</strong></label> <INPUT TYPE='checkbox' NAME='DeployTo' id='qa' VALUE='qa'><label for='qa'> <strong>Test</strong></label> <br /><br /> <a href=\"javascript:;\" id=\"enProd\" style=\"visibility:hidden;\">Production Deploy?</a><br /> <INPUT TYPE='checkbox' NAME='DeployTo' VALUE='prodOne' disabled=\"disabled\" id='prodOne' > Production 1 <INPUT TYPE='checkbox' NAME='DeployTo' VALUE='prodTwo' disabled=\"disabled\" id='prodTwo' > Production 2<br /><br /> ", is_required => 'true', label => "Deploy To",], "Files" => [ html => $filesHtml, is_required => 'false', label => 'Selected Files',],
# LOAD DESTINATION SERVERS INTO AN ARRAY my $serv_ctr = 0; if ($deployTo eq "dev") { $servers[$serv_ctr] = "dev"; $serv_ctr++; } if ($deployTo eq "qa") { $servers[$serv_ctr] = "qa"; $serv_ctr++; } if ($deployTo eq "prodOne") { $servers[$serv_ctr] = "java1_Prod"; $serv_ctr++; } if ($deployTo eq "prodTwo") { $servers[$serv_ctr] = "java2_Prod"; $serv_ctr++; } my ($i, $local, $remote_dir); for ($i=0; $i<$serv_ctr; $i++) { if ($servers[$i] ne "0") { $DEPLOY_TO = $servers[$i]; my $DEPLOY_SCRIPT = "custom_deploy_flist"; &debug("IMAGE PATH is $IMAGE_PATH"); &debug("$DEPLOY_TO "); ##### bunch of code that checks file type and path (code removed)#######open(FILE,">F:\\logFile123"); my $deploy_cmd = join(" ", "$odhome/bin/iwodcmd start", "$DEPLOY_SCRIPT", "-k \"lnode=$lnode\"", "-k \"flist=$deploy_filelist\"", "-k \"targetNode=$DEPLOY_TO\"", "-k \"localDir=$local\"", "-k \"remoteDir=$remote_dir\"");close FILE; &debug("$deploy_cmd"); $results .= `$deploy_cmd`; my $odFail = $?; ### if not OD fail and if any files need to be data deployed at all if (!$odFail) { $task->CallBack(0, "OpenDeploy Deployment Succeeded"); }else{ my $count; ### try five times for ($count = 1; $count <= 5; $count++) { &debug($count); #$results .= `$odcmd`; $results .= `$deploy_cmd`; &debug($results); $odFail = $?; &debug($odFail); if (!$odFail) { $task->CallBack(0, "Multiple OpenDeploy Deployment Succeeded"); }else{ # do nothing } } #print "od fails"; open(RS,">$resultsfile"); print RS qq~$results~; print RS "RUN: $deploy_cmd FOR MORE DETAILS"; close RS; $task->CallBack(1, "OpenDeploy Deployment Failure: Check $resultsfile for more details"); exit; } } # END IF STATEMENT } # END FOR STATEMENT} #end sub deploy_files### debug subroutinesub debug{ #return if !$debug; my $message = shift; open (DEBUG, ">>$DEBUG_FILE") || exit; print DEBUG "\n"; print DEBUG "$message"; print DEBUG "\n"; close DEBUG;}
i think if i can access the checkboxes from the WFT file I can check to see what the user selected. "my @targets = param('DeployTo'); " doesn't work.
if ($deployTo eq "devandqa") { $servers[$serv_ctr] = "dev"; $serv_ctr++; $servers[$serv_ctr] = "qa"; $serv_ctr++; }
I just want to understand the example ISCBorisB gave.Lets say I wanted to use this:my @targets = __VALUE__('iw_deploy_to'); I would define that in ---------------------------------------------…my @targets = __VALUE__('iw_deploy_to');]]></template_script>---------------------------------------------How can I access targets from the ipl script? When I use:&debug("to: $targets[0]");in the ipl file, the debug script bombs and nothing gets printed. How can I send @targets to the ipl file?
You can for example pass captured values as External Task command parameter(s).
Ok - simple things first... Both __VALUE__ and __TAG__ Functions belong to WFT Parser and may not be used outside of WFT Template.Within 'template_script' Tag you should access TAG_info captured values with the __VALUE__ Function. Outside of it - with the __TAG__ Function.As for the rest - you must know Perl to do coding in Perl! If looking at the code you do not understand the semantics of something as rudimentaryas my $deployTo = shift; - I'm not sure I have enough time to explain Perl's Concept of Scalar/Array Context and why you get a scalar String 'ARRAY[some ID]' - and why it fails when you pass this String as a command parameter and try to use as Array
So are you saying that the way this is being passed, it cannot be accessed as an array?
Try this if you want to achieve what you need with minimal changes.keep the original code with radio buttons, then add third option for the radio item with value "devandqa" and named/label "both".then add these lines to your ipl code: if ($deployTo eq "devandqa") { $servers[$serv_ctr] = "dev"; $serv_ctr++; $servers[$serv_ctr] = "qa"; $serv_ctr++; }
Ok, I'll try one more time...The following will work for a scalar 'iw_deploy_to' Value.<command v="__INSERT__($deploy_cmd); __TAG__('iw_deploy_to');"/>However, if __TAG__('iw_deploy_to') evaluates to an Array, in the scalar Context it'll render something like that:<command v="YourScript ARRAY(0xSomeHexDigits)"/>Sure enough, in the totally different thread of External Task Execution this ARRAY parameter is just a String.It is a signature of no longer existing Array Object from the long gone WFT Parser Process. Trying to use itat all, much less as an array makes no sense.If you want to pass an Array as the OS Command Parameter(s) you should build it with Array scalar Values like "Command A B C..." with undefined number of parameters or alternatively use some sort of join and pass a singleparameter with a delimiter: "Command A+B+C..." and split it within codeMakes sense?