neoave / mrack

Multicloud use-case based multihost async provisioner for CIs and testing during development
Apache License 2.0
11 stars 14 forks source link

Add basic image validation to AWS and Beaker #37

Closed Tiboris closed 3 years ago

Tiboris commented 3 years ago

Added basic image validation to AWS and Beaker provider When os was not known in provisioning config, null/None was taken and set as required image even for Openstack.

Value of 'os' is passed to req when image is not in place. Then the 'os' value is seen in ValidationError messages even instead of None/null in Openstack, AWS and Beaker.

Support image/distro definition from metadata. And flag it with meta_distro/meta_image when used.

For AWS check image availability with boto. When image is not present raise ValidationError

Signed-off-by: Tibor Dudlák tdudlak@redhat.com

Tiboris commented 3 years ago

Set os to point to nonexisting value, eg.: fedora-broken

(workenv) ➜  workenv git:(improve-validation) ✗ mrack -c ../provisioning-config.yaml up ./broken.yaml -p openstack
Initializing OpenStack provider
Login duration 0:00:01.018510
Open Stack environment objects load duration: 0:00:02.819607
Provisioning started
[
    {
        "flavor": "ci.m1.medium",
        "image": "fedora-broken",
        "key_name": "idm-jenkins",
        "name": "f32.tdudlak.test",
        "network": "IPv4"
    }
]
[('provider_net_cci_5', 26), ('provider_net_cci_4', 37), ('provider_net_cci_8', 119), ('provider_net_cci_7', 178), ('provider_net_cci_9', 189), ('provider_net_cci_6', 195)]
Validating hosts definitions
Image not found image: fedora-broken, ref: None   <<<<< it was mage not found image: None, ref: None
(workenv) ➜  workenv git:(improve-validation) ✗ mrack -c ../provisioning-config.yaml up ./broken.yaml -p aws
Initializing AWS provider
Login duration 0:00:00.075713
Provisioning started
[
    {
        "flavor": "t2.medium",
        "image": "fedora-broken",
        "name": "f32.tdudlak.test"
    }
]
Validating hosts definitions
aws provider does not validate 'fedora-broken' image name.
(workenv) ➜  workenv git:(improve-validation) ✗ mrack -c ../provisioning-config.yaml up ./broken.yaml -p beaker
Initializing Beaker provider
Creating new session...
New session created.
Login duration 0:00:00.594823
Provisioning started
[
    {
        "arch": "x86_64",
        "distro": "fedora-broken",
        "name": "f32.tdudlak.test",
        "variant": "Server"
    }
]
Validating hosts definitions
beaker provider does not validate 'fedora-broken' distro name.