Ejemplo n.º 1
0
    def _run_main(self, args, parsed_globals):

        if (args.visible_to_all_users and args.no_visible_to_all_users):
            raise ValueError(
                'aws: error: Cannot use both options --visible-to-all-users '
                'and --no-visible-to-all-users together.')
        if (args.termination_protected and args.no_termination_protected):
            raise ValueError(
                'aws: error: Cannot use both options --termination-protected '
                'and --no-termination-protected together.')
        if not(args.termination_protected or args.no_termination_protected
               or args.visible_to_all_users or args.no_visible_to_all_users):
            raise ValueError('aws: error: You need to specify atleast one of '
                             'the options.')

        if (args.visible_to_all_users or args.no_visible_to_all_users):
            visible = (args.visible_to_all_users and
                       not args.no_visible_to_all_users)
            parameters = {'JobFlowIds': [args.cluster_id],
                          'VisibleToAllUsers': visible}
            emrutils.call_and_display_response(self._session,
                                               'SetVisibleToAllUsers',
                                               parameters, parsed_globals)

        if (args.termination_protected or args.no_termination_protected):
            protected = (args.termination_protected and
                         not args.no_termination_protected)
            parameters = {'JobFlowIds': [args.cluster_id],
                          'TerminationProtected': protected}
            emrutils.call_and_display_response(self._session,
                                               'SetTerminationProtection',
                                               parameters, parsed_globals)
        return 0
Ejemplo n.º 2
0
    def _run_main(self, args, parsed_globals):

        if (args.visible_to_all_users and args.no_visible_to_all_users):
            raise exceptions.MutualExclusiveOptionError(
                option1='--visible-to-all-users',
                option2='--no-visible-to-all-users')
        if (args.termination_protected and args.no_termination_protected):
            raise exceptions.MutualExclusiveOptionError(
                option1='--termination-protected',
                option2='--no-termination-protected')
        if not(args.termination_protected or args.no_termination_protected
               or args.visible_to_all_users or args.no_visible_to_all_users):
            raise exceptions.MissingClusterAttributesError()

        if (args.visible_to_all_users or args.no_visible_to_all_users):
            visible = (args.visible_to_all_users and
                       not args.no_visible_to_all_users)
            parameters = {'JobFlowIds': [args.cluster_id],
                          'VisibleToAllUsers': visible}
            emrutils.call_and_display_response(self._session,
                                               'SetVisibleToAllUsers',
                                               parameters, parsed_globals)

        if (args.termination_protected or args.no_termination_protected):
            protected = (args.termination_protected and
                         not args.no_termination_protected)
            parameters = {'JobFlowIds': [args.cluster_id],
                          'TerminationProtected': protected}
            emrutils.call_and_display_response(self._session,
                                               'SetTerminationProtection',
                                               parameters, parsed_globals)
        return 0
Ejemplo n.º 3
0
    def _run_main_command(self, args, parsed_globals):

        if (args.visible_to_all_users and args.no_visible_to_all_users):
            raise exceptions.MutualExclusiveOptionError(
                option1='--visible-to-all-users',
                option2='--no-visible-to-all-users')
        if (args.termination_protected and args.no_termination_protected):
            raise exceptions.MutualExclusiveOptionError(
                option1='--termination-protected',
                option2='--no-termination-protected')
        if not(args.termination_protected or args.no_termination_protected
               or args.visible_to_all_users or args.no_visible_to_all_users):
            raise exceptions.MissingClusterAttributesError()

        if (args.visible_to_all_users or args.no_visible_to_all_users):
            visible = (args.visible_to_all_users and
                       not args.no_visible_to_all_users)
            parameters = {'JobFlowIds': [args.cluster_id],
                          'VisibleToAllUsers': visible}
            emrutils.call_and_display_response(self._session,
                                               'SetVisibleToAllUsers',
                                               parameters, parsed_globals)

        if (args.termination_protected or args.no_termination_protected):
            protected = (args.termination_protected and
                         not args.no_termination_protected)
            parameters = {'JobFlowIds': [args.cluster_id],
                          'TerminationProtected': protected}
            emrutils.call_and_display_response(self._session,
                                               'SetTerminationProtection',
                                               parameters, parsed_globals)
        return 0
