Make providing a keypair optional
A user may not rely on nova-keypairs to access their cluster such as a preconfigured SSSD. story: 2004402 task: 28035 Change-Id: I77fbdc174d3dddfd312fb8dac20516314d4c182e
This commit is contained in:
parent
5d1eab9d9f
commit
8f4643d85c
@ -63,8 +63,12 @@ def validate_flavor(cli, flavor):
|
||||
|
||||
|
||||
def validate_keypair(cli, keypair):
|
||||
"""Validate keypair"""
|
||||
"""Validate keypair
|
||||
|
||||
validate the keypair, if provided.
|
||||
"""
|
||||
if keypair is None:
|
||||
return
|
||||
try:
|
||||
cli.nova().keypairs.get(keypair)
|
||||
except nova_exception.NotFound:
|
||||
|
@ -210,8 +210,7 @@ class BaseTemplateDefinition(TemplateDefinition):
|
||||
self._osc = None
|
||||
|
||||
self.add_parameter('ssh_key_name',
|
||||
cluster_attr='keypair',
|
||||
required=True)
|
||||
cluster_attr='keypair')
|
||||
self.add_parameter('server_image',
|
||||
cluster_template_attr='image_id')
|
||||
self.add_parameter('dns_nameserver',
|
||||
|
@ -14,6 +14,7 @@ parameters:
|
||||
ssh_key_name:
|
||||
type: string
|
||||
description: name of ssh key to be provisioned on our server
|
||||
default: ""
|
||||
|
||||
external_network:
|
||||
type: string
|
||||
|
@ -10,6 +10,7 @@ parameters:
|
||||
ssh_key_name:
|
||||
type: string
|
||||
description: name of ssh key to be provisioned on our server
|
||||
default: ""
|
||||
|
||||
external_network:
|
||||
type: string
|
||||
|
@ -10,6 +10,7 @@ parameters:
|
||||
ssh_key_name:
|
||||
type: string
|
||||
description: name of ssh key to be provisioned on our server
|
||||
default: ""
|
||||
|
||||
external_network:
|
||||
type: string
|
||||
|
@ -11,6 +11,7 @@ parameters:
|
||||
ssh_key_name:
|
||||
type: string
|
||||
description: name of ssh key to be provisioned on our server
|
||||
default: ""
|
||||
|
||||
external_network:
|
||||
type: string
|
||||
|
@ -16,6 +16,7 @@ parameters:
|
||||
ssh_key_name:
|
||||
type: string
|
||||
description: name of ssh key to be provisioned on our server
|
||||
default: ""
|
||||
|
||||
external_network:
|
||||
type: string
|
||||
|
@ -16,6 +16,7 @@ parameters:
|
||||
ssh_key_name:
|
||||
type: string
|
||||
description: name of ssh key to be provisioned on our server
|
||||
default: ""
|
||||
|
||||
external_network:
|
||||
type: string
|
||||
|
@ -94,6 +94,15 @@ class TestAttrValidator(base.BaseTestCase):
|
||||
attr_validator.validate_external_network,
|
||||
mock_os_cli, 'test_ext_net')
|
||||
|
||||
def test_validate_keypair_with_no_keypair(self):
|
||||
mock_keypair = mock.MagicMock()
|
||||
mock_keypair.id = None
|
||||
mock_nova = mock.MagicMock()
|
||||
mock_nova.keypairs.get.return_value = mock_keypair
|
||||
mock_os_cli = mock.MagicMock()
|
||||
mock_os_cli.nova.return_value = mock_nova
|
||||
attr_validator.validate_keypair(mock_os_cli, None)
|
||||
|
||||
def test_validate_keypair_with_valid_keypair(self):
|
||||
mock_keypair = mock.MagicMock()
|
||||
mock_keypair.id = 'test-keypair'
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
This makes the keypair optional. The user should not have to include
|
||||
the keypair because they may use some other method of security such
|
||||
as using SSSD, preconfigured on the image.
|
Loading…
Reference in New Issue
Block a user