api/ticket: move getting cluster name into an eval

to avoid a failed login if a broken corosync config is setup

Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2018-11-26 14:54:02 +01:00
parent f5a9380a6f
commit b27ae8aa44

View File

@ -281,11 +281,14 @@ __PACKAGE__->register_method ({
if (PVE::Corosync::check_conf_exists(1)) {
if ($rpcenv->check($username, '/', ['Sys.Audit'], 1)) {
eval {
my $conf = cfs_read_file('corosync.conf');
my $totem = PVE::Corosync::totem_config($conf);
if ($totem->{cluster_name}) {
$res->{clustername} = $totem->{cluster_name};
}
};
warn "$@\n" if $@;
}
}