Project and Portfolio Management Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to resolve DEST_ENV.SERVER_NAME token

SOLVED
Go to solution
Highlighted
Deepali Gupta
Super Collector

Unable to resolve DEST_ENV.SERVER_NAME token

I am running following commands in PPM:

##########################################################
ksc_connect_source_server

for i in `echo "[PKGL.P.HIT_OT_TARGET_ENV]" | awk -F',' '{for (i=1;i<=NF; i++) { printf "%s\n", $i }}'`; do scp [PKGL.P.HIT_OT_APPLICATION]-[PKGL.VP.HIT_OT_LABEL].tar [DEST_ENV=\"$i\".ENV.SERVER_USERNAME]@[DEST_ENV=\"$i\".ENV.SERVER_NAME]:[DEST_ENV="BRAND_INT2-2".SERVER_BASE_PATH]done

ksc_exit
##########################################################

In for loop, I am parsing a list of environments such that [PKGL.P.HIT_OT_TARGET_ENV]resolves to INT_ENV1, INT_ENV2.
And then I am doing scp to each of those environments ($i). However PPM is not able to resolve the [DEST_ENV=\"$i\".ENV.SERVER_USERNAME]@[DEST_ENV=\"$i\".ENV.SERVER_NAME] tokens.
If I explicitly mention value of $i like i did in [DEST_ENV="BRAND_INT2-2".SERVER_BASE_PATH], it works.

The logs show the following:
/////////////
sent command:
ppm_installer@dc7700p:/DC7700P_DATA/OUTBOX/INTEGRATION_2/Brand/000000-test_rfc> for i in `echo "BRAND_INT2-2,BRAND_INT1-1" | awk -F',' '{for (i=1;i<=NF; i++) { printf "%s\n", $i }}'`; do scp BRAND-test_rfc.tar [DEST_ENV=\"$i\".ENV.SERVER_USERNAME]@[DEST_ENV=\"$i\".ENV.SERVER_NAME]:/export/home/weblogic;done; echo KSC_EXIT_STATUS $?

received echo:
for i in `echo "B for i in `echo "BRAND_INT2-2,BRAND_INT1-1" | awk <0000-test_rfc> for i in `echo "BRAND_INT2-2,BRAND_INT1-1" | awk -F',' '{for (i=1;i<=NF; i++) { p
[DEST_ENV="BRAND_INT2-2".ENV.SERVER_USERNAME]: invalid user name
[DEST_ENV="BRAND_INT1-1".ENV.SERVER_USERNAME]: invalid user name
KSC_EXIT_STATUS 0

Closing SSH2 Session
Commands completed without any errors.

////////////

Any pointers or workarounds will help. Thanks.
6 REPLIES
Jim Esler
Honored Contributor
Solution

Re: Unable to resolve DEST_ENV.SERVER_NAME token

PPM evaluates tokens before the command is sent to the server. $i is a shell variable on the server and is not evaluated until the shell on the server executes the command. PPM, therefore, knows nothing about the value that will be given to $i by the shell. Since PPM does not have a value it can use to replace the token DEST_ENV=\"$i\".ENV.SERVER_USERNAME, it does no substitution.
Deepali Gupta
Super Collector

Re: Unable to resolve DEST_ENV.SERVER_NAME token

Thank You Jim!

Do you any workaround through which I can achieve this? I am running this loop to deploy same file to multiple environments.

~Deepali
Jim Esler
Honored Contributor

Re: Unable to resolve DEST_ENV.SERVER_NAME token

You can place all of your environments in an environment group and specify the environment group on the workflow step. The deploy commands will be executed for each environment in the group.
Deepali Gupta
Super Collector

Re: Unable to resolve DEST_ENV.SERVER_NAME token

I cannot do that as the environments values are determined based on the application. I have a single workflow for different applications and each application has a different set of target environments.

I was therefore using a hidden field in object type parameters which was populated by environment names based on the application name selected.
After that I was parsing this list of environments and then running scp command for each of the environments.
Jim Esler
Honored Contributor

Re: Unable to resolve DEST_ENV.SERVER_NAME token

We have created a workflow that we use as a template for setting up a project. Each project gets a customized copy of the template for their use. Workflows are cheap and building a totally generalized one that works for everybody is probably not worth the time and effort (my opinion only - it may not apply in your environment).
Deepali Gupta
Super Collector

Re: Unable to resolve DEST_ENV.SERVER_NAME token

Thanks Jim.
The approach is little different here. I am trying to build a generic workflow which can work across the organization - for all the applications.Creating new WF for every project is definetly an easy solution but probably requires lot more maintenance.

I am now writing a shell script which will deploy to multiple environments in a serial order.

One again..Thanks a lot for your inputs. It really helped!
Deepali
//Add this to "OnDomLoad" event