| 1 | # | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # (c) Jan Gehring <jan.gehring@gmail.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | Rex::Config - Handles Rex configuration | ||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | use Rex::Config; | ||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | # set a config option | ||||||||||||||||||||||||||||||||||||||||||
| 14 | Rex::Config->set_exec_autodie(TRUE); | ||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | # get value of a config option | ||||||||||||||||||||||||||||||||||||||||||
| 17 | my $user = Rex::Config->get_user(); | ||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | This module holds all configuration options for Rex, and also allows you to specify your own ones for your modules. | ||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | Please take a look at L<Rex::Commands> first, which provides convenience wrappers for many of these options. | ||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | While it's possible to use the methods below to set a configuration option directly, their main intended purpose is to be used as internal plumbing, and to provide an escape hatch in case there are no better alternatives. | ||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | =head1 EXPORTED METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | package Rex::Config; | ||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | 108 | ▶ | use v5.14.4; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | 108 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | 108 | our $VERSION = '1.16.1'; # VERSION | |||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | 108 | ▶ | use Rex::Helper::File::Spec; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 39 | 108 | ▶ | use Rex::Logger; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | 108 | ▶ | use YAML; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | 108 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | 108 | ▶ | use Rex::Require; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | 108 | ▶ | use Symbol; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | our ( | ||||||||||||||||||||||||||||||||||||||||||
| 46 | 108 | $user, $password, | |||||||||||||||||||||||||||||||||||||||||
| 47 | $port, $timeout, | ||||||||||||||||||||||||||||||||||||||||||
| 48 | $max_connect_fails, $password_auth, | ||||||||||||||||||||||||||||||||||||||||||
| 49 | $key_auth, $krb5_auth, | ||||||||||||||||||||||||||||||||||||||||||
| 50 | $public_key, $private_key, | ||||||||||||||||||||||||||||||||||||||||||
| 51 | $parallelism, $log_filename, | ||||||||||||||||||||||||||||||||||||||||||
| 52 | $log_facility, $sudo_password, | ||||||||||||||||||||||||||||||||||||||||||
| 53 | $ca_file, $ca_cert, | ||||||||||||||||||||||||||||||||||||||||||
| 54 | $ca_key, $path, | ||||||||||||||||||||||||||||||||||||||||||
| 55 | $no_path_cleanup, $set_param, | ||||||||||||||||||||||||||||||||||||||||||
| 56 | $environment, $connection_type, | ||||||||||||||||||||||||||||||||||||||||||
| 57 | $distributor, $template_function, | ||||||||||||||||||||||||||||||||||||||||||
| 58 | $SET_HANDLER, $HOME_CONFIG, | ||||||||||||||||||||||||||||||||||||||||||
| 59 | $HOME_CONFIG_YAML, %SSH_CONFIG_FOR, | ||||||||||||||||||||||||||||||||||||||||||
| 60 | $sudo_without_locales, $sudo_without_sh, | ||||||||||||||||||||||||||||||||||||||||||
| 61 | $no_tty, $source_global_profile, | ||||||||||||||||||||||||||||||||||||||||||
| 62 | $source_profile, %executor_for, | ||||||||||||||||||||||||||||||||||||||||||
| 63 | $allow_empty_groups, $use_server_auth, | ||||||||||||||||||||||||||||||||||||||||||
| 64 | $tmp_dir, %openssh_opt, | ||||||||||||||||||||||||||||||||||||||||||
| 65 | $use_cache, $cache_type, | ||||||||||||||||||||||||||||||||||||||||||
| 66 | $use_sleep_hack, $report_type, | ||||||||||||||||||||||||||||||||||||||||||
| 67 | $do_reporting, $say_format, | ||||||||||||||||||||||||||||||||||||||||||
| 68 | $exec_autodie, $verbose_run, | ||||||||||||||||||||||||||||||||||||||||||
| 69 | $disable_taskname_warning, $proxy_command, | ||||||||||||||||||||||||||||||||||||||||||
| 70 | $task_call_by_method, $fallback_auth, | ||||||||||||||||||||||||||||||||||||||||||
| 71 | $register_cmdb_template, $check_service_exists, | ||||||||||||||||||||||||||||||||||||||||||
| 72 | $set_no_append, $use_net_openssh_if_present, | ||||||||||||||||||||||||||||||||||||||||||
| 73 | $use_template_ng, $use_rex_kvm_agent, | ||||||||||||||||||||||||||||||||||||||||||
| 74 | $autodie, $task_chaining_cmdline_args, | ||||||||||||||||||||||||||||||||||||||||||
| 75 | $waitpid_blocking_sleep_time, $write_utf8_files, | ||||||||||||||||||||||||||||||||||||||||||
| 76 | $default_auth, $augeas_commands_prepend, | ||||||||||||||||||||||||||||||||||||||||||
| 77 | $local_augeas_backend, | ||||||||||||||||||||||||||||||||||||||||||
| 78 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | # some defaults | ||||||||||||||||||||||||||||||||||||||||||
| 81 | 108 | %executor_for = ( | |||||||||||||||||||||||||||||||||||||||||
| 82 | perl => "perl", | ||||||||||||||||||||||||||||||||||||||||||
| 83 | python => "python", | ||||||||||||||||||||||||||||||||||||||||||
| 84 | ruby => "ruby", | ||||||||||||||||||||||||||||||||||||||||||
| 85 | bash => "bash", | ||||||||||||||||||||||||||||||||||||||||||
| 86 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | =head2 set_autodie | ||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | =head2 get_autodie | ||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | Sets and gets the value of the C<$autodie> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | This controls whether Rex should C<die()> if there's an error while executing L<file system commands that are supposed to change the contents|Rex::Commands::Fs#Changing-content>. | ||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | 1 | ▶ | sub set_autodie { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_autodie: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | 1 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 102 | 1 | $autodie = shift; | |||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | 2 | ▶ | sub get_autodie { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_autodie: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 106 | 2 | return $autodie; | |||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | =head2 set_use_net_openssh_if_present | ||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | =head2 get_use_net_openssh_if_present | ||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | Sets and gets the value of the C<$use_net_openssh_if_present> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | This controls whether Rex should use L<Net::OpenSSH> for connections if that is available. | ||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||
| 117 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||
| 119 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | 703 | ▶ | sub set_use_net_openssh_if_present { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_use_net_openssh_if_present: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | 703 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 123 | 703 | $use_net_openssh_if_present = shift; | |||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | ▶ | sub get_use_net_openssh_if_present { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_use_net_openssh_if_present: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | return $use_net_openssh_if_present; | |||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | =head2 set_use_rex_kvm_agent | ||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | =head2 get_use_rex_kvm_agent | ||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||
| 134 | Sets and gets the value of the C<$use_rex_kvm_agent> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | This controls whether Rex should setup and use a serial device for the experimental L<Rex KVM agent|https://github.com/RexOps/rex-kvm-agent> for managed VMs. | ||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||
| 140 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | sub set_use_rex_kvm_agent { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_use_rex_kvm_agent: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | $use_rex_kvm_agent = shift; | |||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | ▶ | sub get_use_rex_kvm_agent { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_use_rex_kvm_agent: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | return $use_rex_kvm_agent; | |||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||
| 151 | =head2 set_use_template_ng | ||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | =head2 get_use_template_ng | ||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | Sets and gets the value of the C<$use_template_ng> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||
| 157 | This controls whether Rex should use L<Rex::Template::NG> to render templates. | ||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | ▶ | sub set_use_template_ng { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_use_template_ng: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | $use_template_ng = shift; | |||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||
| 168 | 117 | ▶ | sub get_use_template_ng { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_use_template_ng: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 169 | 117 | return $use_template_ng; | |||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | =head2 set_set_no_append | ||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||
| 174 | =head2 get_set_no_append | ||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||
| 176 | Sets and gets the value of the C<$set_no_append> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||
| 178 | This controls whether Rex should overwrite or append values of configuration options when using the L<set|Rex::Commands#set> command. | ||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||
| 180 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||
| 182 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||
| 184 | 1 | ▶ | sub set_set_no_append { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_set_no_append: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 185 | 1 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 186 | 1 | $set_no_append = shift; | |||||||||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | ▶ | sub get_set_no_append { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_set_no_append: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | return $set_no_append; | |||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||
| 193 | =head2 set_check_service_exists | ||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||
| 195 | =head2 get_check_service_exists | ||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||
| 197 | Sets and gets the value of the C<$check_service_exists> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | This controls whether Rex should C<die()> early if it is asked to manage a service that doesn't exist. | ||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||
| 201 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | 1 | ▶ | sub set_check_service_exists { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_check_service_exists: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | 1 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 207 | 1 | $check_service_exists = shift; | |||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | ▶ | sub get_check_service_exists { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_check_service_exists: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | return $check_service_exists; | |||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||
| 214 | =head2 set_register_cmdb_template | ||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||
| 216 | =head2 get_register_cmdb_template | ||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||
| 218 | Sets and gets the value of the C<$register_cmdb_template> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||
| 220 | This controls whether Rex should make L<CMDB|Rex::CMDB> data available to be used in templates as variables. | ||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||
| 224 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||
| 226 | 3 | ▶ | sub set_register_cmdb_template { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_register_cmdb_template: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 227 | 3 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 228 | 3 | $register_cmdb_template = shift; | |||||||||||||||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||
| 231 | 4 | ▶ | sub get_register_cmdb_template { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_register_cmdb_template: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 232 | 4 | return $register_cmdb_template; | |||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||
| 235 | =head2 set_fallback_auth | ||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||
| 237 | =head2 get_fallback_auth | ||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||
| 239 | Sets and gets the value of the C<$fallback_auth> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||
| 241 | This can be used to define an array of hash references, each of them containing L<authentication details|Rex::Commands#auth> to be tried during connection attempts when the directly specified ones fail. | ||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||
| 243 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||
| 245 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | ▶ | sub set_fallback_auth { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_fallback_auth: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | $fallback_auth = [@_]; | |||||||||||||||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | ▶ | sub get_fallback_auth { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_fallback_auth: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | return $fallback_auth; | |||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||
| 256 | =head2 set_task_call_by_method | ||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||
| 258 | =head2 get_task_call_by_method | ||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||
| 260 | Sets and gets the value of the C<$task_call_by_method> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||
| 262 | This controls whether calling tasks as a method is allowed or not. | ||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||
| 264 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||
| 266 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||
| 268 | 1 | ▶ | sub set_task_call_by_method { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_task_call_by_method: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 269 | 1 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 270 | 1 | $task_call_by_method = shift; | |||||||||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | ▶ | sub get_task_call_by_method { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_task_call_by_method: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | return $task_call_by_method; | |||||||||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||
| 277 | =head2 set_disable_taskname_warning | ||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||
| 279 | =head2 get_disable_taskname_warning | ||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||
| 281 | Sets and gets the value of the C<$disable_taskname_warning> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||
| 283 | This controls whether Rex should show or suppress the warning message about task names that can not be used as Perl identifiers. | ||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||
| 285 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||
| 287 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | ▶ | sub set_disable_taskname_warning { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_disable_taskname_warning: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | $disable_taskname_warning = shift; | |||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | ▶ | sub get_disable_taskname_warning { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_disable_taskname_warning: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | return $disable_taskname_warning; | |||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||
| 298 | =head2 set_task_chaining_cmdline_args | ||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||
| 300 | =head2 get_task_chaining_cmdline_args | ||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||
| 302 | Sets and gets the value of the C<$task_chaining_cmdline_args> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||
| 304 | This controls whether Rex should parse task arguments on the command line per task, or should pass all arguments to all tasks. | ||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||
| 306 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||
| 308 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||
| 310 | 11 | ▶ | sub set_task_chaining_cmdline_args { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_task_chaining_cmdline_args: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 311 | 11 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 312 | 11 | $task_chaining_cmdline_args = shift; | |||||||||||||||||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||
| 315 | 40 | ▶ | sub get_task_chaining_cmdline_args { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_task_chaining_cmdline_args: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 316 | 40 | return $task_chaining_cmdline_args; | |||||||||||||||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||
| 319 | =head2 set_verbose_run | ||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||
| 321 | =head2 get_verbose_run | ||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||
| 323 | Sets and gets the value of the C<$verbose_run> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||
| 325 | This controls whether Rex should show verbose output about executed L<run|Rex::Commands::Run#run> commands. This means an error message if the command is not found, a warning message if the exit code indicates an error, and an informational message upon success. | ||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||
| 327 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||
| 329 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | ▶ | sub set_verbose_run { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_verbose_run: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | $verbose_run = shift; | |||||||||||||||||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||
| 336 | 13 | ▶ | sub get_verbose_run { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_verbose_run: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 337 | 13 | return $verbose_run; | |||||||||||||||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||
| 340 | =head2 set_exec_autodie | ||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||
| 342 | =head2 get_exec_autodie | ||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||
| 344 | Sets and gets the value of the C<$exec_autodie> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||
| 346 | This controls whether Rex should C<die()> or not when the exit code of executed L<run|Rex::Commands::Run#run> command indicate an error. | ||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||
| 348 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||
| 350 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||
| 352 | 14 | ▶ | sub set_exec_autodie { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_exec_autodie: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 353 | 14 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 354 | 14 | $exec_autodie = shift; | |||||||||||||||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||
| 357 | 12 | ▶ | sub get_exec_autodie { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_exec_autodie: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 358 | 12 | return $exec_autodie; | |||||||||||||||||||||||||||||||||||||||||
| 359 | } | ||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||
| 361 | =head2 set_no_path_cleanup | ||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||
| 363 | =head2 get_no_path_cleanup | ||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||
| 365 | Sets and gets the value of the C<$no_path_cleanup> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||
| 367 | This controls whether Rex should use either the default or the explicitly configured C<PATH> settings (via L<path|Rex::Commands#path> or L<set_path>) when executing commands or not. | ||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||
| 369 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||
| 371 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | ▶ | sub set_no_path_cleanup { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_no_path_cleanup: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | $no_path_cleanup = shift; | |||||||||||||||||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||
| 378 | 984 | ▶ | sub get_no_path_cleanup { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_no_path_cleanup: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 379 | 984 | return $no_path_cleanup; | |||||||||||||||||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||
| 382 | =head2 set_source_profile | ||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||
| 384 | =head2 get_source_profile | ||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||
| 386 | Sets and gets the value of the C<$source_profile> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||
| 388 | This controls whether Rex should source shell-specific profile files before executing commands. | ||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||
| 390 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||
| 392 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | ▶ | sub set_source_profile { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_source_profile: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | $source_profile = shift; | |||||||||||||||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | ▶ | sub get_source_profile { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_source_profile: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | return $source_profile; | |||||||||||||||||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||
| 403 | =head2 set_say_format | ||||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||
| 405 | =head2 get_say_format | ||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||
| 407 | Sets and gets the value of the C<$say_format> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||
| 409 | This controls the output format of the built-in C<say> command (see also L<sayformat|Rex::Commands#sayformat>). | ||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||
| 411 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||
| 413 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | ▶ | sub set_say_format { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_say_format: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | $say_format = shift; | |||||||||||||||||||||||||||||||||||||||||
| 418 | } | ||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | ▶ | sub get_say_format { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_say_format: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | return $say_format; | |||||||||||||||||||||||||||||||||||||||||
| 422 | } | ||||||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||||||
| 424 | =head2 set_do_reporting | ||||||||||||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||||||||||||
| 426 | =head2 get_do_reporting | ||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||
| 428 | Sets and gets the value of the C<$do_reporting> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||
| 430 | This controls whether Rex should do reporting on executed resources where it is supported. This only affects the data structures returned internally. | ||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||
| 432 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||
| 434 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||||||||||||
| 436 | 5 | ▶ | sub set_do_reporting { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_do_reporting: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 437 | 5 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 438 | 5 | $do_reporting = shift; | |||||||||||||||||||||||||||||||||||||||||
| 439 | } | ||||||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | ▶ | sub get_do_reporting { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_do_reporting: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | return $do_reporting; | |||||||||||||||||||||||||||||||||||||||||
| 443 | } | ||||||||||||||||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||||||||||||||||
| 445 | =head2 set_report_type | ||||||||||||||||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||||||||||||||||
| 447 | =head2 get_report_type | ||||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||
| 449 | Sets and gets the value of the C<$report_type> configuration variable, which can also be controlled via the C<REX_REPORT_TYPE> environment variable. | ||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||
| 451 | This selects the reporting type (format) Rex should use, e.g. C<'YAML'>. | ||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||
| 453 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||||
| 455 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||
| 457 | 1 | ▶ | sub set_report_type { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_report_type: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 458 | 1 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 459 | 1 | $report_type = shift; | |||||||||||||||||||||||||||||||||||||||||
| 460 | } | ||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||
| 462 | 40 | ▶ | sub get_report_type { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_report_type: called CC=2 SCAR=8.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 463 | 40 | ▶ | if ( exists $ENV{REX_REPORT_TYPE} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | return $ENV{REX_REPORT_TYPE}; | |||||||||||||||||||||||||||||||||||||||||
| 465 | } | ||||||||||||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||||||||||||
| 467 | 40 | return $report_type; | |||||||||||||||||||||||||||||||||||||||||
| 468 | } | ||||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||
| 470 | =head2 set_sleep_hack | ||||||||||||||||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||||||||||||||||
| 472 | =head2 get_sleep_hack | ||||||||||||||||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||||||||||||||||
| 474 | Sets and gets the value of the C<$sleep_hack> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||||||||||||||||
| 476 | This controls whether Rex should use or not an extra 10 ns long sleep after executed commands. | ||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||
| 478 | This might help working around an issue when Rex runs inside a KVM virtualized host and L<Net::SSH2>/L<libssh2|https://www.libssh2.org> is used to connect to another VM on the same hardware. | ||||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||
| 480 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||
| 482 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | ▶ | sub set_sleep_hack { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_sleep_hack: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | $use_sleep_hack = shift; | |||||||||||||||||||||||||||||||||||||||||
| 487 | } | ||||||||||||||||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | ▶ | sub get_sleep_hack { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_sleep_hack: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 490 | 0 | return $use_sleep_hack; | |||||||||||||||||||||||||||||||||||||||||
| 491 | } | ||||||||||||||||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||||||||||||||||
| 493 | =head2 set_cache_type | ||||||||||||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||||||||||||
| 495 | =head2 get_cache_type | ||||||||||||||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||||||||||||
| 497 | Sets and gets the value of the C<$cache_type> configuration variable, which can also be controlled via the C<REX_CACHE_TYPE> environment variable. | ||||||||||||||||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||||||||||||||||
| 499 | This selects the cache type Rex should use, e.g. C<'YAML'>. | ||||||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||||||
| 501 | Default is C<'Base'>. | ||||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||
| 503 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | ▶ | sub set_cache_type { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_cache_type: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 507 | 0 | $cache_type = shift; | |||||||||||||||||||||||||||||||||||||||||
| 508 | } | ||||||||||||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||||||||||||
| 510 | 115 | ▶ | sub get_cache_type { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_cache_type: called CC=3 SCAR=13.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 511 | 115 | ▶ | if ( exists $ENV{REX_CACHE_TYPE} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 512 | 0 | return $ENV{REX_CACHE_TYPE}; | |||||||||||||||||||||||||||||||||||||||||
| 513 | } | ||||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||
| 515 | 115 | ▶ | return $cache_type || "Base"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$Rex::Config::cache_type || 'Base'
MC/DC0%0/1
$Rex::Config::cache_type || 'Base'
$Rex::Config::cache_type
Truth table50%1/2
A
A= $Rex::Config::cache_type
| |||||||||||||||||||||||||||||||||||||||||||
| 516 | } | ||||||||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||||||||
| 518 | =head2 set_use_cache | ||||||||||||||||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||||||||||||||||
| 520 | =head2 get_use_cache | ||||||||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||||||
| 522 | Sets and gets the value of the C<$use_cache> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||
| 524 | This controls whether Rex should use caching or not for runtime information like CMDB contents, hardware and operating system information, or the shell type that is being used to execute commands on the managed endpoint. | ||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||
| 526 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||||||||
| 528 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||||||||||||
| 530 | 2 | ▶ | sub set_use_cache { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_use_cache: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 531 | 2 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 532 | 2 | $use_cache = shift; | |||||||||||||||||||||||||||||||||||||||||
| 533 | } | ||||||||||||||||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||||||||||||||||
| 535 | 1296 | ▶ | sub get_use_cache { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_use_cache: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 536 | 1296 | return $use_cache; | |||||||||||||||||||||||||||||||||||||||||
| 537 | } | ||||||||||||||||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||||||||||||||||
| 539 | =head2 set_openssh_opt | ||||||||||||||||||||||||||||||||||||||||||
| 540 | |||||||||||||||||||||||||||||||||||||||||||
| 541 | =head2 get_openssh_opt | ||||||||||||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||||||||||||
| 543 | Sets and gets the value of the C<$openssh_opt> configuration variable, which holds a hash of the SSH configuration options used for the connection. See the L<ssh_config(5) man page|http://man.openbsd.org/OpenBSD-current/man5/ssh_config.5> for the available options. | ||||||||||||||||||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||||||||||||||||
| 545 | Rex::Config->set_openssh_opt( $option => $value, ); | ||||||||||||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||||||||||||
| 547 | There is a custom option named C<initialize_options> specific to Rex, which can be used to pass a hash reference describing the L<constructor parameters|https://metacpan.org/pod/Net::OpenSSH#Net::OpenSSH-E<gt>new($host,-%opts)> for the underlying L<Net::OpenSSH> object: | ||||||||||||||||||||||||||||||||||||||||||
| 548 | |||||||||||||||||||||||||||||||||||||||||||
| 549 | Rex::Config->set_openssh_opt( initialize_options => { $parameter => $value, } ); | ||||||||||||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||||||||||||
| 551 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 552 | |||||||||||||||||||||||||||||||||||||||||||
| 553 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 554 | |||||||||||||||||||||||||||||||||||||||||||
| 555 | 0 | ▶ | sub set_openssh_opt { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_openssh_opt: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 556 | 0 | my ( $class, %opt ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | for my $key ( keys %opt ) { | |||||||||||||||||||||||||||||||||||||||||
| 559 | 0 | ▶ | if ( !defined $opt{$key} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 560 | 0 | $openssh_opt{$key} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | delete $openssh_opt{$key}; | |||||||||||||||||||||||||||||||||||||||||
| 562 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 563 | } | ||||||||||||||||||||||||||||||||||||||||||
| 564 | |||||||||||||||||||||||||||||||||||||||||||
| 565 | 0 | $openssh_opt{$key} = $opt{$key}; | |||||||||||||||||||||||||||||||||||||||||
| 566 | } | ||||||||||||||||||||||||||||||||||||||||||
| 567 | } | ||||||||||||||||||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||||||||||||||||
| 569 | 0 | ▶ | sub get_openssh_opt { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_openssh_opt: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 570 | 0 | return %openssh_opt; | |||||||||||||||||||||||||||||||||||||||||
| 571 | } | ||||||||||||||||||||||||||||||||||||||||||
| 572 | |||||||||||||||||||||||||||||||||||||||||||
| 573 | =head2 set_sudo_without_locales | ||||||||||||||||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||||||||||||||||
| 575 | =head2 get_sudo_without_locales | ||||||||||||||||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||||||||||||||||
| 577 | Sets and gets the value of the C<$sudo_without_locales> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 578 | |||||||||||||||||||||||||||||||||||||||||||
| 579 | This controls whether Rex should execute L<sudo|Rex::Commands::Run#sudo> commands without setting any locales via the C<LC_ALL> environment variable. | ||||||||||||||||||||||||||||||||||||||||||
| 580 | |||||||||||||||||||||||||||||||||||||||||||
| 581 | B<Warning:> if the locale is something else than C<C> or C<en_US>, then things will break! | ||||||||||||||||||||||||||||||||||||||||||
| 582 | |||||||||||||||||||||||||||||||||||||||||||
| 583 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||||||||||||||||
| 585 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 586 | |||||||||||||||||||||||||||||||||||||||||||
| 587 | 0 | ▶ | sub set_sudo_without_locales { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_sudo_without_locales: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 588 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 589 | 0 | $sudo_without_locales = shift; | |||||||||||||||||||||||||||||||||||||||||
| 590 | } | ||||||||||||||||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||||||||||||||||
| 592 | 0 | ▶ | sub get_sudo_without_locales { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_sudo_without_locales: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 593 | 0 | return $sudo_without_locales; | |||||||||||||||||||||||||||||||||||||||||
| 594 | } | ||||||||||||||||||||||||||||||||||||||||||
| 595 | |||||||||||||||||||||||||||||||||||||||||||
| 596 | =head2 set_sudo_without_sh | ||||||||||||||||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||||||||||||||||
| 598 | =head2 get_sudo_without_sh | ||||||||||||||||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||||||||||||||||
| 600 | Sets and gets the value of the C<$sudo_without_sh> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||||||||||||||||
| 602 | This controls whether Rex should run L<sudo|Rex::Commands::Run#sudo> commands without C<sh>. This might break things. | ||||||||||||||||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||||||||||||||||
| 604 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||||||||||||||||
| 606 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||||||||||||||||
| 608 | 0 | ▶ | sub set_sudo_without_sh { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_sudo_without_sh: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 609 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 610 | 0 | $sudo_without_sh = shift; | |||||||||||||||||||||||||||||||||||||||||
| 611 | } | ||||||||||||||||||||||||||||||||||||||||||
| 612 | |||||||||||||||||||||||||||||||||||||||||||
| 613 | 0 | ▶ | sub get_sudo_without_sh { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_sudo_without_sh: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 614 | 0 | return $sudo_without_sh; | |||||||||||||||||||||||||||||||||||||||||
| 615 | } | ||||||||||||||||||||||||||||||||||||||||||
| 616 | |||||||||||||||||||||||||||||||||||||||||||
| 617 | =head2 set_executor_for | ||||||||||||||||||||||||||||||||||||||||||
| 618 | |||||||||||||||||||||||||||||||||||||||||||
| 619 | =head2 get_executor_for | ||||||||||||||||||||||||||||||||||||||||||
| 620 | |||||||||||||||||||||||||||||||||||||||||||
| 621 | Sets and gets the keys and values of the C<%executor_for> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 622 | |||||||||||||||||||||||||||||||||||||||||||
| 623 | This sets the executor for a given file type when using the C<upload_and_run()> function of L<Rex::Helper::Run> module. | ||||||||||||||||||||||||||||||||||||||||||
| 624 | |||||||||||||||||||||||||||||||||||||||||||
| 625 | Default is: | ||||||||||||||||||||||||||||||||||||||||||
| 626 | |||||||||||||||||||||||||||||||||||||||||||
| 627 | ( | ||||||||||||||||||||||||||||||||||||||||||
| 628 | perl => 'perl', | ||||||||||||||||||||||||||||||||||||||||||
| 629 | python => 'python', | ||||||||||||||||||||||||||||||||||||||||||
| 630 | ruby => 'ruby', | ||||||||||||||||||||||||||||||||||||||||||
| 631 | bash => 'bash', | ||||||||||||||||||||||||||||||||||||||||||
| 632 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 633 | |||||||||||||||||||||||||||||||||||||||||||
| 634 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||||||||||||||||
| 636 | 0 | ▶ | sub set_executor_for { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_executor_for: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 637 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 638 | 0 | my $for = shift; | |||||||||||||||||||||||||||||||||||||||||
| 639 | 0 | my $e = shift; | |||||||||||||||||||||||||||||||||||||||||
| 640 | |||||||||||||||||||||||||||||||||||||||||||
| 641 | 0 | $executor_for{$for} = $e; | |||||||||||||||||||||||||||||||||||||||||
| 642 | } | ||||||||||||||||||||||||||||||||||||||||||
| 643 | |||||||||||||||||||||||||||||||||||||||||||
| 644 | 0 | ▶ | sub get_executor_for { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_executor_for: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 645 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 646 | 0 | my $e = shift; | |||||||||||||||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||||||||||||||||
| 648 | 0 | return $executor_for{$e}; | |||||||||||||||||||||||||||||||||||||||||
| 649 | } | ||||||||||||||||||||||||||||||||||||||||||
| 650 | |||||||||||||||||||||||||||||||||||||||||||
| 651 | =head2 set_tmp_dir | ||||||||||||||||||||||||||||||||||||||||||
| 652 | |||||||||||||||||||||||||||||||||||||||||||
| 653 | =head2 get_tmp_dir | ||||||||||||||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||||||||||||
| 655 | Sets and gets the value of the C<$tmp_dir> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 656 | |||||||||||||||||||||||||||||||||||||||||||
| 657 | This controls which directory Rex should use for temporary files. | ||||||||||||||||||||||||||||||||||||||||||
| 658 | |||||||||||||||||||||||||||||||||||||||||||
| 659 | Default is determined by the following logic: | ||||||||||||||||||||||||||||||||||||||||||
| 660 | |||||||||||||||||||||||||||||||||||||||||||
| 661 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 662 | |||||||||||||||||||||||||||||||||||||||||||
| 663 | =item * try to use what C<< File::Spec->tmpdir >> would return on the managed endpoint | ||||||||||||||||||||||||||||||||||||||||||
| 664 | |||||||||||||||||||||||||||||||||||||||||||
| 665 | =item * fall back to C<'/tmp'> | ||||||||||||||||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||||||||||||||
| 667 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 668 | |||||||||||||||||||||||||||||||||||||||||||
| 669 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 670 | |||||||||||||||||||||||||||||||||||||||||||
| 671 | 0 | ▶ | sub set_tmp_dir { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_tmp_dir: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 672 | 0 | my ( $class, $dir ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 673 | 0 | ▶ | if ( $class eq "Rex::Config" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 674 | 0 | $tmp_dir = $dir; | |||||||||||||||||||||||||||||||||||||||||
| 675 | } | ||||||||||||||||||||||||||||||||||||||||||
| 676 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 677 | 0 | $tmp_dir = $class; | |||||||||||||||||||||||||||||||||||||||||
| 678 | } | ||||||||||||||||||||||||||||||||||||||||||
| 679 | } | ||||||||||||||||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||||||||||||||||
| 681 | 984 | ▶ | sub get_tmp_dir { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_tmp_dir: called CC=8 SCAR=33.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 682 | 984 | my $cache = Rex::get_cache(); | |||||||||||||||||||||||||||||||||||||||||
| 683 | 984 | ▶ | if ( my $cached_tmp = $cache->get("tmpdir") ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 684 | 8 | return $cached_tmp; | |||||||||||||||||||||||||||||||||||||||||
| 685 | } | ||||||||||||||||||||||||||||||||||||||||||
| 686 | |||||||||||||||||||||||||||||||||||||||||||
| 687 | 976 | ▶ | if ( !$tmp_dir ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 688 | 976 | ▶ | if ( my $ssh = Rex::is_ssh() ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 689 | 0 | my $exec; | |||||||||||||||||||||||||||||||||||||||||
| 690 | 0 | ▶ | if ( Rex::is_sudo() ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 691 | 0 | ▶ | if ( ref $ssh eq "Net::OpenSSH" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 692 | 0 | $exec = Rex::Interface::Exec->create("OpenSSH"); | |||||||||||||||||||||||||||||||||||||||||
| 693 | } | ||||||||||||||||||||||||||||||||||||||||||
| 694 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 695 | 0 | $exec = Rex::Interface::Exec->create("SSH"); | |||||||||||||||||||||||||||||||||||||||||
| 696 | } | ||||||||||||||||||||||||||||||||||||||||||
| 697 | } | ||||||||||||||||||||||||||||||||||||||||||
| 698 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 699 | 0 | $exec = Rex::Interface::Exec->create; | |||||||||||||||||||||||||||||||||||||||||
| 700 | } | ||||||||||||||||||||||||||||||||||||||||||
| 701 | 0 | my ($out) = | |||||||||||||||||||||||||||||||||||||||||
| 702 | $exec->exec("perl -MFile::Spec -le 'print File::Spec->tmpdir'"); | ||||||||||||||||||||||||||||||||||||||||||
| 703 | |||||||||||||||||||||||||||||||||||||||||||
| 704 | 0 | ▶ | if ( $? == 0 && $out ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$? == 0 and $out
MC/DC0%0/2
$? == 0 and $out
$? == 0
$out
Truth table0%0/3
A and B
A= $? == 0B= $out
| |||||||||||||||||||||||||||||||||||||||||||
| 705 | 0 | $out =~ s/[\r\n]//gms; | |||||||||||||||||||||||||||||||||||||||||
| 706 | |||||||||||||||||||||||||||||||||||||||||||
| 707 | 0 | $cache->set( "tmpdir", $out ); | |||||||||||||||||||||||||||||||||||||||||
| 708 | 0 | return $out; | |||||||||||||||||||||||||||||||||||||||||
| 709 | } | ||||||||||||||||||||||||||||||||||||||||||
| 710 | 0 | $cache->set( "tmpdir", "/tmp" ); | |||||||||||||||||||||||||||||||||||||||||
| 711 | 0 | return "/tmp"; | |||||||||||||||||||||||||||||||||||||||||
| 712 | } | ||||||||||||||||||||||||||||||||||||||||||
| 713 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 714 | 976 | $cache->set( "tmpdir", Rex::Helper::File::Spec->tmpdir ); | |||||||||||||||||||||||||||||||||||||||||
| 715 | 976 | return Rex::Helper::File::Spec->tmpdir; | |||||||||||||||||||||||||||||||||||||||||
| 716 | } | ||||||||||||||||||||||||||||||||||||||||||
| 717 | } | ||||||||||||||||||||||||||||||||||||||||||
| 718 | 0 | return $tmp_dir; | |||||||||||||||||||||||||||||||||||||||||
| 719 | } | ||||||||||||||||||||||||||||||||||||||||||
| 720 | |||||||||||||||||||||||||||||||||||||||||||
| 721 | =head2 set_path | ||||||||||||||||||||||||||||||||||||||||||
| 722 | |||||||||||||||||||||||||||||||||||||||||||
| 723 | =head2 get_path | ||||||||||||||||||||||||||||||||||||||||||
| 724 | |||||||||||||||||||||||||||||||||||||||||||
| 725 | Sets and gets the value of the C<$path> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 726 | |||||||||||||||||||||||||||||||||||||||||||
| 727 | This controls which C<PATH> Rex should use when executing commands via the L<Rex::Commands::Run> module. | ||||||||||||||||||||||||||||||||||||||||||
| 728 | |||||||||||||||||||||||||||||||||||||||||||
| 729 | The value should be set as an array reference, and will be dereferenced as such before returned by C<get_path>. The L<path|Rex::Commands#path> command is a convenience wrapper for C<set_path>, and accepts an array. | ||||||||||||||||||||||||||||||||||||||||||
| 730 | |||||||||||||||||||||||||||||||||||||||||||
| 731 | Default is | ||||||||||||||||||||||||||||||||||||||||||
| 732 | |||||||||||||||||||||||||||||||||||||||||||
| 733 | qw( | ||||||||||||||||||||||||||||||||||||||||||
| 734 | /usr/gnu/bin | ||||||||||||||||||||||||||||||||||||||||||
| 735 | /bin | ||||||||||||||||||||||||||||||||||||||||||
| 736 | /sbin | ||||||||||||||||||||||||||||||||||||||||||
| 737 | /usr/bin | ||||||||||||||||||||||||||||||||||||||||||
| 738 | /usr/sbin | ||||||||||||||||||||||||||||||||||||||||||
| 739 | /usr/local/bin | ||||||||||||||||||||||||||||||||||||||||||
| 740 | /usr/local/sbin | ||||||||||||||||||||||||||||||||||||||||||
| 741 | /usr/pkg/bin | ||||||||||||||||||||||||||||||||||||||||||
| 742 | /usr/pkg/sbin | ||||||||||||||||||||||||||||||||||||||||||
| 743 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 744 | |||||||||||||||||||||||||||||||||||||||||||
| 745 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 746 | |||||||||||||||||||||||||||||||||||||||||||
| 747 | 1 | ▶ | sub set_path { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_path: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 748 | 1 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 749 | 1 | $path = shift; | |||||||||||||||||||||||||||||||||||||||||
| 750 | } | ||||||||||||||||||||||||||||||||||||||||||
| 751 | |||||||||||||||||||||||||||||||||||||||||||
| 752 | 985 | ▶ | sub get_path { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_path: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 753 | 985 | ▶ | if ( !$path ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 754 | 984 | return qw( | |||||||||||||||||||||||||||||||||||||||||
| 755 | /usr/gnu/bin | ||||||||||||||||||||||||||||||||||||||||||
| 756 | /bin | ||||||||||||||||||||||||||||||||||||||||||
| 757 | /sbin | ||||||||||||||||||||||||||||||||||||||||||
| 758 | /usr/bin | ||||||||||||||||||||||||||||||||||||||||||
| 759 | /usr/sbin | ||||||||||||||||||||||||||||||||||||||||||
| 760 | /usr/local/bin | ||||||||||||||||||||||||||||||||||||||||||
| 761 | /usr/local/sbin | ||||||||||||||||||||||||||||||||||||||||||
| 762 | /usr/pkg/bin | ||||||||||||||||||||||||||||||||||||||||||
| 763 | /usr/pkg/sbin | ||||||||||||||||||||||||||||||||||||||||||
| 764 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 765 | } | ||||||||||||||||||||||||||||||||||||||||||
| 766 | 1 | return @{$path}; | |||||||||||||||||||||||||||||||||||||||||
| 767 | } | ||||||||||||||||||||||||||||||||||||||||||
| 768 | |||||||||||||||||||||||||||||||||||||||||||
| 769 | =head2 set_user | ||||||||||||||||||||||||||||||||||||||||||
| 770 | |||||||||||||||||||||||||||||||||||||||||||
| 771 | =head2 get_user | ||||||||||||||||||||||||||||||||||||||||||
| 772 | |||||||||||||||||||||||||||||||||||||||||||
| 773 | Sets and gets the value of the C<$user> configuration variable, which also can be set via the C<REX_USER> environment variable. | ||||||||||||||||||||||||||||||||||||||||||
| 774 | |||||||||||||||||||||||||||||||||||||||||||
| 775 | This controls which L<user|Rex::Commands#user> Rex should use for authentication. | ||||||||||||||||||||||||||||||||||||||||||
| 776 | |||||||||||||||||||||||||||||||||||||||||||
| 777 | Default is determined by the following logic: | ||||||||||||||||||||||||||||||||||||||||||
| 778 | |||||||||||||||||||||||||||||||||||||||||||
| 779 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 780 | |||||||||||||||||||||||||||||||||||||||||||
| 781 | =item * value of C<REX_USER> environment variable | ||||||||||||||||||||||||||||||||||||||||||
| 782 | |||||||||||||||||||||||||||||||||||||||||||
| 783 | =item * user set by L<user|Rex::Commands#user> command | ||||||||||||||||||||||||||||||||||||||||||
| 784 | |||||||||||||||||||||||||||||||||||||||||||
| 785 | =item * user running Rex | ||||||||||||||||||||||||||||||||||||||||||
| 786 | |||||||||||||||||||||||||||||||||||||||||||
| 787 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 788 | |||||||||||||||||||||||||||||||||||||||||||
| 789 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 790 | |||||||||||||||||||||||||||||||||||||||||||
| 791 | 8 | ▶ | sub set_user { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_user: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 792 | 8 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 793 | 8 | $user = shift; | |||||||||||||||||||||||||||||||||||||||||
| 794 | } | ||||||||||||||||||||||||||||||||||||||||||
| 795 | |||||||||||||||||||||||||||||||||||||||||||
| 796 | 70 | ▶ | sub has_user { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_user: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 797 | 70 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 798 | 70 | return $user; | |||||||||||||||||||||||||||||||||||||||||
| 799 | } | ||||||||||||||||||||||||||||||||||||||||||
| 800 | |||||||||||||||||||||||||||||||||||||||||||
| 801 | 279 | ▶ | sub get_user { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_user: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 802 | 279 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 803 | |||||||||||||||||||||||||||||||||||||||||||
| 804 | 279 | ▶ | if ( exists $ENV{REX_USER} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 805 | 1 | return $ENV{REX_USER}; | |||||||||||||||||||||||||||||||||||||||||
| 806 | } | ||||||||||||||||||||||||||||||||||||||||||
| 807 | |||||||||||||||||||||||||||||||||||||||||||
| 808 | 278 | ▶ | if ($user) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 809 | 44 | return $user; | |||||||||||||||||||||||||||||||||||||||||
| 810 | } | ||||||||||||||||||||||||||||||||||||||||||
| 811 | |||||||||||||||||||||||||||||||||||||||||||
| 812 | 234 | ▶ | if ( $^O =~ m/^MSWin/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 813 | 0 | return getlogin; | |||||||||||||||||||||||||||||||||||||||||
| 814 | } | ||||||||||||||||||||||||||||||||||||||||||
| 815 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 816 | 234 | return scalar getpwuid($<); | |||||||||||||||||||||||||||||||||||||||||
| 817 | } | ||||||||||||||||||||||||||||||||||||||||||
| 818 | } | ||||||||||||||||||||||||||||||||||||||||||
| 819 | |||||||||||||||||||||||||||||||||||||||||||
| 820 | =head2 set_password | ||||||||||||||||||||||||||||||||||||||||||
| 821 | |||||||||||||||||||||||||||||||||||||||||||
| 822 | =head2 get_password | ||||||||||||||||||||||||||||||||||||||||||
| 823 | |||||||||||||||||||||||||||||||||||||||||||
| 824 | Sets and gets the value of the C<$password> configuration variable, which also can be set via the C<REX_PASSWORD> environment variable. | ||||||||||||||||||||||||||||||||||||||||||
| 825 | |||||||||||||||||||||||||||||||||||||||||||
| 826 | This controls what L<password|Rex::Commands#password> Rex should use for authentication or as passphrase when using private keys. | ||||||||||||||||||||||||||||||||||||||||||
| 827 | |||||||||||||||||||||||||||||||||||||||||||
| 828 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 829 | |||||||||||||||||||||||||||||||||||||||||||
| 830 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 831 | |||||||||||||||||||||||||||||||||||||||||||
| 832 | 8 | ▶ | sub set_password { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_password: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 833 | 8 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 834 | 8 | $password = shift; | |||||||||||||||||||||||||||||||||||||||||
| 835 | } | ||||||||||||||||||||||||||||||||||||||||||
| 836 | |||||||||||||||||||||||||||||||||||||||||||
| 837 | 278 | ▶ | sub get_password { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_password: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 838 | 278 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 839 | |||||||||||||||||||||||||||||||||||||||||||
| 840 | 278 | ▶ | if ( exists $ENV{REX_PASSWORD} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 841 | 0 | return $ENV{REX_PASSWORD}; | |||||||||||||||||||||||||||||||||||||||||
| 842 | } | ||||||||||||||||||||||||||||||||||||||||||
| 843 | |||||||||||||||||||||||||||||||||||||||||||
| 844 | 278 | return $password; | |||||||||||||||||||||||||||||||||||||||||
| 845 | } | ||||||||||||||||||||||||||||||||||||||||||
| 846 | |||||||||||||||||||||||||||||||||||||||||||
| 847 | =head2 set_port | ||||||||||||||||||||||||||||||||||||||||||
| 848 | |||||||||||||||||||||||||||||||||||||||||||
| 849 | =head2 get_port | ||||||||||||||||||||||||||||||||||||||||||
| 850 | |||||||||||||||||||||||||||||||||||||||||||
| 851 | Sets and gets the value of the C<$port> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 852 | |||||||||||||||||||||||||||||||||||||||||||
| 853 | This controls which L<port|Rex::Commands#port> Rex should connect to. | ||||||||||||||||||||||||||||||||||||||||||
| 854 | |||||||||||||||||||||||||||||||||||||||||||
| 855 | C<get_port> accepts an optional C<< server => $server >> argument to return the C<port> setting for the given C<$server> as optionally set in group files. | ||||||||||||||||||||||||||||||||||||||||||
| 856 | |||||||||||||||||||||||||||||||||||||||||||
| 857 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 858 | |||||||||||||||||||||||||||||||||||||||||||
| 859 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 860 | |||||||||||||||||||||||||||||||||||||||||||
| 861 | 0 | ▶ | sub set_port { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_port: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 862 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 863 | 0 | $port = shift; | |||||||||||||||||||||||||||||||||||||||||
| 864 | } | ||||||||||||||||||||||||||||||||||||||||||
| 865 | |||||||||||||||||||||||||||||||||||||||||||
| 866 | 88 | ▶ | sub get_port { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_port: called CC=4 SCAR=17.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 867 | 88 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 868 | 88 | my $param = {@_}; | |||||||||||||||||||||||||||||||||||||||||
| 869 | |||||||||||||||||||||||||||||||||||||||||||
| 870 | 88 | ▶ | if ( exists $param->{server} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
exists $param->{"server"} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}{"port"}
exists $param->{"server"} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}
MC/DC0%0/3
exists $param->{"server"} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}{"port"}
exists $param->{"server"}
exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}
exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}{"port"}
Truth table25%1/4
A and B and C
A= exists $param->{"server"}B= exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}C= exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}{"port"}
| |||||||||||||||||||||||||||||||||||||||||||
| 871 | && exists $SSH_CONFIG_FOR{ $param->{server} } | ||||||||||||||||||||||||||||||||||||||||||
| 872 | && exists $SSH_CONFIG_FOR{ $param->{server} }->{port} ) | ||||||||||||||||||||||||||||||||||||||||||
| 873 | { | ||||||||||||||||||||||||||||||||||||||||||
| 874 | 0 | return $SSH_CONFIG_FOR{ $param->{server} }->{port}; | |||||||||||||||||||||||||||||||||||||||||
| 875 | } | ||||||||||||||||||||||||||||||||||||||||||
| 876 | |||||||||||||||||||||||||||||||||||||||||||
| 877 | 88 | return $port; | |||||||||||||||||||||||||||||||||||||||||
| 878 | } | ||||||||||||||||||||||||||||||||||||||||||
| 879 | |||||||||||||||||||||||||||||||||||||||||||
| 880 | =head2 set_sudo_password | ||||||||||||||||||||||||||||||||||||||||||
| 881 | |||||||||||||||||||||||||||||||||||||||||||
| 882 | =head2 get_sudo_password | ||||||||||||||||||||||||||||||||||||||||||
| 883 | |||||||||||||||||||||||||||||||||||||||||||
| 884 | Sets and gets the value of the C<$sudo_password> configuration variable, which can also be controlled via the C<REX_SUDO_PASSWORD> environment variable. | ||||||||||||||||||||||||||||||||||||||||||
| 885 | |||||||||||||||||||||||||||||||||||||||||||
| 886 | This controls what L<sudo password|Rex::Commands#sudo_password> Rex should use. | ||||||||||||||||||||||||||||||||||||||||||
| 887 | |||||||||||||||||||||||||||||||||||||||||||
| 888 | Default is determined by the following logic: | ||||||||||||||||||||||||||||||||||||||||||
| 889 | |||||||||||||||||||||||||||||||||||||||||||
| 890 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 891 | |||||||||||||||||||||||||||||||||||||||||||
| 892 | =item * value of C<REX_SUDO_PASSWORD> environment variable | ||||||||||||||||||||||||||||||||||||||||||
| 893 | |||||||||||||||||||||||||||||||||||||||||||
| 894 | =item * sudo password set by the L<sudo_password|Rex::Command#sudo_password> command | ||||||||||||||||||||||||||||||||||||||||||
| 895 | |||||||||||||||||||||||||||||||||||||||||||
| 896 | =item * password set by the L<password|Rex::Command#password> command | ||||||||||||||||||||||||||||||||||||||||||
| 897 | |||||||||||||||||||||||||||||||||||||||||||
| 898 | =item * empty string (C<''>) | ||||||||||||||||||||||||||||||||||||||||||
| 899 | |||||||||||||||||||||||||||||||||||||||||||
| 900 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 901 | |||||||||||||||||||||||||||||||||||||||||||
| 902 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 903 | |||||||||||||||||||||||||||||||||||||||||||
| 904 | 1 | ▶ | sub set_sudo_password { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_sudo_password: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 905 | 1 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 906 | 1 | $sudo_password = shift; | |||||||||||||||||||||||||||||||||||||||||
| 907 | } | ||||||||||||||||||||||||||||||||||||||||||
| 908 | |||||||||||||||||||||||||||||||||||||||||||
| 909 | 296 | ▶ | sub get_sudo_password { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_sudo_password: called CC=4 SCAR=15.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 910 | 296 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 911 | |||||||||||||||||||||||||||||||||||||||||||
| 912 | 296 | ▶ | if ( exists $ENV{REX_SUDO_PASSWORD} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 913 | 0 | return $ENV{REX_SUDO_PASSWORD}; | |||||||||||||||||||||||||||||||||||||||||
| 914 | } | ||||||||||||||||||||||||||||||||||||||||||
| 915 | |||||||||||||||||||||||||||||||||||||||||||
| 916 | 296 | ▶ | if ($sudo_password) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 917 | 1 | return $sudo_password; | |||||||||||||||||||||||||||||||||||||||||
| 918 | } | ||||||||||||||||||||||||||||||||||||||||||
| 919 | elsif ( !defined $sudo_password ) { | ||||||||||||||||||||||||||||||||||||||||||
| 920 | 295 | return ""; | |||||||||||||||||||||||||||||||||||||||||
| 921 | } | ||||||||||||||||||||||||||||||||||||||||||
| 922 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 923 | 0 | return $password; | |||||||||||||||||||||||||||||||||||||||||
| 924 | } | ||||||||||||||||||||||||||||||||||||||||||
| 925 | |||||||||||||||||||||||||||||||||||||||||||
| 926 | 0 | return ""; | |||||||||||||||||||||||||||||||||||||||||
| 927 | } | ||||||||||||||||||||||||||||||||||||||||||
| 928 | |||||||||||||||||||||||||||||||||||||||||||
| 929 | =head2 set_source_global_profile | ||||||||||||||||||||||||||||||||||||||||||
| 930 | |||||||||||||||||||||||||||||||||||||||||||
| 931 | =head2 get_source_global_profile | ||||||||||||||||||||||||||||||||||||||||||
| 932 | |||||||||||||||||||||||||||||||||||||||||||
| 933 | Sets and gets the value of the C<$source_global_profile> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 934 | |||||||||||||||||||||||||||||||||||||||||||
| 935 | This controls whether Rex should source C</etc/profile> before executing commands. | ||||||||||||||||||||||||||||||||||||||||||
| 936 | |||||||||||||||||||||||||||||||||||||||||||
| 937 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 938 | |||||||||||||||||||||||||||||||||||||||||||
| 939 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 940 | |||||||||||||||||||||||||||||||||||||||||||
| 941 | 0 | ▶ | sub set_source_global_profile { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_source_global_profile: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 942 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 943 | 0 | $source_global_profile = shift; | |||||||||||||||||||||||||||||||||||||||||
| 944 | } | ||||||||||||||||||||||||||||||||||||||||||
| 945 | |||||||||||||||||||||||||||||||||||||||||||
| 946 | 1221 | ▶ | sub get_source_global_profile { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_source_global_profile: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 947 | 1221 | return $source_global_profile; | |||||||||||||||||||||||||||||||||||||||||
| 948 | } | ||||||||||||||||||||||||||||||||||||||||||
| 949 | |||||||||||||||||||||||||||||||||||||||||||
| 950 | =head2 set_max_connect_fails | ||||||||||||||||||||||||||||||||||||||||||
| 951 | |||||||||||||||||||||||||||||||||||||||||||
| 952 | =head2 get_max_connect_fails | ||||||||||||||||||||||||||||||||||||||||||
| 953 | |||||||||||||||||||||||||||||||||||||||||||
| 954 | Sets and gets the value of the C<$max_connect_fails> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 955 | |||||||||||||||||||||||||||||||||||||||||||
| 956 | This controls how many times Rex should retry to connect before giving up. | ||||||||||||||||||||||||||||||||||||||||||
| 957 | |||||||||||||||||||||||||||||||||||||||||||
| 958 | C<get_max_connect_fails> accepts an optional C<< server => $server >> argument to C<connectionattempts> setting for the given C<$server> as optionally set in group files. | ||||||||||||||||||||||||||||||||||||||||||
| 959 | |||||||||||||||||||||||||||||||||||||||||||
| 960 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 961 | |||||||||||||||||||||||||||||||||||||||||||
| 962 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 963 | |||||||||||||||||||||||||||||||||||||||||||
| 964 | 1 | ▶ | sub set_max_connect_fails { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_max_connect_fails: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 965 | 1 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 966 | 1 | $max_connect_fails = shift; | |||||||||||||||||||||||||||||||||||||||||
| 967 | } | ||||||||||||||||||||||||||||||||||||||||||
| 968 | |||||||||||||||||||||||||||||||||||||||||||
| 969 | 1 | ▶ | sub get_max_connect_fails { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_max_connect_fails: called CC=5 SCAR=20.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 970 | 1 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 971 | 1 | my $param = {@_}; | |||||||||||||||||||||||||||||||||||||||||
| 972 | |||||||||||||||||||||||||||||||||||||||||||
| 973 | 1 | ▶ | if ( exists $param->{server} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
exists $param->{"server"} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}{"connectionattempts"}
exists $param->{"server"} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}
MC/DC0%0/3
exists $param->{"server"} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}{"connectionattempts"}
exists $param->{"server"}
exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}
exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}{"connectionattempts"}
Truth table25%1/4
A and B and C
A= exists $param->{"server"}B= exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}C= exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}{"connectionattempts"}
| |||||||||||||||||||||||||||||||||||||||||||
| 974 | && exists $SSH_CONFIG_FOR{ $param->{server} } | ||||||||||||||||||||||||||||||||||||||||||
| 975 | && exists $SSH_CONFIG_FOR{ $param->{server} }->{connectionattempts} ) | ||||||||||||||||||||||||||||||||||||||||||
| 976 | { | ||||||||||||||||||||||||||||||||||||||||||
| 977 | 0 | return $SSH_CONFIG_FOR{ $param->{server} }->{connectionattempts}; | |||||||||||||||||||||||||||||||||||||||||
| 978 | } | ||||||||||||||||||||||||||||||||||||||||||
| 979 | |||||||||||||||||||||||||||||||||||||||||||
| 980 | 1 | ▶ | return $max_connect_fails || 3; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$Rex::Config::max_connect_fails || 3
MC/DC0%0/1
$Rex::Config::max_connect_fails || 3
$Rex::Config::max_connect_fails
Truth table50%1/2
A
A= $Rex::Config::max_connect_fails
| |||||||||||||||||||||||||||||||||||||||||||
| 981 | } | ||||||||||||||||||||||||||||||||||||||||||
| 982 | |||||||||||||||||||||||||||||||||||||||||||
| 983 | =head2 set_proxy_command | ||||||||||||||||||||||||||||||||||||||||||
| 984 | |||||||||||||||||||||||||||||||||||||||||||
| 985 | =head2 get_proxy_command | ||||||||||||||||||||||||||||||||||||||||||
| 986 | |||||||||||||||||||||||||||||||||||||||||||
| 987 | Sets and gets the value of the C<$proxy_command> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 988 | |||||||||||||||||||||||||||||||||||||||||||
| 989 | This controls the SSH ProxyCommand Rex should set for connections when L<Net::OpenSSH> is used. | ||||||||||||||||||||||||||||||||||||||||||
| 990 | |||||||||||||||||||||||||||||||||||||||||||
| 991 | C<get_proxy_command> accepts an optional C<< server => $server >> argument to return the C<proxycommand> setting for the given C<$server> as optionally set in group files. | ||||||||||||||||||||||||||||||||||||||||||
| 992 | |||||||||||||||||||||||||||||||||||||||||||
| 993 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 994 | |||||||||||||||||||||||||||||||||||||||||||
| 995 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 996 | |||||||||||||||||||||||||||||||||||||||||||
| 997 | 0 | ▶ | sub set_proxy_command { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_proxy_command: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 998 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 999 | 0 | $proxy_command = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1000 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1001 | |||||||||||||||||||||||||||||||||||||||||||
| 1002 | 0 | ▶ | sub get_proxy_command { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_proxy_command: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1003 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1004 | 0 | my $param = {@_}; | |||||||||||||||||||||||||||||||||||||||||
| 1005 | |||||||||||||||||||||||||||||||||||||||||||
| 1006 | 0 | ▶ | if ( exists $param->{server} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
exists $param->{"server"} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}{"proxycommand"}
exists $param->{"server"} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}
MC/DC0%0/3
exists $param->{"server"} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}{"proxycommand"}
exists $param->{"server"}
exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}
exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}{"proxycommand"}
Truth table0%0/4
A and B and C
A= exists $param->{"server"}B= exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}C= exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}{"proxycommand"}
| |||||||||||||||||||||||||||||||||||||||||||
| 1007 | && exists $SSH_CONFIG_FOR{ $param->{server} } | ||||||||||||||||||||||||||||||||||||||||||
| 1008 | && exists $SSH_CONFIG_FOR{ $param->{server} }->{proxycommand} ) | ||||||||||||||||||||||||||||||||||||||||||
| 1009 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1010 | 0 | return $SSH_CONFIG_FOR{ $param->{server} }->{proxycommand}; | |||||||||||||||||||||||||||||||||||||||||
| 1011 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1012 | |||||||||||||||||||||||||||||||||||||||||||
| 1013 | 0 | return $proxy_command; | |||||||||||||||||||||||||||||||||||||||||
| 1014 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1015 | |||||||||||||||||||||||||||||||||||||||||||
| 1016 | =head2 set_timeout | ||||||||||||||||||||||||||||||||||||||||||
| 1017 | |||||||||||||||||||||||||||||||||||||||||||
| 1018 | =head2 get_timeout | ||||||||||||||||||||||||||||||||||||||||||
| 1019 | |||||||||||||||||||||||||||||||||||||||||||
| 1020 | Sets and gets the value of the C<$timeout> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 1021 | |||||||||||||||||||||||||||||||||||||||||||
| 1022 | This controls how many seconds Rex should wait for connections to succeed when using SSH or L<Rex::Commands::Rsync>. | ||||||||||||||||||||||||||||||||||||||||||
| 1023 | |||||||||||||||||||||||||||||||||||||||||||
| 1024 | C<get_timeout> accepts an optional C<< server => $server >> argument to return the C<connecttimeout> setting for the given C<$server> as optionally set in group files. | ||||||||||||||||||||||||||||||||||||||||||
| 1025 | |||||||||||||||||||||||||||||||||||||||||||
| 1026 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 1027 | |||||||||||||||||||||||||||||||||||||||||||
| 1028 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1029 | |||||||||||||||||||||||||||||||||||||||||||
| 1030 | 7 | ▶ | sub set_timeout { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_timeout: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1031 | 7 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1032 | 7 | $timeout = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1033 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1034 | |||||||||||||||||||||||||||||||||||||||||||
| 1035 | 1 | ▶ | sub get_timeout { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_timeout: called CC=5 SCAR=20.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1036 | 1 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1037 | 1 | my $param = {@_}; | |||||||||||||||||||||||||||||||||||||||||
| 1038 | |||||||||||||||||||||||||||||||||||||||||||
| 1039 | 1 | ▶ | if ( exists $param->{server} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
exists $param->{"server"} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}{"connecttimeout"}
exists $param->{"server"} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}
MC/DC0%0/3
exists $param->{"server"} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}{"connecttimeout"}
exists $param->{"server"}
exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}
exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}{"connecttimeout"}
Truth table25%1/4
A and B and C
A= exists $param->{"server"}B= exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}C= exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}{"connecttimeout"}
| |||||||||||||||||||||||||||||||||||||||||||
| 1040 | && exists $SSH_CONFIG_FOR{ $param->{server} } | ||||||||||||||||||||||||||||||||||||||||||
| 1041 | && exists $SSH_CONFIG_FOR{ $param->{server} }->{connecttimeout} ) | ||||||||||||||||||||||||||||||||||||||||||
| 1042 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1043 | 0 | return $SSH_CONFIG_FOR{ $param->{server} }->{connecttimeout}; | |||||||||||||||||||||||||||||||||||||||||
| 1044 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1045 | |||||||||||||||||||||||||||||||||||||||||||
| 1046 | 1 | ▶ | return $timeout || 2; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$Rex::Config::timeout || 2
MC/DC0%0/1
$Rex::Config::timeout || 2
$Rex::Config::timeout
Truth table50%1/2
A
A= $Rex::Config::timeout
| |||||||||||||||||||||||||||||||||||||||||||
| 1047 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1048 | |||||||||||||||||||||||||||||||||||||||||||
| 1049 | =head2 set_password_auth | ||||||||||||||||||||||||||||||||||||||||||
| 1050 | |||||||||||||||||||||||||||||||||||||||||||
| 1051 | =head2 get_password_auth | ||||||||||||||||||||||||||||||||||||||||||
| 1052 | |||||||||||||||||||||||||||||||||||||||||||
| 1053 | Sets and gets the value of the C<$password_auth> configuration variable, which can also be set by setting the C<REX_AUTH_TYPE> environment variable to C<pass>. | ||||||||||||||||||||||||||||||||||||||||||
| 1054 | |||||||||||||||||||||||||||||||||||||||||||
| 1055 | This controls whether Rex should use the L<password authentication|Rex::Commands#pass_auth> method. | ||||||||||||||||||||||||||||||||||||||||||
| 1056 | |||||||||||||||||||||||||||||||||||||||||||
| 1057 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 1058 | |||||||||||||||||||||||||||||||||||||||||||
| 1059 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1060 | |||||||||||||||||||||||||||||||||||||||||||
| 1061 | 3 | ▶ | sub set_password_auth { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_password_auth: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1062 | 3 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1063 | 3 | $key_auth = 0; | |||||||||||||||||||||||||||||||||||||||||
| 1064 | 3 | $krb5_auth = 0; | |||||||||||||||||||||||||||||||||||||||||
| 1065 | 3 | ▶ | $password_auth = shift || 1; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() || 1
MC/DC0%0/1
shift() || 1
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 1066 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1067 | |||||||||||||||||||||||||||||||||||||||||||
| 1068 | 71 | ▶ | sub get_password_auth { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_password_auth: called CC=3 SCAR=14.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1069 | 71 | ▶ | if ( exists $ENV{REX_AUTH_TYPE} && $ENV{REX_AUTH_TYPE} eq "pass" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $ENV{"REX_AUTH_TYPE"} and $ENV{"REX_AUTH_TYPE"} eq "pass"
MC/DC0%0/2
exists $ENV{"REX_AUTH_TYPE"} and $ENV{"REX_AUTH_TYPE"} eq "pass"
exists $ENV{"REX_AUTH_TYPE"}
$ENV{"REX_AUTH_TYPE"} eq "pass"
Truth table33%1/3
A and B
A= exists $ENV{"REX_AUTH_TYPE"}B= $ENV{"REX_AUTH_TYPE"} eq "pass"
| |||||||||||||||||||||||||||||||||||||||||||
| 1070 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 1071 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1072 | 71 | return $password_auth; | |||||||||||||||||||||||||||||||||||||||||
| 1073 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1074 | |||||||||||||||||||||||||||||||||||||||||||
| 1075 | =head2 set_key_auth | ||||||||||||||||||||||||||||||||||||||||||
| 1076 | |||||||||||||||||||||||||||||||||||||||||||
| 1077 | =head2 get_key_auth | ||||||||||||||||||||||||||||||||||||||||||
| 1078 | |||||||||||||||||||||||||||||||||||||||||||
| 1079 | Sets and gets the value of the C<$key_auth> configuration variable, which can also be set by setting the C<REX_AUTH_TYPE> environment variable to C<key>. | ||||||||||||||||||||||||||||||||||||||||||
| 1080 | |||||||||||||||||||||||||||||||||||||||||||
| 1081 | This controls whether Rex should use the L<key authentication|Rex::Commands#key_auth> method. | ||||||||||||||||||||||||||||||||||||||||||
| 1082 | |||||||||||||||||||||||||||||||||||||||||||
| 1083 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 1084 | |||||||||||||||||||||||||||||||||||||||||||
| 1085 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1086 | |||||||||||||||||||||||||||||||||||||||||||
| 1087 | 1 | ▶ | sub set_key_auth { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_key_auth: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1088 | 1 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1089 | 1 | $password_auth = 0; | |||||||||||||||||||||||||||||||||||||||||
| 1090 | 1 | $krb5_auth = 0; | |||||||||||||||||||||||||||||||||||||||||
| 1091 | 1 | ▶ | $key_auth = shift || 1; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() || 1
MC/DC0%0/1
shift() || 1
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 1092 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1093 | |||||||||||||||||||||||||||||||||||||||||||
| 1094 | 63 | ▶ | sub get_key_auth { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_key_auth: called CC=3 SCAR=14.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1095 | 63 | ▶ | if ( exists $ENV{REX_AUTH_TYPE} && $ENV{REX_AUTH_TYPE} eq "key" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $ENV{"REX_AUTH_TYPE"} and $ENV{"REX_AUTH_TYPE"} eq "key"
MC/DC0%0/2
exists $ENV{"REX_AUTH_TYPE"} and $ENV{"REX_AUTH_TYPE"} eq "key"
exists $ENV{"REX_AUTH_TYPE"}
$ENV{"REX_AUTH_TYPE"} eq "key"
Truth table33%1/3
A and B
A= exists $ENV{"REX_AUTH_TYPE"}B= $ENV{"REX_AUTH_TYPE"} eq "key"
| |||||||||||||||||||||||||||||||||||||||||||
| 1096 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 1097 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1098 | 63 | return $key_auth; | |||||||||||||||||||||||||||||||||||||||||
| 1099 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1100 | |||||||||||||||||||||||||||||||||||||||||||
| 1101 | =head2 set_krb5_auth | ||||||||||||||||||||||||||||||||||||||||||
| 1102 | |||||||||||||||||||||||||||||||||||||||||||
| 1103 | =head2 get_krb5_auth | ||||||||||||||||||||||||||||||||||||||||||
| 1104 | |||||||||||||||||||||||||||||||||||||||||||
| 1105 | Sets and gets the value of the C<$krb5_auth> configuration variable, which can also be set by setting the C<REX_AUTH_TYPE> environment variable to C<krb5>. | ||||||||||||||||||||||||||||||||||||||||||
| 1106 | |||||||||||||||||||||||||||||||||||||||||||
| 1107 | This controls whether Rex should use the L<Kerberos 5|Rex::Commands#krb5_auth> authentication method. | ||||||||||||||||||||||||||||||||||||||||||
| 1108 | |||||||||||||||||||||||||||||||||||||||||||
| 1109 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 1110 | |||||||||||||||||||||||||||||||||||||||||||
| 1111 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1112 | |||||||||||||||||||||||||||||||||||||||||||
| 1113 | 0 | ▶ | sub set_krb5_auth { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_krb5_auth: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1114 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1115 | 0 | $password_auth = 0; | |||||||||||||||||||||||||||||||||||||||||
| 1116 | 0 | $key_auth = 0; | |||||||||||||||||||||||||||||||||||||||||
| 1117 | 0 | ▶ | $krb5_auth = shift || 1; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 1
MC/DC0%0/1
shift() || 1
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 1118 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1119 | |||||||||||||||||||||||||||||||||||||||||||
| 1120 | 70 | ▶ | sub get_krb5_auth { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_krb5_auth: called CC=3 SCAR=14.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1121 | 70 | ▶ | if ( exists $ENV{REX_AUTH_TYPE} && $ENV{REX_AUTH_TYPE} eq "krb5" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $ENV{"REX_AUTH_TYPE"} and $ENV{"REX_AUTH_TYPE"} eq "krb5"
MC/DC0%0/2
exists $ENV{"REX_AUTH_TYPE"} and $ENV{"REX_AUTH_TYPE"} eq "krb5"
exists $ENV{"REX_AUTH_TYPE"}
$ENV{"REX_AUTH_TYPE"} eq "krb5"
Truth table33%1/3
A and B
A= exists $ENV{"REX_AUTH_TYPE"}B= $ENV{"REX_AUTH_TYPE"} eq "krb5"
| |||||||||||||||||||||||||||||||||||||||||||
| 1122 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 1123 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1124 | 70 | return $krb5_auth; | |||||||||||||||||||||||||||||||||||||||||
| 1125 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1126 | |||||||||||||||||||||||||||||||||||||||||||
| 1127 | =head2 set_public_key | ||||||||||||||||||||||||||||||||||||||||||
| 1128 | |||||||||||||||||||||||||||||||||||||||||||
| 1129 | =head2 get_public_key | ||||||||||||||||||||||||||||||||||||||||||
| 1130 | |||||||||||||||||||||||||||||||||||||||||||
| 1131 | Sets and gets the value of the C<$public_key> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 1132 | |||||||||||||||||||||||||||||||||||||||||||
| 1133 | This controls which L<public key|Rex::Commands#public_key> Rex should use when using L<Net::SSH2> for connections. | ||||||||||||||||||||||||||||||||||||||||||
| 1134 | |||||||||||||||||||||||||||||||||||||||||||
| 1135 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 1136 | |||||||||||||||||||||||||||||||||||||||||||
| 1137 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1138 | |||||||||||||||||||||||||||||||||||||||||||
| 1139 | 7 | ▶ | sub set_public_key { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_public_key: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1140 | 7 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1141 | 7 | $public_key = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1142 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1143 | |||||||||||||||||||||||||||||||||||||||||||
| 1144 | 88 | ▶ | sub has_public_key { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_public_key: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1145 | 88 | return get_public_key(); | |||||||||||||||||||||||||||||||||||||||||
| 1146 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1147 | |||||||||||||||||||||||||||||||||||||||||||
| 1148 | 472 | ▶ | sub get_public_key { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_public_key: called CC=3 SCAR=11.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1149 | 0 | ▶ | if ( exists $ENV{REX_PUBLIC_KEY} ) { return $ENV{REX_PUBLIC_KEY}; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1150 | 472 | ▶ | if ($public_key) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1151 | 156 | return $public_key; | |||||||||||||||||||||||||||||||||||||||||
| 1152 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1153 | |||||||||||||||||||||||||||||||||||||||||||
| 1154 | 316 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1155 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1156 | |||||||||||||||||||||||||||||||||||||||||||
| 1157 | =head2 set_private_key | ||||||||||||||||||||||||||||||||||||||||||
| 1158 | |||||||||||||||||||||||||||||||||||||||||||
| 1159 | =head2 get_private_key | ||||||||||||||||||||||||||||||||||||||||||
| 1160 | |||||||||||||||||||||||||||||||||||||||||||
| 1161 | Sets and gets the value of the C<$private_key> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 1162 | |||||||||||||||||||||||||||||||||||||||||||
| 1163 | This controls which L<private key|Rex::Commands#private_key> Rex should use with L<Rex::Commands::Rsync> or when using L<Net::SSH2> for connections. | ||||||||||||||||||||||||||||||||||||||||||
| 1164 | |||||||||||||||||||||||||||||||||||||||||||
| 1165 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 1166 | |||||||||||||||||||||||||||||||||||||||||||
| 1167 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1168 | |||||||||||||||||||||||||||||||||||||||||||
| 1169 | 7 | ▶ | sub set_private_key { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_private_key: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1170 | 7 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1171 | 7 | $private_key = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1172 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1173 | |||||||||||||||||||||||||||||||||||||||||||
| 1174 | 88 | ▶ | sub has_private_key { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_private_key: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1175 | 88 | return get_private_key(); | |||||||||||||||||||||||||||||||||||||||||
| 1176 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1177 | |||||||||||||||||||||||||||||||||||||||||||
| 1178 | 472 | ▶ | sub get_private_key { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_private_key: called CC=3 SCAR=11.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1179 | 0 | ▶ | if ( exists $ENV{REX_PRIVATE_KEY} ) { return $ENV{REX_PRIVATE_KEY}; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1180 | 472 | ▶ | if ($private_key) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1181 | 156 | return $private_key; | |||||||||||||||||||||||||||||||||||||||||
| 1182 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1183 | |||||||||||||||||||||||||||||||||||||||||||
| 1184 | 316 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1185 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1186 | |||||||||||||||||||||||||||||||||||||||||||
| 1187 | =head2 set_parallelism | ||||||||||||||||||||||||||||||||||||||||||
| 1188 | |||||||||||||||||||||||||||||||||||||||||||
| 1189 | =head2 get_parallelism | ||||||||||||||||||||||||||||||||||||||||||
| 1190 | |||||||||||||||||||||||||||||||||||||||||||
| 1191 | Sets and gets the value of the C<$parallelism> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 1192 | |||||||||||||||||||||||||||||||||||||||||||
| 1193 | This controls how many hosts Rex should connect to in L<parallel|Rex::Commands#parallelism>. | ||||||||||||||||||||||||||||||||||||||||||
| 1194 | |||||||||||||||||||||||||||||||||||||||||||
| 1195 | Default is C<1>. | ||||||||||||||||||||||||||||||||||||||||||
| 1196 | |||||||||||||||||||||||||||||||||||||||||||
| 1197 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1198 | |||||||||||||||||||||||||||||||||||||||||||
| 1199 | 2 | ▶ | sub set_parallelism { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_parallelism: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1200 | 2 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1201 | 2 | $parallelism = $_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 1202 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1203 | |||||||||||||||||||||||||||||||||||||||||||
| 1204 | 139 | ▶ | sub get_parallelism { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_parallelism: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1205 | 139 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1206 | 139 | ▶ | return $parallelism || 1; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$Rex::Config::parallelism || 1
MC/DC100%1/1
$Rex::Config::parallelism || 1
$Rex::Config::parallelism
Truth table100%2/2
A
A= $Rex::Config::parallelism
| |||||||||||||||||||||||||||||||||||||||||||
| 1207 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1208 | |||||||||||||||||||||||||||||||||||||||||||
| 1209 | =head2 set_log_filename | ||||||||||||||||||||||||||||||||||||||||||
| 1210 | |||||||||||||||||||||||||||||||||||||||||||
| 1211 | =head2 get_log_filename | ||||||||||||||||||||||||||||||||||||||||||
| 1212 | |||||||||||||||||||||||||||||||||||||||||||
| 1213 | Sets and gets the value of the C<$log_filename> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 1214 | |||||||||||||||||||||||||||||||||||||||||||
| 1215 | This controls which file Rex should use for L<logging|Rex::Commands#logging>. | ||||||||||||||||||||||||||||||||||||||||||
| 1216 | |||||||||||||||||||||||||||||||||||||||||||
| 1217 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 1218 | |||||||||||||||||||||||||||||||||||||||||||
| 1219 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1220 | |||||||||||||||||||||||||||||||||||||||||||
| 1221 | 2 | ▶ | sub set_log_filename { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_log_filename: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1222 | 2 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1223 | 2 | $log_filename = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1224 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1225 | |||||||||||||||||||||||||||||||||||||||||||
| 1226 | 215 | ▶ | sub get_log_filename { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_log_filename: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1227 | 215 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1228 | 215 | return $log_filename; | |||||||||||||||||||||||||||||||||||||||||
| 1229 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1230 | |||||||||||||||||||||||||||||||||||||||||||
| 1231 | =head2 set_log_facility | ||||||||||||||||||||||||||||||||||||||||||
| 1232 | |||||||||||||||||||||||||||||||||||||||||||
| 1233 | =head2 get_log_facility | ||||||||||||||||||||||||||||||||||||||||||
| 1234 | |||||||||||||||||||||||||||||||||||||||||||
| 1235 | Sets and gets the value of the C<$log_facility> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 1236 | |||||||||||||||||||||||||||||||||||||||||||
| 1237 | This controls which log facility Rex should use when L<logging|Rex::Commands#logging> to syslog. | ||||||||||||||||||||||||||||||||||||||||||
| 1238 | |||||||||||||||||||||||||||||||||||||||||||
| 1239 | Default is C<'local0'>. | ||||||||||||||||||||||||||||||||||||||||||
| 1240 | |||||||||||||||||||||||||||||||||||||||||||
| 1241 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1242 | |||||||||||||||||||||||||||||||||||||||||||
| 1243 | 0 | ▶ | sub set_log_facility { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_log_facility: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1244 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1245 | 0 | $log_facility = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1246 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1247 | |||||||||||||||||||||||||||||||||||||||||||
| 1248 | 124 | ▶ | sub get_log_facility { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_log_facility: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1249 | 124 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1250 | 124 | ▶ | return $log_facility || "local0"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$Rex::Config::log_facility || 'local0'
MC/DC0%0/1
$Rex::Config::log_facility || 'local0'
$Rex::Config::log_facility
Truth table50%1/2
A
A= $Rex::Config::log_facility
| |||||||||||||||||||||||||||||||||||||||||||
| 1251 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1252 | |||||||||||||||||||||||||||||||||||||||||||
| 1253 | =head2 set_environment | ||||||||||||||||||||||||||||||||||||||||||
| 1254 | |||||||||||||||||||||||||||||||||||||||||||
| 1255 | =head2 get_environment | ||||||||||||||||||||||||||||||||||||||||||
| 1256 | |||||||||||||||||||||||||||||||||||||||||||
| 1257 | Sets and gets the value of the C<$environment> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 1258 | |||||||||||||||||||||||||||||||||||||||||||
| 1259 | This controls which L<environment|Rex::Commands#environment> Rex should use. | ||||||||||||||||||||||||||||||||||||||||||
| 1260 | |||||||||||||||||||||||||||||||||||||||||||
| 1261 | Default is C<''>. | ||||||||||||||||||||||||||||||||||||||||||
| 1262 | |||||||||||||||||||||||||||||||||||||||||||
| 1263 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1264 | |||||||||||||||||||||||||||||||||||||||||||
| 1265 | 0 | ▶ | sub set_environment { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_environment: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1266 | 0 | my ( $class, $env ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1267 | 0 | $environment = $env; | |||||||||||||||||||||||||||||||||||||||||
| 1268 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1269 | |||||||||||||||||||||||||||||||||||||||||||
| 1270 | 270 | ▶ | sub get_environment { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_environment: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1271 | 270 | ▶ | return $environment || ""; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$Rex::Config::environment || ''
MC/DC0%0/1
$Rex::Config::environment || ''
$Rex::Config::environment
Truth table50%1/2
A
A= $Rex::Config::environment
| |||||||||||||||||||||||||||||||||||||||||||
| 1272 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1273 | |||||||||||||||||||||||||||||||||||||||||||
| 1274 | 36 | ▶ | sub get_ssh_config_username { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_ssh_config_username: called CC=4 SCAR=17.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1275 | 36 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1276 | 36 | my $param = {@_}; | |||||||||||||||||||||||||||||||||||||||||
| 1277 | |||||||||||||||||||||||||||||||||||||||||||
| 1278 | 36 | ▶ | if ( exists $param->{server} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
exists $param->{"server"} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}{"user"}
exists $param->{"server"} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}
MC/DC0%0/3
exists $param->{"server"} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}{"user"}
exists $param->{"server"}
exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}
exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}{"user"}
Truth table25%1/4
A and B and C
A= exists $param->{"server"}B= exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}C= exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}{"user"}
| |||||||||||||||||||||||||||||||||||||||||||
| 1279 | && exists $SSH_CONFIG_FOR{ $param->{server} } | ||||||||||||||||||||||||||||||||||||||||||
| 1280 | && exists $SSH_CONFIG_FOR{ $param->{server} }->{user} ) | ||||||||||||||||||||||||||||||||||||||||||
| 1281 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1282 | 0 | return $SSH_CONFIG_FOR{ $param->{server} }->{user}; | |||||||||||||||||||||||||||||||||||||||||
| 1283 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1284 | |||||||||||||||||||||||||||||||||||||||||||
| 1285 | 36 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 1286 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1287 | |||||||||||||||||||||||||||||||||||||||||||
| 1288 | 0 | ▶ | sub get_ssh_config_hostname { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_ssh_config_hostname: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1289 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1290 | 0 | my $param = {@_}; | |||||||||||||||||||||||||||||||||||||||||
| 1291 | |||||||||||||||||||||||||||||||||||||||||||
| 1292 | 0 | ▶ | if ( exists $param->{server} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
exists $param->{"server"} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}{"hostname"}
exists $param->{"server"} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}
MC/DC0%0/3
exists $param->{"server"} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}{"hostname"}
exists $param->{"server"}
exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}
exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}{"hostname"}
Truth table0%0/4
A and B and C
A= exists $param->{"server"}B= exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}C= exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}{"hostname"}
| |||||||||||||||||||||||||||||||||||||||||||
| 1293 | && exists $SSH_CONFIG_FOR{ $param->{server} } | ||||||||||||||||||||||||||||||||||||||||||
| 1294 | && exists $SSH_CONFIG_FOR{ $param->{server} }->{hostname} ) | ||||||||||||||||||||||||||||||||||||||||||
| 1295 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1296 | 0 | ▶ | if ( $SSH_CONFIG_FOR{ $param->{server} }->{hostname} =~ m/^\%h(\.(.*))?/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1297 | 0 | return $param->{server} . $1; | |||||||||||||||||||||||||||||||||||||||||
| 1298 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1299 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1300 | 0 | return $SSH_CONFIG_FOR{ $param->{server} }->{hostname}; | |||||||||||||||||||||||||||||||||||||||||
| 1301 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1302 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1303 | |||||||||||||||||||||||||||||||||||||||||||
| 1304 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 1305 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1306 | |||||||||||||||||||||||||||||||||||||||||||
| 1307 | 39 | ▶ | sub get_ssh_config_private_key { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_ssh_config_private_key: called CC=4 SCAR=19.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1308 | 39 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1309 | 39 | my $param = {@_}; | |||||||||||||||||||||||||||||||||||||||||
| 1310 | |||||||||||||||||||||||||||||||||||||||||||
| 1311 | 39 | ▶ | if ( exists $param->{server} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
exists $param->{"server"} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}{"identityfile"}
exists $param->{"server"} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}
MC/DC0%0/3
exists $param->{"server"} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}{"identityfile"}
exists $param->{"server"}
exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}
exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}{"identityfile"}
Truth table25%1/4
A and B and C
A= exists $param->{"server"}B= exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}C= exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}{"identityfile"}
| |||||||||||||||||||||||||||||||||||||||||||
| 1312 | && exists $SSH_CONFIG_FOR{ $param->{server} } | ||||||||||||||||||||||||||||||||||||||||||
| 1313 | && exists $SSH_CONFIG_FOR{ $param->{server} }->{identityfile} ) | ||||||||||||||||||||||||||||||||||||||||||
| 1314 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1315 | |||||||||||||||||||||||||||||||||||||||||||
| 1316 | 0 | my $file = $SSH_CONFIG_FOR{ $param->{server} }->{identityfile}; | |||||||||||||||||||||||||||||||||||||||||
| 1317 | 0 | my $home_dir = _home_dir(); | |||||||||||||||||||||||||||||||||||||||||
| 1318 | 0 | $file =~ s/^~/$home_dir/; | |||||||||||||||||||||||||||||||||||||||||
| 1319 | |||||||||||||||||||||||||||||||||||||||||||
| 1320 | 0 | return $file; | |||||||||||||||||||||||||||||||||||||||||
| 1321 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1322 | |||||||||||||||||||||||||||||||||||||||||||
| 1323 | 39 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 1324 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1325 | |||||||||||||||||||||||||||||||||||||||||||
| 1326 | 39 | ▶ | sub get_ssh_config_public_key { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_ssh_config_public_key: called CC=4 SCAR=19.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1327 | 39 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1328 | 39 | my $param = {@_}; | |||||||||||||||||||||||||||||||||||||||||
| 1329 | |||||||||||||||||||||||||||||||||||||||||||
| 1330 | 39 | ▶ | if ( exists $param->{server} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
exists $param->{"server"} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}{"identityfile"}
exists $param->{"server"} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}
MC/DC0%0/3
exists $param->{"server"} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}} and exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}{"identityfile"}
exists $param->{"server"}
exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}
exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}{"identityfile"}
Truth table25%1/4
A and B and C
A= exists $param->{"server"}B= exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}C= exists $Rex::Config::SSH_CONFIG_FOR{$param->{"server"}}{"identityfile"}
| |||||||||||||||||||||||||||||||||||||||||||
| 1331 | && exists $SSH_CONFIG_FOR{ $param->{server} } | ||||||||||||||||||||||||||||||||||||||||||
| 1332 | && exists $SSH_CONFIG_FOR{ $param->{server} }->{identityfile} ) | ||||||||||||||||||||||||||||||||||||||||||
| 1333 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1334 | 0 | my $file = $SSH_CONFIG_FOR{ $param->{server} }->{identityfile} . ".pub"; | |||||||||||||||||||||||||||||||||||||||||
| 1335 | 0 | my $home_dir = _home_dir(); | |||||||||||||||||||||||||||||||||||||||||
| 1336 | 0 | $file =~ s/^~/$home_dir/; | |||||||||||||||||||||||||||||||||||||||||
| 1337 | 0 | return $file; | |||||||||||||||||||||||||||||||||||||||||
| 1338 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1339 | |||||||||||||||||||||||||||||||||||||||||||
| 1340 | 39 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 1341 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1342 | |||||||||||||||||||||||||||||||||||||||||||
| 1343 | 217 | ▶ | sub get_connection_type { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_connection_type: called CC=8 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1344 | 217 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1345 | |||||||||||||||||||||||||||||||||||||||||||
| 1346 | 217 | ▶ | if ( $^O !~ m/^MSWin/ && !$connection_type && $use_net_openssh_if_present ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
not $^O =~ /^MSWin/u || $Rex::Config::connection_type and $Rex::Config::use_net_openssh_if_present
$^O =~ /^MSWin/u || $Rex::Config::connection_type
MC/DC33%1/3
not $^O =~ /^MSWin/u || $Rex::Config::connection_type and $Rex::Config::use_net_openssh_if_present
$^O =~ /^MSWin/u
$Rex::Config::connection_type
$Rex::Config::use_net_openssh_if_present
Truth table50%2/4
not(A || B) and C
A= $^O =~ /^MSWin/uB= $Rex::Config::connection_typeC= $Rex::Config::use_net_openssh_if_present
| |||||||||||||||||||||||||||||||||||||||||||
| 1347 | 55 | my $has_net_openssh = 0; | |||||||||||||||||||||||||||||||||||||||||
| 1348 | 55 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 1349 | 55 | Net::OpenSSH->require; | |||||||||||||||||||||||||||||||||||||||||
| 1350 | 55 | Net::SFTP::Foreign->require; | |||||||||||||||||||||||||||||||||||||||||
| 1351 | 55 | $has_net_openssh = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1352 | 55 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 1353 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 1354 | |||||||||||||||||||||||||||||||||||||||||||
| 1355 | 55 | ▶ | if ($has_net_openssh) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1356 | 55 | Rex::Logger::debug( | |||||||||||||||||||||||||||||||||||||||||
| 1357 | "Found Net::OpenSSH and Net::SFTP::Foreign - using it as default"); | ||||||||||||||||||||||||||||||||||||||||||
| 1358 | 55 | $connection_type = "OpenSSH"; | |||||||||||||||||||||||||||||||||||||||||
| 1359 | 55 | return "OpenSSH"; | |||||||||||||||||||||||||||||||||||||||||
| 1360 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1361 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1362 | |||||||||||||||||||||||||||||||||||||||||||
| 1363 | 162 | ▶ | if ( !$connection_type ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1364 | 0 | my $has_net_ssh2 = 0; | |||||||||||||||||||||||||||||||||||||||||
| 1365 | 0 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 1366 | 0 | Net::SSH2->require; | |||||||||||||||||||||||||||||||||||||||||
| 1367 | 0 | $has_net_ssh2 = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1368 | 0 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 1369 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 1370 | |||||||||||||||||||||||||||||||||||||||||||
| 1371 | 0 | ▶ | if ($has_net_ssh2) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1372 | 0 | $connection_type = "SSH"; | |||||||||||||||||||||||||||||||||||||||||
| 1373 | 0 | return "SSH"; | |||||||||||||||||||||||||||||||||||||||||
| 1374 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1375 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1376 | |||||||||||||||||||||||||||||||||||||||||||
| 1377 | 162 | ▶ | return $connection_type || "SSH"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$Rex::Config::connection_type || 'SSH'
MC/DC0%0/1
$Rex::Config::connection_type || 'SSH'
$Rex::Config::connection_type
Truth table50%1/2
A
A= $Rex::Config::connection_type
| |||||||||||||||||||||||||||||||||||||||||||
| 1378 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1379 | |||||||||||||||||||||||||||||||||||||||||||
| 1380 | 0 | ▶ | sub get_ca { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_ca: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1381 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1382 | 0 | ▶ | return $ca_file || ""; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$Rex::Config::ca_file || ''
MC/DC0%0/1
$Rex::Config::ca_file || ''
$Rex::Config::ca_file
Truth table0%0/2
A
A= $Rex::Config::ca_file
| |||||||||||||||||||||||||||||||||||||||||||
| 1383 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1384 | |||||||||||||||||||||||||||||||||||||||||||
| 1385 | 0 | ▶ | sub get_ca_cert { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_ca_cert: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1386 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1387 | 0 | ▶ | return $ca_cert || ""; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$Rex::Config::ca_cert || ''
MC/DC0%0/1
$Rex::Config::ca_cert || ''
$Rex::Config::ca_cert
Truth table0%0/2
A
A= $Rex::Config::ca_cert
| |||||||||||||||||||||||||||||||||||||||||||
| 1388 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1389 | |||||||||||||||||||||||||||||||||||||||||||
| 1390 | 0 | ▶ | sub get_ca_key { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_ca_key: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1391 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1392 | 0 | ▶ | return $ca_key || ""; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$Rex::Config::ca_key || ''
MC/DC0%0/1
$Rex::Config::ca_key || ''
$Rex::Config::ca_key
Truth table0%0/2
A
A= $Rex::Config::ca_key
| |||||||||||||||||||||||||||||||||||||||||||
| 1393 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1394 | |||||||||||||||||||||||||||||||||||||||||||
| 1395 | =head2 set_distributor | ||||||||||||||||||||||||||||||||||||||||||
| 1396 | |||||||||||||||||||||||||||||||||||||||||||
| 1397 | =head2 get_distributor | ||||||||||||||||||||||||||||||||||||||||||
| 1398 | |||||||||||||||||||||||||||||||||||||||||||
| 1399 | Sets and gets the value of the C<$distributor> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 1400 | |||||||||||||||||||||||||||||||||||||||||||
| 1401 | This controls which method Rex should use for distributing tasks for parallel execution. | ||||||||||||||||||||||||||||||||||||||||||
| 1402 | |||||||||||||||||||||||||||||||||||||||||||
| 1403 | Default is C<'Base'>. | ||||||||||||||||||||||||||||||||||||||||||
| 1404 | |||||||||||||||||||||||||||||||||||||||||||
| 1405 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1406 | |||||||||||||||||||||||||||||||||||||||||||
| 1407 | 9 | ▶ | sub set_distributor { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_distributor: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1408 | 9 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1409 | 9 | $distributor = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1410 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1411 | |||||||||||||||||||||||||||||||||||||||||||
| 1412 | 67 | ▶ | sub get_distributor { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_distributor: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1413 | 67 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1414 | 67 | ▶ | return $distributor || "Base"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$Rex::Config::distributor || 'Base'
MC/DC100%1/1
$Rex::Config::distributor || 'Base'
$Rex::Config::distributor
Truth table100%2/2
A
A= $Rex::Config::distributor
| |||||||||||||||||||||||||||||||||||||||||||
| 1415 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1416 | |||||||||||||||||||||||||||||||||||||||||||
| 1417 | =head2 set_template_function | ||||||||||||||||||||||||||||||||||||||||||
| 1418 | |||||||||||||||||||||||||||||||||||||||||||
| 1419 | =head2 get_template_function | ||||||||||||||||||||||||||||||||||||||||||
| 1420 | |||||||||||||||||||||||||||||||||||||||||||
| 1421 | Sets and gets the value of the C<$template_function> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 1422 | |||||||||||||||||||||||||||||||||||||||||||
| 1423 | This controls the function to be used for rendering L<templates|Rex::Commands::File#template>. The value should be a subroutine reference that will be called with passing two scalar references as positional arguments: first is template content, second is template variables. | ||||||||||||||||||||||||||||||||||||||||||
| 1424 | |||||||||||||||||||||||||||||||||||||||||||
| 1425 | Default is determined by the following logic: | ||||||||||||||||||||||||||||||||||||||||||
| 1426 | |||||||||||||||||||||||||||||||||||||||||||
| 1427 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1428 | |||||||||||||||||||||||||||||||||||||||||||
| 1429 | =item * if L<Rex::Template::NG> is loadable and L<use_template_ng|Rex::Config#get_use_template_ng> is true, use that | ||||||||||||||||||||||||||||||||||||||||||
| 1430 | |||||||||||||||||||||||||||||||||||||||||||
| 1431 | =item * fall back to L<Rex::Template> otherwise | ||||||||||||||||||||||||||||||||||||||||||
| 1432 | |||||||||||||||||||||||||||||||||||||||||||
| 1433 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1434 | |||||||||||||||||||||||||||||||||||||||||||
| 1435 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1436 | |||||||||||||||||||||||||||||||||||||||||||
| 1437 | 0 | ▶ | sub set_template_function { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_template_function: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1438 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1439 | 0 | ($template_function) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1440 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1441 | |||||||||||||||||||||||||||||||||||||||||||
| 1442 | 117 | ▶ | sub get_template_function { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_template_function: called CC=4 SCAR=20.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1443 | 117 | ▶ | if ( ref($template_function) eq "CODE" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1444 | 0 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1445 | 0 | my ( $content, $template_vars ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1446 | $template_vars = { | ||||||||||||||||||||||||||||||||||||||||||
| 1447 | Rex::Commands::task()->get_opts, | ||||||||||||||||||||||||||||||||||||||||||
| 1448 | ( | ||||||||||||||||||||||||||||||||||||||||||
| 1449 | Rex::Resource->is_inside_resource | ||||||||||||||||||||||||||||||||||||||||||
| 1450 | 0 | ? %{ Rex::Resource->get_current_resource()->get_all_parameters } | |||||||||||||||||||||||||||||||||||||||||
| 1451 | : () | ||||||||||||||||||||||||||||||||||||||||||
| 1452 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 1453 | 0 | ▶ | %{ $template_vars || {} } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/2
$template_vars || {}
MC/DC0%0/1
$template_vars || {}
$template_vars
Truth table0%0/2
A
A= $template_vars
| |||||||||||||||||||||||||||||||||||||||||||
| 1454 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1455 | if ( Rex::Commands::task() ); | ||||||||||||||||||||||||||||||||||||||||||
| 1456 | 0 | return $template_function->( $content, $template_vars ); | |||||||||||||||||||||||||||||||||||||||||
| 1457 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||
| 1458 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1459 | |||||||||||||||||||||||||||||||||||||||||||
| 1460 | 117 | ▶ | if ( Rex::Template::NG->is_loadable && get_use_template_ng() ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
"Rex::Template::NG"->is_loadable and get_use_template_ng()
MC/DC0%0/2
"Rex::Template::NG"->is_loadable and get_use_template_ng()
"Rex::Template::NG"->is_loadable
get_use_template_ng()
Truth table33%1/3
A and B
A= "Rex::Template::NG"->is_loadableB= get_use_template_ng()
| |||||||||||||||||||||||||||||||||||||||||||
| 1461 | |||||||||||||||||||||||||||||||||||||||||||
| 1462 | # new template engine | ||||||||||||||||||||||||||||||||||||||||||
| 1463 | 0 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1464 | 0 | my ( $content, $template_vars ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1465 | $template_vars = { | ||||||||||||||||||||||||||||||||||||||||||
| 1466 | Rex::Commands::task()->get_opts, | ||||||||||||||||||||||||||||||||||||||||||
| 1467 | ( | ||||||||||||||||||||||||||||||||||||||||||
| 1468 | Rex::Resource->is_inside_resource | ||||||||||||||||||||||||||||||||||||||||||
| 1469 | 0 | ? %{ Rex::Resource->get_current_resource()->get_all_parameters } | |||||||||||||||||||||||||||||||||||||||||
| 1470 | : () | ||||||||||||||||||||||||||||||||||||||||||
| 1471 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 1472 | 0 | ▶ | %{ $template_vars || {} } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/2
$template_vars || {}
MC/DC0%0/1
$template_vars || {}
$template_vars
Truth table0%0/2
A
A= $template_vars
| |||||||||||||||||||||||||||||||||||||||||||
| 1473 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1474 | if ( Rex::Commands::task() ); | ||||||||||||||||||||||||||||||||||||||||||
| 1475 | 0 | Rex::Template::NG->require; | |||||||||||||||||||||||||||||||||||||||||
| 1476 | 0 | my $t = Rex::Template::NG->new; | |||||||||||||||||||||||||||||||||||||||||
| 1477 | 0 | return $t->parse( $content, %{$template_vars} ); | |||||||||||||||||||||||||||||||||||||||||
| 1478 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||
| 1479 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1480 | |||||||||||||||||||||||||||||||||||||||||||
| 1481 | 117 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1482 | 117 | my ( $content, $template_vars ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1483 | $template_vars = { | ||||||||||||||||||||||||||||||||||||||||||
| 1484 | Rex::Commands::task()->get_opts, | ||||||||||||||||||||||||||||||||||||||||||
| 1485 | ( | ||||||||||||||||||||||||||||||||||||||||||
| 1486 | Rex::Resource->is_inside_resource | ||||||||||||||||||||||||||||||||||||||||||
| 1487 | 12 | ? %{ Rex::Resource->get_current_resource()->get_all_parameters } | |||||||||||||||||||||||||||||||||||||||||
| 1488 | : () | ||||||||||||||||||||||||||||||||||||||||||
| 1489 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 1490 | 117 | ▶ | %{ $template_vars || {} } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition50%1/2
$template_vars || {}
MC/DC0%0/1
$template_vars || {}
$template_vars
Truth table50%1/2
A
A= $template_vars
| |||||||||||||||||||||||||||||||||||||||||||
| 1491 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1492 | if ( Rex::Commands::task() ); | ||||||||||||||||||||||||||||||||||||||||||
| 1493 | 108 | ▶ | use Rex::Template; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1494 | 117 | my $template = Rex::Template->new; | |||||||||||||||||||||||||||||||||||||||||
| 1495 | 117 | return $template->parse( $content, $template_vars ); | |||||||||||||||||||||||||||||||||||||||||
| 1496 | 117 | }; | |||||||||||||||||||||||||||||||||||||||||
| 1497 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1498 | |||||||||||||||||||||||||||||||||||||||||||
| 1499 | =head2 set_no_tty | ||||||||||||||||||||||||||||||||||||||||||
| 1500 | |||||||||||||||||||||||||||||||||||||||||||
| 1501 | =head2 get_no_tty | ||||||||||||||||||||||||||||||||||||||||||
| 1502 | |||||||||||||||||||||||||||||||||||||||||||
| 1503 | Sets and gets the value of the C<$no_tty> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 1504 | |||||||||||||||||||||||||||||||||||||||||||
| 1505 | This controls whether Rex should request a terminal when using L<Net::SSH2> or allocate a pseudo-tty for the remote process when using L<Net::OpenSSH>. | ||||||||||||||||||||||||||||||||||||||||||
| 1506 | |||||||||||||||||||||||||||||||||||||||||||
| 1507 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 1508 | |||||||||||||||||||||||||||||||||||||||||||
| 1509 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1510 | |||||||||||||||||||||||||||||||||||||||||||
| 1511 | 4 | ▶ | sub set_no_tty { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_no_tty: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1512 | 4 | shift; | |||||||||||||||||||||||||||||||||||||||||
| 1513 | 4 | $no_tty = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1514 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1515 | |||||||||||||||||||||||||||||||||||||||||||
| 1516 | 1237 | ▶ | sub get_no_tty { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_no_tty: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1517 | 1237 | return $no_tty; | |||||||||||||||||||||||||||||||||||||||||
| 1518 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1519 | |||||||||||||||||||||||||||||||||||||||||||
| 1520 | =head2 set_allow_empty_groups | ||||||||||||||||||||||||||||||||||||||||||
| 1521 | |||||||||||||||||||||||||||||||||||||||||||
| 1522 | =head2 get_allow_empty_groups | ||||||||||||||||||||||||||||||||||||||||||
| 1523 | |||||||||||||||||||||||||||||||||||||||||||
| 1524 | Sets and gets the value of the C<$allow_empty_groups> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 1525 | |||||||||||||||||||||||||||||||||||||||||||
| 1526 | This controls whether Rex should allow empty L<groups of hosts|Rex::Commands#group> or not. | ||||||||||||||||||||||||||||||||||||||||||
| 1527 | |||||||||||||||||||||||||||||||||||||||||||
| 1528 | Default is C<0>. | ||||||||||||||||||||||||||||||||||||||||||
| 1529 | |||||||||||||||||||||||||||||||||||||||||||
| 1530 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1531 | |||||||||||||||||||||||||||||||||||||||||||
| 1532 | 0 | ▶ | sub set_allow_empty_groups { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_allow_empty_groups: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1533 | 0 | my ( $class, $set ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1534 | 0 | ▶ | if ($set) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1535 | 0 | $allow_empty_groups = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1536 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1537 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1538 | 0 | $allow_empty_groups = 0; | |||||||||||||||||||||||||||||||||||||||||
| 1539 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1540 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1541 | |||||||||||||||||||||||||||||||||||||||||||
| 1542 | 0 | ▶ | sub get_allow_empty_groups { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_allow_empty_groups: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1543 | 0 | ▶ | if ($allow_empty_groups) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1544 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 1545 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1546 | |||||||||||||||||||||||||||||||||||||||||||
| 1547 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 1548 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1549 | |||||||||||||||||||||||||||||||||||||||||||
| 1550 | =head2 set_use_server_auth | ||||||||||||||||||||||||||||||||||||||||||
| 1551 | |||||||||||||||||||||||||||||||||||||||||||
| 1552 | =head2 get_use_server_auth | ||||||||||||||||||||||||||||||||||||||||||
| 1553 | |||||||||||||||||||||||||||||||||||||||||||
| 1554 | Sets and gets the value of the C<$use_server_auth> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 1555 | |||||||||||||||||||||||||||||||||||||||||||
| 1556 | This controls whether Rex should use server-specific authentication information from group files. | ||||||||||||||||||||||||||||||||||||||||||
| 1557 | |||||||||||||||||||||||||||||||||||||||||||
| 1558 | Default is C<0>. | ||||||||||||||||||||||||||||||||||||||||||
| 1559 | |||||||||||||||||||||||||||||||||||||||||||
| 1560 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1561 | |||||||||||||||||||||||||||||||||||||||||||
| 1562 | 1 | ▶ | sub set_use_server_auth { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_use_server_auth: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1563 | 1 | my ( $class, $set ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1564 | 1 | ▶ | if ($set) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1565 | 1 | $use_server_auth = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1566 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1567 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1568 | 0 | $use_server_auth = 0; | |||||||||||||||||||||||||||||||||||||||||
| 1569 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1570 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1571 | |||||||||||||||||||||||||||||||||||||||||||
| 1572 | 105 | ▶ | sub get_use_server_auth { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_use_server_auth: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1573 | 105 | ▶ | if ($use_server_auth) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1574 | 4 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 1575 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1576 | |||||||||||||||||||||||||||||||||||||||||||
| 1577 | 101 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 1578 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1579 | |||||||||||||||||||||||||||||||||||||||||||
| 1580 | =head2 set_waitpid_blocking_sleep_time | ||||||||||||||||||||||||||||||||||||||||||
| 1581 | |||||||||||||||||||||||||||||||||||||||||||
| 1582 | =head2 get_waitpid_blocking_sleep_time | ||||||||||||||||||||||||||||||||||||||||||
| 1583 | |||||||||||||||||||||||||||||||||||||||||||
| 1584 | Sets and gets the value of the C<$waitpid_blocking_sleep_time> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 1585 | |||||||||||||||||||||||||||||||||||||||||||
| 1586 | This controls how many seconds Rex should sleep between checking forks. | ||||||||||||||||||||||||||||||||||||||||||
| 1587 | |||||||||||||||||||||||||||||||||||||||||||
| 1588 | Default is C<0.1>. | ||||||||||||||||||||||||||||||||||||||||||
| 1589 | |||||||||||||||||||||||||||||||||||||||||||
| 1590 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1591 | |||||||||||||||||||||||||||||||||||||||||||
| 1592 | 1 | ▶ | sub set_waitpid_blocking_sleep_time { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_waitpid_blocking_sleep_time: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1593 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1594 | 1 | $waitpid_blocking_sleep_time = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1595 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1596 | |||||||||||||||||||||||||||||||||||||||||||
| 1597 | 3031 | ▶ | sub get_waitpid_blocking_sleep_time { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_waitpid_blocking_sleep_time: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1598 | 3031 | ▶ | return $waitpid_blocking_sleep_time // 0.1; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$Rex::Config::waitpid_blocking_sleep_time // "0.1"
MC/DC100%1/1
$Rex::Config::waitpid_blocking_sleep_time // "0.1"
$Rex::Config::waitpid_blocking_sleep_time
Truth table100%2/2
A
A= $Rex::Config::waitpid_blocking_sleep_time
| |||||||||||||||||||||||||||||||||||||||||||
| 1599 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1600 | |||||||||||||||||||||||||||||||||||||||||||
| 1601 | =head2 set_write_utf8_files | ||||||||||||||||||||||||||||||||||||||||||
| 1602 | |||||||||||||||||||||||||||||||||||||||||||
| 1603 | =head2 get_write_utf8_files | ||||||||||||||||||||||||||||||||||||||||||
| 1604 | |||||||||||||||||||||||||||||||||||||||||||
| 1605 | Sets and gets the value of the C<$write_utf8_files> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 1606 | |||||||||||||||||||||||||||||||||||||||||||
| 1607 | This controls whether Rex should force C<UTF-8> encoding when writing files. | ||||||||||||||||||||||||||||||||||||||||||
| 1608 | |||||||||||||||||||||||||||||||||||||||||||
| 1609 | Default is C<undef>. | ||||||||||||||||||||||||||||||||||||||||||
| 1610 | |||||||||||||||||||||||||||||||||||||||||||
| 1611 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1612 | |||||||||||||||||||||||||||||||||||||||||||
| 1613 | 0 | ▶ | sub set_write_utf8_files { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_write_utf8_files: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1614 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1615 | 0 | $write_utf8_files = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1616 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1617 | |||||||||||||||||||||||||||||||||||||||||||
| 1618 | 274 | ▶ | sub get_write_utf8_files { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_write_utf8_files: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1619 | 274 | return $write_utf8_files; | |||||||||||||||||||||||||||||||||||||||||
| 1620 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1621 | |||||||||||||||||||||||||||||||||||||||||||
| 1622 | =head2 set_default_auth | ||||||||||||||||||||||||||||||||||||||||||
| 1623 | |||||||||||||||||||||||||||||||||||||||||||
| 1624 | =head2 get_default_auth | ||||||||||||||||||||||||||||||||||||||||||
| 1625 | |||||||||||||||||||||||||||||||||||||||||||
| 1626 | Sets and gets the value of the C<$default_auth> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 1627 | |||||||||||||||||||||||||||||||||||||||||||
| 1628 | This controls whether Rex should attach default authentication info to tasks. | ||||||||||||||||||||||||||||||||||||||||||
| 1629 | |||||||||||||||||||||||||||||||||||||||||||
| 1630 | Default is C<1>. | ||||||||||||||||||||||||||||||||||||||||||
| 1631 | |||||||||||||||||||||||||||||||||||||||||||
| 1632 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1633 | |||||||||||||||||||||||||||||||||||||||||||
| 1634 | 3 | ▶ | sub set_default_auth { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_default_auth: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1635 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1636 | 3 | $default_auth = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1637 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1638 | |||||||||||||||||||||||||||||||||||||||||||
| 1639 | 61 | ▶ | sub get_default_auth { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_default_auth: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1640 | 61 | ▶ | return $default_auth // 1; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$Rex::Config::default_auth // 1
MC/DC100%1/1
$Rex::Config::default_auth // 1
$Rex::Config::default_auth
Truth table100%2/2
A
A= $Rex::Config::default_auth
| |||||||||||||||||||||||||||||||||||||||||||
| 1641 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1642 | |||||||||||||||||||||||||||||||||||||||||||
| 1643 | =head2 set_augeas_commands_prepend | ||||||||||||||||||||||||||||||||||||||||||
| 1644 | |||||||||||||||||||||||||||||||||||||||||||
| 1645 | =head2 get_augeas_commands_prepend | ||||||||||||||||||||||||||||||||||||||||||
| 1646 | |||||||||||||||||||||||||||||||||||||||||||
| 1647 | Sets and gets the value of the C<$augeas_commands_prepend> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 1648 | |||||||||||||||||||||||||||||||||||||||||||
| 1649 | This controls the list of commands Rex should prepend at the beginning of the command file for Augeas operations. | ||||||||||||||||||||||||||||||||||||||||||
| 1650 | |||||||||||||||||||||||||||||||||||||||||||
| 1651 | Default is C<[]>. | ||||||||||||||||||||||||||||||||||||||||||
| 1652 | |||||||||||||||||||||||||||||||||||||||||||
| 1653 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1654 | |||||||||||||||||||||||||||||||||||||||||||
| 1655 | 0 | ▶ | sub set_augeas_commands_prepend { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_augeas_commands_prepend: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1656 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1657 | 0 | $augeas_commands_prepend = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1658 | 0 | return $augeas_commands_prepend; | |||||||||||||||||||||||||||||||||||||||||
| 1659 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1660 | |||||||||||||||||||||||||||||||||||||||||||
| 1661 | 0 | ▶ | sub get_augeas_commands_prepend { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_augeas_commands_prepend: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1662 | 0 | ▶ | return $augeas_commands_prepend // []; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$Rex::Config::augeas_commands_prepend // []
MC/DC0%0/1
$Rex::Config::augeas_commands_prepend // []
$Rex::Config::augeas_commands_prepend
Truth table0%0/2
A
A= $Rex::Config::augeas_commands_prepend
| |||||||||||||||||||||||||||||||||||||||||||
| 1663 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1664 | |||||||||||||||||||||||||||||||||||||||||||
| 1665 | =head2 set_local_augeas_backend | ||||||||||||||||||||||||||||||||||||||||||
| 1666 | |||||||||||||||||||||||||||||||||||||||||||
| 1667 | =head2 get_local_augeas_backend | ||||||||||||||||||||||||||||||||||||||||||
| 1668 | |||||||||||||||||||||||||||||||||||||||||||
| 1669 | Sets and gets the value of the C<$local_augeas_backend> configuration variable. | ||||||||||||||||||||||||||||||||||||||||||
| 1670 | |||||||||||||||||||||||||||||||||||||||||||
| 1671 | This controls which Augeas backend to use for local operations, C<augtool> or C<Config::Augeas>. | ||||||||||||||||||||||||||||||||||||||||||
| 1672 | |||||||||||||||||||||||||||||||||||||||||||
| 1673 | Default is C<Config::Augeas>. | ||||||||||||||||||||||||||||||||||||||||||
| 1674 | |||||||||||||||||||||||||||||||||||||||||||
| 1675 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1676 | |||||||||||||||||||||||||||||||||||||||||||
| 1677 | 0 | ▶ | sub set_local_augeas_backend { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_local_augeas_backend: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1678 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1679 | 0 | $local_augeas_backend = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1680 | 0 | return $local_augeas_backend; | |||||||||||||||||||||||||||||||||||||||||
| 1681 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1682 | |||||||||||||||||||||||||||||||||||||||||||
| 1683 | 0 | ▶ | sub get_local_augeas_backend { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_local_augeas_backend: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1684 | 0 | ▶ | return $local_augeas_backend // 'Config::Augeas'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$Rex::Config::local_augeas_backend // "Config::Augeas"
MC/DC0%0/1
$Rex::Config::local_augeas_backend // "Config::Augeas"
$Rex::Config::local_augeas_backend
Truth table0%0/2
A
A= $Rex::Config::local_augeas_backend
| |||||||||||||||||||||||||||||||||||||||||||
| 1685 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1686 | |||||||||||||||||||||||||||||||||||||||||||
| 1687 | =head2 register_set_handler($handler_name, $code) | ||||||||||||||||||||||||||||||||||||||||||
| 1688 | |||||||||||||||||||||||||||||||||||||||||||
| 1689 | Register a handler that gets called by I<set>. | ||||||||||||||||||||||||||||||||||||||||||
| 1690 | |||||||||||||||||||||||||||||||||||||||||||
| 1691 | Rex::Config->register_set_handler("foo", sub { | ||||||||||||||||||||||||||||||||||||||||||
| 1692 | my ($value) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 1693 | print "The user set foo -> $value\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 1694 | }); | ||||||||||||||||||||||||||||||||||||||||||
| 1695 | |||||||||||||||||||||||||||||||||||||||||||
| 1696 | And now you can use this handler in your I<Rexfile> like this: | ||||||||||||||||||||||||||||||||||||||||||
| 1697 | |||||||||||||||||||||||||||||||||||||||||||
| 1698 | set foo => "bar"; | ||||||||||||||||||||||||||||||||||||||||||
| 1699 | |||||||||||||||||||||||||||||||||||||||||||
| 1700 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1701 | |||||||||||||||||||||||||||||||||||||||||||
| 1702 | 1994 | ▶ | sub register_set_handler { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
register_set_handler: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1703 | 1994 | my ( $class, $handler_name, $code ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1704 | 1994 | $SET_HANDLER->{$handler_name} = $code; | |||||||||||||||||||||||||||||||||||||||||
| 1705 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1706 | |||||||||||||||||||||||||||||||||||||||||||
| 1707 | 141 | ▶ | sub set { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1708 | 141 | my ( $class, $var, $data ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1709 | |||||||||||||||||||||||||||||||||||||||||||
| 1710 | 141 | ▶ | if ( exists( $SET_HANDLER->{$var} ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1711 | 14 | shift; | |||||||||||||||||||||||||||||||||||||||||
| 1712 | 14 | shift; | |||||||||||||||||||||||||||||||||||||||||
| 1713 | 14 | return &{ $SET_HANDLER->{$var} }(@_); | |||||||||||||||||||||||||||||||||||||||||
| 1714 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1715 | |||||||||||||||||||||||||||||||||||||||||||
| 1716 | 127 | ▶ | if ($set_no_append) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1717 | 6 | $set_param->{$var} = $data; | |||||||||||||||||||||||||||||||||||||||||
| 1718 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1719 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1720 | 121 | ▶ | if ( ref($data) eq "HASH" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 1721 | 101 | ▶ | if ( !ref( $set_param->{$var} ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1722 | 99 | $set_param->{$var} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 1723 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1724 | 101 | for my $key ( keys %{$data} ) { | |||||||||||||||||||||||||||||||||||||||||
| 1725 | 8 | $set_param->{$var}->{$key} = $data->{$key}; | |||||||||||||||||||||||||||||||||||||||||
| 1726 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1727 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1728 | elsif ( ref($data) eq "ARRAY" ) { | ||||||||||||||||||||||||||||||||||||||||||
| 1729 | 4 | push( @{ $set_param->{$var} }, @{$data} ); | |||||||||||||||||||||||||||||||||||||||||
| 1730 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1731 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1732 | 16 | $set_param->{$var} = $data; | |||||||||||||||||||||||||||||||||||||||||
| 1733 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1734 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1735 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1736 | |||||||||||||||||||||||||||||||||||||||||||
| 1737 | 0 | ▶ | sub unset { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unset: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1738 | 0 | my ( $class, $var ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1739 | 0 | $set_param->{$var} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 1740 | 0 | delete $set_param->{$var}; | |||||||||||||||||||||||||||||||||||||||||
| 1741 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1742 | |||||||||||||||||||||||||||||||||||||||||||
| 1743 | 130 | ▶ | sub get { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1744 | 130 | my ( $class, $var ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1745 | 130 | ▶ | $var or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1746 | 117 | ▶ | if ( exists $set_param->{$var} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1747 | 60 | return $set_param->{$var}; | |||||||||||||||||||||||||||||||||||||||||
| 1748 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1749 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1750 | |||||||||||||||||||||||||||||||||||||||||||
| 1751 | 52 | ▶ | sub get_all { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_all: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1752 | 52 | my ($class) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1753 | 52 | return $set_param; | |||||||||||||||||||||||||||||||||||||||||
| 1754 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1755 | |||||||||||||||||||||||||||||||||||||||||||
| 1756 | =head2 register_config_handler($topic, $code) | ||||||||||||||||||||||||||||||||||||||||||
| 1757 | |||||||||||||||||||||||||||||||||||||||||||
| 1758 | With this function it is possible to register own sections in the users config file (C<$HOME/.rex/config.yml>). | ||||||||||||||||||||||||||||||||||||||||||
| 1759 | |||||||||||||||||||||||||||||||||||||||||||
| 1760 | Example: | ||||||||||||||||||||||||||||||||||||||||||
| 1761 | |||||||||||||||||||||||||||||||||||||||||||
| 1762 | Rex::Config->register_config_handler("foo", sub { | ||||||||||||||||||||||||||||||||||||||||||
| 1763 | my ($param) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 1764 | print "bar is: " . $param->{bar} . "\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 1765 | }); | ||||||||||||||||||||||||||||||||||||||||||
| 1766 | |||||||||||||||||||||||||||||||||||||||||||
| 1767 | And now the user can set this in his configuration file: | ||||||||||||||||||||||||||||||||||||||||||
| 1768 | |||||||||||||||||||||||||||||||||||||||||||
| 1769 | base: | ||||||||||||||||||||||||||||||||||||||||||
| 1770 | user: theuser | ||||||||||||||||||||||||||||||||||||||||||
| 1771 | password: thepassw0rd | ||||||||||||||||||||||||||||||||||||||||||
| 1772 | foo: | ||||||||||||||||||||||||||||||||||||||||||
| 1773 | bar: baz | ||||||||||||||||||||||||||||||||||||||||||
| 1774 | |||||||||||||||||||||||||||||||||||||||||||
| 1775 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1776 | |||||||||||||||||||||||||||||||||||||||||||
| 1777 | 112 | ▶ | sub register_config_handler { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
register_config_handler: called CC=4 SCAR=15.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1778 | 112 | my ( $class, $topic, $code ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1779 | |||||||||||||||||||||||||||||||||||||||||||
| 1780 | 112 | ▶ | if ( !ref($HOME_CONFIG) ) { $HOME_CONFIG = {}; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1781 | 112 | $HOME_CONFIG->{$topic} = $code; | |||||||||||||||||||||||||||||||||||||||||
| 1782 | |||||||||||||||||||||||||||||||||||||||||||
| 1783 | 112 | ▶ | if ( ref($HOME_CONFIG_YAML) && exists $HOME_CONFIG_YAML->{$topic} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $Rex::Config::HOME_CONFIG_YAML and exists $Rex::Config::HOME_CONFIG_YAML->{$topic}
MC/DC0%0/2
ref $Rex::Config::HOME_CONFIG_YAML and exists $Rex::Config::HOME_CONFIG_YAML->{$topic}
ref $Rex::Config::HOME_CONFIG_YAML
exists $Rex::Config::HOME_CONFIG_YAML->{$topic}
Truth table33%1/3
A and B
A= ref $Rex::Config::HOME_CONFIG_YAMLB= exists $Rex::Config::HOME_CONFIG_YAML->{$topic}
| |||||||||||||||||||||||||||||||||||||||||||
| 1784 | 0 | &$code( $HOME_CONFIG_YAML->{$topic} ); | |||||||||||||||||||||||||||||||||||||||||
| 1785 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1786 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1787 | |||||||||||||||||||||||||||||||||||||||||||
| 1788 | 811 | ▶ | sub read_config_file { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
read_config_file: called CC=6 SCAR=18.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1789 | 811 | my ($config_file) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1790 | 811 | ▶ | $config_file ||= _home_dir() . "/.rex/config.yml"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$config_file ||= _home_dir() . '/.rex/config.yml'
MC/DC100%1/1
$config_file ||= _home_dir() . '/.rex/config.yml'
$config_file
Truth table100%2/2
A
A= $config_file
| |||||||||||||||||||||||||||||||||||||||||||
| 1791 | |||||||||||||||||||||||||||||||||||||||||||
| 1792 | 811 | ▶ | if ( -f $config_file ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1793 | 1 | my $yaml = eval { local ( @ARGV, $/ ) = ($config_file); <>; }; | |||||||||||||||||||||||||||||||||||||||||
| 1794 | 1 | eval { $HOME_CONFIG_YAML = Load($yaml); }; | |||||||||||||||||||||||||||||||||||||||||
| 1795 | |||||||||||||||||||||||||||||||||||||||||||
| 1796 | 1 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1797 | 0 | print STDERR "Error loading $config_file\n"; | |||||||||||||||||||||||||||||||||||||||||
| 1798 | 0 | print STDERR "$@\n"; | |||||||||||||||||||||||||||||||||||||||||
| 1799 | 0 | exit 2; | |||||||||||||||||||||||||||||||||||||||||
| 1800 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1801 | |||||||||||||||||||||||||||||||||||||||||||
| 1802 | 1 | for my $key ( keys %{$HOME_CONFIG} ) { | |||||||||||||||||||||||||||||||||||||||||
| 1803 | 1 | ▶ | if ( exists $HOME_CONFIG_YAML->{$key} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1804 | 1 | my $code = $HOME_CONFIG->{$key}; | |||||||||||||||||||||||||||||||||||||||||
| 1805 | 1 | &$code( $HOME_CONFIG_YAML->{$key} ); | |||||||||||||||||||||||||||||||||||||||||
| 1806 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1807 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1808 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1809 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1810 | |||||||||||||||||||||||||||||||||||||||||||
| 1811 | 812 | ▶ | sub read_ssh_config_file { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
read_ssh_config_file: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1812 | 812 | my ($config_file) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1813 | 812 | ▶ | $config_file ||= _home_dir() . '/.ssh/config'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$config_file ||= _home_dir() . '/.ssh/config'
MC/DC100%1/1
$config_file ||= _home_dir() . '/.ssh/config'
$config_file
Truth table100%2/2
A
A= $config_file
| |||||||||||||||||||||||||||||||||||||||||||
| 1814 | |||||||||||||||||||||||||||||||||||||||||||
| 1815 | 812 | ▶ | if ( -f $config_file ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1816 | 2 | my @lines = eval { local (@ARGV) = ($config_file); <>; }; | |||||||||||||||||||||||||||||||||||||||||
| 1817 | 2 | %SSH_CONFIG_FOR = _parse_ssh_config(@lines); | |||||||||||||||||||||||||||||||||||||||||
| 1818 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1819 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1820 | |||||||||||||||||||||||||||||||||||||||||||
| 1821 | 3 | ▶ | sub _parse_ssh_config { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_ssh_config: called CC=8 SCAR=20.8
| |||||||||||||||||||||||||||||||||||||||||||
| 1822 | 3 | my (@lines) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1823 | |||||||||||||||||||||||||||||||||||||||||||
| 1824 | 3 | my %ret = (); | |||||||||||||||||||||||||||||||||||||||||
| 1825 | |||||||||||||||||||||||||||||||||||||||||||
| 1826 | 3 | my ( @host, $in_host ); | |||||||||||||||||||||||||||||||||||||||||
| 1827 | 3 | for my $line (@lines) { | |||||||||||||||||||||||||||||||||||||||||
| 1828 | 27 | chomp $line; | |||||||||||||||||||||||||||||||||||||||||
| 1829 | 27 | ▶ | next if ( $line =~ m/^\s*#/ ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1830 | 26 | ▶ | next if ( $line =~ m/^\s*$/ ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1831 | |||||||||||||||||||||||||||||||||||||||||||
| 1832 | 19 | ▶ | if ( $line =~ m/^Host(?:\s*=\s*|\s+)(.*)$/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 1833 | 6 | my $host_tmp = $1; | |||||||||||||||||||||||||||||||||||||||||
| 1834 | 6 | @host = split( /\s+/, $host_tmp ); | |||||||||||||||||||||||||||||||||||||||||
| 1835 | 6 | $in_host = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1836 | 6 | for my $h (@host) { | |||||||||||||||||||||||||||||||||||||||||
| 1837 | 8 | $ret{$h} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 1838 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1839 | 6 | next; | |||||||||||||||||||||||||||||||||||||||||
| 1840 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1841 | elsif ($in_host) { | ||||||||||||||||||||||||||||||||||||||||||
| 1842 | |||||||||||||||||||||||||||||||||||||||||||
| 1843 | #my ($key, $val) = ($line =~ m/^\s*([^\s]+)\s+=?\s*(.*)$/); | ||||||||||||||||||||||||||||||||||||||||||
| 1844 | 13 | $line =~ s/^\s*//g; | |||||||||||||||||||||||||||||||||||||||||
| 1845 | 13 | my ( $key, $val_tmp ) = split( /[\s=]/, $line, 2 ); | |||||||||||||||||||||||||||||||||||||||||
| 1846 | 13 | $val_tmp =~ s/^[\s=]+//g; | |||||||||||||||||||||||||||||||||||||||||
| 1847 | 13 | my $val = $val_tmp; | |||||||||||||||||||||||||||||||||||||||||
| 1848 | |||||||||||||||||||||||||||||||||||||||||||
| 1849 | 13 | $val =~ s/^\s+//; | |||||||||||||||||||||||||||||||||||||||||
| 1850 | 13 | $val =~ s/\s+$//; | |||||||||||||||||||||||||||||||||||||||||
| 1851 | 13 | for my $h (@host) { | |||||||||||||||||||||||||||||||||||||||||
| 1852 | 15 | $ret{$h}->{ lc($key) } = $val; | |||||||||||||||||||||||||||||||||||||||||
| 1853 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1854 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1855 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1856 | |||||||||||||||||||||||||||||||||||||||||||
| 1857 | 3 | return %ret; | |||||||||||||||||||||||||||||||||||||||||
| 1858 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1859 | |||||||||||||||||||||||||||||||||||||||||||
| 1860 | 810 | ▶ | sub import { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
import: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1861 | 810 | read_ssh_config_file(); | |||||||||||||||||||||||||||||||||||||||||
| 1862 | 810 | read_config_file(); | |||||||||||||||||||||||||||||||||||||||||
| 1863 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1864 | |||||||||||||||||||||||||||||||||||||||||||
| 1865 | 108 | _register_config_handlers(); | |||||||||||||||||||||||||||||||||||||||||
| 1866 | |||||||||||||||||||||||||||||||||||||||||||
| 1867 | 108 | ▶ | sub _register_config_handlers { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_register_config_handlers: called CC=1 SCAR=0.5
| |||||||||||||||||||||||||||||||||||||||||||
| 1868 | __PACKAGE__->register_config_handler( | ||||||||||||||||||||||||||||||||||||||||||
| 1869 | 1 | ▶ | base => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=18.7
| |||||||||||||||||||||||||||||||||||||||||||
| 1870 | 1 | my ($param) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1871 | |||||||||||||||||||||||||||||||||||||||||||
| 1872 | 1 | for my $key ( keys %{$param} ) { | |||||||||||||||||||||||||||||||||||||||||
| 1873 | |||||||||||||||||||||||||||||||||||||||||||
| 1874 | 1 | ▶ | if ( $key eq "keyauth" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1875 | 0 | $key_auth = $param->{keyauth}; | |||||||||||||||||||||||||||||||||||||||||
| 1876 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 1877 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1878 | |||||||||||||||||||||||||||||||||||||||||||
| 1879 | 1 | ▶ | if ( $key eq "passwordauth" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1880 | 0 | $password_auth = $param->{passwordauth}; | |||||||||||||||||||||||||||||||||||||||||
| 1881 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 1882 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1883 | |||||||||||||||||||||||||||||||||||||||||||
| 1884 | 1 | ▶ | if ( $key eq "passauth" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1885 | 0 | $password_auth = $param->{passauth}; | |||||||||||||||||||||||||||||||||||||||||
| 1886 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 1887 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1888 | |||||||||||||||||||||||||||||||||||||||||||
| 1889 | 1 | my $ref_to_key = qualify_to_ref( $key, __PACKAGE__ ); | |||||||||||||||||||||||||||||||||||||||||
| 1890 | 1 | my $ref_to_key_scalar = *{$ref_to_key}{SCALAR}; | |||||||||||||||||||||||||||||||||||||||||
| 1891 | |||||||||||||||||||||||||||||||||||||||||||
| 1892 | 1 | ${$ref_to_key_scalar} = $param->{$key}; | |||||||||||||||||||||||||||||||||||||||||
| 1893 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1894 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1895 | 108 | ); | |||||||||||||||||||||||||||||||||||||||||
| 1896 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1897 | |||||||||||||||||||||||||||||||||||||||||||
| 1898 | 108 | _register_set_handlers(); | |||||||||||||||||||||||||||||||||||||||||
| 1899 | |||||||||||||||||||||||||||||||||||||||||||
| 1900 | 108 | ▶ | sub _register_set_handlers { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_register_set_handlers: called CC=2 SCAR=8.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1901 | 108 | my @set_handler = | |||||||||||||||||||||||||||||||||||||||||
| 1902 | qw/user password private_key public_key -keyauth -passwordauth -passauth | ||||||||||||||||||||||||||||||||||||||||||
| 1903 | parallelism sudo_password connection ca cert key distributor | ||||||||||||||||||||||||||||||||||||||||||
| 1904 | template_function port waitpid_blocking_sleep_time/; | ||||||||||||||||||||||||||||||||||||||||||
| 1905 | 108 | for my $hndl (@set_handler) { | |||||||||||||||||||||||||||||||||||||||||
| 1906 | __PACKAGE__->register_set_handler( | ||||||||||||||||||||||||||||||||||||||||||
| 1907 | 3 | ▶ | $hndl => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=9 SCAR=26.8
| |||||||||||||||||||||||||||||||||||||||||||
| 1908 | 3 | my ($val) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1909 | 3 | ▶ | if ( $hndl =~ m/^\-/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1910 | 0 | $hndl = substr( $hndl, 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 1911 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1912 | 0 | ▶ | if ( $hndl eq "keyauth" ) { $hndl = "key_auth"; $val = 1; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1913 | 3 | ▶ | if ( $hndl eq "passwordauth" || $hndl eq "passauth" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$hndl eq "passwordauth" or $hndl eq "passauth"
MC/DC0%0/2
$hndl eq "passwordauth" or $hndl eq "passauth"
$hndl eq "passwordauth"
$hndl eq "passauth"
Truth table33%1/3
A or B
A= $hndl eq "passwordauth"B= $hndl eq "passauth"
| |||||||||||||||||||||||||||||||||||||||||||
| 1914 | 0 | $hndl = "password_auth"; | |||||||||||||||||||||||||||||||||||||||||
| 1915 | 0 | $val = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1916 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1917 | 3 | ▶ | if ( $hndl eq "connection" ) { $hndl = "connection_type"; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1918 | 0 | ▶ | if ( $hndl eq "ca" ) { $hndl = "ca_file"; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1919 | 0 | ▶ | if ( $hndl eq "cert" ) { $hndl = "ca_cert"; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1920 | 0 | ▶ | if ( $hndl eq "key" ) { $hndl = "ca_key"; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1921 | |||||||||||||||||||||||||||||||||||||||||||
| 1922 | 3 | my $ref_to_hndl = qualify_to_ref( $hndl, __PACKAGE__ ); | |||||||||||||||||||||||||||||||||||||||||
| 1923 | 3 | my $ref_to_hndl_scalar = *{$ref_to_hndl}{SCALAR}; | |||||||||||||||||||||||||||||||||||||||||
| 1924 | |||||||||||||||||||||||||||||||||||||||||||
| 1925 | 3 | ${$ref_to_hndl_scalar} = $val; | |||||||||||||||||||||||||||||||||||||||||
| 1926 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1927 | 1836 | ); | |||||||||||||||||||||||||||||||||||||||||
| 1928 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1929 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1930 | |||||||||||||||||||||||||||||||||||||||||||
| 1931 | 1620 | ▶ | sub _home_dir { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_home_dir: called CC=3 SCAR=13.1
| |||||||||||||||||||||||||||||||||||||||||||
| 1932 | 1620 | ▶ | if ( $^O =~ m/^MSWin/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1933 | 0 | return $ENV{'USERPROFILE'}; | |||||||||||||||||||||||||||||||||||||||||
| 1934 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1935 | |||||||||||||||||||||||||||||||||||||||||||
| 1936 | 1620 | ▶ | return $ENV{'HOME'} || ""; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$ENV{'HOME'} || ''
MC/DC0%0/1
$ENV{'HOME'} || ''
$ENV{'HOME'}
Truth table50%1/2
A
A= $ENV{'HOME'}
| |||||||||||||||||||||||||||||||||||||||||||
| 1937 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1938 | |||||||||||||||||||||||||||||||||||||||||||
| 1939 | 108 | 1; | |||||||||||||||||||||||||||||||||||||||||