@@ -231,6 +231,7 @@ def __init__(self):
231231 self .host_post_info = None
232232 self .pip_url = None
233233 self .require_python_env = "true"
234+ self .host_info = None
234235
235236
236237class Msg (object ):
@@ -1026,7 +1027,11 @@ def apt_update_packages(name_list, host_post_info):
10261027 host_post_info .host ))
10271028
10281029
1030+ IS_REMOTE_PIP_READY = {}
1031+
1032+
10291033def pip_install_package (pip_install_arg , host_post_info ):
1034+ global IS_REMOTE_PIP_READY
10301035 start_time = datetime .datetime .now ()
10311036 host_post_info .start_time = start_time
10321037 name = pip_install_arg .name
@@ -1047,8 +1052,10 @@ def pip_install_package(pip_install_arg, host_post_info):
10471052 host_post_info .post_label_param = name
10481053 handle_ansible_info ("INFO: pip installing package %s ..." %
10491054 name , host_post_info , "INFO" )
1050- command = "which pip || ln -s /usr/bin/pip2 /usr/bin/pip"
1051- run_remote_command (command , host_post_info )
1055+ if host not in IS_REMOTE_PIP_READY .keys () or not IS_REMOTE_PIP_READY [host ]:
1056+ command = "which pip || ln -s /usr/bin/pip2 /usr/bin/pip"
1057+ run_remote_command (command , host_post_info )
1058+ IS_REMOTE_PIP_READY [host ] = True
10521059 param_dict = {}
10531060 param_dict_raw = dict (version = version ,
10541061 extra_args = extra_args ,
@@ -1546,7 +1553,9 @@ def get_remote_host_info_obj(host_post_info):
15461553 runner_args = ZstackRunnerArg ()
15471554 runner_args .host_post_info = host_post_info
15481555 runner_args .module_name = 'setup'
1549- runner_args .module_args = 'filter=ansible*'
1556+ runner_args .module_args = ('gather_subset=machine,processor '
1557+ 'filter=ansible_dist*,ansible_machine,'
1558+ 'ansible_processor,ansible_kernel' )
15501559 zstack_runner = ZstackRunner (runner_args )
15511560 result = zstack_runner .run ()
15521561 logger .debug (result )
@@ -2211,7 +2220,9 @@ def __init__(self, args):
22112220 check_umask (self .host_post_info )
22122221 configure_hosts (self .host_post_info )
22132222
2214- host_info = get_remote_host_info_obj (self .host_post_info )
2223+ host_info = args .host_info
2224+ if not host_info :
2225+ host_info = get_remote_host_info_obj (self .host_post_info )
22152226
22162227 if self .distro in RPM_BASED_OS :
22172228 install_release_on_host (True , host_info , self .host_post_info )
0 commit comments