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

Printing to console an output fails my creation script

Open mattronix opened this issue 2 years ago • 6 comments

When creating, a new resource via market space script (python).

Error message [ErrorDetail(string='Unexpected structure of output', code=['mattronix,', 'has', 'been', 'deployed.'])] Error traceback Traceback (most recent call last): File "/usr/src/waldur/src/waldur_mastermind/marketplace/utils.py", line 104, in process_order processor(order).process_order(user) File "/usr/src/waldur/src/waldur_mastermind/marketplace/processors.py", line 70, in process_order scope = self.send_request(user) ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/waldur/src/waldur_mastermind/marketplace_script/processors.py", line 73, in send_request raise serializers.ValidationError( rest_framework.exceptions.ValidationError: [ErrorDetail(string='Unexpected structure of output', code=['mattronix,', 'has', 'been', 'deployed.'])]

Here is the script for example: https://github.com/mattronix/waldur-custom-offerings/blob/main/create_user_over_ssh/storage-user-add-waldur.py

mattronix avatar Feb 14 '24 15:02 mattronix

yes, this is intended

this will be documented for https://github.com/waldur/waldur-mastermind/issues/50 .

Meanwhile you can check the code - https://github.com/waldur/waldur-mastermind/blob/develop/src/waldur_mastermind/marketplace_script/processors.py#L48

Basically, creation script expect either a single word in the last line of the output, or 2 words with second being base64 encoded metadata.

livenson avatar Feb 14 '24 17:02 livenson

ah! i see thanks, hope you dont mind me reporting these things as i see them :)

I also noticed exit0 and exit1 dont trigger the deployment to fail, at this moment what would be the best way to do a check and say fail as you cant do that due to it already existing.

Also wanna cleanup the resource if it fails.

mattronix avatar Feb 14 '24 19:02 mattronix

what is the backend_id and metadata used for?

mattronix avatar Feb 14 '24 19:02 mattronix

Dont quite follow what the backend_id is for can you help me in the right direction?

Do you maybe have a slack or chat group for this kind of stuff

mattronix avatar Feb 26 '24 16:02 mattronix

Hi,

first of all, sorry for incorrect estimations as to when we can get to the issues you've raised. As they say, if you want to make God laugh, tell him your plans. Anyways, we don't have really chats/groups for non-paying customers, but send me some contact details to [email protected] with messenger details of your choice (signal, slack or skype are ok) and I will add you.

On the topic - backend_id is used for referencing a unique 'isolation' in the backend system matching resource in waldur. E.g. openstack tenant uuid for a resource matching tenant, or a slurm hpc allocation name for slurm.

livenson avatar Feb 26 '24 18:02 livenson

No problem, dont want to be a bother or anything just checking in from time to time :)

Il send you my contacts since probably most of my questions are not really good for issues ahahahha.

Thanks anyway for all the help so far :)

mattronix avatar Feb 29 '24 11:02 mattronix

Added documentation on output formats: https://docs.waldur.com/admin-guide/providers/custom-scripts/#script-output-format

livenson avatar Jun 25 '24 06:06 livenson