Hi,
With your information, I've modified the script. It worked for me.
use strict;
use BuildForge::Services;
my $host = 'localhost';
my $user = 'root';
my $password = 'root';
my $envName = 'TEST_ENV_1';
my $varName = 'TEST_VAR_1';
my $optionName = 'Model Office';
my $optionValue = 'MO';
my $conn = new BuildForge::Services::Connection($host);
my $token = $conn->authUser($user, $password);
my $env = BuildForge::Services::DBO::Environment->findByName($conn, $envName);
die('Could not find env ' . $envName) unless defined($env);
my $envEntry = $env->getEntry($varName);
die('Could not find env entry with name ' . $varName) unless defined($envEntry);
die('Env entry is not a pull down variable type entry') unless ($envEntry->getVariableType() eq 'PULLDOWN');
$envEntry = BuildForge::Services::DBO::EnvironmentEntry->findByUuid($conn, $envEntry->getUuid());
die('Could not find env entry by UUID') unless defined($envEntry);
my $envEntryOption = $envEntry->getOption($optionName);
if (!defined($envEntryOption)) {
$envEntryOption = new BuildForge::Services::DBO::EnvironmentEntryOption($conn);
$envEntryOption->setName($optionName);
$envEntryOption->setValue($optionValue);
$envEntryOption = $envEntryOption->update();
$envEntry->addOption($envEntryOption);
$envEntry = $envEntry->update();
print "Added env entry option named " . $optionName . " with value of " . $optionValue . " to env entry named " . $envEntry->getName() . ".\n";
} else {
print "The option " . $optionName . " already exists for variable " . $varName . " and contains value of " . $envEntryOption->getValue() . ".\n";
}
$conn->logout();
$conn->close();
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.