.set of a non-existent variable
In the help for ".set":
.set env <EnvGroupName> "<VariableName>=<DesiredValue>"
...
Note: Variables set by this command must already exist.
...
Is there *any* way to get around this so I can .set a permanent
variable in an environment that was not set at the start of the job?
--
Tim McDaniel, tmcd@panix.com
.set env <EnvGroupName> "<VariableName>=<DesiredValue>"
...
Note: Variables set by this command must already exist.
...
Is there *any* way to get around this so I can .set a permanent
variable in an environment that was not set at the start of the job?
--
Tim McDaniel, tmcd@panix.com
3 answers
In the help for ".set":
.set env <EnvGroupName> "<VariableName>=<DesiredValue>"
...
Note: Variables set by this command must already exist.
...
Is there *any* way to get around this so I can .set a permanent
variable in an environment that was not set at the start of the job?
--
Tim McDaniel, tmcd@panix.com
you could call an api program to create the variable before you .set it. But the variable must exist before you call .set. There's not a way around it using the .set command.
In article <idol2o>,
rhaig <rhaig> wrote:
I finally found the Perl API documentation. I see methods to read
environment variables, but nothing on how to create or set them.
--
Tim McDaniel, tmcd@panix.com
rhaig <rhaig> wrote:
Tim McDanielwrote:
In the help for ".set":
.set env <EnvGroupName>
"<VariableName>=<DesiredValue>"
...
Note: Variables set by this command must already exist.
...
Is there *any* way to get around this so I can .set a permanent
variable in an environment that was not set at the start of the
job?
you could call an api program to create the variable before you .set
it.
I finally found the Perl API documentation. I see methods to read
environment variables, but nothing on how to create or set them.
--
Tim McDaniel, tmcd@panix.com
I finally found the Perl API documentation. I see methods to read
environment variables, but nothing on how to create or set them.
Hi Tim,
I've added an example of how to create an environment variable.
use strict;
use BuildForge::Services;
my $host = 'localhost';
my $user = 'root';
my $password = 'root';
my $envName = 'TEST_ENV_1';
my $envEntryName = 'TEST_VAR_1';
my $envEntryValue = "TEST_VAR_1_VAL";
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($envEntryName);
if (!defined($envEntry)) {
$envEntry = new BuildForge::Services::DBO::EnvironmentEntry($conn);
$envEntry->setName($envEntryName);
$envEntry->setValue($envEntryValue);
$envEntry->setAction('SET');
$envEntry->setMode('NORMAL');
$env->addEnvironmentEntry($envEntry);
$env->update();
print "Variable " . $envEntryName . " added to environment group " . $envName . "\n";
} else {
print "Variable " . $envEntryName . " already exists in the environment group " . $envName . "\n";
}
$conn->logout();
$conn->close();
Brent Ulbricht
Developer/Lead - RTC Build