Skip to content

Commit 9de5f9e

Browse files
Merge customizations for EMR
1 parent e0dba6b commit 9de5f9e

File tree

6 files changed

+72
-14
lines changed

6 files changed

+72
-14
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"type": "enhancement",
3+
"category": "EMR",
4+
"description": "Updated create-cluster and describe-cluster commands to support --extended-support and --no-extended-support arguments"
5+
}

awscli/customizations/emr/createcluster.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,17 @@ class CreateCluster(Command):
213213
'schema': argumentschema.AUTO_TERMINATION_POLICY_SCHEMA,
214214
'help_text': helptext.AUTO_TERMINATION_POLICY,
215215
},
216+
{
217+
'name': 'extended-support',
218+
'action': 'store_true',
219+
'group_name': 'extended-support',
220+
'help_text': helptext.EXTENDED_SUPPORT,
221+
},
222+
{
223+
'name': 'no-extended-support',
224+
'action': 'store_true',
225+
'group_name': 'extended-support',
226+
},
216227
]
217228
SYNOPSIS = BasicCommand.FROM_FILE('emr', 'create-cluster-synopsis.txt')
218229
EXAMPLES = BasicCommand.FROM_FILE('emr', 'create-cluster-examples.rst')
@@ -514,6 +525,14 @@ def _run_main_command(self, parsed_args, parsed_globals):
514525
if parsed_args.step_concurrency_level is not None:
515526
params['StepConcurrencyLevel'] = parsed_args.step_concurrency_level
516527

528+
if parsed_args.extended_support or parsed_args.no_extended_support:
529+
params['ExtendedSupport'] = emrutils.apply_boolean_options(
530+
parsed_args.extended_support,
531+
'--extended-support',
532+
parsed_args.no_extended_support,
533+
'--no-extended-support',
534+
)
535+
517536
if parsed_args.managed_scaling_policy is not None:
518537
emrutils.apply_dict(
519538
params,

awscli/customizations/emr/helptext.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
1313

14-
from awscli.customizations.emr.createdefaultroles import (
15-
EC2_ROLE_NAME,
16-
EMR_ROLE_NAME,
17-
)
1814

1915
TERMINATE_CLUSTERS = (
2016
'Shuts down one or more clusters, each specified by cluster ID. '
@@ -572,3 +568,5 @@
572568
UNHEALTHY_NODE_REPLACEMENT = (
573569
'<p>Unhealthy node replacement for an Amazon EMR cluster.</p> '
574570
)
571+
572+
EXTENDED_SUPPORT = '<p>Reserved.</p> '

awscli/examples/emr/create-cluster-synopsis.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@
3232
[--managed-scaling-policy <value>]
3333
[--placement-group-configs <value>]
3434
[--auto-termination-policy <value>]
35+
[--extended-support | --no-extended-support]

tests/unit/customizations/emr/test_create_cluster_ami_version.py

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
13+
1314
import copy
1415
import json
1516
import os
1617

17-
from awscli.testutils import mock
18+
from awscli.testutils import mock, unittest
1819
from tests.unit.customizations.emr import (
1920
EMRBaseAWSCommandParamsTest as BaseAWSCommandParamsTest,
2021
)
@@ -589,6 +590,27 @@ def test_visible_to_all_users_and_no_visible_to_all_users(self):
589590
result = self.run_cmd(cmd, 252)
590591
self.assertEqual(expected_error_msg, result[1])
591592

593+
def test_extended_support(self):
594+
cmd = DEFAULT_CMD + '--extended-support'
595+
result = copy.deepcopy(DEFAULT_RESULT)
596+
result['ExtendedSupport'] = True
597+
self.assert_params_for_cmd(cmd, result)
598+
599+
def test_no_extended_support(self):
600+
cmd = DEFAULT_CMD + '--no-extended-support'
601+
result = copy.deepcopy(DEFAULT_RESULT)
602+
result['ExtendedSupport'] = False
603+
self.assert_params_for_cmd(cmd, result)
604+
605+
def test_extended_support_and_no_extended_support(self):
606+
cmd = DEFAULT_CMD + '--extended-support --no-extended-support'
607+
expected_error_msg = (
608+
'\naws: error: cannot use both --extended-support'
609+
' and --no-extended-support options together.\n'
610+
)
611+
result = self.run_cmd(cmd, 252)
612+
self.assertEqual(expected_error_msg, result[1])
613+
592614
def test_tags(self):
593615
cmd = DEFAULT_CMD.split() + ['--tags', 'k1=v1', 'k2', 'k3=spaces v3']
594616
result = copy.deepcopy(DEFAULT_RESULT)
@@ -803,10 +825,6 @@ def test_instance_groups_missing_instance_type_error(self):
803825
'--instance-groups '
804826
'Name=Master,InstanceGroupType=MASTER,InstanceCount=1'
805827
)
806-
expect_error_msg = (
807-
'\nThe following required parameters are missing'
808-
' for structure:: InstanceType\n'
809-
)
810828
stderr = self.run_cmd(cmd, 252)[1]
811829
self.assert_error_message_has_field_name(stderr, 'InstanceType')
812830

tests/unit/customizations/emr/test_create_cluster_release_label.py

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
from botocore.compat import OrderedDict, json
1818

19-
from awscli.testutils import mock
19+
from awscli.testutils import mock, unittest
2020
from tests.unit.customizations.emr import (
2121
EMRBaseAWSCommandParamsTest as BaseAWSCommandParamsTest,
2222
)
@@ -557,6 +557,27 @@ def test_visible_to_all_users_and_no_visible_to_all_users(self):
557557
result = self.run_cmd(cmd, 252)
558558
self.assertEqual(expected_error_msg, result[1])
559559

560+
def test_extended_support(self):
561+
cmd = DEFAULT_CMD + '--extended-support'
562+
result = copy.deepcopy(DEFAULT_RESULT)
563+
result['ExtendedSupport'] = True
564+
self.assert_params_for_cmd(cmd, result)
565+
566+
def test_no_extended_support(self):
567+
cmd = DEFAULT_CMD + '--no-extended-support'
568+
result = copy.deepcopy(DEFAULT_RESULT)
569+
result['ExtendedSupport'] = False
570+
self.assert_params_for_cmd(cmd, result)
571+
572+
def test_extended_support_and_no_extended_support(self):
573+
cmd = DEFAULT_CMD + '--extended-support --no-extended-support'
574+
expected_error_msg = (
575+
'\naws: error: cannot use both --extended-support'
576+
' and --no-extended-support options together.\n'
577+
)
578+
result = self.run_cmd(cmd, 252)
579+
self.assertEqual(expected_error_msg, result[1])
580+
560581
def test_tags(self):
561582
cmd = DEFAULT_CMD.split() + ['--tags', 'k1=v1', 'k2', 'k3=spaces v3']
562583
result = copy.deepcopy(DEFAULT_RESULT)
@@ -762,10 +783,6 @@ def test_instance_groups_missing_instance_type_error(self):
762783
'--instance-groups '
763784
'Name=Master,InstanceGroupType=MASTER,InstanceCount=1'
764785
)
765-
expect_error_msg = (
766-
'\nThe following required parameters are missing'
767-
' for structure:: InstanceType\n'
768-
)
769786
stderr = self.run_cmd(cmd, 252)[1]
770787
self.assert_error_message_has_field_name(stderr, 'InstanceType')
771788

0 commit comments

Comments
 (0)