-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LTSS registration in HanaSR test #20642
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,23 +17,22 @@ use strict; | |
use JSON; | ||
use warnings FATAL => 'all'; | ||
use Exporter 'import'; | ||
use Scalar::Util 'looks_like_number'; | ||
use Scalar::Util qw(looks_like_number); | ||
use List::MoreUtils qw(uniq); | ||
use Carp qw(croak); | ||
use YAML::PP; | ||
use testapi; | ||
use utils qw(file_content_replace); | ||
use serial_terminal qw(serial_term_prompt); | ||
use version_utils qw(check_version); | ||
use version_utils qw(check_version is_sle); | ||
use hacluster; | ||
use qesapdeployment; | ||
use publiccloud::utils; | ||
use publiccloud::provider; | ||
use publiccloud::ssh_interactive 'select_host_console'; | ||
use publiccloud::ssh_interactive qw(select_host_console); | ||
use publiccloud::instance; | ||
use sles4sap; | ||
use saputils; | ||
use version_utils 'is_sle'; | ||
|
||
our @EXPORT = qw( | ||
run_cmd | ||
|
@@ -901,6 +900,13 @@ sub delete_network_peering { | |
|
||
=item B<ptf_container> - name of the container for PTF files (optional) | ||
|
||
=item B<ltss> - name and reg_code for LTSS extension to register. | ||
This argument is a two element comma separated list string. | ||
Like: 'SLES-LTSS-Extended-Security/12.5/x86_64,123456789' | ||
First string before the comma has to be a valid SCC extension name, later used by Ansible | ||
as argument for SUSEConnect or registercloudguest argument. | ||
Second string has to be valid registration code for the particular LTSS extension. | ||
|
||
=back | ||
=cut | ||
|
||
|
@@ -921,14 +927,19 @@ sub create_playbook_section_list { | |
my @playbook_list; | ||
|
||
unless ($args{registration} eq 'noreg') { | ||
# Add registration module as first element | ||
my $reg_code = '-e reg_code=' . get_required_var('SCC_REGCODE_SLES4SAP') . " -e email_address=''"; | ||
if ($args{registration} eq 'suseconnect') { | ||
push @playbook_list, "registration.yaml $reg_code -e use_suseconnect=true"; | ||
} | ||
else { | ||
push @playbook_list, "registration.yaml $reg_code"; | ||
my @reg_args = ('registration.yaml'); | ||
push @reg_args, '-e reg_code=' . get_required_var('SCC_REGCODE_SLES4SAP') . " -e email_address=''"; | ||
push @reg_args, '-e use_suseconnect=true' if ($args{registration} eq 'suseconnect'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changed to inline |
||
if ($args{ltss}) { | ||
my @ltss_args = split(/,/, $args{ltss}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unpack arguments, symmetrical to pack in https://github.com/os-autoinst/os-autoinst-distri-opensuse/pull/20642/files#diff-d537e7676e4de934957a302dd9662d07237c473a02581e3fa2ca4065a6471c6dR190 |
||
die "Missing reg_code for '$ltss_args[0]'" if scalar @ltss_args != 2; | ||
push @reg_args, "-e sles_modules='[{" . | ||
"\"key\":\"$ltss_args[0]\"," . | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This implementation only support one. [0] is the name of the extension |
||
"\"value\":\"$ltss_args[1]\"}]'"; | ||
} | ||
# Add registration module as first element | ||
push @playbook_list, join(' ', @reg_args); | ||
|
||
# Add "fully patch system" module after registration module and before test start/configuration modules. | ||
# Temporary moved inside noreg condition to avoid test without Ansible to fails. | ||
# To be properly addressed in the caller and fully-patch-system can be placed back out of the if. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ use publiccloud::utils qw(is_azure is_gce get_ssh_private_key_path); | |
use sles4sap_publiccloud; | ||
use qesapdeployment; | ||
use serial_terminal 'select_serial_terminal'; | ||
use registration qw(get_addon_fullname scc_version %ADDONS_REGCODE); | ||
|
||
our $ha_enabled = set_var_output('HA_CLUSTER', '0') =~ /false|0/i ? 0 : 1; | ||
|
||
|
@@ -175,6 +176,22 @@ sub run { | |
$playbook_configs{spn_application_password} = get_var('AZURE_SPN_APP_PASSWORD', get_required_var('_SECRET_AZURE_SPN_APP_PASSWORD')); | ||
} | ||
} | ||
|
||
my @addons = grep { defined $_ && $_ } split(/,/, get_var('SCC_ADDONS')); | ||
# This implementation has a known limitation | ||
# if SCC_ADDONS has two or more elements (like "ltss,ltss_es") | ||
# only the last one will be added to the playbook argument. | ||
foreach my $addon (@addons) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Scan all extensions in SCC_ADDONS and only care about ltss, calculate SCC Extension name and reg code for it and pack them in the right format expected by ltss argument of create_playbook_section_list |
||
my $name; | ||
# Keep the code simple by only support ltss addons, | ||
# it simplify version calculation. | ||
$name = get_addon_fullname($addon) if ($addon =~ 'ltss'); | ||
alvarocarvajald marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if ($name) { | ||
record_info($name, "Register '$name' with code '$ADDONS_REGCODE{$name}'"); | ||
$playbook_configs{ltss} = join(',', join('/', $name, scc_version(), 'x86_64'), $ADDONS_REGCODE{$name}); | ||
$playbook_configs{registration} = 'suseconnect' if ($os_image_name =~ 'byos'); | ||
} | ||
} | ||
$ansible_playbooks = create_playbook_section_list(%playbook_configs); | ||
|
||
my $ansible_hana_vars = create_hana_vars_section($ha_enabled); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as the command line composition for this playbook become more complex I decided to fit all argument in a list and then join them at the end