From eae9d029b7073e7eb8c7ba4df9ec19b755a8f603 Mon Sep 17 00:00:00 2001
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
Date: Wed, 27 Sep 2017 14:26:38 +0200
Subject: [PATCH 16/17] fix for ignored options

---
 fence/agents/compute/fence_compute.py  | 20 +++++++-------
 fence/agents/compute/fence_evacuate.py | 18 ++++++-------
 fence/agents/scsi/fence_scsi.py        |  4 +--
 tests/data/metadata/fence_compute.xml  | 49 +++++-----------------------------
 tests/data/metadata/fence_evacuate.xml | 42 +++++------------------------
 tests/data/metadata/fence_scsi.xml     |  6 +----
 6 files changed, 35 insertions(+), 104 deletions(-)

diff --git a/fence/agents/compute/fence_compute.py b/fence/agents/compute/fence_compute.py
index 476109e5..d7f357a2 100644
--- a/fence/agents/compute/fence_compute.py
+++ b/fence/agents/compute/fence_compute.py
@@ -314,7 +314,7 @@ def create_nova_connection(options):
 	return None
 
 def define_new_opts():
-	all_opt["endpoint-type"] = {
+	all_opt["endpoint_type"] = {
 		"getopt" : "e:",
 		"longopt" : "endpoint-type",
 		"help" : "-e, --endpoint-type=[endpoint] Nova Endpoint type (publicURL, internalURL, adminURL)",
@@ -323,7 +323,7 @@ def define_new_opts():
 		"default" : "internalURL",
 		"order": 1,
 	}
-	all_opt["tenant-name"] = {
+	all_opt["tenant_name"] = {
 		"getopt" : "t:",
 		"longopt" : "tenant-name",
 		"help" : "-t, --tenant-name=[tenant]     Keystone Admin Tenant",
@@ -332,7 +332,7 @@ def define_new_opts():
 		"default" : "",
 		"order": 1,
 	}
-	all_opt["auth-url"] = {
+	all_opt["auth_url"] = {
 		"getopt" : "k:",
 		"longopt" : "auth-url",
 		"help" : "-k, --auth-url=[url]           Keystone Admin Auth URL",
@@ -341,7 +341,7 @@ def define_new_opts():
 		"default" : "",
 		"order": 1,
 	}
-	all_opt["region-name"] = {
+	all_opt["region_name"] = {
 		"getopt" : "",
 		"longopt" : "region-name",
 		"help" : "--region-name=[region]         Region Name",
@@ -367,7 +367,7 @@ def define_new_opts():
 		"shortdesc" : "DNS domain in which hosts live",
 		"order": 5,
 	}
-	all_opt["record-only"] = {
+	all_opt["record_only"] = {
 		"getopt" : "r:",
 		"longopt" : "record-only",
 		"help" : "--record-only                  Record the target as needing evacuation but as yet do not intiate it",
@@ -376,7 +376,7 @@ def define_new_opts():
 		"default" : "False",
 		"order": 5,
 	}
-	all_opt["instance-filtering"] = {
+	all_opt["instance_filtering"] = {
 		"getopt" : "",
 		"longopt" : "instance-filtering",
 		"help" : "--instance-filtering           Allow instances created from images and flavors with evacuable=true to be evacuated (or all if no images/flavors have been tagged)",
@@ -385,7 +385,7 @@ def define_new_opts():
 		"default" : "True",
 		"order": 5,
 	}
-	all_opt["no-shared-storage"] = {
+	all_opt["no_shared_storage"] = {
 		"getopt" : "",
 		"longopt" : "no-shared-storage",
 		"help" : "--no-shared-storage            Disable functionality for shared storage",
@@ -411,9 +411,9 @@ def main():
 	global override_status
 	atexit.register(atexit_handler)
 
-	device_opt = ["login", "passwd", "tenant-name", "auth-url", "fabric_fencing",
-		"no_login", "no_password", "port", "domain", "no-shared-storage", "endpoint-type",
-		"record-only", "instance-filtering", "insecure", "region-name"]
+	device_opt = ["login", "passwd", "tenant_name", "auth_url", "fabric_fencing",
+		"no_login", "no_password", "port", "domain", "no_shared_storage", "endpoint_type",
+		"record_only", "instance_filtering", "insecure", "region_name"]
 	define_new_opts()
 	all_opt["shell_timeout"]["default"] = "180"
 
diff --git a/fence/agents/compute/fence_evacuate.py b/fence/agents/compute/fence_evacuate.py
index f8d1f31a..b29b5dd1 100644
--- a/fence/agents/compute/fence_evacuate.py
+++ b/fence/agents/compute/fence_evacuate.py
@@ -247,7 +247,7 @@ def create_nova_connection(options):
 	return None
 
 def define_new_opts():
-	all_opt["endpoint-type"] = {
+	all_opt["endpoint_type"] = {
 		"getopt" : "e:",
 		"longopt" : "endpoint-type",
 		"help" : "-e, --endpoint-type=[endpoint] Nova Endpoint type (publicURL, internalURL, adminURL)",
@@ -256,7 +256,7 @@ def define_new_opts():
 		"default" : "internalURL",
 		"order": 1,
 	}
-	all_opt["tenant-name"] = {
+	all_opt["tenant_name"] = {
 		"getopt" : "t:",
 		"longopt" : "tenant-name",
 		"help" : "-t, --tenant-name=[tenant]     Keystone Admin Tenant",
@@ -265,7 +265,7 @@ def define_new_opts():
 		"default" : "",
 		"order": 1,
 	}
-	all_opt["auth-url"] = {
+	all_opt["auth_url"] = {
 		"getopt" : "k:",
 		"longopt" : "auth-url",
 		"help" : "-k, --auth-url=[url]                   Keystone Admin Auth URL",
@@ -274,7 +274,7 @@ def define_new_opts():
 		"default" : "",
 		"order": 1,
 	}
-	all_opt["region-name"] = {
+	all_opt["region_name"] = {
 		"getopt" : "",
 		"longopt" : "region-name",
 		"help" : "--region-name=[region]                 Region Name",
@@ -300,7 +300,7 @@ def define_new_opts():
 		"shortdesc" : "DNS domain in which hosts live",
 		"order": 5,
 	}
-	all_opt["instance-filtering"] = {
+	all_opt["instance_filtering"] = {
 		"getopt" : "",
 		"longopt" : "instance-filtering",
 		"help" : "--instance-filtering                   Allow instances created from images and flavors with evacuable=true to be evacuated (or all if no images/flavors have been tagged)",
@@ -309,7 +309,7 @@ def define_new_opts():
 		"default" : "True",
 		"order": 5,
 	}
-	all_opt["no-shared-storage"] = {
+	all_opt["no_shared_storage"] = {
 		"getopt" : "",
 		"longopt" : "no-shared-storage",
 		"help" : "--no-shared-storage            Disable functionality for shared storage",
@@ -322,9 +322,9 @@ def define_new_opts():
 def main():
 	atexit.register(atexit_handler)
 
-	device_opt = ["login", "passwd", "tenant-name", "auth-url",
-		"no_login", "no_password", "port", "domain", "no-shared-storage", "endpoint-type",
-		"instance-filtering", "insecure", "region-name"]
+	device_opt = ["login", "passwd", "tenant_name", "auth_url",
+		"no_login", "no_password", "port", "domain", "no_shared_storage", "endpoint_type",
+		"instance_filtering", "insecure", "region_name"]
 	define_new_opts()
 	all_opt["shell_timeout"]["default"] = "180"
 
diff --git a/fence/agents/scsi/fence_scsi.py b/fence/agents/scsi/fence_scsi.py
index dbc9c501..99c426e0 100644
--- a/fence/agents/scsi/fence_scsi.py
+++ b/fence/agents/scsi/fence_scsi.py
@@ -335,7 +335,7 @@ be removed from the device(s).",
 		"shortdesc" : "Log output (stdout and stderr) to file",
 		"order": 5
 	}
-	all_opt["corosync-cmap_path"] = {
+	all_opt["corosync_cmap_path"] = {
 		"getopt" : ":",
 		"longopt" : "corosync-cmap-path",
 		"help" : "--corosync-cmap-path=[path]    Path to corosync-cmapctl binary",
@@ -419,7 +419,7 @@ def main():
 	atexit.register(atexit_handler)
 
 	device_opt = ["no_login", "no_password", "devices", "nodename", "key",\
-	"aptpl", "fabric_fencing", "on_target", "corosync-cmap_path",\
+	"aptpl", "fabric_fencing", "on_target", "corosync_cmap_path",\
 	"sg_persist_path", "sg_turs_path", "logfile", "vgs_path", "force_on"]
 
 	define_new_opts()
diff --git a/tests/data/metadata/fence_compute.xml b/tests/data/metadata/fence_compute.xml
index 2945d1cb..98c7d480 100644
--- a/tests/data/metadata/fence_compute.xml
+++ b/tests/data/metadata/fence_compute.xml
@@ -8,22 +8,12 @@
 		<content type="string" default="off"  />
 		<shortdesc lang="en">Fencing action</shortdesc>
 	</parameter>
-	<parameter name="auth-url" unique="0" required="0" deprecated="1">
+	<parameter name="auth_url" unique="0" required="0">
 		<getopt mixed="-k, --auth-url=[url]" />
 		<content type="string" default=""  />
 		<shortdesc lang="en">Keystone Admin Auth URL</shortdesc>
 	</parameter>
-	<parameter name="auth_url" unique="0" required="0" obsoletes="auth-url">
-		<getopt mixed="-k, --auth-url=[url]" />
-		<content type="string" default=""  />
-		<shortdesc lang="en">Keystone Admin Auth URL</shortdesc>
-	</parameter>
-	<parameter name="endpoint-type" unique="0" required="0" deprecated="1">
-		<getopt mixed="-e, --endpoint-type=[endpoint]" />
-		<content type="string" default="internalURL"  />
-		<shortdesc lang="en">Nova Endpoint type</shortdesc>
-	</parameter>
-	<parameter name="endpoint_type" unique="0" required="0" obsoletes="endpoint-type">
+	<parameter name="endpoint_type" unique="0" required="0">
 		<getopt mixed="-e, --endpoint-type=[endpoint]" />
 		<content type="string" default="internalURL"  />
 		<shortdesc lang="en">Nova Endpoint type</shortdesc>
@@ -63,22 +53,12 @@
 		<content type="string"  />
 		<shortdesc lang="en">Physical plug number on device, UUID or identification of machine</shortdesc>
 	</parameter>
-	<parameter name="region-name" unique="0" required="0" deprecated="1">
+	<parameter name="region_name" unique="0" required="0">
 		<getopt mixed="--region-name=[region]" />
 		<content type="boolean" default=""  />
 		<shortdesc lang="en">Region Name</shortdesc>
 	</parameter>
-	<parameter name="region_name" unique="0" required="0" obsoletes="region-name">
-		<getopt mixed="--region-name=[region]" />
-		<content type="boolean" default=""  />
-		<shortdesc lang="en">Region Name</shortdesc>
-	</parameter>
-	<parameter name="tenant-name" unique="0" required="0" deprecated="1">
-		<getopt mixed="-t, --tenant-name=[tenant]" />
-		<content type="string" default=""  />
-		<shortdesc lang="en">Keystone Admin Tenant</shortdesc>
-	</parameter>
-	<parameter name="tenant_name" unique="0" required="0" obsoletes="tenant-name">
+	<parameter name="tenant_name" unique="0" required="0">
 		<getopt mixed="-t, --tenant-name=[tenant]" />
 		<content type="string" default=""  />
 		<shortdesc lang="en">Keystone Admin Tenant</shortdesc>
@@ -98,32 +78,17 @@
 		<content type="string"  />
 		<shortdesc lang="en">DNS domain in which hosts live</shortdesc>
 	</parameter>
-	<parameter name="instance-filtering" unique="0" required="0" deprecated="1">
+	<parameter name="instance_filtering" unique="0" required="0">
 		<getopt mixed="--instance-filtering" />
 		<content type="boolean" default="True"  />
 		<shortdesc lang="en">Allow instances to be evacuated</shortdesc>
 	</parameter>
-	<parameter name="instance_filtering" unique="0" required="0" obsoletes="instance-filtering">
-		<getopt mixed="--instance-filtering" />
-		<content type="boolean" default="True"  />
-		<shortdesc lang="en">Allow instances to be evacuated</shortdesc>
-	</parameter>
-	<parameter name="no-shared-storage" unique="0" required="0" deprecated="1">
-		<getopt mixed="--no-shared-storage" />
-		<content type="boolean" default="False"  />
-		<shortdesc lang="en">Disable functionality for dealing with shared storage</shortdesc>
-	</parameter>
-	<parameter name="no_shared_storage" unique="0" required="0" obsoletes="no-shared-storage">
+	<parameter name="no_shared_storage" unique="0" required="0">
 		<getopt mixed="--no-shared-storage" />
 		<content type="boolean" default="False"  />
 		<shortdesc lang="en">Disable functionality for dealing with shared storage</shortdesc>
 	</parameter>
-	<parameter name="record-only" unique="0" required="0" deprecated="1">
-		<getopt mixed="--record-only" />
-		<content type="string" default="False"  />
-		<shortdesc lang="en">Only record the target as needing evacuation</shortdesc>
-	</parameter>
-	<parameter name="record_only" unique="0" required="0" obsoletes="record-only">
+	<parameter name="record_only" unique="0" required="0">
 		<getopt mixed="--record-only" />
 		<content type="string" default="False"  />
 		<shortdesc lang="en">Only record the target as needing evacuation</shortdesc>
diff --git a/tests/data/metadata/fence_evacuate.xml b/tests/data/metadata/fence_evacuate.xml
index e2c13494..a636af60 100644
--- a/tests/data/metadata/fence_evacuate.xml
+++ b/tests/data/metadata/fence_evacuate.xml
@@ -8,22 +8,12 @@
 		<content type="string" default="reboot"  />
 		<shortdesc lang="en">Fencing action</shortdesc>
 	</parameter>
-	<parameter name="auth-url" unique="0" required="0" deprecated="1">
+	<parameter name="auth_url" unique="0" required="0">
 		<getopt mixed="-k, --auth-url=[url]" />
 		<content type="string" default=""  />
 		<shortdesc lang="en">Keystone Admin Auth URL</shortdesc>
 	</parameter>
-	<parameter name="auth_url" unique="0" required="0" obsoletes="auth-url">
-		<getopt mixed="-k, --auth-url=[url]" />
-		<content type="string" default=""  />
-		<shortdesc lang="en">Keystone Admin Auth URL</shortdesc>
-	</parameter>
-	<parameter name="endpoint-type" unique="0" required="0" deprecated="1">
-		<getopt mixed="-e, --endpoint-type=[endpoint]" />
-		<content type="string" default="internalURL"  />
-		<shortdesc lang="en">Nova Endpoint type</shortdesc>
-	</parameter>
-	<parameter name="endpoint_type" unique="0" required="0" obsoletes="endpoint-type">
+	<parameter name="endpoint_type" unique="0" required="0">
 		<getopt mixed="-e, --endpoint-type=[endpoint]" />
 		<content type="string" default="internalURL"  />
 		<shortdesc lang="en">Nova Endpoint type</shortdesc>
@@ -63,22 +53,12 @@
 		<content type="string"  />
 		<shortdesc lang="en">Physical plug number on device, UUID or identification of machine</shortdesc>
 	</parameter>
-	<parameter name="region-name" unique="0" required="0" deprecated="1">
-		<getopt mixed="--region-name=[region]" />
-		<content type="boolean" default=""  />
-		<shortdesc lang="en">Region Name</shortdesc>
-	</parameter>
-	<parameter name="region_name" unique="0" required="0" obsoletes="region-name">
+	<parameter name="region_name" unique="0" required="0">
 		<getopt mixed="--region-name=[region]" />
 		<content type="boolean" default=""  />
 		<shortdesc lang="en">Region Name</shortdesc>
 	</parameter>
-	<parameter name="tenant-name" unique="0" required="0" deprecated="1">
-		<getopt mixed="-t, --tenant-name=[tenant]" />
-		<content type="string" default=""  />
-		<shortdesc lang="en">Keystone Admin Tenant</shortdesc>
-	</parameter>
-	<parameter name="tenant_name" unique="0" required="0" obsoletes="tenant-name">
+	<parameter name="tenant_name" unique="0" required="0">
 		<getopt mixed="-t, --tenant-name=[tenant]" />
 		<content type="string" default=""  />
 		<shortdesc lang="en">Keystone Admin Tenant</shortdesc>
@@ -98,22 +78,12 @@
 		<content type="string"  />
 		<shortdesc lang="en">DNS domain in which hosts live</shortdesc>
 	</parameter>
-	<parameter name="instance-filtering" unique="0" required="0" deprecated="1">
-		<getopt mixed="--instance-filtering" />
-		<content type="boolean" default="True"  />
-		<shortdesc lang="en">Allow instances to be evacuated</shortdesc>
-	</parameter>
-	<parameter name="instance_filtering" unique="0" required="0" obsoletes="instance-filtering">
+	<parameter name="instance_filtering" unique="0" required="0">
 		<getopt mixed="--instance-filtering" />
 		<content type="boolean" default="True"  />
 		<shortdesc lang="en">Allow instances to be evacuated</shortdesc>
 	</parameter>
-	<parameter name="no-shared-storage" unique="0" required="0" deprecated="1">
-		<getopt mixed="--no-shared-storage" />
-		<content type="boolean" default="False"  />
-		<shortdesc lang="en">Disable functionality for dealing with shared storage</shortdesc>
-	</parameter>
-	<parameter name="no_shared_storage" unique="0" required="0" obsoletes="no-shared-storage">
+	<parameter name="no_shared_storage" unique="0" required="0">
 		<getopt mixed="--no-shared-storage" />
 		<content type="boolean" default="False"  />
 		<shortdesc lang="en">Disable functionality for dealing with shared storage</shortdesc>
diff --git a/tests/data/metadata/fence_scsi.xml b/tests/data/metadata/fence_scsi.xml
index 58447b69..54fc9470 100644
--- a/tests/data/metadata/fence_scsi.xml
+++ b/tests/data/metadata/fence_scsi.xml
@@ -94,11 +94,7 @@ The fence_scsi agent works by having each node in the cluster register a unique
 		<content type="integer" default="1"  />
 		<shortdesc lang="en">Count of attempts to retry power on</shortdesc>
 	</parameter>
-	<parameter name="corosync-cmap_path" unique="0" required="0" deprecated="1">
-		<getopt mixed="--corosync-cmap-path=[path]" />
-		<shortdesc lang="en">Path to corosync-cmapctl binary</shortdesc>
-	</parameter>
-	<parameter name="corosync_cmap_path" unique="0" required="0" obsoletes="corosync-cmap_path">
+	<parameter name="corosync_cmap_path" unique="0" required="0">
 		<getopt mixed="--corosync-cmap-path=[path]" />
 		<shortdesc lang="en">Path to corosync-cmapctl binary</shortdesc>
 	</parameter>
-- 
2.13.6

