Call: $self->generate_basename();
openqa test product name composition, based on basic product parameters values and eventual modifiers.
Returns a string-name containing distri, version, flavor, arch.
Retrieves the image-id by given image name.
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(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 the output from img-proof command and retrieves instance-id, ip and logfile names.
Creates an ssh keypair in a given file path by $args{ssh_private_key_file}
Creates ~/.ssh/config file with all the common ssh client settings
called by childs within img-proof function
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
Retrieves the CSP image uri if exists, otherwise exception is thrown. This is currently used specifically in Azure so the subroutine will die afterwards.
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.
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.
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.
This method can be overwritten by child classes to do some special cleanup task if 'destroy' fails (including timeout). The working directory is always the terraform directory, where the statefile and the *.tf is placed. Returns 1 if the fallback cleanup succeeded (caller should not die), or a false value if it did not (caller should die).
This method is used to initialize the terraform environment. it is executed only once, guareded by `terraform_env_prepared` member.
my ($ret, $output) = $self->_tofu_run_step(
step => 'init', # short label, also used to name the output file (tf_<step>_output)
cmd => 'tofu init -no-color',
timeout => 180, # overall script_retry() timeout, in seconds
delay => 10, # seconds to wait between retries
retry => 6, # number of script_retry() attempts
);
Run a single tofu/terraform step (init, plan or apply) via script_retry(), capturing its combined stdout/stderr to tf_<step_output> so the output survives even on a timeout (unlike letting script_retry die internally with no diagnostics). Always returns the exit code and the captured output rather than dying itself, so the caller decides how to react to a failure.
my $bool = $self->region_out_of_resources($terraform_output);
Return true if the given terraform apply output indicates that the current region has no resources available to fulfil the request for the selected instance type (e.g. STOCKOUT on GCE, InsufficientInstanceCapacity on EC2 or SkuNotAvailable/AllocationFailed on Azure).
It is used by "terraform_apply" to decide whether it is worth retrying the deployment in one of the PUBLIC_CLOUD_ALTERNATE_REGIONS (poo#202446, AC2). Any other kind of error must fail immediately, so it returns false for them.
Calls terraform tool and applies the corresponding configuration .tf file
Destroys the current terraform deployment
Build the tags parameter for terraform. It is a single depth json like c<{"key": "value"}> where c<value> must be a string.
Query the terraform data structure in json format. Input: <jq-query-format> string; <empty> = no query then full output of data structure. E.g: to get the VM instance name from json data structure, the call is: get_terraform_output(".vm_name.value[0]"); To get the complete output structure, the call is: get_terraform_output();
This method is calling the terraform_destroy() subroutine.
This function implements a provider specifc stop call for a given instance.
This function implements a provider specifc start call for a given instance.
This function implements a provider specifc get_state call for a given instance.