@@ -40,7 +40,7 @@ def init_dir(server, client, key, path, deploy_name, link_path=None):
4040 ret = client .execute_command ('ls %s' % (path ))
4141 if not ret or ret .stdout .strip ():
4242 critical (EC_FAIL_TO_INIT_PATH .format (server = server , key = '%s path' % key , msg = InitDirFailedErrorMessage .NOT_EMPTY .format (path = path )))
43- critical (EC_COMPONENT_DIR_NOT_EMPTY .format (deploy_name = deploy_name ), _on_exit = True )
43+ source_option == "deploy" and critical (EC_COMPONENT_DIR_NOT_EMPTY .format (deploy_name = deploy_name ), _on_exit = True )
4444 return False
4545 else :
4646 critical (EC_FAIL_TO_INIT_PATH .format (server = server , key = '%s path' % key , msg = InitDirFailedErrorMessage .CREATE_FAILED .format (path = path )))
@@ -55,7 +55,7 @@ def init_dir(server, client, key, path, deploy_name, link_path=None):
5555 return False
5656
5757
58- def init (plugin_context , * args , ** kwargs ):
58+ def init (plugin_context , source_option = None , * args , ** kwargs ):
5959 global stdio , force
6060 cluster_config = plugin_context .cluster_config
6161 clients = plugin_context .clients
@@ -126,7 +126,7 @@ def init(plugin_context, *args, **kwargs):
126126 ret = client .execute_command ('ls %s' % (home_path ))
127127 if not ret or ret .stdout .strip ():
128128 critical (EC_FAIL_TO_INIT_PATH .format (server = server , key = 'home path' , msg = InitDirFailedErrorMessage .NOT_EMPTY .format (path = home_path )))
129- critical (EC_COMPONENT_DIR_NOT_EMPTY .format (deploy_name = deploy_name ), _on_exit = True )
129+ source_option == "deploy" and critical (EC_COMPONENT_DIR_NOT_EMPTY .format (deploy_name = deploy_name ), _on_exit = True )
130130 continue
131131 else :
132132 critical (EC_FAIL_TO_INIT_PATH .format (server = server , key = 'home path' , msg = InitDirFailedErrorMessage .CREATE_FAILED .format (path = home_path )))
@@ -144,7 +144,7 @@ def init(plugin_context, *args, **kwargs):
144144 ret = client .execute_command ('ls %s' % (data_path ))
145145 if not ret or ret .stdout .strip ():
146146 critical (EC_FAIL_TO_INIT_PATH .format (server = server , key = 'data dir' , msg = InitDirFailedErrorMessage .NOT_EMPTY .format (path = data_path )))
147- critical (EC_COMPONENT_DIR_NOT_EMPTY .format (deploy_name = deploy_name ), _on_exit = True )
147+ source_option == "deploy" and critical (EC_COMPONENT_DIR_NOT_EMPTY .format (deploy_name = deploy_name ), _on_exit = True )
148148 continue
149149 else :
150150 critical (EC_FAIL_TO_INIT_PATH .format (server = server , key = 'data dir' , msg = InitDirFailedErrorMessage .CREATE_FAILED .format (path = data_path )))
@@ -165,7 +165,7 @@ def init(plugin_context, *args, **kwargs):
165165 ret = client .execute_command ('ls %s' % (log_dir ))
166166 if not ret or ret .stdout .strip ():
167167 critical (EC_FAIL_TO_INIT_PATH .format (server = server , key = '%s dir' % key , msg = InitDirFailedErrorMessage .NOT_EMPTY .format (path = log_dir )))
168- critical (EC_COMPONENT_DIR_NOT_EMPTY .format (deploy_name = deploy_name ), _on_exit = True )
168+ source_option == "deploy" and critical (EC_COMPONENT_DIR_NOT_EMPTY .format (deploy_name = deploy_name ), _on_exit = True )
169169 continue
170170 else :
171171 critical (EC_FAIL_TO_INIT_PATH .format (server = server , key = '%s dir' % key , msg = InitDirFailedErrorMessage .CREATE_FAILED .format (path = log_dir )))
0 commit comments