@@ -76,7 +76,7 @@ def create_component(self, staged_component_path, application_name, user_name, c
76
76
os .system ('cp {}/jupyter_README.ipynb {}/README.ipynb' .format (this_dir , repo_path ))
77
77
os .system ('cd {0} && git add README.ipynb && git commit -m "Initial commit"' .format (repo_path ))
78
78
## add notebooks to application_user github repo.
79
- notebook_install_path = '{}/{}/ ' .format (repo_path , application_name )
79
+ notebook_install_path = '{}/{}' .format (repo_path , application_name )
80
80
os .system ('mkdir -p {}' .format (notebook_install_path ))
81
81
file_list = component ['component_detail' ]
82
82
for file_name in file_list :
@@ -86,7 +86,11 @@ def create_component(self, staged_component_path, application_name, user_name, c
86
86
self ._fill_properties ('%s/%s' % (staged_component_path , file_name ), properties )
87
87
logging .debug ('Copying {} to {}' .format (file_name , notebook_install_path ))
88
88
os .system ('cp {}/{} {}' .format ( staged_component_path , file_name , notebook_install_path ))
89
- # update local github repo:
89
+ # Create a properties.json file in notebooks to access application jupyter component properties.
90
+ with open ('{}/properties.json' .format (notebook_install_path ), 'w' ) as prop_file :
91
+ prop_dict = { k .replace ('component_' ,'' ): v for k , v in properties .items () if k .startswith ('component_' )}
92
+ json .dump (prop_dict , prop_file )
93
+ # update local github repo:
90
94
91
95
os .system ('cd {0} && git add {1} && git commit -m "added {1} app notebooks"' .format (repo_path , application_name ))
92
96
delete_commands .append ('rm -rf {}\n ' .format ( notebook_install_path ))
0 commit comments