Allow kwargs in create_keypair
As a part of the scenario/manager.py stabilization tracked by
the below BP the patch adds kwargs argument for create_keyapair
method so that the consumers are able to pass additional
parameters if needed.
Implements: blueprint tempest-scenario-manager-stable
Change-Id: Iee5dffcafc8a6870c8a7005870055a614eaafab8
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index ff860d5..8059746 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -160,7 +160,7 @@
client.delete_port, port['id'])
return port
- def create_keypair(self, client=None):
+ def create_keypair(self, client=None, **kwargs):
"""Creates keypair
Keypair is a public key of OpenSSH key pair used for accessing
@@ -170,10 +170,11 @@
"""
if not client:
client = self.keypairs_client
- name = data_utils.rand_name(self.__class__.__name__)
+ if not kwargs.get('name'):
+ kwargs['name'] = data_utils.rand_name(self.__class__.__name__)
# We don't need to create a keypair by pubkey in scenario
- body = client.create_keypair(name=name)
- self.addCleanup(client.delete_keypair, name)
+ body = client.create_keypair(**kwargs)
+ self.addCleanup(client.delete_keypair, kwargs['name'])
return body['keypair']
def create_server(self, name=None, image_id=None, flavor=None,