private static List <RepoTable> LoadRepositoryTables() { using (var reader = File.OpenText(REPOSITORY_TABLES_FILE)) { IDeserializer deserializer = YamlDeserializer.Create(); return(deserializer.Deserialize <List <RepoTable> >(reader)); } }
/// <summary> /// Tries to load the default process names from the process names yaml file. /// Since failing to load these disables parsing any processs, this /// method throws its errors /// </summary> /// <returns></returns> internal static List <ProcessData> LoadProcessData() { // since PaletteInsightAgent always sets the current directory to its location, // we should always be in the correct folder for this to work using (var reader = File.OpenText(PROCESSES_DEFAULT_FILE)) { IDeserializer deserializer = YamlDeserializer.Create(); return(deserializer.Deserialize <List <ProcessData> >(reader)); } }
/// <summary> /// Tries to load the default log folders from the log folders yaml file. /// Since failing to load these disables parsing any logs, this /// method throws its errors /// </summary> /// <returns></returns> internal static List <LogFolder> LoadDefaultLogFolders() { // load the defaults from the application // since PaletteInsightAgent always sets the current directory to its location, // we should always be in the correct folder for this to work using (var reader = File.OpenText(LOGFOLDER_DEFAULTS_FILE)) { IDeserializer deserializer = YamlDeserializer.Create(); return(deserializer.Deserialize <List <LogFolder> >(reader)); } }
public static ICollection <ICounter> Load(string pathToConfig) { // load the defaults from the application // since PaletteInsightAgent always sets the current directory to its location, // we should always be in the correct folder for this to work using (var reader = File.OpenText(pathToConfig)) { IDeserializer deserializer = YamlDeserializer.Create(); var counterConfig = deserializer.Deserialize <List <Counters.Config> >(reader); return(Counters.Config.ToICounterList(counterConfig)); } }
public static PaletteInsightConfiguration LoadConfigFile(string filename) { try { // deserialize the config using (var reader = File.OpenText(filename)) { IDeserializer deserializer = YamlDeserializer.Create(); var config = deserializer.Deserialize <PaletteInsightConfiguration>(reader); return(config); } } catch (Exception e) { Log.Fatal("Error during cofiguration loading: {0} -- {1}", filename, e); return(null); } }
public static Workgroup GetRepoFromWorkgroupYaml(string workgroupYmlPath, bool preferPassiveRepo) { if (workgroupYmlPath == null) { Log.Error("Path for workgroup.yml must not be null while reading configs!"); return(null); } try { // Get basic info from workgroup yml. Everything else from connections.yml IDeserializer deserializer = YamlDeserializer.Create(); Workgroup workgroup = null; using (var workgroupFile = File.OpenText(workgroupYmlPath)) { workgroup = deserializer.Deserialize <Workgroup>(workgroupFile); using (var connectionsFile = File.OpenText(workgroup.ConnectionsFile)) { workgroup.Connection = deserializer.Deserialize <TableauConnectionInfo>(connectionsFile); // workgroup.Connection.Host always contains the active repo if (preferPassiveRepo) { if (workgroup.PgHost0 != null && workgroup.PgHost1 != null) { // Use passive repo if possible/exists if (workgroup.Connection.Host != workgroup.PgHost0) { workgroup.Connection.Host = workgroup.PgHost0; workgroup.Connection.Port = workgroup.PgPort0; } else { workgroup.Connection.Host = workgroup.PgHost1; workgroup.Connection.Port = workgroup.PgPort1; } Log.Info("Based on workgroup.yml, passive repository host is: '{0}' with port: '{1}'", workgroup.Connection.Host, workgroup.Connection.Port); } else { Log.Info("Passive repo is preferred as target Tableau repo, but '{0}' does not contain passive repo node information", workgroupYmlPath); } } else { Log.Info("Active Tableau repo is configured to be the target repo"); } } if (!IsValidRepoData(workgroup)) { return(null); } } return(workgroup); } catch (Exception e) { Log.Error(e, "Error while trying to load and parse YAML config from '{0}' Exception: ", workgroupYmlPath); } return(null); }