diff --git a/ChangeLog b/ChangeLog index f7bf3be94..0ac334ee1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,7 @@ Revision history for Rex [BUG FIXES] - Fix warning about redundant arguments when using sync with key authentication + - Fix setting distributor when versioned feature flags are active [DOCUMENTATION] - Clarify sudo usage for multiple commands @@ -17,6 +18,8 @@ Revision history for Rex [MINOR] [NEW FEATURES] + - Add new configuration option to control attaching default authentication + info to tasks [REVISION] diff --git a/lib/Rex.pm b/lib/Rex.pm index a9202cfcb..1ba17f630 100644 --- a/lib/Rex.pm +++ b/lib/Rex.pm @@ -757,7 +757,7 @@ sub import { # remove default task auth if ( $add =~ m/^\d+\.\d+$/ && $add >= 0.31 ) { Rex::Logger::debug("activating featureset >= 0.31"); - Rex::TaskList->create()->set_default_auth(0); + Rex::Config->set_default_auth(0); $found_feature = 1; } diff --git a/lib/Rex/Config.pm b/lib/Rex/Config.pm index d5ba5c9ff..c8cbeea95 100644 --- a/lib/Rex/Config.pm +++ b/lib/Rex/Config.pm @@ -60,6 +60,7 @@ our ( $use_template_ng, $use_rex_kvm_agent, $autodie, $task_chaining_cmdline_args, $waitpid_blocking_sleep_time, $write_utf8_files, + $default_auth, ); # some defaults @@ -1591,6 +1592,27 @@ sub get_write_utf8_files { return $write_utf8_files; } +=head2 set_default_auth + +=head2 get_default_auth + +Sets and gets the value of the C<$default_auth> configuration variable. + +This controls whether Rex should attach default authentication info to tasks. + +Default is C<1>. + +=cut + +sub set_default_auth { + my $self = shift; + $default_auth = shift; +} + +sub get_default_auth { + return $default_auth // 1; +} + =head2 register_set_handler($handler_name, $code) Register a handler that gets called by I. diff --git a/lib/Rex/TaskList/Base.pm b/lib/Rex/TaskList/Base.pm index aaf776f16..2c83a91d0 100644 --- a/lib/Rex/TaskList/Base.pm +++ b/lib/Rex/TaskList/Base.pm @@ -35,7 +35,7 @@ sub new { bless( $self, $proto ); $self->{IN_TRANSACTION} = 0; - $self->{DEFAULT_AUTH} = 1; + $self->{DEFAULT_AUTH} = Rex::Config->get_default_auth(); $self->{tasks} = {}; return $self; diff --git a/t/group.t b/t/group.t index 5f6588566..3ff8affe4 100644 --- a/t/group.t +++ b/t/group.t @@ -4,6 +4,7 @@ use warnings; use Test::More tests => 95; use Rex -feature => '0.31'; +use Rex::Group; delete $ENV{REX_USER};