def build_applications()

in awscli/customizations/emr/applicationutils.py [0:0]


def build_applications(region,
                       parsed_applications, ami_version=None):
    app_list = []
    step_list = []
    ba_list = []

    for app_config in parsed_applications:
        app_name = app_config['Name'].lower()

        if app_name == constants.HIVE:
            hive_version = constants.LATEST
            step_list.append(
                _build_install_hive_step(region=region))
            args = app_config.get('Args')
            if args is not None:
                hive_site_path = _find_matching_arg(
                    key=constants.HIVE_SITE_KEY, args_list=args)
                if hive_site_path is not None:
                    step_list.append(
                        _build_install_hive_site_step(
                            region=region,
                            hive_site_path=hive_site_path))
        elif app_name == constants.PIG:
            pig_version = constants.LATEST
            step_list.append(
                _build_pig_install_step(
                    region=region))
        elif app_name == constants.GANGLIA:
            ba_list.append(
                _build_ganglia_install_bootstrap_action(
                    region=region))
        elif app_name == constants.HBASE:
            ba_list.append(
                _build_hbase_install_bootstrap_action(
                    region=region))
            if ami_version >= '3.0':
                step_list.append(
                    _build_hbase_install_step(
                        constants.HBASE_PATH_HADOOP2_INSTALL_JAR))
            elif ami_version >= '2.1':
                step_list.append(
                    _build_hbase_install_step(
                        constants.HBASE_PATH_HADOOP1_INSTALL_JAR))
            else:
                raise ValueError('aws: error: AMI version ' + ami_version +
                                 'is not compatible with HBase.')
        elif app_name == constants.IMPALA:
            ba_list.append(
                _build_impala_install_bootstrap_action(
                    region=region,
                    args=app_config.get('Args')))
        else:
            app_list.append(
                _build_supported_product(
                    app_config['Name'], app_config.get('Args')))

    return app_list, ba_list, step_list