ranger/orm/orm_client/db_clear/yaml_handler.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

26 lines
661 B
Python

import config as conf
import fnmatch
import os
def _get_resource_file_path():
file_path = conf.local_repository_path
return file_path
def _find_file(resource_id):
file_name = conf.file_name_format.format(resource_id)
folder_to_search = _get_resource_file_path(resource_id)
matches = []
for root, dirnames, filenames in os.walk(folder_to_search):
for filename in fnmatch.filter(filenames, file_name):
matches.append(os.path.join(root, filename))
return matches
def check_yaml_exist(resource_id):
files = _find_file(resource_id)
if files:
return files
return None