waldur-mastermind icon indicating copy to clipboard operation
waldur-mastermind copied to clipboard

Accessing Attributes in Termination Script

Open mattronix opened this issue 1 year ago • 2 comments

When creating a resource with a script i use (python):

attributes = json.loads(os.environ.get("ATTRIBUTES"))

To access the attributes of a resource.

However in a termination script i cant use the same method it seems to access the attributes as it gives me the following error:

2024-02-14T13:53:32.944140165Z [2024-02-14 13:53:32,943: ERROR/ForkPoolWorker-9] Error processing order type: Terminate, offering: Storage Share fs.ti, created_by: 089353b4-782e-44ba-a88a-382920d816e8 (Matthew Frost). Order ID: 129. Exception: [ErrorDetail(string='Command '['python', 'script']' in image 'mattronix:alpine-py-3.11' returned non-zero exit status 1: b'Traceback (most recent call last):\n File "/work/script", line 117, in \n new_user = attributes["username"]\n

When i do a print its also not set it seems, however i do see them in the database.

(once im finished with these scripts il send them your way also for the examples)

mattronix avatar Feb 14 '24 13:02 mattronix