ranger/orm/orm_client/db_clear/utils.py
raigax9 2bc511c69f Added orm_client codebase
Initial commit for orm_client by adding the codebase.

Change-Id: I24f17561e6a426e6af9dbbe04e4a66599344d265
2017-08-28 14:17:28 +00:00

24 lines
600 B
Python

import csv
import logging
log = logging.getLogger(__name__)
def _validate_file(file):
if str(file).split('.')[-1] != 'csv':
log.error('please provide csv file')
raise TypeError('please provide csv file')
def read_csv_file(file):
_validate_file(file)
resources = []
with open(file, 'rb') as csvfile:
csv_dict = csv.DictReader(csvfile)
for resource in csv_dict:
resources.append(resource["uuids"])
log.debug(
'list of resources to clean ----{} -------'.format(resources))
return resources