Perl API - environments variables
Hi,
I have a perl script that works with the Build Forge through the API. I want to check if a value exist in one of my environment variable, and if not to add it. I tried to look in the documentation, but i can't find it. Please help, Thanks shiran |
11 answers
Hi, Hi shiran, I have pasted some code that may help you. It looks in environment for a variable and changes the value of the variable if it doesn't contain the expected value.
bju |
Hi, Hi shiran, I have pasted some code that may help you. It looks in environment for a variable and changes the value of the variable if it doesn't contain the expected value.
bju Hi bju, I am sorry, i forgot to mention it is a variable with pull down list so i need to check if the option exist in the list and of not add it. Thanks a lot shiran |
Hi, Hi shiran, I have pasted some code that may help you. It looks in environment for a variable and changes the value of the variable if it doesn't contain the expected value.
bju Hi bju, I am sorry, i forgot to mention it is a variable with pull down list so i need to check if the option exist in the list and of not add it. Thanks a lot shiran Hi, I've pasted some code for environment entry option. I have to warn you that there appears to be a bug in the Perl client because the getOption/getOptions functions on the EnvironmentEntry don't seem to return any of the options.
bju |
Hi, Thasnk you, So because i don't get ane information on envEntryOption veriable it will always create the option even if it exist. There is a bug open on this issue? do you know? Hi shiran, I have pasted some code that may help you. It looks in environment for a variable and changes the value of the variable if it doesn't contain the expected value.
bju Hi bju, I am sorry, i forgot to mention it is a variable with pull down list so i need to check if the option exist in the list and of not add it. Thanks a lot shiran Hi, I've pasted some code for environment entry option. I have to warn you that there appears to be a bug in the Perl client because the getOption/getOptions functions on the EnvironmentEntry don't seem to return any of the options.
bju |
Hi,
Yes, when I ran the last script that I pasted - it did create the option even if it already existed because each time getOption or getOptions was called, it always returned the value as undefined or containing zero options. I'm not aware of a defect for this yet, so if you wanted to open a defect through the jazz.net site that is an option. I believe the Java client does work for these methods, so that could be another option although I realize the rest of your script is in Perl. bju |
Hi, OK, thanks for your help, i opened a bug. |
Hi, OK, thanks for your help, i opened a bug. IBM answer: Resolution: Unresolved --> Works as Designed Comments: added: In order to get the environment entry options, the environment entry must be gotten directly, via the BuildForge::Services::DBO::EnvironmentEntry::findByUuid($connection, $environmentEntryUuid) command. (This is documented under this function.) If the environment entry is gotten from the parent environment group's $environment->getEntry() or $environment->getEntries() functions, getOption() and getOptions() will return nothing. A snippet of code to get an environment entry's options: $var = $environment->getEntry('VARNAME'); $var = BuildForge::Services::DBO::EnvironmentEntry::findByUuid($conn, $var->getUuid()); $opts = $var->getOptions(); |
Hi,
With your information, I've modified the script. It worked for me.
|
Hi, Hi, every time i run this line: my $env = BuildForge::Services::DBO::Environment->findByName ($conn, $envName); I get Could not find env message, i tried with few of my environment but it happened with all of them, do you know what can be the problem? I have installed a new BF server so the environment were imported to the new server. Thanks, shiran |
Hi, Hi, every time i run this line: my $env = BuildForge::Services::DBO::Environment->findByName ($conn, $envName); I get Could not find env message, i tried with few of my environment but it happened with all of them, do you know what can be the problem? I have installed a new BF server so the environment were imported to the new server. Thanks, shiran Check to see if you can manually view the contents of the environment from the console. The relocation process may have missed the environments or the names may have changed slightly. |
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.