Support CustomAmiId in EMR (#2037)
This commit is contained in:
parent
d952410965
commit
4cce4defac
3 changed files with 59 additions and 1 deletions
|
|
@ -97,7 +97,8 @@ class FakeCluster(BaseModel):
|
|||
visible_to_all_users='false',
|
||||
release_label=None,
|
||||
requested_ami_version=None,
|
||||
running_ami_version=None):
|
||||
running_ami_version=None,
|
||||
custom_ami_id=None):
|
||||
self.id = cluster_id or random_cluster_id()
|
||||
emr_backend.clusters[self.id] = self
|
||||
self.emr_backend = emr_backend
|
||||
|
|
@ -162,6 +163,7 @@ class FakeCluster(BaseModel):
|
|||
self.release_label = release_label
|
||||
self.requested_ami_version = requested_ami_version
|
||||
self.running_ami_version = running_ami_version
|
||||
self.custom_ami_id = custom_ami_id
|
||||
|
||||
self.role = job_flow_role or 'EMRJobflowDefault'
|
||||
self.service_role = service_role
|
||||
|
|
|
|||
|
|
@ -267,6 +267,18 @@ class ElasticMapReduceResponse(BaseResponse):
|
|||
else:
|
||||
kwargs['running_ami_version'] = '1.0.0'
|
||||
|
||||
custom_ami_id = self._get_param('CustomAmiId')
|
||||
if custom_ami_id:
|
||||
kwargs['custom_ami_id'] = custom_ami_id
|
||||
if release_label and release_label < 'emr-5.7.0':
|
||||
message = 'Custom AMI is not allowed'
|
||||
raise EmrError(error_type='ValidationException',
|
||||
message=message, template='error_json')
|
||||
elif ami_version:
|
||||
message = 'Custom AMI is not supported in this version of EMR'
|
||||
raise EmrError(error_type='ValidationException',
|
||||
message=message, template='error_json')
|
||||
|
||||
cluster = self.backend.run_job_flow(**kwargs)
|
||||
|
||||
applications = self._get_list_prefix('Applications.member')
|
||||
|
|
@ -375,6 +387,9 @@ DESCRIBE_CLUSTER_TEMPLATE = """<DescribeClusterResponse xmlns="http://elasticmap
|
|||
</member>
|
||||
{% endfor %}
|
||||
</Configurations>
|
||||
{% if cluster.custom_ami_id is not none %}
|
||||
<CustomAmiId>{{ cluster.custom_ami_id }}</CustomAmiId>
|
||||
{% endif %}
|
||||
<Ec2InstanceAttributes>
|
||||
<AdditionalMasterSecurityGroups>
|
||||
{% for each in cluster.additional_master_security_groups %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue