configmapdata2files/configmapdata2files.py

16 lines
445 B
Python
Raw Normal View History

2022-09-15 21:24:21 +00:00
import os
import yaml
def configmapdata2files(file_path, output_directory='./out'):
stream = open(file_path, 'r')
dic_file = yaml.safe_load(stream)
data_files = dic_file.get("data")
file_names = data_files.keys()
os.mkdir(output_directory)
for f in file_names:
file_content = data_files.get(f)
with open(output_directory + '/' + f, mode='w') as opened_file:
opened_file.write(file_content)