From d048c404fc37dd46c3de377c6b77867166906b1c Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Fri, 19 Jun 2015 09:36:37 -0400 Subject: [PATCH] #4706 The global variables need to be undefine if not defined in GetOpts --- xCAT-server/lib/xcat/plugins/DBobjectdefs.pm | 30 ++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm index 369aa0b35..9f7c4c051 100755 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -427,6 +427,36 @@ sub processArgs if (scalar(@ARGV) <= 0) { return 2; } + + # clean up all the global variables for each options + # so def command can be called multiple times in one process + undef $::opt_a; + undef $::opt_c; + undef $::opt_d; + undef $::opt_a; + undef $::opt_c; + undef $::opt_d; + undef $::opt_f; + undef $::opt_i; + undef $::opt_h; + undef $::opt_l; + undef $::opt_s; + undef $::opt_m; + undef $::opt_n; + undef $::opt_o; + undef $::opt_p; + undef $::opt_t; + undef $::opt_V; + undef $::opt_v; + undef $::opt_w; + undef $::opt_x; + undef $::opt_z; + undef $::opt_S; + undef $::opt_nc; + undef $::opt_osimg; + undef $::opt_nics; + undef $::opt_setattr; + # parse the options - include any option from all 4 cmds Getopt::Long::Configure("no_pass_through");