pythonoctopus-deploy

Access Octopus Deploy variables scoped with `Octopus.Deployment` in Python


I am developing some Octopus Deploy steps using Python. This works up to the point where I want to get this variable:

err = get_octopusvariable('Octopus.Deployment.Error')

Which throws an exception with a message of 'Octopus.Deployment.Error' This is strange as variables as Octopus.Environment.Name are retrievable.

Is there any other way of getting this variable? I could use requests to get the value through API but I think that this would be quite terrible...


Solution

  • Maybe the variable is not defined if no error is present. Wrap the assignment in a try/except.