summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2019-02-06 13:19:57 +0000
committerGerrit Code Review <review@openstack.org>2019-02-06 13:19:57 +0000
commit81781d56bc121bf78b3ac2b18c8344fc3a6d615b (patch)
treec0596ddf0e30da5e95df1c312a48225ad4df9dc1
parent280cd5937d9b5f7c8f7830106ea2d142a8c56c82 (diff)
parent5c0ca26feaf7a670d8f83c5a8960cb77e83874f7 (diff)
Merge "Remove unused fields from AWS driver"
-rw-r--r--nodepool/driver/aws/config.py43
1 files changed, 2 insertions, 41 deletions
diff --git a/nodepool/driver/aws/config.py b/nodepool/driver/aws/config.py
index 5742811..17a64e6 100644
--- a/nodepool/driver/aws/config.py
+++ b/nodepool/driver/aws/config.py
@@ -14,7 +14,6 @@
14# See the License for the specific language governing permissions and 14# See the License for the specific language governing permissions and
15# limitations under the License. 15# limitations under the License.
16 16
17import math
18import voluptuous as v 17import voluptuous as v
19 18
20from nodepool.driver import ConfigPool 19from nodepool.driver import ConfigPool
@@ -26,7 +25,6 @@ class ProviderCloudImage(ConfigValue):
26 def __init__(self): 25 def __init__(self):
27 self.name = None 26 self.name = None
28 self.image_id = None 27 self.image_id = None
29 self.image_name = None
30 self.username = None 28 self.username = None
31 self.connection_type = None 29 self.connection_type = None
32 self.connection_port = None 30 self.connection_port = None
@@ -35,7 +33,6 @@ class ProviderCloudImage(ConfigValue):
35 if isinstance(other, ProviderCloudImage): 33 if isinstance(other, ProviderCloudImage):
36 return (self.name == other.name 34 return (self.name == other.name
37 and self.image_id == other.image_id 35 and self.image_id == other.image_id
38 and self.image_name == other.image_name
39 and self.username == other.username 36 and self.username == other.username
40 and self.connection_type == other.connection_type 37 and self.connection_type == other.connection_type
41 and self.connection_port == other.connection_port) 38 and self.connection_port == other.connection_port)
@@ -47,7 +44,7 @@ class ProviderCloudImage(ConfigValue):
47 @property 44 @property
48 def external_name(self): 45 def external_name(self):
49 '''Human readable version of external.''' 46 '''Human readable version of external.'''
50 return self.image_id or self.image_name or self.name 47 return self.image_id or self.name
51 48
52 49
53class ProviderLabel(ConfigValue): 50class ProviderLabel(ConfigValue):
@@ -82,8 +79,6 @@ class ProviderPool(ConfigPool):
82 self.name = None 79 self.name = None
83 self.max_cores = None 80 self.max_cores = None
84 self.max_ram = None 81 self.max_ram = None
85 self.ignore_provider_quota = False
86 self.availability_zone = None
87 self.subnet_id = None 82 self.subnet_id = None
88 self.security_group_id = None 83 self.security_group_id = None
89 self.host_key_checking = True 84 self.host_key_checking = True
@@ -99,11 +94,6 @@ class ProviderPool(ConfigPool):
99 self.name = pool_config['name'] 94 self.name = pool_config['name']
100 self.provider = provider 95 self.provider = provider
101 96
102 self.max_cores = pool_config.get('max-cores', math.inf)
103 self.max_ram = pool_config.get('max-ram', math.inf)
104 self.ignore_provider_quota = pool_config.get(
105 'ignore-provider-quota', False)
106 self.availability_zone = pool_config.get('availability-zone')
107 self.security_group_id = pool_config.get('security-group-id') 97 self.security_group_id = pool_config.get('security-group-id')
108 self.subnet_id = pool_config.get('subnet-id') 98 self.subnet_id = pool_config.get('subnet-id')
109 self.host_key_checking = bool( 99 self.host_key_checking = bool(
@@ -138,11 +128,6 @@ class ProviderPool(ConfigPool):
138 # since this causes recursive checks with OpenStackProviderConfig. 128 # since this causes recursive checks with OpenStackProviderConfig.
139 return (super().__eq__(other) 129 return (super().__eq__(other)
140 and other.name == self.name 130 and other.name == self.name
141 and other.max_cores == self.max_cores
142 and other.max_ram == self.max_ram
143 and other.ignore_provider_quota == (
144 self.ignore_provider_quota)
145 and other.availability_zone == self.availability_zone
146 and other.subnet_id == self.subnet_id 131 and other.subnet_id == self.subnet_id
147 and other.security_group_id == self.security_group_id 132 and other.security_group_id == self.security_group_id
148 and other.host_key_checking == self.host_key_checking 133 and other.host_key_checking == self.host_key_checking
@@ -159,13 +144,9 @@ class AwsProviderConfig(ProviderConfig):
159 self.__pools = {} 144 self.__pools = {}
160 self.profile_name = None 145 self.profile_name = None
161 self.region_name = None 146 self.region_name = None
162 self.rate = None
163 self.boot_timeout = None 147 self.boot_timeout = None
164 self.launch_retries = None 148 self.launch_retries = None
165 self.launch_timeout = None
166 self.cloud_images = {} 149 self.cloud_images = {}
167 self.hostname_format = None
168 self.image_name_format = None
169 super().__init__(provider) 150 super().__init__(provider)
170 151
171 def __eq__(self, other): 152 def __eq__(self, other):
@@ -174,10 +155,8 @@ class AwsProviderConfig(ProviderConfig):
174 and other.profile_name == self.profile_name 155 and other.profile_name == self.profile_name
175 and other.region_name == self.region_name 156 and other.region_name == self.region_name
176 and other.pools == self.pools 157 and other.pools == self.pools
177 and other.rate == self.rate
178 and other.boot_timeout == self.boot_timeout 158 and other.boot_timeout == self.boot_timeout
179 and other.launch_retries == self.launch_retries 159 and other.launch_retries == self.launch_retries
180 and other.launch_timeout == self.launch_timeout
181 and other.cloud_images == self.cloud_images) 160 and other.cloud_images == self.cloud_images)
182 return False 161 return False
183 162
@@ -196,18 +175,8 @@ class AwsProviderConfig(ProviderConfig):
196 def load(self, config): 175 def load(self, config):
197 self.profile_name = self.provider.get('profile-name') 176 self.profile_name = self.provider.get('profile-name')
198 self.region_name = self.provider.get('region-name') 177 self.region_name = self.provider.get('region-name')
199 self.rate = float(self.provider.get('rate', 1.0))
200 self.boot_timeout = self.provider.get('boot-timeout', 60) 178 self.boot_timeout = self.provider.get('boot-timeout', 60)
201 self.launch_retries = self.provider.get('launch-retries', 3) 179 self.launch_retries = self.provider.get('launch-retries', 3)
202 self.launch_timeout = self.provider.get('launch-timeout', 3600)
203 self.hostname_format = self.provider.get(
204 'hostname-format',
205 '{label.name}-{provider.name}-{node.id}'
206 )
207 self.image_name_format = self.provider.get(
208 'image-name-format',
209 '{image_name}-{timestamp}'
210 )
211 180
212 default_port_mapping = { 181 default_port_mapping = {
213 'ssh': 22, 182 'ssh': 22,
@@ -219,7 +188,6 @@ class AwsProviderConfig(ProviderConfig):
219 i = ProviderCloudImage() 188 i = ProviderCloudImage()
220 i.name = image['name'] 189 i.name = image['name']
221 i.image_id = image.get('image-id', None) 190 i.image_id = image.get('image-id', None)
222 i.image_name = image.get('image-name', None)
223 i.username = image.get('username', None) 191 i.username = image.get('username', None)
224 i.connection_type = image.get('connection-type', 'ssh') 192 i.connection_type = image.get('connection-type', 'ssh')
225 i.connection_port = image.get( 193 i.connection_port = image.get(
@@ -246,9 +214,6 @@ class AwsProviderConfig(ProviderConfig):
246 pool.update({ 214 pool.update({
247 v.Required('name'): str, 215 v.Required('name'): str,
248 v.Required('labels'): [pool_label], 216 v.Required('labels'): [pool_label],
249 'max-cores': int,
250 'max-ram': int,
251 'availability-zone': str,
252 'security-group-id': str, 217 'security-group-id': str,
253 'subnet-id': str, 218 'subnet-id': str,
254 }) 219 })
@@ -257,8 +222,7 @@ class AwsProviderConfig(ProviderConfig):
257 'name': str, 222 'name': str,
258 'connection-type': str, 223 'connection-type': str,
259 'connection-port': int, 224 'connection-port': int,
260 v.Exclusive('image-id', 'cloud-image-name-or-id'): str, 225 'image-id': str,
261 v.Exclusive('image-name', 'cloud-image-name-or-id'): str,
262 'username': str, 226 'username': str,
263 } 227 }
264 228
@@ -268,11 +232,8 @@ class AwsProviderConfig(ProviderConfig):
268 v.Required('region-name'): str, 232 v.Required('region-name'): str,
269 'profile-name': str, 233 'profile-name': str,
270 'cloud-images': [provider_cloud_images], 234 'cloud-images': [provider_cloud_images],
271 'rate': v.Coerce(float),
272 'hostname-format': str, 235 'hostname-format': str,
273 'image-name-format': str,
274 'boot-timeout': int, 236 'boot-timeout': int,
275 'launch-timeout': int,
276 'launch-retries': int, 237 'launch-retries': int,
277 }) 238 })
278 return v.Schema(provider) 239 return v.Schema(provider)