def build_main(in_path, out_path, make_dir_index, api_index, f, info_list, auto_start, max_workers): logger.debug('Setting authentication info') auth_info = authentication_cli(fp = f, info_list = info_list, api_index = api_index) logger.debug('loading external data') ext_info = external_data(auth_info, info_list = info_list, fp = f) logger.debug('Checking cloud states') ext_info = check_cloud_state(ext_info, auth_info, info_list = info_list, fp = f, api_index = api_index, func_type = "build") logger.debug('Start the process related to the config file') config_param = config_main(ext_info, in_path = in_path, out_path = out_path, make_dir_index = make_dir_index, info_list = info_list, fp = f) logger.debug('Start configuring the application') config_param = set_app_params(config_param, api_index = api_index, f = f, info_list = info_list) logger.debug('Convert config params into a format for building') build_params = config_transformation(ext_info, config_param, api_index = api_index, f = f, info_list = info_list) logger.debug('Preparing monitor info') info_list_cluster = preparing_monitor(ext_info, config_param, api_index = api_index, f = f, info_list = info_list) logger.debug('Starting main function to build') cls_bil = build_class.build_sacluster(build_params, auth_info, max_workers, fp = f , info_list = info_list, monitor_info_list = info_list_cluster, api_index = api_index) cls_bil() if(auto_start == True): str_cls = start_sacluster(cls_bil.all_id_dict, auth_info, fp = f, info_list = info_list, api_index = api_index) str_cls()
def stop_main(api_index, f, info_list,max_workers): logger.debug('Setting authentication info') auth_info = authentication_cli(fp = f, info_list = info_list, api_index = api_index) logger.debug('loading external data') ext_info = external_data(auth_info, info_list = info_list, fp = f) logger.debug('Getting cluster information') params = get_params.get_params(ext_info, auth_info, info_list = info_list, f = f, api_index = api_index) params() params.show_cluster_info() index, cluster_id = get_cluster_id.get_cluster_id(params.cluster_info_all, info_list, f, api_index) if(index == True): logger.debug("Start stopping the cluster : " + str(cluster_id)) printout("Start stopping the cluster : " + str(cluster_id), info_type = 0, info_list = info_list, fp = f) stop_obj = stop_class.stop_sacluster(params.cluster_info_all[cluster_id], auth_info, max_workers,fp = f, info_list = info_list, api_index = api_index) stop_obj() logger.debug("Finished stopping the cluster : " + str(cluster_id)) printout("Finished stopping the cluster : " + str(cluster_id), info_type = 0, info_list = info_list, fp = f) else: logger.debug('There are no clusters to stop')
def ps_main(api_index, f, info_list): logger.debug('Setting authentication info') auth_info = authentication_cli(fp=f, info_list=info_list, api_index=api_index) logger.debug('loading external data') ext_info = external_data(auth_info, info_list=info_list, fp=f) logger.debug('Checking cloud states') ext_info = check_cloud_state(ext_info, auth_info, info_list=info_list, fp=f, api_index=api_index) logger.debug('Getting cluster information') params = get_params.get_params(ext_info, auth_info, info_list=info_list, f=f, api_index=api_index) params() params.show_cluster_info()
def def_config_main(out_path, make_dir_index, api_index, f, info_list): logger.debug('Setting authentication info') auth_info = authentication_cli(fp=f, info_list=info_list, api_index=api_index) logger.debug('loading external data') ext_info = external_data(auth_info, info_list=info_list, fp=f) logger.debug('Checking cloud states') ext_info = check_cloud_state(ext_info, auth_info, info_list=info_list, fp=f, api_index=api_index, func_type="build") logger.debug('Start the process related to the config file') config_param = config_main(ext_info, in_path="", out_path=out_path, make_dir_index=make_dir_index, info_list=info_list, fp=f)
def modify_main(api_index, f, info_list, max_workers): logger.debug('Setting authentication info') auth_info = authentication_cli(fp=f, info_list=info_list, api_index=api_index) logger.debug('loading external data') ext_info = external_data(auth_info, info_list=info_list, fp=f) logger.debug('Checking cloud states') ext_info = check_cloud_state(ext_info, auth_info, info_list=info_list, fp=f, api_index=api_index) logger.debug('Getting cluster information') params = get_params.get_params(ext_info, auth_info, info_list=info_list, f=f, api_index=api_index) params() #import pprint #pprint.pprint(params.cluster_info_all) #sys.exit() params.show_cluster_info() index, cluster_id = get_cluster_id.get_cluster_id(params.cluster_info_all, info_list, f, api_index) state, obj = params.checking_status(cluster_id) if (state == False): conf_stop_process(info_list, f) logger.debug("Start stopping the cluster : " + str(cluster_id)) printout("Start stopping the cluster : " + str(cluster_id), info_type=0, info_list=info_list, fp=f) stop_obj = stop_sacluster(params.cluster_info_all[cluster_id], auth_info, max_workers, fp=f, info_list=info_list, api_index=api_index) stop_obj() logger.debug("Finished stopping the cluster : " + str(cluster_id)) printout("Finished stopping the cluster : " + str(cluster_id), info_type=0, info_list=info_list, fp=f) if (index == True): logger.debug("Starting to modify the cluster : " + str(cluster_id)) printout("Starting to modify the cluster : " + str(cluster_id), info_type=0, info_list=info_list, fp=f) mod_obj = modify_sacluster(params.cluster_info_all[cluster_id], cluster_id, auth_info, ext_info, fp=f, info_list=info_list, api_index=api_index, max_workers=max_workers) mod_obj()
def delete_main(api_index, f, info_list, max_workers): logger.debug('Setting authentication info') auth_info = authentication_cli(fp=f, info_list=info_list, api_index=api_index) logger.debug('loading external data') ext_info = external_data(auth_info, info_list=info_list, fp=f) logger.debug('Getting cluster information') params = get_params.get_params(ext_info, auth_info, info_list=info_list, f=f, api_index=api_index) params() params.show_cluster_info() index, cluster_id = get_cluster_id.get_cluster_id(params.cluster_info_all, info_list, f, api_index) temp = conf_pattern_2("Delete the selected cluster?", ["yes", "no"], "no", info_list=info_list, fp=f) state, obj = params.checking_status(cluster_id) if temp == "yes": if (state == False): conf_stop_process(info_list, f) logger.debug("Start stopping the cluster : " + str(cluster_id)) printout("Start stopping the cluster : " + str(cluster_id), info_type=0, info_list=info_list, fp=f) stop_obj = stop_sacluster(params.cluster_info_all[cluster_id], auth_info, max_workers, fp=f, info_list=info_list, api_index=api_index) stop_obj() logger.debug("Finished stopping the cluster : " + str(cluster_id)) printout("Finished stopping the cluster : " + str(cluster_id), info_type=0, info_list=info_list, fp=f) if (index == True): logger.debug("Start deleting the cluster : " + str(cluster_id)) printout("Start deleting the cluster : " + str(cluster_id), info_type=0, info_list=info_list, fp=f) delete_obj = delete_class.delete_sacluster( params.cluster_info_all[cluster_id], auth_info, max_workers, fp=f, info_list=info_list, api_index=api_index) delete_obj() logger.debug("Finished deleting the cluster : " + str(cluster_id)) printout("Finished deleting the cluster : " + str(cluster_id), info_type=0, info_list=info_list, fp=f) else: logger.debug('There are no clusters to stop') else: printout("Stop processing.", info_type=0, info_list=info_list, fp=f) sys.exit()