I have some PowerShell tasks that are part of a provisioning workflow and work fine when a new instance is deployed via the catalog. However, when trying to deploy directly from the Provisioning > Instances tab, I get a failure with the message
No such property: customOption.
I’ve narrowed the failure down to where I reference the hostname, which I’m doing via
$hostName = "<%= instance.hostName %>". I’ve tried other variations, and I can get to the hostName when using the catalog or running tasks against an existing instance; however none seem to work when deploying directly from the instances tab.
I’m running out of ideas, so now I’m asking for yours.
When you’re using a catalog you define your own inputs and map those. Guessing your customOption has a field name cased liked
hostName however, the Morpheus native variable during provisioning is cased all lower like
instance.hostname. That’s most likely the issue you are seeing.
instance.hostname should be available [in your tasks] to you in a catalog, even if you map the hostname with
customOptions.hostName. The instance var gets created as soon as you hit submit.
Thanks @cbunge, though now I’m more confused than when I started.
We’re not using
hostName in the customOptions for the catalog at all; we’re actually using
hostName came from doing a dump of the
hostName worked on existing instances, even if they were not created from the catalog. It only failed if the task was run as part of a provisioning workflow.
That said, I went ahead and tried changing the case to all lowercase, and it worked. I’m at a loss to explain why
hostName was working sometimes, but I’m happy enough to have it working reliably now.