Skip to content

Commit

Permalink
LTSS registratio in HanaSR test
Browse files Browse the repository at this point in the history
  • Loading branch information
mpagot committed Nov 14, 2024
1 parent a9fed7a commit 6a67505
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lib/sles4sap_publiccloud.pm
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,8 @@ sub delete_network_peering {
=item B<ptf_container> - name of the container for PTF files (optional)
=item B<ltss> - name of the LTSS extension to register. String has to be a valid one to be used to compose sles_modules variable,
then used as SUSEConnect or registercloudguest argument. Registration code for it will be get from SCC_REGCODE_LTSS variable.
=back
=cut

Expand All @@ -921,14 +923,14 @@ sub create_playbook_section_list {
my @playbook_list;

unless ($args{registration} eq 'noreg') {
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');
push @reg_args, "-e sles_modules='[{\"key\":\"$args{ltss}\",\"value\":\"" . get_required_var('SCC_REGCODE_LTSS') . "\"}]'" if ($args{ltss});

# 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";
}
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.
Expand Down
13 changes: 13 additions & 0 deletions t/12_sles4sap_publicccloud.t
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,19 @@ subtest '[create_playbook_section_list]' => sub {
};


subtest '[create_playbook_section_list] ltss' => sub {
set_var('SCC_REGCODE_SLES4SAP', 'Magellano');
set_var('SCC_REGCODE_LTSS', 'Jofuku');
set_var('USE_SAPCONF', 'Colombo');
my $ansible_playbooks = create_playbook_section_list(ltss => 'XuFu');
set_var('SCC_REGCODE_SLES4SAP', undef);
set_var('SCC_REGCODE_LTSS', undef);
set_var('USE_SAPCONF', undef);
note("\n --> " . join("\n --> ", @$ansible_playbooks));
ok((any { /.*registration\.yaml.*sles_modules=.*key.*XuFu.*value.*Jofuku/ } @$ansible_playbooks), 'registration playbook is called with reg code from SCC_REGCODE_LTSS');
};


subtest '[create_playbook_section_list] ha_enabled => 0' => sub {
set_var('SCC_REGCODE_SLES4SAP', 'Magellano');
set_var('USE_SAPCONF', 'Colombo');
Expand Down

0 comments on commit 6a67505

Please sign in to comment.