fence-agents: master - fencing: Accept unknown options from standard input

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


Gitweb:        http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=commitdiff;h=744df71768fc561693bee28e635501cf641d8d29
Commit:        744df71768fc561693bee28e635501cf641d8d29
Parent:        460609f46485cd39f1ea158a00e1ca8fa3dd809f
Author:        Marek 'marx' Grac <mgrac at redhat.com>
AuthorDate:    Fri Oct 16 17:23:21 2009 +0200
Committer:     Marek 'marx' Grac <mgrac at redhat.com>
CommitterDate: Fri Oct 16 17:28:40 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 9df1190..a099a0a 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -543,7 +543,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