From 9b5d42f7ef04c338d146e765f9fea8466c76699b Mon Sep 17 00:00:00 2001 From: Bert Blommers Date: Wed, 13 Oct 2021 09:58:46 +0000 Subject: [PATCH] EC2 - DHCP Options - remove duplicate get-all-method (#4406) --- moto/ec2/models.py | 15 +++------------ moto/ec2/responses/dhcp_options.py | 2 +- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/moto/ec2/models.py b/moto/ec2/models.py index 0b6e252c4..65c001c07 100644 --- a/moto/ec2/models.py +++ b/moto/ec2/models.py @@ -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"]: diff --git a/moto/ec2/responses/dhcp_options.py b/moto/ec2/responses/dhcp_options.py index 868ab85cf..6eae4e3e8 100644 --- a/moto/ec2/responses/dhcp_options.py +++ b/moto/ec2/responses/dhcp_options.py @@ -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)