16 lines
445 B
Python
16 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)
|