From e3800f7695c2126ee2b2913d81f89f3e5af9d702 Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Tue, 3 May 2016 15:05:00 +0200 Subject: [PATCH] + Fix #368 --- apps/cluster/mscs/local/mode/listresources.pm | 6 ++++-- apps/cluster/mscs/local/mode/networkstatus.pm | 3 ++- apps/cluster/mscs/local/mode/resourcegroupstatus.pm | 8 +++++--- apps/cluster/mscs/local/mode/resourcestatus.pm | 6 ++++-- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/apps/cluster/mscs/local/mode/listresources.pm b/apps/cluster/mscs/local/mode/listresources.pm index 504c36e76..da61a9b98 100644 --- a/apps/cluster/mscs/local/mode/listresources.pm +++ b/apps/cluster/mscs/local/mode/listresources.pm @@ -80,6 +80,8 @@ sub manage_selection { my $name = $obj->{Name}; my $state = $map_state{$obj->{State}}; my $class = $map_class{$obj->{ResourceClass}}; + my $id = defined($obj->{Id}) ? $obj->{Id} : $name; + my $owner_node = defined($obj->{OwnerNode}) ? $obj->{OwnerNode} : '-'; if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' && $name !~ /$self->{option_results}->{filter_name}/) { @@ -87,8 +89,8 @@ sub manage_selection { next; } - $self->{resources}->{$obj->{Id}} = { name => $name, state => $state, owner_node => $obj->{OwnerNode}, - class => $class }; + $self->{resources}->{$id} = { name => $name, state => $state, owner_node => $owner_node, + class => $class }; } } diff --git a/apps/cluster/mscs/local/mode/networkstatus.pm b/apps/cluster/mscs/local/mode/networkstatus.pm index f14298e97..b3a6c907a 100644 --- a/apps/cluster/mscs/local/mode/networkstatus.pm +++ b/apps/cluster/mscs/local/mode/networkstatus.pm @@ -154,6 +154,7 @@ sub manage_selection { foreach my $obj (in $resultset) { my $name = $obj->{Name}; my $state = $map_state{$obj->{State}}; + my $id = defined($obj->{ID}) ? $obj->{ID} : $name; if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' && $name !~ /$self->{option_results}->{filter_name}/) { @@ -161,7 +162,7 @@ sub manage_selection { next; } - $self->{network}->{$obj->{ID}} = { display => $name, state => $state }; + $self->{network}->{$id} = { display => $name, state => $state }; } } diff --git a/apps/cluster/mscs/local/mode/resourcegroupstatus.pm b/apps/cluster/mscs/local/mode/resourcegroupstatus.pm index 6731475da..bdf277526 100644 --- a/apps/cluster/mscs/local/mode/resourcegroupstatus.pm +++ b/apps/cluster/mscs/local/mode/resourcegroupstatus.pm @@ -196,15 +196,17 @@ sub manage_selection { foreach my $obj (in $resultset) { my $name = $obj->{Name}; my $state = $map_state{$obj->{State}}; + my $id = defined($obj->{Id}) ? $obj->{Id} : $name; + my $owner_node = defined($obj->{OwnerNode}) ? $obj->{OwnerNode} : '-'; if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' && $name !~ /$self->{option_results}->{filter_name}/) { - $self->{output}->output_add(long_msg => "Skipping '" . $name . "': no matching filter.", debug => 1); + $self->{output}->output_add(long_msg => "skipping '" . $name . "': no matching filter.", debug => 1); next; } - $self->{rg}->{$obj->{Id}} = { display => $name, state => $state, owner_node => $obj->{OwnerNode}, - preferred_owners => defined($preferred_nodes->{$name}) ? $preferred_nodes->{$name} : [] }; + $self->{rg}->{$id} = { display => $name, state => $state, owner_node => $owner_node, + preferred_owners => defined($preferred_nodes->{$name}) ? $preferred_nodes->{$name} : [] }; } } diff --git a/apps/cluster/mscs/local/mode/resourcestatus.pm b/apps/cluster/mscs/local/mode/resourcestatus.pm index 381535539..28ed41a42 100644 --- a/apps/cluster/mscs/local/mode/resourcestatus.pm +++ b/apps/cluster/mscs/local/mode/resourcestatus.pm @@ -159,14 +159,16 @@ sub manage_selection { foreach my $obj (in $resultset) { my $name = $obj->{Name}; my $state = $map_state{$obj->{State}}; + my $id = defined($obj->{Id}) ? $obj->{Id} : $name; + my $owner_node = defined($obj->{OwnerNode}) ? $obj->{OwnerNode} : '-'; if (defined($self->{option_results}->{filter_name}) && $self->{option_results}->{filter_name} ne '' && $name !~ /$self->{option_results}->{filter_name}/) { - $self->{output}->output_add(long_msg => "Skipping '" . $name . "': no matching filter.", debug => 1); + $self->{output}->output_add(long_msg => "skipping '" . $name . "': no matching filter.", debug => 1); next; } - $self->{resource}->{$obj->{Id}} = { display => $name, state => $state, owner_node => $obj->{OwnerNode} }; + $self->{resource}->{$id} = { display => $name, state => $state, owner_node => $owner_node }; } }