Remove unused attribute "ssh_authorized_key"

This attribute was used in CoreOS template before. The usage of this
attribute has been removed [1][2]. This patch remove it from Magnum.
[1] https://review.openstack.org/#/c/262628/
[2] https://review.openstack.org/#/c/262926/

Change-Id: I7ff80fd1421bf2ea61e951e87f83983fb2883f79
Closes-Bug: #1540134
Partial-Implements: blueprint coreos-k8s-bay
changes/55/274455/4
Hongbin Lu 7 years ago
parent af4ecf6555
commit c64e8eb502
  1. 1
      doc/source/dev/tls.rst
  2. 4
      magnum/api/controllers/v1/baymodel.py
  3. 32
      magnum/db/sqlalchemy/alembic/versions/049f81f6f584_remove_ssh_authorized_key_from_baymodel.py
  4. 1
      magnum/db/sqlalchemy/models.py
  5. 4
      magnum/objects/baymodel.py
  6. 2
      magnum/tests/functional/common/datagen.py
  7. 20
      magnum/tests/unit/api/controllers/v1/test_baymodel.py
  8. 1
      magnum/tests/unit/conductor/handlers/test_k8s_bay_conductor.py
  9. 8
      magnum/tests/unit/db/utils.py
  10. 2
      magnum/tests/unit/objects/test_objects.py

@ -74,7 +74,6 @@ Create a baymodel, by default TLS is enabled in Magnum::
| name | secure-kubernetes |
| created_at | 2015-10-08T05:05:10+00:00 |
| network_driver | flannel |
| ssh_authorized_key | None |
| coe | kubernetes |
| flavor_id | m1.small |
| dns_nameserver | 8.8.8.8 |

@ -90,9 +90,6 @@ class BayModel(base.APIBase):
docker_volume_size = wtypes.IntegerType(minimum=1)
"""The size in GB of the docker volume"""
ssh_authorized_key = wtypes.StringType(min_length=1)
"""The SSH Authorized Key"""
cluster_distro = wtypes.StringType(min_length=1, max_length=255)
"""The Cluster distro for the bay, ex - coreos, fedora-atomic."""
@ -179,7 +176,6 @@ class BayModel(base.APIBase):
apiserver_port=8080,
docker_volume_size=25,
cluster_distro='fedora-atomic',
ssh_authorized_key='ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAB',
coe=fields.BayType.KUBERNETES,
http_proxy='http://proxy.com:123',
https_proxy='https://proxy.com:123',

