Remove unused fields from AWS driver
These fields were cargo-culted from another provider, but they are not used in the actual AWS driver, and thus should invalidate the configuration if specified. Change-Id: Ic12b47eea1ab4b49e8c6746749f0a6d4fb322435
This commit is contained in:
parent
f8f4b623ee
commit
5c0ca26fea
|
@ -14,7 +14,6 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import math
|
||||
import voluptuous as v
|
||||
|
||||
from nodepool.driver import ConfigPool
|
||||
|
@ -26,7 +25,6 @@ class ProviderCloudImage(ConfigValue):
|
|||
def __init__(self):
|
||||
self.name = None
|
||||
self.image_id = None
|
||||
self.image_name = None
|
||||
self.username = None
|
||||
self.connection_type = None
|
||||
self.connection_port = None
|
||||
|
@ -35,7 +33,6 @@ class ProviderCloudImage(ConfigValue):
|
|||
if isinstance(other, ProviderCloudImage):
|
||||
return (self.name == other.name
|
||||
and self.image_id == other.image_id
|
||||
and self.image_name == other.image_name
|
||||
and self.username == other.username
|
||||
and self.connection_type == other.connection_type
|
||||
and self.connection_port == other.connection_port)
|
||||
|
@ -47,7 +44,7 @@ class ProviderCloudImage(ConfigValue):
|
|||
@property
|
||||
def external_name(self):
|
||||
'''Human readable version of external.'''
|
||||
return self.image_id or self.image_name or self.name
|
||||
return self.image_id or self.name
|
||||
|
||||
|
||||
class ProviderLabel(ConfigValue):
|
||||
|
@ -82,8 +79,6 @@ class ProviderPool(ConfigPool):
|
|||
self.name = None
|
||||
self.max_cores = None
|
||||
self.max_ram = None
|
||||
self.ignore_provider_quota = False
|
||||
self.availability_zone = None
|
||||
self.subnet_id = None
|
||||
self.security_group_id = None
|
||||
self.host_key_checking = True
|
||||
|
@ -99,11 +94,6 @@ class ProviderPool(ConfigPool):
|
|||
self.name = pool_config['name']
|
||||
self.provider = provider
|
||||
|
||||
self.max_cores = pool_config.get('max-cores', math.inf)
|
||||
self.max_ram = pool_config.get('max-ram', math.inf)
|
||||
self.ignore_provider_quota = pool_config.get(
|
||||
'ignore-provider-quota', False)
|
||||
self.availability_zone = pool_config.get('availability-zone')
|
||||
self.security_group_id = pool_config.get('security-group-id')
|
||||
self.subnet_id = pool_config.get('subnet-id')
|
||||
self.host_key_checking = bool(
|
||||
|
@ -138,11 +128,6 @@ class ProviderPool(ConfigPool):
|
|||
# since this causes recursive checks with OpenStackProviderConfig.
|
||||
return (super().__eq__(other)
|
||||
and other.name == self.name
|
||||
and other.max_cores == self.max_cores
|
||||
and other.max_ram == self.max_ram
|
||||
and other.ignore_provider_quota == (
|
||||
self.ignore_provider_quota)
|
||||
and other.availability_zone == self.availability_zone
|
||||
and other.subnet_id == self.subnet_id
|
||||
and other.security_group_id == self.security_group_id
|
||||
and other.host_key_checking == self.host_key_checking
|
||||
|
@ -159,13 +144,9 @@ class AwsProviderConfig(ProviderConfig):
|
|||
self.__pools = {}
|
||||
self.profile_name = None
|
||||
self.region_name = None
|
||||
self.rate = None
|
||||
self.boot_timeout = None
|
||||
self.launch_retries = None
|
||||
self.launch_timeout = None
|
||||
self.cloud_images = {}
|
||||
self.hostname_format = None
|
||||
self.image_name_format = None
|
||||
super().__init__(provider)
|
||||
|
||||
def __eq__(self, other):
|
||||
|
@ -174,10 +155,8 @@ class AwsProviderConfig(ProviderConfig):
|
|||
and other.profile_name == self.profile_name
|
||||
and other.region_name == self.region_name
|
||||
and other.pools == self.pools
|
||||
and other.rate == self.rate
|
||||
and other.boot_timeout == self.boot_timeout
|
||||
and other.launch_retries == self.launch_retries
|
||||
and other.launch_timeout == self.launch_timeout
|
||||
and other.cloud_images == self.cloud_images)
|
||||
return False
|
||||
|
||||
|
@ -196,18 +175,8 @@ class AwsProviderConfig(ProviderConfig):
|
|||
def load(self, config):
|
||||
self.profile_name = self.provider.get('profile-name')
|
||||
self.region_name = self.provider.get('region-name')
|
||||
self.rate = float(self.provider.get('rate', 1.0))
|
||||
self.boot_timeout = self.provider.get('boot-timeout', 60)
|
||||
self.launch_retries = self.provider.get('launch-retries', 3)
|
||||
self.launch_timeout = self.provider.get('launch-timeout', 3600)
|
||||
self.hostname_format = self.provider.get(
|
||||
'hostname-format',
|
||||
'{label.name}-{provider.name}-{node.id}'
|
||||
)
|
||||
self.image_name_format = self.provider.get(
|
||||
'image-name-format',
|
||||
'{image_name}-{timestamp}'
|
||||
)
|
||||
|
||||
default_port_mapping = {
|
||||
'ssh': 22,
|
||||
|
@ -219,7 +188,6 @@ class AwsProviderConfig(ProviderConfig):
|
|||
i = ProviderCloudImage()
|
||||
i.name = image['name']
|
||||
i.image_id = image.get('image-id', None)
|
||||
i.image_name = image.get('image-name', None)
|
||||
i.username = image.get('username', None)
|
||||
i.connection_type = image.get('connection-type', 'ssh')
|
||||
i.connection_port = image.get(
|
||||
|
@ -246,9 +214,6 @@ class AwsProviderConfig(ProviderConfig):
|
|||
pool.update({
|
||||
v.Required('name'): str,
|
||||
v.Required('labels'): [pool_label],
|
||||
'max-cores': int,
|
||||
'max-ram': int,
|
||||
'availability-zone': str,
|
||||
'security-group-id': str,
|
||||
'subnet-id': str,
|
||||
})
|
||||
|
@ -257,8 +222,7 @@ class AwsProviderConfig(ProviderConfig):
|
|||
'name': str,
|
||||
'connection-type': str,
|
||||
'connection-port': int,
|
||||
v.Exclusive('image-id', 'cloud-image-name-or-id'): str,
|
||||
v.Exclusive('image-name', 'cloud-image-name-or-id'): str,
|
||||
'image-id': str,
|
||||
'username': str,
|
||||
}
|
||||
|
||||
|
@ -268,11 +232,8 @@ class AwsProviderConfig(ProviderConfig):
|
|||
v.Required('region-name'): str,
|
||||
'profile-name': str,
|
||||
'cloud-images': [provider_cloud_images],
|
||||
'rate': v.Coerce(float),
|
||||
'hostname-format': str,
|
||||
'image-name-format': str,
|
||||
'boot-timeout': int,
|
||||
'launch-timeout': int,
|
||||
'launch-retries': int,
|
||||
})
|
||||
return v.Schema(provider)
|
||||
|
|
Loading…
Reference in New Issue