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
Wrapper for zypper_call and trup_call #18204
Conversation
I found, not kernel related test, which is great candidate for this PR: https://github.com/os-autoinst/os-autoinst-distri-opensuse/blob/master/tests/console/year_2038_detection.pm |
Great PR! Please pay attention to the following items before merging: Files matching
This is an automatically generated QA checklist based on modified files. |
Thank you @czerw, the |
d6c0b62
to
c5f922e
Compare
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.
LGTM, it's good start to have things more seamless.
lib/wrapper.pm
Outdated
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; |
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.
First, why add a new file? This should go to utils.pm
or at least qam.pm
because it'll be used a lot.
Second, I really don't like that all packages have to be passed in a keyword argument. I'd prefer the package list handling like this:
my ($packages, %args) = @_;
if (is_transactional) {
$packages .= ' ' . $args{trup_extra} // '';
}
else {
$packages .= ' ' . $args{zypper_extra} // '';
}
So that I can call just install_package('foo');
.
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.
I think I read somewhere it should be in separated package, but I don't mind to have it in likely utils.pm
.
Sure, I will do the packages default parameter without keyword argument.
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.
I changed the code, if nobody disagrees @czerw @foursixnine ? I would move the install_package into utils.
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.
This should go to utils.pm or at least qam.pm because it'll be used a lot.
That it will be used a lot isn't a good reason to keep making lib/utils grow, so @dzedro lets keep it separate.
In the end, Jozef's work would end up as a stepping stone to move towards something that abstracts most things from the caller, and end up in $self->action($packages)
or something like that
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.
OK, can we at least rename the file so that it sounds like something related to package installation? rpm.pm
, package_utils.pm
, or something like that...
lib/wrapper.pm
Outdated
# Maintainer: QE Core <qe-core@suse.de> | ||
|
||
package wrapper; | ||
use Mojo::Base qw(Exporter); |
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.
In the future, we can take a look into using perl signatures https://www.perl.com/article/announcing-perl-7/
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.
Sure
lib/wrapper.pm
Outdated
record_info('install_package', $args{skip_trup}) if $args{skip_trup} =~ /\w+/; | ||
return if $args{skip_trup}; |
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.
record_info('install_package', $args{skip_trup}) if $args{skip_trup} =~ /\w+/; | |
return if $args{skip_trup}; | |
if $args{skip_trup}{ record_info "Skipping changes in transactional system as requested"; return }; | |
record_info('install_package', $args{skip_trup}) if $args{skip_trup} =~ /\w+/; | |
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.
I can put also all the code on one line, can I ? 🙄
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.
I can put also all the code on one line, can I ?
Well I mean to have a clear indicator that there's an intended skip
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.
I would do it, but then record_info after return is pointless.
I did it just because existing code had record_info, there is option to leave message,
must be not done always.
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.
record_info('install_package', ...);
would be just pointless spam...
lib/wrapper.pm
Outdated
record_info('install_package', $args{skip_zypper}) if $args{skip_zypper} =~ /\w+/; | ||
return if $args{skip_zypper}; |
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.
Same as above
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.
Looking good @dzedro, I guess the update or patch are what come next, isn't it?
(random question, is there a difference between patch
vs dup/up
? from a customer point of view?
IDK, Whatever is needed Regarding location of install_package, I will not put it into utils, because of failure https://dzedro.suse.cz/tests/252, probably some circular dependency. |
|
It's in |
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.
LGTM
https://dzedro.suse.cz/tests/301#step/update_kernel/106 SLE Micro
https://dzedro.suse.cz/tests/302#step/update_kernel/26 SLES
https://openqa.suse.de/tests/overview?distri=sle&version=15-SP5&build=jpupava_wrapper