@ -0,0 +1,32 @@
# Copyright 2016 Huawei Technologies Co.,LTD.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""remove_ssh_authorized_key_from_baymodel
Revision ID: 049f81f6f584
Revises: ee92b41b8809
Create Date: 2016-02-28 15:27:26.211244
"""
# revision identifiers, used by Alembic.
revision = '049f81f6f584'
down_revision = 'ee92b41b8809'
from alembic import op
def upgrade():
op.drop_column('baymodel', 'ssh_authorized_key')

@ -160,7 +160,6 @@ class BayModel(Base):
dns_nameserver = Column(String(255))
apiserver_port = Column(Integer())
docker_volume_size = Column(Integer())
ssh_authorized_key = Column(Text)
cluster_distro = Column(String(255))
coe = Column(String(255))
http_proxy = Column(String(255))

@ -32,7 +32,8 @@ class BayModel(base.MagnumPersistentObject, base.MagnumObject,
# Version 1.7: Added 'public' field
# Version 1.8: Added 'server_type' field
# Version 1.9: Added 'volume_driver' field
VERSION = '1.9'
# Version 1.10: Removed 'ssh_authorized_key' field
VERSION = '1.10'
dbapi = dbapi.get_instance()
@ -53,7 +54,6 @@ class BayModel(base.MagnumPersistentObject, base.MagnumObject,
'volume_driver': fields.StringField(nullable=True),
'apiserver_port': fields.IntegerField(nullable=True),
'docker_volume_size': fields.IntegerField(nullable=True),
'ssh_authorized_key': fields.StringField(nullable=True),
'cluster_distro': fields.StringField(nullable=True),
'coe': m_fields.BayTypeField(nullable=True),
'http_proxy': fields.StringField(nullable=True),

@ -188,7 +188,7 @@ def valid_swarm_baymodel():
master_flavor_id=config.Config.master_flavor_id,
keypair_id=config.Config.keypair_id, coe="swarm",
docker_volume_size=3, cluster_distro=None,
ssh_authorized_key=None, external_network_id="public",
external_network_id="public",
http_proxy=None, https_proxy=None, no_proxy=None,
network_driver=None, volume_driver=None, labels={},
tls_disabled=False)

@ -51,8 +51,8 @@ class TestListBayModel(api_base.FunctionalTest):
'cluster_distro', 'external_network_id',
'image_id', 'registry_enabled', 'no_proxy',
'keypair_id', 'https_proxy', 'tls_disabled',
'public', 'labels', 'ssh_authorized_key',
'master_flavor_id', 'volume_driver')
'public', 'labels', 'master_flavor_id',
'volume_driver')
def test_empty(self):
response = self.get_json('/baymodels')
@ -203,13 +203,6 @@ class TestPatch(api_base.FunctionalTest):
volume_driver='rexray',
public=False,
docker_volume_size=20,
ssh_authorized_key='ssh-rsa AAAAB3NzaC1ycEAAAADA'
'v0XRqg3tm+jlsOKGO81lPDH+KaSJ'
'Q7wvmjUqszP/H6NC/m+qiGp/sTis'
'DYucqbeuM7nmJi+8Hb55y1xWoOZI'
'KMa71G5/4EOQxuQ/sgW965OOO2Hq'
'X8vjlQUnTK0HijrbSTLxp/9kazWW'
'FrfsdB8RtAAA test1234@magnum',
coe='swarm',
labels={'key1': 'val1', 'key2': 'val2'}
)
@ -289,8 +282,6 @@ class TestPatch(api_base.FunctionalTest):
response['volume_driver'])
self.assertEqual(self.baymodel.docker_volume_size,
response['docker_volume_size'])
self.assertEqual(self.baymodel.ssh_authorized_key,
response['ssh_authorized_key'])
self.assertEqual(self.baymodel.coe,
response['coe'])
self.assertEqual(self.baymodel.http_proxy,
@ -330,8 +321,6 @@ class TestPatch(api_base.FunctionalTest):
response['volume_driver'])
self.assertEqual(baymodel.docker_volume_size,
response['docker_volume_size'])
self.assertEqual(baymodel.ssh_authorized_key,
response['ssh_authorized_key'])
self.assertEqual(baymodel.coe, response['coe'])
self.assertEqual(baymodel.http_proxy, response['http_proxy'])
self.assertEqual(baymodel.https_proxy, response['https_proxy'])
@ -465,9 +454,8 @@ class TestPost(api_base.FunctionalTest):
fields = ["uuid", "name", "image_id", "flavor_id", "master_flavor_id",
"dns_nameserver", "keypair_id", "external_network_id",
"cluster_distro", "fixed_network", "apiserver_port",
"docker_volume_size", "ssh_authorized_key", "labels",
"http_proxy", "https_proxy", "no_proxy", "network_driver",
"volume_driver"]
"docker_volume_size", "labels", "http_proxy", "https_proxy",
"no_proxy", "network_driver", "volume_driver"]
for field in fields:
self._create_baymodel_raises_app_error(**{field: ''})

@ -34,7 +34,6 @@ class TestBayConductorWithK8s(base.TestCase):
'network_driver': 'network_driver',
'docker_volume_size': 20,
'cluster_distro': 'fedora-atomic',
'ssh_authorized_key': 'ssh_authorized_key',
'coe': 'kubernetes',
'token': None,
'http_proxy': 'http_proxy',

@ -38,14 +38,6 @@ def get_test_baymodel(**kw):
'apiserver_port': kw.get('apiserver_port', 8080),
'docker_volume_size': kw.get('docker_volume_size', 20),
'cluster_distro': kw.get('cluster_distro', 'fedora-atomic'),
'ssh_authorized_key': kw.get('ssh_authorized_key',
'ssh-rsa AAAAB3NzaC1ycEAAAADA'
'v0XRqg3tm+jlsOKGO81lPDH+KaSJ'
'Q7wvmjUqszP/H6NC/m+qiGp/sTis'
'DYucqbeuM7nmJi+8Hb55y1xWoOZI'
'KMa71G5/4EOQxuQ/sgW965OOO2Hq'
'X8vjlQUnTK0HijrbSTLxp/9kazWW'
'FrfsdB8RtAAA test1234@magnum'),
'coe': kw.get('coe', 'swarm'),
'created_at': kw.get('created_at'),
'updated_at': kw.get('updated_at'),

@ -424,7 +424,7 @@ class _TestObject(object):
# http://docs.openstack.org/developer/magnum/objects.html
object_data = {
'Bay': '1.5-a3b9292ef5d35175b93ca46ba3baec2d',
'BayModel': '1.9-d5d32553721d0cadfcc45ddc316d9c1a',
'BayModel': '1.10-759aea0021329a0c413e1d9d5179dda2',
'Certificate': '1.0-2aff667971b85c1edf8d15684fd7d5e2',
'Container': '1.3-e2d9d2e8a8844d421148cd9fde6c6bd6',
'MyObj': '1.0-b43567e512438205e32f4e95ca616697',

Loading…
Cancel
Save