Blob Blame History Raw
From 31d6f75837251dae4a494fe361105c8f6fa63a17 Mon Sep 17 00:00:00 2001
From: Marek 'marx' Grac <mgrac@redhat.com>
Date: Wed, 2 Sep 2015 14:35:23 +0200
Subject: [PATCH 1/3] fence_ipmilan: Restore deprecated option -i which is
 alias to -a / --ip

Resolves: rhbz#1257137
---
 fence/agents/ipmilan/fence_ipmilan.py | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/fence/agents/ipmilan/fence_ipmilan.py b/fence/agents/ipmilan/fence_ipmilan.py
index 8490837..8224b83 100644
--- a/fence/agents/ipmilan/fence_ipmilan.py
+++ b/fence/agents/ipmilan/fence_ipmilan.py
@@ -119,12 +119,18 @@ def define_new_opts():
 		"default" : "@IPMITOOL_PATH@",
 		"order": 200
 	}
+	all_opt["obsolete_ip"] = {
+		"getopt" : "i:",
+		"longopt" : "obsolete-ip",
+		"help" : "",
+		"order" : 1
+	}
 
 def main():
 	atexit.register(atexit_handler)
 
-	device_opt = ["ipaddr", "login", "no_login", "no_password", "passwd",
-		"lanplus", "auth", "cipher", "privlvl", "sudo", "ipmitool_path", "method"]
+	device_opt = ["ipaddr", "ipport", "login", "no_login", "no_password", "passwd",
+		"lanplus", "auth", "cipher", "privlvl", "sudo", "ipmitool_path", "method", "obsolete_ip"]
 	define_new_opts()
 
 	if os.path.basename(sys.argv[0]) == "fence_ilo3":
@@ -136,7 +142,11 @@ def main():
 
 	all_opt["ipport"]["default"] = "623"
 
-	options = check_input(device_opt, process_input(device_opt))
+	pi = process_input(device_opt)
+	# Accept also deprecated option but do not propagate it at all
+	if "--obsolete-ip" in pi:
+		pi["--ip"] = pi["--obsolete-ip"]
+	options = check_input(device_opt, pi)
 
 	docs = {}
 	docs["shortdesc"] = "Fence agent for IPMI"
-- 
1.9.3