Ask A Question

View Question

I'm using Otter 1.5.5 and have two environments (Test and Production). Each has an environment variable defined. I'm referencing the variables in an Asset Template. However, I always get an error saying that the variable is not defined when the job runs.

Also, the $EnvironmentName variable is always null/empty. If I put the following in my template:

Log-Debug Environemnt = "$EnvironmentName";
Log-Debug  GetVariableValue "$GetVariableValue(EnvironmentName)";
Log-Debug  IsVariableDefined "$IsVariableDefined(EnvironmentName)";

My output is:

DEGUG: Environemnt = ""
DEGUG: GetVariableValue ""
DEGUG: IsVariableDefined "True"

It appears that the Otter thinks the $EnvirnomentName variable is defined but has no value.

Product: Otter
Version: 1.5.5

The problem here is that there is not exactly 1 environment in context. I'm guessing this is an orchestration plan? Configuration plans will already bring in the environment context if there is exactly one environment. The way this will be solved (targeted for v1.6, but may appear earlier in a v1.5.X maintenance release) is by the following rules:

  1. Context will solely be determined from environment associations of servers (this changes the current behavior which relies on orchestration jobs being targeted at an environment in order to bring the environment into context)
  2. Parent environments will only be considered for user permissions and variable resolution
  3. If there is not exactly 1 environment applicable to the current server in context, $EnvironmentName will result in an empty string (so the same as you're seeing now)
  4. We will add @EnvironmentNames which will resolve to a list of all environment names in context (including an optional parameter for including/ignoring parent environments)
Answer Question