@@ -60,6 +60,29 @@ def nfs_ganesha_unexport_volume(section_dict):
6060 section_dict = get_base_dir (section_dict )
6161 return section_dict , defaults .GANESHA_VOL_EXPORT
6262
63+ def nfs_ganesha_refresh_config (section_dict ):
64+ del_lines = list_to_string (section_dict .get ('del-config-lines' ))
65+ # Split the string which is `|' delimited. Escaped `|' is handled gracefully
66+ section_dict ['del-config-lines' ] = helpers .split_string (del_lines , '|' )
67+
68+ add_lines = list_to_string (section_dict .get ('add-config-lines' ))
69+ section_dict ['add-config-lines' ] = helpers .split_string (add_lines , '|' )
70+
71+ block_name = section_dict .get ('block-name' )
72+ section_dict ['block-name' ] = block_name
73+
74+ config_block = list_to_string (section_dict .get ('config-block' ))
75+ section_dict ['config-block' ] = helpers .split_string (config_block , '|' )
76+
77+ section_dict ['ha-conf-dir' ] = section_dict .get ('ha-conf-dir' )
78+ section_dict = get_base_dir (section_dict )
79+
80+ if config_block :
81+ section_dict ['config-block' ].insert (0 , '%s {' % block_name )
82+ section_dict ['config-block' ].append ('}\n ' )
83+
84+ return section_dict , defaults .GANESHA_REFRESH_CONFIG
85+
6386def get_cluster_nodes (section_dict ):
6487 global helpers
6588 cluster_nodes = section_dict .get ('cluster-nodes' )
@@ -93,3 +116,11 @@ def get_base_dir(section_dict):
93116 section_dict ['base_dir' ] = Global .base_dir
94117 section_dict ['ha_base_dir' ] = '/etc/ganesha'
95118 return section_dict
119+
120+ def list_to_string (l ):
121+ # If l is a list of lines, join and return string
122+ if type (l ) is list :
123+ return "," .join (l )
124+ else :
125+ # Return the string
126+ return l
0 commit comments