cluster: STABLE3 - fencing: Accept unknown options from standard input

Marek Grác marx at fedoraproject.org
Fri Oct 16 15:32:16 UTC 2009


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=9fe781d4070527ea89acd848a5d50f3d24302f90
Commit:        9fe781d4070527ea89acd848a5d50f3d24302f90
Parent:        622002d75df7bb067bca51f46731b89f2104b65a
Author:        Marek 'marx' Grac <mgrac at redhat.com>
AuthorDate:    Fri Oct 16 17:31:10 2009 +0200
Committer:     Marek 'marx' Grac <mgrac at redhat.com>
CommitterDate: Fri Oct 16 17:31:10 2009 +0200

fencing: Accept unknown options from standard input

libefence added new option 'nodename' to every query, as most of the agents
does not need such feature, we will ignore it. Unknown options from STDIN where
handled differently before.

New policy: fence agent should accept unknown args from STDIN. It can print on STDERR
warning that it is ignoring that option.
---
 fence/agents/bullpap/fence_bullpap.pl |    4 ----
 fence/agents/drac/fence_drac.pl       |    5 -----
 fence/agents/egenera/fence_egenera.pl |    7 -------
 fence/agents/lib/fencing.py.py        |    3 ++-
 4 files changed, 2 insertions(+), 17 deletions(-)

diff --git a/fence/agents/bullpap/fence_bullpap.pl b/fence/agents/bullpap/fence_bullpap.pl
index b643413..11382dc 100644
--- a/fence/agents/bullpap/fence_bullpap.pl
+++ b/fence/agents/bullpap/fence_bullpap.pl
@@ -148,10 +148,6 @@ sub get_options_stdin
 		{
 			$verbose = $val;
 		} 
-		else 
-		{
-			fail "parse error: unknown option \"$opt\"";
-		}
 	}
 }
 
diff --git a/fence/agents/drac/fence_drac.pl b/fence/agents/drac/fence_drac.pl
index e743aae..78c4735 100644
--- a/fence/agents/drac/fence_drac.pl
+++ b/fence/agents/drac/fence_drac.pl
@@ -560,11 +560,6 @@ sub get_options_stdin
 		{
 			$cmd_prompt = $val;
 		} 
-		# Excess name/vals will fail
-		else 
-		{
-			fail "parse error: unknown option \"$opt\"";
-		}
 	}
 }
 
diff --git a/fence/agents/egenera/fence_egenera.pl b/fence/agents/egenera/fence_egenera.pl
index a193fb0..8df0029 100644
--- a/fence/agents/egenera/fence_egenera.pl
+++ b/fence/agents/egenera/fence_egenera.pl
@@ -164,13 +164,6 @@ sub get_options_stdin
 		{
 			$user = $val;
 		}
-
-		# FIXME should we do more error checking?  
-		# Excess name/vals will be eaten for now
-		else 
-		{
-			fail "parse error: unknown option \"$opt\"";
-		}
 	}
 }
 
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index fe83a3f..5e9b3cc 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -538,7 +538,8 @@ def process_input(avail_opt):
 			##
 			######
 			if avail_opt.count(name) == 0:
-				fail_usage("Parse error: Unknown option '"+line+"'")
+				sys.stderr.write("Parse error: Ignoring unknown option '"+line+"'\n")
+				continue
 
 			if all_opt[name]["getopt"].endswith(":"):
 				opt["-"+all_opt[name]["getopt"].rstrip(":")] = value


More information about the cluster-commits mailing list