Ejemplo n.º 4
0
    def _run_main_command(self, parsed_args, parsed_globals):
        parsed_steps = parsed_args.steps
        step_list = steputils.build_step_config_list(
            parsed_step_list=parsed_steps, region=self.region)
        parameters = {'JobFlowId': parsed_args.cluster_id, 'Steps': step_list}

        emrutils.call_and_display_response(self._session, 'AddJobFlowSteps',
                                           parameters, parsed_globals)
        return 0
Ejemplo n.º 5
0
    def _run_main(self, parsed_args, parsed_globals):

        parameters = {'JobFlowId': parsed_args.cluster_id}

        self._check_for_supported_apps(parsed_args.apps)
        parameters['Steps'] = applicationutils.build_applications(
            parsed_args.apps, parsed_globals)[2]

        emrutils.call_and_display_response(self._session, 'AddJobFlowSteps',
                                           parameters, parsed_globals)
        return 0
Ejemplo n.º 6
0
    def _run_main(self, parsed_args, parsed_globals):
        parsed_steps = parsed_args.steps
        step_list = steputils.build_step_config_list(
            parsed_step_list=parsed_steps, region=parsed_globals.region)
        parameters = {
            'JobFlowId': parsed_args.cluster_id,
            'Steps': step_list
        }

        emrutils.call_and_display_response(self._session, 'AddJobFlowSteps',
                                           parameters, parsed_globals)
        return 0
Ejemplo n.º 7
0
    def _run_main_command(self, parsed_args, parsed_globals):
        steps = []

        args = self._build_hbase_disable_backups_args(parsed_args)

        step_config = emrutils.build_step(
            constants.HBASE_JAR_PATH,
            constants.HBASE_SCHEDULE_BACKUP_STEP_NAME,
            constants.CANCEL_AND_WAIT, args)

        steps.append(step_config)
        parameters = {'JobFlowId': parsed_args.cluster_id, 'Steps': steps}
        emrutils.call_and_display_response(self._session, 'AddJobFlowSteps',
                                           parameters, parsed_globals)
        return 0
Ejemplo n.º 8
0
    def _run_main_command(self, parsed_args, parsed_globals):
        steps = []
        args = hbaseutils.build_hbase_restore_from_backup_args(
            parsed_args.dir, parsed_args.backup_version)

        step_config = emrutils.build_step(
            jar=constants.HBASE_JAR_PATH,
            name=constants.HBASE_RESTORE_STEP_NAME,
            action_on_failure=constants.CANCEL_AND_WAIT,
            args=args)

        steps.append(step_config)
        parameters = {'JobFlowId': parsed_args.cluster_id, 'Steps': steps}
        emrutils.call_and_display_response(self._session, 'AddJobFlowSteps',
                                           parameters, parsed_globals)
        return 0
Ejemplo n.º 9
0
    def _run_main_command(self, parsed_args, parsed_globals):
        steps = []
        args = self._build_hbase_backup_args(parsed_args)

        step_config = emrutils.build_step(
            jar=constants.HBASE_JAR_PATH,
            name=constants.HBASE_BACKUP_STEP_NAME,
            action_on_failure=constants.CANCEL_AND_WAIT,
            args=args)

        steps.append(step_config)
        parameters = {'JobFlowId': parsed_args.cluster_id,
                      'Steps': steps}
        emrutils.call_and_display_response(self._session, 'AddJobFlowSteps',
                                           parameters, parsed_globals)
        return 0
