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',
|
||||
|
@ -10,10 +10,11 @@ parameters:
|
||||
octavia_enabled:
|
||||
type: string
|
||||
default: true
|
||||
|
||||
|
||||
ssh_key_name:
|
||||
type: string
|
||||
description: name of ssh key to be provisioned on our server
|
||||
default: ""
|
||||
|
||||
external_network:
|
||||
type: string
|
||||
@ -337,7 +338,7 @@ parameters:
|
||||
kube_version:
|
||||
type: string
|
||||
description: version of kubernetes used for kubernetes cluster
|
||||
default: v1.10.3_coreos.0
|
||||
default: v1.10.3_coreos.0
|
||||
|
||||
kube_dashboard_version:
|
||||
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,7 +10,8 @@ parameters:
|
||||
ssh_key_name:
|
||||
type: string
|
||||
description: name of ssh key to be provisioned on our server
|
||||
|
||||
default: ""
|
||||
|
||||
external_network:
|
||||
type: string
|
||||
description: uuid/name of a network to use for floating ip addresses
|
||||
|
@ -11,7 +11,8 @@ parameters:
|
||||
ssh_key_name:
|
||||
type: string
|
||||
description: name of ssh key to be provisioned on our server
|
||||
|
||||
default: ""
|
||||
|
||||
external_network:
|
||||
type: string
|
||||
description: uuid/name of a network to use for floating ip addresses
|
||||
|
@ -16,7 +16,8 @@ parameters:
|
||||
ssh_key_name:
|
||||
type: string
|
||||
description: name of ssh key to be provisioned on our server
|
||||
|
||||
default: ""
|
||||
|
||||
external_network:
|
||||
type: string
|
||||
description: uuid/name of a network to use for floating ip addresses
|
||||
|
@ -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…
x
Reference in New Issue
Block a user