From 376660a120b13d9b04007569699c76c1e1b17a8d Mon Sep 17 00:00:00 2001 From: digimer Date: Thu, 22 Jun 2023 21:20:10 -0400 Subject: [PATCH] * Removed the EXTRA_DIST argument from tools/Makefile.am * Added a sanity check that a valid optical device was passed to anvil-manage-server-storage Signed-off-by: digimer --- tools/Makefile.am | 1 - tools/anvil-manage-server-storage | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/tools/Makefile.am b/tools/Makefile.am index 6c51c2d7..cd2b412f 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -1,7 +1,6 @@ MAINTAINERCLEANFILES = Makefile.in # XXX recheck after rebase! -EXTRA_DIST = \ dist_sbin_SCRIPTS = \ anvil-access-module \ diff --git a/tools/anvil-manage-server-storage b/tools/anvil-manage-server-storage index 2f956b28..d32b26a8 100755 --- a/tools/anvil-manage-server-storage +++ b/tools/anvil-manage-server-storage @@ -406,6 +406,21 @@ sub manage_optical my $device_target = $anvil->data->{switches}{optical}; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { device_target => $device_target }}); + if ($anvil->data->{switches}{optical} eq "#!SET!#") + { + # User didn't specify a device. + show_server_details($anvil); + print "\n[ Error ] - Please specify the optical disk target you want to work on.\n"; + $anvil->nice_exit({exit_code => 1}); + } + elsif (not exists $anvil->data->{server}{$short_host_name}{$server_name}{$from_source}{device}{cdrom}{target}{$device_target}) + { + # Invalid device target + show_server_details($anvil); + print "\n[ Error ] - The optical device target: [".$device_target."] wasn't found.\n"; + $anvil->nice_exit({exit_code => 1}); + } + my $eject_first = 0; my $alias = $anvil->data->{server}{$short_host_name}{$server_name}{$from_source}{device}{cdrom}{target}{$device_target}{alias}; my $boot_order = $anvil->data->{server}{$short_host_name}{$server_name}{$from_source}{device}{cdrom}{target}{$device_target}{boot_order};