Even if your parameter is not in a prefectch block the evaluation should be the same. Have you posted the result of the command from the client log?
On another note from your question about exit codes, you should use the below or you might get an error at compile time.
((not active of it) OR (exist code of it != 0)) of action
Thatâs a very good catch, especially since @cstoneba just mentioned that thereâs a prefetch/download command. It reminds me of a problem I had periodically. Hereâs my understanding of itâŚ
When an action is taken, the client will first check for downloads/prefetch. If there is a prefetch block, the client will evaluate only that block; if there is no prefetch block, the client evaluates all relevance statements within the script (mind you, this is before any of the action script executes).
The result is that if your relevance evaluates anything that doesnât exist (yet), then you will get an evaluation error. As @rkorinek illustrates, at this point âactive of actionâ would give a False, and âexit code of actionâ would give an error. Where this often comes up is where ActionScript is creating a file, appending lines to it, and then later in the action evaluates something from the file (that wonât exist until the action executes). If the Relevance doesnât check for file existence, it will give an evaluate error during the preprocessing, before any line of the action actually executes.
There are some conditions that lead to this âpreprocessingâ behavior. I think I once had an actionscript that worked fine, until I added a prefetch line to it (without a prefetch block). It seems that the existence of a prefetch command triggered the processing and caused a totally unrelated relevance substitution later in the script to fail.
Iâm sure itâs long fixed by now, but I seem to recall that when that condition occurred, the log didnât even show the error on the correct line, or when the fixlet was in a baseline it marked a relevance substitution error on the wrong baseline component or something along those lines.
Short version, if youâre using a prefetch, be sure to include the whole prefetch block.
JasonWalker, I think youâre right on. Due to the new line in my task where I use prefetch (and not a prefetch block, but just a single 1 line prefect command), the actionscript is being evaluated before the action starts, which is different than my previous task version.
What still makes no sense is why the parameter fails on .7% of the targeted clients, but it works fine in QnA:
Failed parameter "slash"="{(if (name of operating system as lowercase contains "win") then "\" else "/")}"
q: (if (name of operating system as lowercase contains "win") then "\" else "/")
A: \
T: 27.693 ms
I: singular string
ActionLogMessage: (action:256069) Action signature verified for Downloads
At 09:51:15 -0600 -
ActionLogMessage: (action:256069) Action temporal distribution - delay for 0 seconds.
ActionLogMessage: (action:256069) Parameter command error. Parameter may not already be defined.
ActionLogMessage: (action:256069) ending action
At 09:51:38 -0600 -
Report posted successfully
UPDATE**
Well this is new to me, anyone know why the log is saying that a parameter is already defined when the parameter is line1 of the task?
It states that the name âslashâ is already in use in this action. You can only use it once in the whole action as we donât have âscopesâ like other languages
right, i know you can only have 1 parameter set with the same name, but Iâm only setting the parameter âslashâ once. Could it be seeing the parameter from a different running action?
No, each action has its own table built at the start of the action processing.
Look closer; the log says the parameter may NOT be defined.
The Parameter wonât be defined until the action executes; so during the prefetch evaluation you may get an error on the relevance substitution that tries to use the (not-defined) parameter.
Also, the line âaction signature verified for downloadsâ makes me think we are in the right area - that itâs still doing download evaluation, pre-execution.
Thatâs fun to debug, since you wonât see what line is flagging an error.
Use a prefetch block, or wrap the rest of the action in an
if {active of action} block.
This error means the parameter is already defined. The parameters are defined at the first time the code parses the actionscript which in this case is during the download phase. Parameters are only defined once, not during execution.
Maybe the log message varies by BES version? Hereâs what I get when I redefine an existing parameter:
Relevant - Custom Action (fixlet:500513)
At 09:50:18 -0500 -
ActionLogMessage: (action:500513) Action signature verified for Execution
ActionLogMessage: (action:500513) starting action
At 09:50:18 -0500 - actionsite (http://server.domain:52311/cgi-bin/
bfgather.exe/actionsite)
Command succeeded parameter âtestâ=âtestâ (action:500513)
Command failed (parameter add exists) parameter âtestâ=âtestâ (action:500513)
At 09:50:18 -0500 -
ActionLogMessage: (action:500513) ending action
At 09:50:18 -0500 - mailboxsite (http://server.domain:52311/cgi-bin
/bfgather.exe/mailboxsite4255874)
Not Relevant - Custom Action (fixlet:500513)
JasonWalker - do you have a download/prefetch in your test script above, so it evaluates before executing?
It often does. We refine it as people get confused by it.
Your message definitely still exists as the agent tries to add a parameter during execution. The error message mentioned is in the Download evaluation of the actionscript though
So AlanM, if the IEM client does not carry over parameters from action to action, why would the client say âParameter may not already be definedâ when it is defined in line1 of the actionscript?
Could it be that itâs because your parameter is written within an if statement that is evaluating to false and not getting defined?
Note: I ask because in your snippet above it is written within the if statement.
if that was true, Iâd expect it to fail on all targets, not a subset of them.
I guess that means there are issues with defining it outside the statement?
I understand everything should be coming up roses but the errors indicate the value is not being defined. I canât think of any other reason but that itâs evaluating to false and moving on without it.
hereâs a scrubbed version of the script that is failing. if you place a file on your relay in âŚ/wwwrootbes/SMSync/by_name/, the the majority of the task should work.
parameter "slash"="{(if (name of operating system as lowercase contains "win") then "\" else "/")}"
if {name of operating system as lowercase contains "win" AND not exists file (value of variable "systemdrive" of environment & "\supportfiles\maint\wget.exe")}
//download WGET on windows
//prefetch wget.tmp sha1:df67c25a9f7cf4a1717034c841211fbd5cad0db0 size:604643 http://-url:52311/Uploads/df67c25a9f7cf4a1717034c841211fbd5cad0db0/wget.tmp
download http://-url:52311/Uploads/df67c25a9f7cf4a1717034c841211fbd5cad0db0/wget.tmp
continue if {(size of it = 604643 AND sha1 of it = "df67c25a9f7cf4a1717034c841211fbd5cad0db0") of file "wget.tmp" of folder "__Download"}
extract wget.tmp
if {not exists folder (value of variable "systemdrive" of environment & "\supportfiles")}
waithidden cmd.exe /c mkdir "{value of variable "systemdrive" of environment & "\supportfiles"}"
waithidden cmd.exe /c mkdir "{value of variable "systemdrive" of environment & "\supportfiles\maint"}"
move __Download\wget.exe "{value of variable "systemdrive" of environment & "\supportfiles\maint\wget.exe"}"
move __Download\ssleay32.dll "{value of variable "systemdrive" of environment & "\supportfiles\maint\ssleay32.dll"}"
move __Download\libeay32.dll "{value of variable "systemdrive" of environment & "\supportfiles\maint\libeay32.dll"}"
elseif {exists folder (value of variable "systemdrive" of environment & "\supportfiles") AND not exists folder (value of variable "systemdrive" of environment & "\supportfiles\maint")}
waithidden cmd.exe /c mkdir "{value of variable "systemdrive" of environment & "\supportfiles\maint"}"
move __Download\wget.exe "{value of variable "systemdrive" of environment & "\supportfiles\maint\wget.exe"}"
move __Download\ssleay32.dll "{value of variable "systemdrive" of environment & "\supportfiles\maint\ssleay32.dll"}"
move __Download\libeay32.dll "{value of variable "systemdrive" of environment & "\supportfiles\maint\libeay32.dll"}"
elseif {exists folder (value of variable "systemdrive" of environment & "\supportfiles\maint") AND not exists file (value of variable "systemdrive" of environment & "\supportfiles\maint\wget.exe")}
move __Download\wget.exe "{value of variable "systemdrive" of environment & "\supportfiles\maint\wget.exe"}"
move __Download\ssleay32.dll "{value of variable "systemdrive" of environment & "\supportfiles\maint\ssleay32.dll"}"
move __Download\libeay32.dll "{value of variable "systemdrive" of environment & "\supportfiles\maint\libeay32.dll"}"
endif
endif
delete "{(pathname of client folder of current site) & (parameter "slash" of action) & "__Download" & (parameter "slash" of action) & "assetinfo.txt"}"
//track failures
setting "SMSyncFail"="{ if (exists setting "SMSyncFail" of client) then (if (exists value of setting "SMSyncFail" of client) then (value of setting "SMSyncFail" of client as integer + 1)as string else "1") else "1"}" on "{now}" for client
//if {value of setting "SMSyncFail" of client as integer >=3}
if {if (exists setting "SMSyncFail" of client) then (if (exists value of setting "SMSyncFail" of client) then (value of setting "SMSyncFail" of client as integer >=3) else true) else false}
setting "location"="Asset Not in SM" on "{now}" for client
setting "sbu"="Asset Not in SM" on "{now}" for client
setting "bu"="Asset Not in SM" on "{now}" for client
setting "day_0"="Asset Not in SM" on "{now}" for client
setting "week_number_day_0"="Asset Not in SM" on "{now}" for client
setting "time"="Asset Not in SM" on "{now}" for client
setting "days_after_day_0"="Asset Not in SM" on "{now}" for client
setting "duration"="Asset Not in SM" on "{now}" for client
setting "reboot"="Asset Not in SM" on "{now}" for client
setting "patchprofile"="Asset Not in SM" on "{now}" for client
setting "exposure"="Asset Not in SM" on "{now}" for client
setting "platform_support"="Asset Not in SM" on "{now}" for client
setting "deploy_status"="Asset Not in SM" on "{now}" for client
setting "paging_order"="Asset Not in SM" on "{now}" for client
setting "build_status"="Asset Not in SM" on "{now}" for client
setting "user_area_contact"="Asset Not in SM" on "{now}" for client
setting "primary_app_name"="Asset Not in SM" on "{now}" for client
setting "project"="Asset Not in SM" on "{now}" for client
setting "sox_classification"="Asset Not in SM" on "{now}" for client
setting "site"="Asset Not in SM" on "{now}" for client
setting "module"="Asset Not in SM" on "{now}" for client
endif
//Sync endpoints clients that are relays
if {exists relay service AND exists file (value of setting "_BESRelay_HTTPServer_ServerRootPath" of client & (parameter "slash" of action) & "SMSync" & (parameter "slash" of action) & "by_name" & (parameter "slash" of action) & (hostname as lowercase))}
download now as "assetinfo.txt" "http://{"127.0.0.1:52311" & "/SMSync/by_name/" & (hostname as string as lowercase)}"
elseif {exists relay service AND not exists file (value of setting "_BESRelay_HTTPServer_ServerRootPath" of client & (parameter "slash" of action) & "SMSync" & (parameter "slash" of action) & "by_name" & (parameter "slash" of action) & (hostname as lowercase))}
download now as "assetinfo.txt" "{preceding text of first "/cgi-" of value of setting "__Relay_Control_RootServer" of client as string & "/SMSync/by_name/" & (hostname as string as lowercase)}"
endif
//Sync endpoints clients that are not relays AND not BES Root
if {not exists relay service AND not exists main gather service AND name of operating system as lowercase contains "win"}
waithidden cmd.exe /c {(value of variable "systemdrive" of environment & "\supportfiles\maint\wget.exe")} -O __Download\assetinfo.txt http://{name of registration server & "/SMSync/by_name/" & (hostname as string as lowercase)}
if {exists true whose (if true then (exit code of action != 0) else false)}
download now as "assetinfo.txt" "{preceding text of first "/cgi-" of value of setting "__Relay_Control_RootServer" of client as string & "/SMSync/by_name/" & (hostname as string as lowercase)}"
endif
elseif {not exists relay service AND not exists main gather service AND name of operating system as lowercase does not contain "win"}
wait sh -c "wget -O __Download/assetinfo.txt http://{(name of registration server) & "/SMSync/by_name/" & (hostname as string as lowercase)}"
if {exists true whose (if true then (exit code of action != 0) else false)}
download now as "assetinfo.txt" "{preceding text of first "/cgi-" of value of setting "__Relay_Control_RootServer" of client as string & "/SMSync/by_name/" & (hostname as string as lowercase)}"
endif
endif
//Sync endpoints that are BES Root servers
if {exists main gather service}
download now as "assetinfo.txt" "http://{"127.0.0.1:52311" & "/SMSync/by_name/" & (hostname as string as lowercase)}"
endif
//confirm endpoint downloaded the correct file
continue if {following text of first "=" of (lines whose (it starts with "name=") of file ("__Download" &(parameter "slash" of action) & "assetinfo.txt") as lowercase) = (hostname as lowercase)}
////////////
//set values
////////////
if {if (exists file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) then (exists lines whose (it starts with "location=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) else false}
setting "location"="{substrings separated by "%09" of following text of first "=" of (lines whose (it starts with "location=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt") as uppercase as trimmed string)}" on "{now}" for client
endif
if {if (exists file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) then (exists lines whose (it starts with "wg_chargeback_sbu=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) else false}
setting "sbu"="{substrings separated by "%09" of following text of first "=" of (lines whose (it starts with "wg_chargeback_sbu=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt") as uppercase as trimmed string)}" on "{now}" for client
endif
if {if (exists file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) then (exists lines whose (it starts with "wg_chargeback_bu=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) else false}
setting "bu"="{substrings separated by "%09" of following text of first "=" of (lines whose (it starts with "wg_chargeback_bu=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt") as uppercase as trimmed string)}" on "{now}" for client
endif
if {if (exists file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) then (exists lines whose (it starts with "pp_day_zero_day=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) else false}
setting "day_0"="{substrings separated by "%09" of following text of first "=" of (lines whose (it starts with "pp_day_zero_day=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt") as uppercase as trimmed string)}" on "{now}" for client
endif
if {if (exists file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) then (exists lines whose (it starts with "pp_day_zero_week=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) else false}
setting "week_number_day_0"="{substrings separated by "%09" of following text of first "=" of (lines whose (it starts with "pp_day_zero_week=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt") as uppercase as trimmed string)}" on "{now}" for client
endif
if {if (exists file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) then (exists lines whose (it starts with "pp_window_start_time=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) else false}
setting "time"="{substrings separated by "%09" of following text of first "=" of (lines whose (it starts with "pp_window_start_time=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt") as uppercase as trimmed string)}" on "{now}" for client
endif
if {if (exists file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) then (exists lines whose (it starts with "pp_window_start_day=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) else false}
setting "days_after_day_0"="{substrings separated by "%09" of following text of first "=" of (lines whose (it starts with "pp_window_start_day=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt") as uppercase as trimmed string)}" on "{now}" for client
endif
if {if (exists file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) then (exists lines whose (it starts with "pp_duration=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) else false}
setting "duration"="{substrings separated by "%09" of following text of first "=" of (lines whose (it starts with "pp_duration=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt") as uppercase as trimmed string)}" on "{now}" for client
endif
if {if (exists file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) then (exists lines whose (it starts with "pp_reboot=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) else false}
setting "reboot"="{substrings separated by "%09" of following text of first "=" of (lines whose (it starts with "pp_reboot=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt") as uppercase as trimmed string)}" on "{now}" for client
endif
if {if (exists file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) then (exists lines whose (it starts with "pp_name=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) else false}
setting "patchprofile"="{substrings separated by "%09" of following text of first "=" of (lines whose (it starts with "pp_name=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt") as uppercase as trimmed string)}" on "{now}" for client
endif
if {if (exists file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) then (exists lines whose (it starts with "wg_customer_facing=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) else false}
setting "exposure"="{substrings separated by "%09" of following text of first "=" of (lines whose (it starts with "wg_customer_facing=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt") as uppercase as trimmed string)}" on "{now}" for client
endif
if {if (exists file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) then (exists lines whose (it starts with "platform_support_group=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) else false}
setting "platform_support"="{substrings separated by "%09" of following text of first "=" of (lines whose (it starts with "platform_support_group=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt") as uppercase as trimmed string)}" on "{now}" for client
endif
if {if (exists file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) then (exists lines whose (it starts with "wg_server_deploy_status=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) else false}
setting "deploy_status"="{substrings separated by "%09" of following text of first "=" of (lines whose (it starts with "wg_server_deploy_status=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt") as uppercase as trimmed string)}" on "{now}" for client
endif
if {if (exists file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) then (exists lines whose (it starts with "support_group_paging_order_groups=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) else false}
setting "paging_order"="{concatenation "!~!" of substrings separated by "%09" of following text of first "=" of (lines whose (it starts with "support_group_paging_order_groups=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt") as uppercase as trimmed string)}" on "{now}" for client
endif
if {if (exists file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) then (exists lines whose (it starts with "istatus=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) else false}
setting "build_status"="{substrings separated by "%09" of following text of first "=" of (lines whose (it starts with "istatus=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt") as uppercase as trimmed string)}" on "{now}" for client
endif
if {if (exists file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) then (exists lines whose (it starts with "user_area_contact_order_groups=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) else false}
setting "user_area_contact"="{concatenation "!~!" of substrings separated by "%09" of following text of first "=" of (lines whose (it starts with "user_area_contact_order_groups=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt") as uppercase as trimmed string)}" on "{now}" for client
endif
if {if (exists file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) then (exists lines whose (it starts with "primary_app_name=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) else false}
setting "primary_app_name"="{substrings separated by "%09" of following text of first "=" of (lines whose (it starts with "primary_app_name=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt") as uppercase as trimmed string)}" on "{now}" for client
endif
if {if (exists file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) then (exists lines whose (it starts with "wg_project_name=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) else false}
setting "project"="{substrings separated by "%09" of following text of first "=" of (lines whose (it starts with "wg_project_name=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt") as uppercase as trimmed string)}" on "{now}" for client
endif
if {if (exists file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) then (exists lines whose (it starts with "soxclassification=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt")) else false}
setting "sox_classification"="{substrings separated by "%09" of following text of first "=" of (lines whose (it starts with "soxclassification=") of file ("__Download" & (parameter "slash" of action) & "assetinfo.txt") as uppercase as trimmed string)}" on "{now}" for client
endif
setting delete "SMSyncFail" on "{now}" for client
//to sync site and module data that is not avilable in the emat 9asset cache
//store url parameter based on location
//CIS vs CPS
if {exists setting "exposure" whose (exists value of it) of client}
if {value of setting "exposure" of client as string as lowercase = "non-customer"}
parameter "url" = "{(if it = "1" then "http://url" else if it = "2" then "url" else if it = "3" then "url" else if it = "4" then "http://url" else if it = "5" then "http://url" else if it = "6" then "http://url" else if it = "7" then "url" else if it = "8" then "http://url" else if it = "9" then "http://url" else "url") of (value of setting "location" of client as string as lowercase)}"
elseif {value of setting "exposure" of client as string as lowercase = "customer"}
parameter "url" = "{(if it = "1" then "http://url" else if it = "2" then "http://url" else if it = "3" then "http://url" else if it = "4" then "http://url" else if it = "5" then "http://url" else if it = "6" then "http://url" else if it = "7" then "http://url" else if it = "8" then "http://url" else if it = "9" then "http://url" else "http://url") of (value of setting "location" of client as string as lowercase)}"
//default to CIS
else
parameter "url" = "{(if it = "1" then "http://url" else if it = "2" then "url" else if it = "3" then "url" else if it = "4" then "http://url" else if it = "5" then "http://url" else if it = "6" then "http://url" else if it = "7" then "http://url" else if it = "8" then "http://url" else if it = "9" then "http://url" else "http://url") of (value of setting "location" of client as string as lowercase)}"
endif
//download the second cache info
download now as "assetinfo2.txt" "{parameter "url"}/{hostname as lowercase}/JSON"
//assetinfo2
if {exists file ("__Download" & (parameter "slash" of action) & "assetinfo2.txt")}
setting "site"="{preceding text of first "%22," of following text of first "site%22:%22" of lines of file ("__Download" & (parameter "slash" of action) & "assetinfo2.txt") as uppercase as trimmed string}" on "{now}" for client
setting "module"="{preceding text of first "%22," of following text of first "module%22:%22" of lines of file ("__Download" & (parameter "slash" of action) & "assetinfo2.txt") as uppercase as trimmed string}" on "{now}" for client
endif
endif
Parameters can be defined outside of the ActionScript body in headers of the action. There are some standards that are used there like this one as an example:
action-parameter: "action issue date"="Fri, 27 Apr 2012 21:54:11 +0000"
This means you canât define âaction issue dateâ as a parameter in any action as its already there.
You might try to use a more unique name?
If there was a parameter used in the heads of the action called âslashâ, I would expect it to error on all targets, not just some. It seems like when I push the task directly to a client that out before, it works, but then when I push the task again as a policy action to > Dynamically target by property > All Computers, they error again (currently 55 of 16,000). And as time goes on and the action reapplies every 2 hours, the count goes from 55 to 2,000+.
I did move the parameter âslashâ line down to right above the first reference to the âslashâ parameter, but that didnât seem to change anything.