Hi,
I’m trying to bind conditionally a field to boolean value:
#{if #{Octopus.Environment.Name} == “PROD”}True#{/if}
#{if #{Octopus.Environment.Name} == “DEV”}False#{/if}
So that when the deployment runs on PROD, the result will be true, if “DEV”, false.
This is for to enable SSL bindings for a website on specific environments.
But I get an error
Exception calling “Parse” with “1” argument(s): "String was not recognized as
11:39:05Error
a valid Boolean."
11:39:05Error
At C:\inetpub\wwwroot\PP\Octopus.Features.IISWebSite_BeforePostDeploy.ps1:99
11:39:05Error
char:6
11:39:05Error
-
if([Bool]::Parse($binding.enabled)) {
11:39:05Error
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11:39:05Error
+ CategoryInfo : NotSpecified: ( [], ParentContainsErrorRecordE
11:39:05Error
xception
11:39:05Error
+ FullyQualifiedErrorId : FormatException
11:39:05Error
11:39:05Error
Script ‘C:\inetpub\wwwroot\PP\Octopus.Features.IISWebSite_BeforePostDeploy.ps1’ returned non-zero exit code: 1
11:39:05Error
Running rollback conventions…
11:39:06Error
Script ‘C:\inetpub\wwwroot\PP\Octopus.Features.IISWebSite_BeforePostDeploy.ps1’ returned non-zero exit code: 1
11:39:06Error
The remote script failed with exit code 1
How can I do it correctly?
Thanks,
Daniel