configmapdata2files/configmapdata2files.py
François Pelletier dd1d31f4d3 Première version
2022-09-15 17:24:21 -04:00

15 lines
445 B
Python

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)