Add method to check and delete keypairs

This patch adds method to check nova keypair
existence and to delete it

Change-Id: I1c96e00c6c4cdb80613efb70ed000b913c715289
Related-PROD: PRODX-2183
diff --git a/src/com/mirantis/mk/Openstack.groovy b/src/com/mirantis/mk/Openstack.groovy
index 9fa683f..59bbeb7 100644
--- a/src/com/mirantis/mk/Openstack.groovy
+++ b/src/com/mirantis/mk/Openstack.groovy
@@ -377,6 +377,24 @@
 }
 
 /**
+ * Check if Nova keypair exists and delete it.
+ *
+ * @param env          Connection parameters for OpenStack API endpoint
+ * @param name         Name of the key pair to delete
+ * @param path         Path to virtualenv
+**/
+def ensureKeyPairRemoved(String name, env, path) {
+    def common = new com.mirantis.mk.Common()
+    def keypairs = runOpenstackCommand("openstack keypair list -f value -c Name", env, path).tokenize('\n')
+    if (name in keypairs) {
+        deleteKeyPair(env, name, path)
+        common.infoMsg("Keypair ${name} has been deleted")
+    } else {
+        common.warningMsg("Keypair ${name} not found")
+    }
+}
+
+/**
  * Get nova key pair
  *
  * @param env          Connection parameters for OpenStack API endpoint