diff --git a/tobiko/openstack/nova/config.py b/tobiko/openstack/nova/config.py index 576ebffe6..63a93427c 100644 --- a/tobiko/openstack/nova/config.py +++ b/tobiko/openstack/nova/config.py @@ -20,10 +20,8 @@ def register_tobiko_options(conf): conf.register_opts( group=cfg.OptGroup('nova'), opts=[cfg.StrOpt('image', - help="Default image for new server instances"), - cfg.StrOpt('flavor', - help="Default flavor for new server instances"), - cfg.StrOpt('key_file', default='~/.ssh/id_rsa', - help="ssh key file for new server instances"), - cfg.StrOpt('key_name', default='nova_ssh_key', - help="ssh key name for new server instances")]) + help="Default image for new server instances"), + cfg.StrOpt('flavor', + help="Default flavor for new server instances"), + cfg.StrOpt('key_file', default='~/.ssh/id_rsa', + help="ssh key file for new server instances")]) diff --git a/tobiko/tests/scenario/neutron/stacks.py b/tobiko/tests/scenario/neutron/stacks.py index ac528d1dc..260419910 100644 --- a/tobiko/tests/scenario/neutron/stacks.py +++ b/tobiko/tests/scenario/neutron/stacks.py @@ -117,7 +117,6 @@ class SecurityGroupsFixture(heat.HeatStackFixture): class KeyPairFixture(heat.HeatStackFixture): template = heat_template_file('key_pair.yaml') key_file = os.path.expanduser(CONF.tobiko.nova.key_file) - key_name = CONF.tobiko.nova.key_name @property def public_key(self): diff --git a/tobiko/tests/scenario/neutron/templates/key_pair.yaml b/tobiko/tests/scenario/neutron/templates/key_pair.yaml index 3b51fa191..daefc2364 100644 --- a/tobiko/tests/scenario/neutron/templates/key_pair.yaml +++ b/tobiko/tests/scenario/neutron/templates/key_pair.yaml @@ -3,16 +3,26 @@ heat_template_version: 2015-04-30 description: | Creates a nova ssh keypair + parameters: public_key: type: string - key_name: - type: string - default: 'nova_ssh_key' + resources: - nova_ssh_key_pair: + + key_name: + type: OS::Heat::RandomString + properties: + length: 32 + + key_pair: type: OS::Nova::KeyPair properties: - name: {get_param: key_name} + name: {get_attr: [key_name, value]} public_key: {get_param: public_key} + + +outputs: + key_name: + value: {get_attr: [key_name, value]} diff --git a/tobiko/tests/scenario/neutron/test_floating_ip.py b/tobiko/tests/scenario/neutron/test_floating_ip.py index d8afbfb68..2c40a02e4 100644 --- a/tobiko/tests/scenario/neutron/test_floating_ip.py +++ b/tobiko/tests/scenario/neutron/test_floating_ip.py @@ -59,7 +59,6 @@ class FloatingIPFixture(heat.HeatStackFixture): # --- class parameters --- #: Whenever port security on internal network is enable key_pair_stack = tobiko.required_setup_fixture(stacks.KeyPairFixture) - key_name = CONF.tobiko.nova.key_name port_security_enabled = False #: Security groups to be associated to network ports @@ -82,9 +81,9 @@ class FloatingIPFixture(heat.HeatStackFixture): port_security_enabled=self.port_security_enabled, security_groups=self.security_groups or []) - def setup_stack(self): - self.key_pair_stack.wait_for_create_complete() - super(FloatingIPFixture, self).setup_stack() + @property + def key_name(self): + return self.key_pair_stack.outputs.key_name class FloatingIPTest(base.TobikoTest):