It's all about the answers!

Ask a question

Using BF_AGENT_PLATFORM in a conditional step


ep zee (9695) | asked Mar 30 '11, 9:49 a.m.
I want to have a step that executes the Command commands if the agent is on unix and the Else Command part if the agent is running on windows. I tried to put this condition but it didn't work:
true(BF_AGENT_PLATFORM==aix 3 5)
true(BF_AGENT_PLATFORM=="aix 3 5")


Any idea how can I build the conditional expression properly?


Thanks!

5 answers



permanent link
Brent Ulbricht (2.5k11) | answered Mar 30 '11, 10:53 a.m.
JAZZ DEVELOPER
I want to have a step that executes the Command commands if the agent is on unix and the Else Command part if the agent is running on windows. I tried to put this condition but it didn't work:
true(BF_AGENT_PLATFORM==aix 3 5)
true(BF_AGENT_PLATFORM=="aix 3 5")


Any idea how can I build the conditional expression properly?


Thanks!


Hi epzee,

I use the following condition frequently in my libraries.

${BF_AGENT_PLATFORM} contains Windows


If you don't like using the 'contains', then I would suggest using the comparison operator of 'eq' instead of '==' since you're comparing a string instead of number.

Brent Ulbricht
Developer/Lead - RTC Build

permanent link
ep zee (9695) | answered Mar 30 '11, 2:23 p.m.
Great, that's exactly what I was looking for! Is there any doc with a list of all possible operators? I only found the string operators in the online help, but no example of the contains condition you wrote.

Thanks!

permanent link
Brent Ulbricht (2.5k11) | answered Mar 31 '11, 9:53 a.m.
JAZZ DEVELOPER
Great, that's exactly what I was looking for! Is there any doc with a list of all possible operators? I only found the string operators in the online help, but no example of the contains condition you wrote.

Thanks!


Hi,

In the documentation at 'Working with steps' -> 'Controlling execution flow' -> 'Condition functions', there are some examples of the various functions that can be used in the condition field.

Brent Ulbricht
Developer/Lead - RTC Build

permanent link
Tim McDaniel (401146) | answered Apr 02 '11, 8:15 a.m.
In article <imvckf>,
epzee <amazza> wrote:
I want to have a step that executes the Command commands if the agent
is on unix and the Else Command part if the agent is running on
windows.

It's also possible to have a CMD script and a Bourne-like shell script
in the same file. It depends on the fact that "goto" is a command in
CMD but not in a Bourne-like shell. So when the script is run by CMD,
the goto executes; when run by bash or sh or the like, it falls thru
to the next statement (with an error exit code and an error message on
stderr, file descriptor 2).

On my system, where the UNIXy shell is Cygwin's bash running on
Windows:

GOTO :CMD_COMMANDS 2>NUL:
# The next is a Cygwin extension to cause the shell to
# ignore the carriage returns.
set -o igncr # must keep a comment here.

# bash commands here.
exit

:CMD_COMMANDS

REM CMD commands here
exit

For your setup, where the agent is on real Linux or UNIX, you'd remove
the "set -o igncr" and instead "rm NUL:".

--
Tim McDaniel, tmcd@panix.com

permanent link
Tim McDaniel (401146) | answered Apr 11 '11, 9:02 a.m.
In article <in7i3l>,
Tim McDaniel <tmcd> wrote:
On my system, where the UNIXy shell is Cygwin's bash running on
Windows:

....
# The next is a Cygwin extension to cause the shell to
# ignore the carriage returns.
set -o igncr # must keep a comment here.

Carriage returns appear to be an artifact of the Opera Web browser
only. When I run Opera on Windows and save a step, it appears to send
in the text with lines ending in carriage return-linefeed. From
Firefox or IE (!), the lines in a step only end in newline.

It's bad when that happens for the .drill command, because it refuses
to ignore the trailing carriage return and throws a syntax error and
usage message, and there's no workaround other than switching
browsers. (RBF supports only IE and Firefox.)

--
Tim McDaniel, tmcd@panix.com

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.