Exemplo n.º 1
0
def test_instances(secret_conf_path, server, username, password):
    c = get_demisto_instance_and_login(server, username, password)
    integrations = get_integrations(secret_conf_path)

    instance_ids = []
    failed_integration = []
    integrations_counter = 0
    for integration in integrations:
        integrations_counter += 1
        integration_name = integration.get('name', None)
        integration_params = integration.get('params', None)
        devops_comments = integration.get('devops_comments', None)
        product_description = integration.get('product_description', None)
        is_byoi = integration.get('byoi', True)
        has_integration = integration.get('has_integration', True)

        if has_integration:
            instance_id = __create_integration_instance(c, integration_name, integration_params, is_byoi)
            if not instance_id:
                print_error('Failed to create instance of %s' % (integration_name,))
                failed_integration.append("{0} {1} - {2}".format(integration_name,
                                                                 product_description, devops_comments))
            else:
                instance_ids.append(instance_id)
                print('Create integration %s succeed' % (integration_name,))
                __delete_integrations_instances(c, instance_ids)

    return failed_integration, integrations_counter
Exemplo n.º 2
0
def test_instances(secret_conf_path, server, username, password):
    c = get_demisto_instance_and_login(server, username, password)
    integrations = get_integrations(secret_conf_path)

    instance_ids = []
    failed_integration = []
    integrations_counter = 0
    for integration in integrations:
        integrations_counter += 1
        integration_name = integration.get('name', None)
        integration_instance_name = integration.get('instance_name', '')
        integration_params = integration.get('params', None)
        devops_comments = integration.get('devops_comments', None)
        product_description = integration.get('product_description', None)
        is_byoi = integration.get('byoi', True)
        has_integration = integration.get('has_integration', True)

        if has_integration:
            instance_id = __create_integration_instance(c, integration_name, integration_instance_name,
                                                        integration_params, is_byoi)
            if not instance_id:
                print_error('Failed to create instance of %s' % (integration_name,))
                failed_integration.append("{0} {1} - {2}".format(integration_name,
                                                                 product_description, devops_comments))
            else:
                instance_ids.append(instance_id)
                print('Create integration %s succeed' % (integration_name,))
                __delete_integrations_instances(c, instance_ids)

    return failed_integration, integrations_counter
Exemplo n.º 3
0
def test_instances(secret_conf_path, server, username, password):
    integrations = get_integrations(secret_conf_path)

    instance_ids = []
    failed_integrations = []
    integrations_counter = 0
    for integration in integrations:
        c = demisto_client.configure(base_url=server, username=username, password=password, verify_ssl=False)
        integrations_counter += 1
        integration_name = integration.get('name')
        integration_instance_name = integration.get('instance_name', '')
        integration_params = integration.get('params')
        devops_comments = integration.get('devops_comments')
        product_description = integration.get('product_description', '')
        is_byoi = integration.get('byoi', True)
        has_integration = integration.get('has_integration', True)

        if has_integration:
            instance_id, failure_message = __create_integration_instance(
                c, integration_name, integration_instance_name, integration_params, is_byoi
            )
            if not instance_id:
                print_error('Failed to create instance of {} with message: {}'.format(integration_name, failure_message))
                failed_integrations.append("{} {} - devops comments: {}".format(
                    integration_name, product_description, devops_comments))
            else:
                instance_ids.append(instance_id)
                print('Create integration %s succeed' % (integration_name,))
                __delete_integrations_instances(c, instance_ids)

    return failed_integrations, integrations_counter