Create Nova key pair with random name.
Change-Id: Ic9d107cc92592efd0bcd9c060c1a702a155f9dc4
This commit is contained in:
parent
579b0beb83
commit
850a791e5d
@ -20,10 +20,8 @@ def register_tobiko_options(conf):
|
|||||||
conf.register_opts(
|
conf.register_opts(
|
||||||
group=cfg.OptGroup('nova'),
|
group=cfg.OptGroup('nova'),
|
||||||
opts=[cfg.StrOpt('image',
|
opts=[cfg.StrOpt('image',
|
||||||
help="Default image for new server instances"),
|
help="Default image for new server instances"),
|
||||||
cfg.StrOpt('flavor',
|
cfg.StrOpt('flavor',
|
||||||
help="Default flavor for new server instances"),
|
help="Default flavor for new server instances"),
|
||||||
cfg.StrOpt('key_file', default='~/.ssh/id_rsa',
|
cfg.StrOpt('key_file', default='~/.ssh/id_rsa',
|
||||||
help="ssh key file for new server instances"),
|
help="ssh key file for new server instances")])
|
||||||
cfg.StrOpt('key_name', default='nova_ssh_key',
|
|
||||||
help="ssh key name for new server instances")])
|
|
||||||
|
@ -117,7 +117,6 @@ class SecurityGroupsFixture(heat.HeatStackFixture):
|
|||||||
class KeyPairFixture(heat.HeatStackFixture):
|
class KeyPairFixture(heat.HeatStackFixture):
|
||||||
template = heat_template_file('key_pair.yaml')
|
template = heat_template_file('key_pair.yaml')
|
||||||
key_file = os.path.expanduser(CONF.tobiko.nova.key_file)
|
key_file = os.path.expanduser(CONF.tobiko.nova.key_file)
|
||||||
key_name = CONF.tobiko.nova.key_name
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def public_key(self):
|
def public_key(self):
|
||||||
|
@ -3,16 +3,26 @@ heat_template_version: 2015-04-30
|
|||||||
description: |
|
description: |
|
||||||
Creates a nova ssh keypair
|
Creates a nova ssh keypair
|
||||||
|
|
||||||
|
|
||||||
parameters:
|
parameters:
|
||||||
public_key:
|
public_key:
|
||||||
type: string
|
type: string
|
||||||
key_name:
|
|
||||||
type: string
|
|
||||||
default: 'nova_ssh_key'
|
|
||||||
|
|
||||||
resources:
|
resources:
|
||||||
nova_ssh_key_pair:
|
|
||||||
|
key_name:
|
||||||
|
type: OS::Heat::RandomString
|
||||||
|
properties:
|
||||||
|
length: 32
|
||||||
|
|
||||||
|
key_pair:
|
||||||
type: OS::Nova::KeyPair
|
type: OS::Nova::KeyPair
|
||||||
properties:
|
properties:
|
||||||
name: {get_param: key_name}
|
name: {get_attr: [key_name, value]}
|
||||||
public_key: {get_param: public_key}
|
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 ---
|
# --- class parameters ---
|
||||||
#: Whenever port security on internal network is enable
|
#: Whenever port security on internal network is enable
|
||||||
key_pair_stack = tobiko.required_setup_fixture(stacks.KeyPairFixture)
|
key_pair_stack = tobiko.required_setup_fixture(stacks.KeyPairFixture)
|
||||||
key_name = CONF.tobiko.nova.key_name
|
|
||||||
port_security_enabled = False
|
port_security_enabled = False
|
||||||
|
|
||||||
#: Security groups to be associated to network ports
|
#: Security groups to be associated to network ports
|
||||||
@ -82,9 +81,9 @@ class FloatingIPFixture(heat.HeatStackFixture):
|
|||||||
port_security_enabled=self.port_security_enabled,
|
port_security_enabled=self.port_security_enabled,
|
||||||
security_groups=self.security_groups or [])
|
security_groups=self.security_groups or [])
|
||||||
|
|
||||||
def setup_stack(self):
|
@property
|
||||||
self.key_pair_stack.wait_for_create_complete()
|
def key_name(self):
|
||||||
super(FloatingIPFixture, self).setup_stack()
|
return self.key_pair_stack.outputs.key_name
|
||||||
|
|
||||||
|
|
||||||
class FloatingIPTest(base.TobikoTest):
|
class FloatingIPTest(base.TobikoTest):
|
||||||
|
Loading…
Reference in New Issue
Block a user