EC2 - DHCP Options - remove duplicate get-all-method (#4406)
This commit is contained in:
parent
b95bda11f3
commit
9b5d42f7ef
@ -6724,15 +6724,6 @@ class DHCPOptionsSetBackend(object):
|
|||||||
self.dhcp_options_sets[options.id] = options
|
self.dhcp_options_sets[options.id] = options
|
||||||
return 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):
|
def delete_dhcp_options_set(self, options_id):
|
||||||
if not (options_id and options_id.startswith("dopt-")):
|
if not (options_id and options_id.startswith("dopt-")):
|
||||||
raise MalformedDHCPOptionsIdError(options_id)
|
raise MalformedDHCPOptionsIdError(options_id)
|
||||||
@ -6745,8 +6736,8 @@ class DHCPOptionsSetBackend(object):
|
|||||||
raise InvalidDHCPOptionsIdError(options_id)
|
raise InvalidDHCPOptionsIdError(options_id)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def get_all_dhcp_options(self, dhcp_options_ids=None, filters=None):
|
def describe_dhcp_options(self, dhcp_options_ids=None, filters=None):
|
||||||
dhcp_options_sets = self.dhcp_options_sets.values()
|
dhcp_options_sets = self.dhcp_options_sets.copy().values()
|
||||||
|
|
||||||
if dhcp_options_ids:
|
if dhcp_options_ids:
|
||||||
dhcp_options_sets = [
|
dhcp_options_sets = [
|
||||||
@ -8550,7 +8541,7 @@ class EC2Backend(
|
|||||||
if resource_prefix == EC2_RESOURCE_TO_PREFIX["customer-gateway"]:
|
if resource_prefix == EC2_RESOURCE_TO_PREFIX["customer-gateway"]:
|
||||||
self.get_customer_gateway(customer_gateway_id=resource_id)
|
self.get_customer_gateway(customer_gateway_id=resource_id)
|
||||||
elif resource_prefix == EC2_RESOURCE_TO_PREFIX["dhcp-options"]:
|
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"]:
|
elif resource_prefix == EC2_RESOURCE_TO_PREFIX["image"]:
|
||||||
self.describe_images(ami_ids=[resource_id])
|
self.describe_images(ami_ids=[resource_id])
|
||||||
elif resource_prefix == EC2_RESOURCE_TO_PREFIX["instance"]:
|
elif resource_prefix == EC2_RESOURCE_TO_PREFIX["instance"]:
|
||||||
|
@ -47,7 +47,7 @@ class DHCPOptions(BaseResponse):
|
|||||||
def describe_dhcp_options(self):
|
def describe_dhcp_options(self):
|
||||||
dhcp_opt_ids = self._get_multi_param("DhcpOptionsId")
|
dhcp_opt_ids = self._get_multi_param("DhcpOptionsId")
|
||||||
filters = filters_from_querystring(self.querystring)
|
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)
|
template = self.response_template(DESCRIBE_DHCP_OPTIONS_RESPONSE)
|
||||||
return template.render(dhcp_options=dhcp_opts)
|
return template.render(dhcp_options=dhcp_opts)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user