TT#68300 Do not use authentication if is not configured

When we are just using the defaults and there's been no authentication
configured, we should just not use any authentication.

This makes it possible to use the code with no config file.

Change-Id: I9b23cd5ac806f6a56456d70175f9bdfcb436b62c
changes/08/34108/5
Guillem Jover 6 years ago
parent f50b79e782
commit 901996fc97

@ -59,9 +59,11 @@ sub _create_ua {
$urlbase->host($self->{_opts}{host});
$urlbase->port($self->{_opts}{port});
$ua->credentials($urlbase->host_port,
'api_admin_system', #'api_admin_http'
@{$self->{_opts}}{qw(auth_user auth_pass)});
if (defined $self->{_opts}{auth_user}) {
$ua->credentials($urlbase->host_port,
'api_admin_system', #'api_admin_http'
@{$self->{_opts}}{qw(auth_user auth_pass)});
}
if ($self->{_opts}{verbose}) {
$ua->show_progress(1);

Loading…
Cancel
Save