def _resolve_path(self, path): if os.path.isabs(path): if not os.path.isfile(path): raise FatalError(("'{}' does not exist." ).format(path)) return path else: locations = [self.get_project_plugin_directory(), get_edi_plugin_directory()] for location in locations: abspath = os.path.join(location, path) if os.path.isfile(abspath): return abspath raise FatalError(("'{0}' not found in the " "following locations:\n{1}" ).format(path, "\n".join(locations)))
def get_base_dictionary(): base_dict = {} current_user_name = get_user() base_dict["edi_current_user_name"] = current_user_name base_dict["edi_current_user_group_name"] = get_user_group() base_dict["edi_current_user_ssh_pub_keys"] = get_user_ssh_pub_keys() base_dict["edi_current_user_uid"] = get_user_uid() base_dict["edi_current_user_gid"] = get_user_gid() base_dict["edi_current_user_host_home_directory"] = get_user_home_directory(current_user_name) base_dict["edi_current_user_target_home_directory"] = "/home/{}".format(current_user_name) base_dict["edi_host_hostname"] = get_hostname() base_dict["edi_edi_plugin_directory"] = get_edi_plugin_directory() proxy_setup = ProxySetup() base_dict["edi_host_http_proxy"] = proxy_setup.get('http_proxy', default='') base_dict["edi_host_https_proxy"] = proxy_setup.get('https_proxy', default='') base_dict["edi_host_ftp_proxy"] = proxy_setup.get('ftp_proxy', default='') base_dict["edi_host_socks_proxy"] = proxy_setup.get('all_proxy', default='') base_dict["edi_host_no_proxy"] = proxy_setup.get('no_proxy', default='') base_dict["edi_lxd_version"] = get_lxd_version() return base_dict
def get_base_dictionary(): base_dict = {} current_user_name = get_user() base_dict["edi_current_user_name"] = current_user_name base_dict["edi_current_user_uid"] = get_user_uid() base_dict["edi_current_user_gid"] = get_user_gid() base_dict[ "edi_current_user_host_home_directory"] = get_user_environment_variable( "HOME") base_dict["edi_current_user_target_home_directory"] = "/home/{}".format( current_user_name) base_dict["edi_host_hostname"] = get_hostname() base_dict["edi_edi_plugin_directory"] = get_edi_plugin_directory() base_dict["edi_host_http_proxy"] = get_user_environment_variable( 'http_proxy', '') base_dict["edi_host_https_proxy"] = get_user_environment_variable( 'https_proxy', '') base_dict["edi_host_ftp_proxy"] = get_user_environment_variable( 'ftp_proxy', '') base_dict["edi_host_socks_proxy"] = get_user_environment_variable( 'all_proxy', '') base_dict["edi_host_no_proxy"] = get_user_environment_variable( 'no_proxy', '') return base_dict
def get_project_tree(): return os.path.join(get_edi_plugin_directory(), 'config_templates', 'project_tree')
def get_template(name): return os.path.join(get_edi_plugin_directory(), 'config_templates', '{}.yml'.format(name))