Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.
If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!
Availability of variables from sub environments
-
Hi,
I have a problem with the availability of variables if it is defined in the parent environment and the server is in two sub environments simultaneously. The problem does not occur if the server is added to only one sub environment.Schema of environments:
TestEnvironment
|-SubEnvironment1
|-SubEnvironment2The variable is defined in TestEnvironment.
I have added a very simple configuration plan to the server:
Ensure-Directory c:\$TestVariable;
I get an error:
ERROR: 2020-08-21 11:31:05Z - Could not resolve variable $TestVariable.What is the cause of the problem?
-
Hello; what product is this for... Otter?
-
Yes, the problem occurs in Otter.
-
hi @Adam1, I looked into this further, and this is by design, but it should really be clarified in the UI a little bit better (I updated the docs).
A server can exist in multiple environments, but it's not recommended.
Basically, when a server is in multiple environments, then there can be no single environment in context. This means that the variable function
$EnvironmentName
will return empty, and variables cannot be resolved against those environments.This is unlike a role (which is set when executing a configuration plan, or explicitly set with
for role X
). So, in this case, I recommend you to use multiple roles.