Skip to content

sap_vm_provision: Add fail task when image was not found #79

@marcelmamula

Description

@marcelmamula

Description

Step Identify OS Image (AWS AMI) does not fail when AMI is not found, because it has RC 0 even with 0 results.

ok: [ae1ascs -> localhost] => {
    "__sap_vm_provision_task_aws_ami": {
        "changed": false,
        "failed": false,
        "images": []
    }
}

Which results in failure during Provision AWS EC2 Virtual Server instance with unclear error which can be prevented by failing directly when __sap_vm_provision_task_aws_ami.images | length == 0 :

TASK [community.sap_infrastructure.sap_vm_provision : Provision AWS EC2 Virtual Server instance] ************************************************************
fatal: [ae1ers -> localhost]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: No last item, sequence was empty.. No last item, sequence was empty.\n\nThe error appears to be in '/home/mmamula/ansible_collections/community/sap_infrastructure/roles/sap_vm_provision/tasks/platform_ansible/aws_ec2_vs/execute_provision.yml': line 21, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Provision AWS EC2 Virtual Server instance\n  ^ here\n"}

Tested

Reproducible with invalid AMI name.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions