Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wrapper for zypper_call and trup_call
- Loading branch information
Showing
3 changed files
with
61 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# SUSE's openQA tests | ||
# | ||
# Copyright 2023 SUSE LLC | ||
# SPDX-License-Identifier: FSFAP | ||
# | ||
# Summary: Wrapper for package installation, zypper or transactional update | ||
# Maintainer: QE Core <qe-core@suse.de> | ||
|
||
package wrapper; | ||
use Mojo::Base qw(Exporter); | ||
use testapi; | ||
use version_utils qw(is_transactional); | ||
use transactional qw(trup_call); | ||
use utils qw(zypper_call); | ||
|
||
our @EXPORT = "install_package"; | ||
|
||
=head1 DESCRIPTION | ||
Wrapper for zypper_call and trup_call | ||
=head2 install_package | ||
install_package(packages => 'kernel-devel' [, trup_packages => 'kernel-default-base] [, zypper_packages => 'kernel-devel']); | ||
C<packages> defines packages to install for both zypper and trup call, | ||
different packages can be installaed on transactional system via C<trup_packages> | ||
or on standard system via C<zypper_packages> | ||
After trup_call check_reboot_changes can be executed via C<trup_check_reboot> parameter | ||
=cut | ||
|
||
sub install_package { | ||
my (%args) = @_; | ||
my $trup_packages = $args{trup_packages} // $args{packages}; | ||
my $zypper_packages = $args{zypper_packages} // $args{packages}; | ||
die 'At least one of packages, trup_packages, zypper_packages arguments is required' unless defined($args{packages} || $args{trup_packages} || $args{zypper_packages}); | ||
my $timeout = $args{timeout} // 500; | ||
|
||
if (is_transactional) { | ||
if ($args{trup_info}) { | ||
record_info('install_package', $args{trup_info}); | ||
} | ||
else { | ||
trup_call('pkg in -l ' . $trup_packages, timeout => $args{timeout}); | ||
check_reboot_changes if $args{trup_check_reboot}; | ||
} | ||
} | ||
else { | ||
if ($args{zypper_info}) { | ||
record_info('install_package', $args{zypper_info}); | ||
} | ||
else { | ||
zypper_call('in -l ' . $zypper_packages, timeout => $args{timeout}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters