@@ -50,6 +50,7 @@ <h1 class="title">Module <code>codeflare_sdk.utils.generate_yaml</code></h1>
5050
5151import yaml
5252import sys
53+ import os
5354import argparse
5455import uuid
5556from kubernetes import client, config
@@ -537,8 +538,14 @@ <h1 class="title">Module <code>codeflare_sdk.utils.generate_yaml</code></h1>
537538
538539
539540def write_user_appwrapper(user_yaml, output_file_name):
541+ # Create the directory if it doesn't exist
542+ directory_path = os.path.dirname(output_file_name)
543+ if not os.path.exists(directory_path):
544+ os.makedirs(directory_path)
545+
540546 with open(output_file_name, "w") as outfile:
541547 yaml.dump(user_yaml, outfile, default_flow_style=False)
548+
542549 print(f"Written to: {output_file_name}")
543550
544551
@@ -706,7 +713,8 @@ <h1 class="title">Module <code>codeflare_sdk.utils.generate_yaml</code></h1>
706713 if openshift_oauth:
707714 enable_openshift_oauth(user_yaml, cluster_name, namespace)
708715
709- outfile = appwrapper_name + ".yaml"
716+ directory_path = os.path.expanduser("~/.codeflare/appwrapper/")
717+ outfile = os.path.join(directory_path, appwrapper_name + ".yaml")
710718 if not mcad:
711719 write_components(user_yaml, outfile)
712720 else:
@@ -1019,7 +1027,8 @@ <h2 class="section-title" id="header-functions">Functions</h2>
10191027 if openshift_oauth:
10201028 enable_openshift_oauth(user_yaml, cluster_name, namespace)
10211029
1022- outfile = appwrapper_name + ".yaml"
1030+ directory_path = os.path.expanduser("~/.codeflare/appwrapper/")
1031+ outfile = os.path.join(directory_path, appwrapper_name + ".yaml")
10231032 if not mcad:
10241033 write_components(user_yaml, outfile)
10251034 else:
@@ -1541,8 +1550,14 @@ <h2 class="section-title" id="header-functions">Functions</h2>
15411550< span > Expand source code</ span >
15421551</ summary >
15431552< pre > < code class ="python "> def write_user_appwrapper(user_yaml, output_file_name):
1553+ # Create the directory if it doesn't exist
1554+ directory_path = os.path.dirname(output_file_name)
1555+ if not os.path.exists(directory_path):
1556+ os.makedirs(directory_path)
1557+
15441558 with open(output_file_name, "w") as outfile:
15451559 yaml.dump(user_yaml, outfile, default_flow_style=False)
1560+
15461561 print(f"Written to: {output_file_name}")</ code > </ pre >
15471562</ details >
15481563</ dd >
0 commit comments