Merge "Make providing a keypair optional"
This commit is contained in:
commit
ee44e6e9e1
|
@ -63,8 +63,12 @@ def validate_flavor(cli, flavor):
|
||||||
|
|
||||||
|
|
||||||
def validate_keypair(cli, keypair):
|
def validate_keypair(cli, keypair):
|
||||||
"""Validate keypair"""
|
"""Validate keypair
|
||||||
|
|
||||||
|
validate the keypair, if provided.
|
||||||
|
"""
|
||||||
|
if keypair is None:
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
cli.nova().keypairs.get(keypair)
|
cli.nova().keypairs.get(keypair)
|
||||||
except nova_exception.NotFound:
|
except nova_exception.NotFound:
|
||||||
|
|
|
@ -210,8 +210,7 @@ class BaseTemplateDefinition(TemplateDefinition):
|
||||||
self._osc = None
|
self._osc = None
|
||||||
|
|
||||||
self.add_parameter('ssh_key_name',
|
self.add_parameter('ssh_key_name',
|
||||||
cluster_attr='keypair',
|
cluster_attr='keypair')
|
||||||
required=True)
|
|
||||||
self.add_parameter('server_image',
|
self.add_parameter('server_image',
|
||||||
cluster_template_attr='image_id')
|
cluster_template_attr='image_id')
|
||||||
self.add_parameter('dns_nameserver',
|
self.add_parameter('dns_nameserver',
|
||||||
|
|
|
@ -10,10 +10,11 @@ parameters:
|
||||||
octavia_enabled:
|
octavia_enabled:
|
||||||
type: string
|
type: string
|
||||||
default: true
|
default: true
|
||||||
|
|
||||||
ssh_key_name:
|
ssh_key_name:
|
||||||
type: string
|
type: string
|
||||||
description: name of ssh key to be provisioned on our server
|
description: name of ssh key to be provisioned on our server
|
||||||
|
default: ""
|
||||||
|
|
||||||
external_network:
|
external_network:
|
||||||
type: string
|
type: string
|
||||||
|
@ -337,7 +338,7 @@ parameters:
|
||||||
kube_version:
|
kube_version:
|
||||||
type: string
|
type: string
|
||||||
description: version of kubernetes used for kubernetes cluster
|
description: version of kubernetes used for kubernetes cluster
|
||||||
default: v1.10.3_coreos.0
|
default: v1.10.3_coreos.0
|
||||||
|
|
||||||
kube_dashboard_version:
|
kube_dashboard_version:
|
||||||
type: string
|
type: string
|
||||||
|
|
|
@ -10,6 +10,7 @@ parameters:
|
||||||
ssh_key_name:
|
ssh_key_name:
|
||||||
type: string
|
type: string
|
||||||
description: name of ssh key to be provisioned on our server
|
description: name of ssh key to be provisioned on our server
|
||||||
|
default: ""
|
||||||
|
|
||||||
external_network:
|
external_network:
|
||||||
type: string
|
type: string
|
||||||
|
|
|
@ -10,7 +10,8 @@ parameters:
|
||||||
ssh_key_name:
|
ssh_key_name:
|
||||||
type: string
|
type: string
|
||||||
description: name of ssh key to be provisioned on our server
|
description: name of ssh key to be provisioned on our server
|
||||||
|
default: ""
|
||||||
|
|
||||||
external_network:
|
external_network:
|
||||||
type: string
|
type: string
|
||||||
description: uuid/name of a network to use for floating ip addresses
|
description: uuid/name of a network to use for floating ip addresses
|
||||||
|
|
|
@ -11,7 +11,8 @@ parameters:
|
||||||
ssh_key_name:
|
ssh_key_name:
|
||||||
type: string
|
type: string
|
||||||
description: name of ssh key to be provisioned on our server
|
description: name of ssh key to be provisioned on our server
|
||||||
|
default: ""
|
||||||
|
|
||||||
external_network:
|
external_network:
|
||||||
type: string
|
type: string
|
||||||
description: uuid/name of a network to use for floating ip addresses
|
description: uuid/name of a network to use for floating ip addresses
|
||||||
|
|
|
@ -16,7 +16,8 @@ parameters:
|
||||||
ssh_key_name:
|
ssh_key_name:
|
||||||
type: string
|
type: string
|
||||||
description: name of ssh key to be provisioned on our server
|
description: name of ssh key to be provisioned on our server
|
||||||
|
default: ""
|
||||||
|
|
||||||
external_network:
|
external_network:
|
||||||
type: string
|
type: string
|
||||||
description: uuid/name of a network to use for floating ip addresses
|
description: uuid/name of a network to use for floating ip addresses
|
||||||
|
|
|
@ -16,6 +16,7 @@ parameters:
|
||||||
ssh_key_name:
|
ssh_key_name:
|
||||||
type: string
|
type: string
|
||||||
description: name of ssh key to be provisioned on our server
|
description: name of ssh key to be provisioned on our server
|
||||||
|
default: ""
|
||||||
|
|
||||||
external_network:
|
external_network:
|
||||||
type: string
|
type: string
|
||||||
|
|
|
@ -94,6 +94,15 @@ class TestAttrValidator(base.BaseTestCase):
|
||||||
attr_validator.validate_external_network,
|
attr_validator.validate_external_network,
|
||||||
mock_os_cli, 'test_ext_net')
|
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):
|
def test_validate_keypair_with_valid_keypair(self):
|
||||||
mock_keypair = mock.MagicMock()
|
mock_keypair = mock.MagicMock()
|
||||||
mock_keypair.id = 'test-keypair'
|
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