From a503a4bedf8238256ef3fd61a9d4e993812e5c45 Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Wed, 10 May 2017 15:43:07 +0200 Subject: [PATCH] + enhance hyperv mode --- apps/hyperv/2012/local/mode/nodevmstatus.pm | 5 +++++ apps/hyperv/2012/local/mode/scvmmvmstatus.pm | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/apps/hyperv/2012/local/mode/nodevmstatus.pm b/apps/hyperv/2012/local/mode/nodevmstatus.pm index 15c801354..b21251b8d 100644 --- a/apps/hyperv/2012/local/mode/nodevmstatus.pm +++ b/apps/hyperv/2012/local/mode/nodevmstatus.pm @@ -175,6 +175,11 @@ sub manage_selection { $self->{vm}->{$id} = { display => $name, vm => $name, status => $status, state => $state, is_clustered => $is_clustered }; $id++; } + + if (scalar(keys %{$self->{vm}}) <= 0) { + $self->{output}->add_option_msg(short_msg => "No virtual machine found."); + $self->{output}->option_exit(); + } } 1; diff --git a/apps/hyperv/2012/local/mode/scvmmvmstatus.pm b/apps/hyperv/2012/local/mode/scvmmvmstatus.pm index 326b7bd0e..6563b126a 100644 --- a/apps/hyperv/2012/local/mode/scvmmvmstatus.pm +++ b/apps/hyperv/2012/local/mode/scvmmvmstatus.pm @@ -191,6 +191,11 @@ sub manage_selection { $self->{vm}->{$id} = { display => $values{vm}, vm => $values{vm}, status => $values{status}, hostgroup => $values{hostgroup} }; $id++; } + + if (scalar(keys %{$self->{vm}}) <= 0) { + $self->{output}->add_option_msg(short_msg => "No virtual machine found."); + $self->{output}->option_exit(); + } } 1;