Ejemplo n.º 10
0
    def _run_main_command(self, parsed_args, parsed_globals):
        steps = []
        self._check_type(parsed_args.type)
        self._check_unit(parsed_args.unit)
        args = self._build_hbase_schedule_backup_args(parsed_args)

        step_config = emrutils.build_step(
            jar=constants.HBASE_JAR_PATH,
            name=constants.HBASE_SCHEDULE_BACKUP_STEP_NAME,
            action_on_failure=constants.CANCEL_AND_WAIT,
            args=args)

        steps.append(step_config)
        parameters = {'JobFlowId': parsed_args.cluster_id, 'Steps': steps}
        emrutils.call_and_display_response(self._session, 'AddJobFlowSteps',
                                           parameters, parsed_globals)
        return 0
    def _run_main_command(self, parsed_args, parsed_globals):
        parsed_steps = parsed_args.steps

        release_label = emrutils.get_release_label(parsed_args.cluster_id,
                                                   self._session, self.region,
                                                   parsed_globals.endpoint_url,
                                                   parsed_globals.verify_ssl)

        step_list = steputils.build_step_config_list(
            parsed_step_list=parsed_steps,
            region=self.region,
            release_label=release_label)
        parameters = {'JobFlowId': parsed_args.cluster_id, 'Steps': step_list}

        emrutils.call_and_display_response(self._session, 'AddJobFlowSteps',
                                           parameters, parsed_globals)
        return 0
Ejemplo n.º 12
0
    def _run_main_command(self, parsed_args, parsed_globals):
        parsed_steps = parsed_args.steps

        release_label = emrutils.get_release_label(
            parsed_args.cluster_id, self._session, self.region,
            parsed_globals.endpoint_url, parsed_globals.verify_ssl)

        step_list = steputils.build_step_config_list(
            parsed_step_list=parsed_steps, region=self.region,
            release_label=release_label)
        parameters = {
            'JobFlowId': parsed_args.cluster_id,
            'Steps': step_list
        }

        emrutils.call_and_display_response(self._session, 'AddJobFlowSteps',
                                           parameters, parsed_globals)
        return 0
Ejemplo n.º 13
0
    def _run_main(self, args, parsed_globals):

        if (args.visible_to_all_users and args.no_visible_to_all_users):
            raise ValueError(
                'aws: error: Cannot use both options --visible-to-all-users '
                'and --no-visible-to-all-users together.')
        if (args.termination_protected and args.no_termination_protected):
            raise ValueError(
                'aws: error: Cannot use both options --termination-protected '
                'and --no-termination-protected together.')
        if not (args.termination_protected or args.no_termination_protected
                or args.visible_to_all_users or args.no_visible_to_all_users):
            raise ValueError('aws: error: You need to specify atleast one of '
                             'the options.')

        if (args.visible_to_all_users or args.no_visible_to_all_users):
            visible = (args.visible_to_all_users
                       and not args.no_visible_to_all_users)
            parameters = {
                'JobFlowIds': [args.cluster_id],
                'VisibleToAllUsers': visible
            }
            emrutils.call_and_display_response(self._session,
                                               'SetVisibleToAllUsers',
                                               parameters, parsed_globals)

        if (args.termination_protected or args.no_termination_protected):
            protected = (args.termination_protected
                         and not args.no_termination_protected)
            parameters = {
                'JobFlowIds': [args.cluster_id],
                'TerminationProtected': protected
            }
            emrutils.call_and_display_response(self._session,
                                               'SetTerminationProtection',
                                               parameters, parsed_globals)
        return 0
Ejemplo n.º 14
0
 def _run_main(self, parsed_args, parsed_globals):
     parameters = {'JobFlowIds': parsed_args.cluster_ids}
     emrutils.call_and_display_response(self._session, 'TerminateJobFlows',
                                        parameters, parsed_globals)
     return 0
 def _run_main(self, parsed_args, parsed_globals):
     parameters = {"JobFlowIds": parsed_args.cluster_ids}
     emrutils.call_and_display_response(self._session, "TerminateJobFlows", parameters, parsed_globals)
     return 0
Ejemplo n.º 16
0
 def _run_main_command(self, parsed_args, parsed_globals):
     parameters = {'JobFlowIds': parsed_args.cluster_ids}
     emrutils.call_and_display_response(self._session,
                                        'TerminateJobFlows', parameters,
                                        parsed_globals)
     return 0