Create Nova key pair with random name.
Change-Id: Ic9d107cc92592efd0bcd9c060c1a702a155f9dc4
This commit is contained in:
parent
579b0beb83
commit
850a791e5d
@ -24,6 +24,4 @@ def register_tobiko_options(conf):
|
||||
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="ssh key file for new server instances")])
|
||||
|
@ -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):
|
||||
|
@ -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]}
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user