def delete_logsearch_collections()

in ambari-infra-solr-client/src/main/python/migrationHelper.py [0:0]


def delete_logsearch_collections(options, config, collections_json_location, collections):
  service_logs_collection = config.get('logsearch_collections', 'hadoop_logs_collection_name')
  audit_logs_collection = config.get('logsearch_collections', 'audit_logs_collection_name')
  history_collection = config.get('logsearch_collections', 'history_collection_name')
  if service_logs_collection in collections:
    solr_urls = get_solr_urls(options, config, service_logs_collection, collections_json_location)
    response_map={}
    retry(delete_collection, options, config, service_logs_collection, solr_urls, response_map, context='[Delete {0} collection]'.format(service_logs_collection))
    retry(monitor_solr_async_request, options, config, response_map['status_request'], response_map['request_id'],
          context="[Monitor Solr async request, id: {0}]".format(response_map['request_id']))
  else:
    print('Collection {0} does not exist or filtered out. Skipping delete operation.'.format(service_logs_collection))
  if audit_logs_collection in collections:
    solr_urls = get_solr_urls(options, config, audit_logs_collection, collections_json_location)
    response_map={}
    retry(delete_collection, options, config, audit_logs_collection, solr_urls, response_map, context='[Delete {0} collection]'.format(audit_logs_collection))
    retry(monitor_solr_async_request, options, config, response_map['status_request'], response_map['request_id'],
          context="[Monitor Solr async request, id: {0}]".format(response_map['request_id']))
  else:
    print('Collection {0} does not exist or filtered out. Skipping delete operation.'.format(audit_logs_collection))
  if history_collection in collections:
    solr_urls = get_solr_urls(options, config, history_collection, collections_json_location)
    response_map={}
    retry(delete_collection, options, config, history_collection, solr_urls, response_map, context='[Delete {0} collection]'.format(history_collection))
    retry(monitor_solr_async_request, options, config, response_map['status_request'], response_map['request_id'],
          context="[Monitor Solr async request, id: {0}]".format(response_map['request_id']))
  else:
    print('Collection {0} does not exist or filtered out. Skipping delete operation.'.format(history_collection))