EC2 - DHCP Options - remove duplicate get-all-method (#4406)

This commit is contained in:
Bert Blommers 2021-10-13 09:58:46 +00:00 committed by GitHub
parent b95bda11f3
commit 9b5d42f7ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 13 deletions

View File

@ -6724,15 +6724,6 @@ class DHCPOptionsSetBackend(object):
self.dhcp_options_sets[options.id] = options
return options
def describe_dhcp_options(self, options_ids=None):
options_sets = []
for option_id in options_ids or []:
if option_id in self.dhcp_options_sets:
options_sets.append(self.dhcp_options_sets[option_id])
else:
raise InvalidDHCPOptionsIdError(option_id)
return options_sets or self.dhcp_options_sets.copy().values()
def delete_dhcp_options_set(self, options_id):
if not (options_id and options_id.startswith("dopt-")):
raise MalformedDHCPOptionsIdError(options_id)
@ -6745,8 +6736,8 @@ class DHCPOptionsSetBackend(object):
raise InvalidDHCPOptionsIdError(options_id)
return True
def get_all_dhcp_options(self, dhcp_options_ids=None, filters=None):
dhcp_options_sets = self.dhcp_options_sets.values()
def describe_dhcp_options(self, dhcp_options_ids=None, filters=None):
dhcp_options_sets = self.dhcp_options_sets.copy().values()
if dhcp_options_ids:
dhcp_options_sets = [
@ -8550,7 +8541,7 @@ class EC2Backend(
if resource_prefix == EC2_RESOURCE_TO_PREFIX["customer-gateway"]:
self.get_customer_gateway(customer_gateway_id=resource_id)
elif resource_prefix == EC2_RESOURCE_TO_PREFIX["dhcp-options"]:
self.describe_dhcp_options(options_ids=[resource_id])
self.describe_dhcp_options(dhcp_options_ids=[resource_id])
elif resource_prefix == EC2_RESOURCE_TO_PREFIX["image"]:
self.describe_images(ami_ids=[resource_id])
elif resource_prefix == EC2_RESOURCE_TO_PREFIX["instance"]:

View File

@ -47,7 +47,7 @@ class DHCPOptions(BaseResponse):
def describe_dhcp_options(self):
dhcp_opt_ids = self._get_multi_param("DhcpOptionsId")
filters = filters_from_querystring(self.querystring)
dhcp_opts = self.ec2_backend.get_all_dhcp_options(dhcp_opt_ids, filters)
dhcp_opts = self.ec2_backend.describe_dhcp_options(dhcp_opt_ids, filters)
template = self.response_template(DESCRIBE_DHCP_OPTIONS_RESPONSE)
return template.render(dhcp_options=dhcp_opts)