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

Marek Grác marx at fedoraproject.org
Mon Nov 9 13:10:58 UTC 2009


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=2b37e34b7ae97a6f80cb5dda033b63da83d1f49e
Commit:        2b37e34b7ae97a6f80cb5dda033b63da83d1f49e
Parent:        c39935e81f55e4e2b1b2b7b81994300a5a062cf9
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: Mon Nov 9 14:09:22 2009 +0100

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.

Resolves: bz#532920
---
 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 bb02fb8..a53c8e1 100755
--- a/fence/agents/bullpap/fence_bullpap.pl
+++ b/fence/agents/bullpap/fence_bullpap.pl
@@ -160,10 +160,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 3f3bb76..f4824cb 100755
--- a/fence/agents/drac/fence_drac.pl
+++ b/fence/agents/drac/fence_drac.pl
@@ -572,11 +572,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 b516ceb..928ebb2 100755
--- a/fence/agents/egenera/fence_egenera.pl
+++ b/fence/agents/egenera/fence_egenera.pl
@@ -177,13 +177,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 3dd9763..860d194 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -548,7 +548,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