Skip to content

Commit

Permalink
Merge branch 'RexOps:master' into load_rexfile_test_and_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
uralm1 authored Jan 13, 2023
2 parents 5b80cc5 + 36b9d62 commit 347e328
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 5 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Revision history for Rex

[DOCUMENTATION]
- Clarify optional arguments of file commands
- Clarify optional arguments of the pkg command
- Correct example for file_read command

[ENHANCEMENTS]
- Use $SIG{__WARN__} when loading Rexfile instead stderr redirection
Expand Down
2 changes: 1 addition & 1 deletion lib/Rex/Commands/File.pm
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ On failure it will die.
my $fh;
eval {
$fh = read("/etc/groups");
$fh = file_read("/etc/groups");
};
# catch an error
Expand Down
2 changes: 1 addition & 1 deletion lib/Rex/Commands/Pkg.pm
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ use vars qw(@EXPORT);
@EXPORT =
qw(install update remove update_system installed_packages is_installed update_package_db repository package_provider_for pkg);

=head2 pkg($package, %options)
=head2 pkg($package [, %options])
Since: 0.45
Expand Down
4 changes: 3 additions & 1 deletion lib/Rex/Pkg/Base.pm
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,9 @@ OLD_PKG:
push @modifications, map { $_->{action} = 'installed'; $_ }
grep { !exists $_->{found} } @new_installed;

map { delete $_->{found} } @modifications;
for (@modifications) {
delete $_->{found};
}

return @modifications;
}
Expand Down
4 changes: 3 additions & 1 deletion lib/Rex/Pkg/Debian.pm
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ OLD_PKG:
push @modifications, map { $_->{action} = 'installed'; $_ }
grep { !exists $_->{found} } @new_installed;

map { delete $_->{found} } @modifications;
for (@modifications) {
delete $_->{found};
}

return @modifications;
}
Expand Down
5 changes: 4 additions & 1 deletion t/package.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use strict;
use warnings;

use Test::More tests => 4;
use Test::More tests => 5;

use Rex::Pkg::Base;

Expand Down Expand Up @@ -33,4 +33,7 @@ is( $found_libssh2->{action}, "installed", "libssh2-1 was installed" );
my ($found_mc) = grep { $_->{name} eq "mc" } @mods;
is( $found_mc->{action}, "removed", "mc was removed" );

my $leftover_found = scalar grep { defined $_->{found} } @mods;
is( $leftover_found, 0, 'no internal found marker left' );

1;

0 comments on commit 347e328

Please sign in to comment.