From d80bda8eb40b0f85c632b47ea881db2f6998f6f0 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Thu, 9 May 2019 17:18:54 -0400 Subject: [PATCH 1/4] Plugin should not return error in certain places because it will attempt to look at another plugin --- xCAT-server/lib/xcat/plugins/anaconda.pm | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index 358678482..ca5519df8 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -2022,11 +2022,7 @@ sub copycd { #If they say to call it something unidentifiable, give up? - $callback->( - { - error => "The name specified ($distname) is not supported. Use the following format: rh*,pkvm*,centos*,fedora*,SL*,ol*", errorcode => [1] - } - ); + print "DEBUG - [anaconda.pm] The name specified ($distname) is not supported for anaconda images, continue to another plugin..."; return; } @@ -2151,14 +2147,10 @@ sub copycd if ($arch eq "ppc") { $arch = "ppc64" } } - # At this point, arch should have been detected from the .discinfo, if not, then we require the user to provide it. + # At this point, if arch is not provided and we cannot determine it, return unless ($arch) { - $callback->( - { - error => "ARCH not be detected, provide an OS ARCH using the -a option. (ppc64le, x86_64)", errorcode => [1] - } - ); + print "DEBUG - [anaconda.pm] ARCH not detected, provided an OS ARCH using the -a option."; return; } From 0ee133ce9b06436d6db2a1b96a170505888b52aa Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Thu, 9 May 2019 17:23:50 -0400 Subject: [PATCH 2/4] Improve the debug messages to show plugin --- xCAT-server/lib/xcat/plugins/anaconda.pm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index ca5519df8..3bb738651 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -2034,7 +2034,7 @@ sub copycd if (-r $mntpath . "/.discinfo") { - print "DEBUG - Attempt to detemine OS information from the .discinfo file ...\n"; + print "DEBUG - [anaconda.pm] Attempt to detemine OS information from the .discinfo file ...\n"; open($dinfo, $mntpath . "/.discinfo"); $did = <$dinfo>; @@ -2050,7 +2050,7 @@ sub copycd } else { - print "DEBUG - No .discinfo file found on media, will continue ...\n"; + print "DEBUG - [anaconda.pm] No .discinfo file found on media, will continue ...\n"; } if ($darch and $darch =~ /i.86/) @@ -2072,12 +2072,12 @@ sub copycd $dno = $1; } } - print "DEBUG - Distname=$distname, OS=$desc, ARCH=$arch, Version=$dno\n"; + print "DEBUG - [anaconda.pm] Distname=$distname, OS=$desc, ARCH=$arch, Version=$dno\n"; unless ($distname) { - print "DEBUG - Could not find ID=$did in the discinfo database for OS=$desc ARCH=$darch NUM=$dno\n"; - print "DEBUG - Attempting to auto-detect...\n"; + print "DEBUG - [anaconda.pm] Could not find ID=$did in the discinfo database for OS=$desc ARCH=$darch NUM=$dno\n"; + print "DEBUG - [anaconda.pm] Attempting to auto-detect...\n"; if ($desc =~ /IBM_PowerKVM/) { # check for PowerKVM support @@ -2124,7 +2124,7 @@ sub copycd } else { - print "DEBUG - Could not auto-detect operating system.\n"; + print "DEBUG - [anaconda.pm] Could not auto-detect operating system.\n"; # Cannot continue with what was detected, or attributes provided return; } @@ -2173,7 +2173,7 @@ sub copycd my $osdistroname = $distname . "-" . $arch; my $defaultpath = "$installroot/$distname/$arch"; - print "DEBUG - Detected distname=$distname, arch=$arch defaultpath=$defaultpath osdistroname=$osdistroname\n"; + print "DEBUG - [anaconda.pm] Detected distname=$distname, arch=$arch defaultpath=$defaultpath osdistroname=$osdistroname\n"; unless ($path) { $path = $defaultpath; From 4ae1391051e1e56c5b4c123ccb6d1090f22b8dd2 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Thu, 9 May 2019 17:25:21 -0400 Subject: [PATCH 3/4] Missing newline --- xCAT-server/lib/xcat/plugins/anaconda.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index 3bb738651..a7764cc8c 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -2022,7 +2022,7 @@ sub copycd { #If they say to call it something unidentifiable, give up? - print "DEBUG - [anaconda.pm] The name specified ($distname) is not supported for anaconda images, continue to another plugin..."; + print "DEBUG - [anaconda.pm] The name specified ($distname) is not supported for anaconda images, continue to another plugin...\n"; return; } @@ -2150,7 +2150,7 @@ sub copycd # At this point, if arch is not provided and we cannot determine it, return unless ($arch) { - print "DEBUG - [anaconda.pm] ARCH not detected, provided an OS ARCH using the -a option."; + print "DEBUG - [anaconda.pm] ARCH not detected, provided an OS ARCH using the -a option.\n"; return; } From 985421561781b53027162c56f18c3cf68f43b644 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Fri, 10 May 2019 10:36:31 -0400 Subject: [PATCH 4/4] Inform the user when arch cannot automatically be detected, if we are in the correct plugin --- xCAT-server/lib/xcat/plugins/anaconda.pm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index a7764cc8c..ccaabae36 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -2124,8 +2124,8 @@ sub copycd } else { - print "DEBUG - [anaconda.pm] Could not auto-detect operating system.\n"; # Cannot continue with what was detected, or attributes provided + print "DEBUG - [anaconda.pm] Could not auto-detect operating system. Maybe some other plugin can, return.\n"; return; } } @@ -2147,10 +2147,14 @@ sub copycd if ($arch eq "ppc") { $arch = "ppc64" } } - # At this point, if arch is not provided and we cannot determine it, return + # At this point, if arch is not provided and we cannot determine it, inform the user unless ($arch) { - print "DEBUG - [anaconda.pm] ARCH not detected, provided an OS ARCH using the -a option.\n"; + $callback->( + { + error => "copycds could not identify the ARCH, you may wish to try -a .", errorcode => [1] + } + ); return; }