lib/publiccloud/provider.pm

METHODS

conv_openqa_tf_name

Does the conversion between PUBLIC_CLOUD_PROVIDER and Terraform providers name.

find_img

Retrieves the image-id by given image name.

upload_img

Upload a image to the CSP. Required parameter is the location of the image file. UEFI images are supported by giving the optional parameter type = 'uefi'. This is only supported on GCE at the momment.

Retrieves the image-id after upload or die.

img_proof

img_proof(instance_type => <string>, cleanup => <bool>, tests => <string>, timeout => <seconds>, results_dir => <string>, distro => <string>);

Call img-proof tool and retrieves a hashref as result. Do not die if img-proof call exit with error. $result_hash = { instance => <publiccloud:instance>, # instance object logfile => <string>, # the pytest logfile results => <string>, # json results file tests => <int>, # total number of tests pass => <int>, # successful tests skip => <int>, # skipped tests fail => <int>, # number of failed tests error => <int>, # number of errors };

parse_img_proof_output

Parse the output from img-proof command and retrieves instance-id, ip and logfile names.

create_ssh_key

Creates an ssh keypair in a given file path by $args{ssh_private_key_file}

run_img_proof

called by childs within img-proof function

get_image_id

get_image_id([$img_url]);

Retrieves the CSP image id if exists, otherwise exception is thrown. The given $img_url is optional, if not present it retrieves from PUBLIC_CLOUD_IMAGE_LOCATION. If PUBLIC_CLOUD_IMAGE_ID is set, then this value will be used

get_image_uri

Retrieves the CSP image uri if exists, otherwise exception is thrown. This is currently used specifically in Azure so the subroutine will die afterwards.

create_instance

Creates an instance on the public cloud provider. Retrieves a publiccloud::instance object.

image defines the image_id to create the instance. instance_type defines the flavor of the instance. If not specified, it will load it from PUBLIC_CLOUD_INSTANCE_TYPE.

create_instances

Creates multiple instances on the public cloud provider. Retrieves an array of publiccloud::instance objects.

image defines the image_id to create the instance. instance_type defines the flavor of the instance. If not specified, it will load it from PUBLIC_CLOUD_INSTANCE_TYPE. timeout Parameter to pass to instance::wait_for_ssh. proceed_on_failure Same as timeout.

on_terraform_apply_timeout

This method can be overwritten by child classes to do some special cleanup task if 'apply' fails. Terraform was already terminated using the QUIT signal and openqa has a valid shell. The working directory is always the terraform directory, where the statefile and the *.tf is placed.

on_terraform_destroy_timeout

This method can be overwritten by child classes to do some special cleanup task if 'destroy' fails. Terraform was already terminated using the QUIT signal and openqa has a valid shell. The working directory is always the terraform directory, where the statefile and the *.tf is placed.

terraform_prepare_env

This method is used to initialize the terraform environment. it is executed only once, guareded by `terraform_env_prepared` member.

terraform_apply

Calls terraform tool and applies the corresponding configuration .tf file

terraform_destroy

Destroys the current terraform deployment

terraform_param_tags

Build the tags parameter for terraform. It is a single depth json like c<{"key": "value"}> where c<value> must be a string.

cleanup

This method is called called after each test on failure or success.

stop_instance

This function implements a provider specifc stop call for a given instance.

start_instance

This function implements a provider specifc start call for a given instance.

get_state_from_instance

This function implements a provider specifc get_state call for a given instance.