lib/autoyast.pm

autoyast

Provide translations for autoyast XML file

expand_patterns

 expand_patterns();

Expand patterns for sle12 and sle15. Returns a list of patterns to be installed.

get_product_version

 get_product_version();

Return product version from SCC and product name, so-called unversioned products like asmm, contm, lgm, tcm, wsm if product version number lower than 15

expand_addons

 expand_addons();

Returns hash of all SCC_ADDONS with name, version and architecture.

expand_template

 expand_template($profile);

Expand and returns template including autoyast profile and it's varialbes like addons, repos, patterns, get_var

$profile is the autoyast profile 'autoinst.xml'.

init_autoyast_profile

 init_autoyast_profile();

Initialize or create a new autoyast profile by 'yast2 clone_system' if doesn't exist and returns the path of autoyast profile

validate_autoyast_profile

  validate_autoyast_profile($profile);

Validate AutoYaST profile traversing yaml test data $profile is the root node in the test data

Expected yaml data should mimic structure of xml file for AutoYaST profile, so hashes and arrays in the yaml should represent nodes in the xml file.

In case of list in xml, yaml structure should be represented as an array, so it would be able to generate expression to check that element on the list met expectations. If a hash is used instead, it will validate its inner value but it will not check size of the list.

To identify an element in a list (as they are not ordered) on xml via xpath it has been added an special field in yaml named 'unique_key' which value is the name of the selected property to search the element on the list. When that property is not a direct child (in other words, it is not at the same level in the yaml) it should be specify in yaml 'unique_value' to specify the value expected for that inner/nested property (it is verbose but avoid to search every time in the whole yaml tree). For instance:

- drive: unique_key: mount unique_value: / ... partitions: - partition: unique_key: label ... label: root_multi_btrfs mount: /

In the example, the tester chose 'mount' node/value to distinguish this 'drive' from other 'drive' nodes in the xml. In order to distinguish that particular 'partition' node only 'unique_key' was required because label is a direct child of 'partition' node in the xml.

Finally, creates a report at the end with errors (both yaml and execution errors) and overall expressions executed.

detect_profile_directory

 detect_profile_directory(profile => $profile, path => $path)

 Try to detect profile directory (autoyast_opensuse/, autoyast_sle{12,15}/, autoyast_sles11/)
 and returns its path.
 TODO: autoyast_{caasp,kvm,qam,xen}

 $profile is the autoyast profile 'autoinst.xml'.
 $path is AutoYaST profile path

expand_version

 expand_version($profile);

 Expand VERSION, as e.g. 15-SP1 has to be mapped to 15.1

 $profile is the autoyast profile 'autoinst.xml'.

adjust_network_conf

 adjust_network_conf($profile);

 For s390x and svirt backends need to adjust network configuration

 $profile is the autoyast profile 'autoinst.xml'.

expand_variables

 expand_variables($profile);

 Expand variables from job settings which do not require further processing

 $profile is the autoyast profile 'autoinst.xml'.

upload_profile

 upload_profile(profile => $profile, path => $path)

 Upload modified profile
 Update url
 Update path
 Make available profile in job logs

 $profile is the AutoYaST profile 'autoinst.xml'.
 $path is AutoYaST profile path

inject_registration

 inject_registration($profile);

 $profile is the autoyast profile 'autoinst.xml'.

test_ayp_url

 test_ayp_url();

 Test if the autoyast profile url is reachable, before the autoyast installation begins.