private void GetDiscoveryConfig(ITemplateContext templateContext, TemplateInputConfig templateConfig) { foreach (var discovery in SDKHelper.GetFolderItems <ManagementPackDiscovery>(this, templateContext.OutputFolder)) { var discoveryConfig = discovery.DataSource.Configuration; if (discovery.Name.StartsWith(ClustersDiscoveryNamePrefix, StringComparison.OrdinalIgnoreCase)) { if (WatcherNodesListNodeRegex.IsMatch(discoveryConfig)) { templateConfig.WatcherNodesList = WatcherNodesListNodeRegex.Match(discoveryConfig).Groups[1].Value; } } else if (discovery.Name.StartsWith(SeedDiscoveryNamePrefix, StringComparison.OrdinalIgnoreCase)) { if (SeedComputerNameNodeRegex.IsMatch(discoveryConfig)) { templateConfig.SeedComputerName = SeedComputerNameNodeRegex.Match(discoveryConfig).Groups[1].Value; } if (AmbariUriNodeRegex.IsMatch(discoveryConfig)) { templateConfig.AmbariUri = AmbariUriNodeRegex.Match(discoveryConfig).Groups[1].Value; } } } }
private void GetDiscoveryConfig(ITemplateContext templateContext, TemplateInputConfig templateConfig) { foreach (var discovery in SDKHelper.GetFolderItems<ManagementPackDiscovery>(this, templateContext.OutputFolder)) { var discoveryConfig = discovery.DataSource.Configuration; if (discovery.Name.StartsWith(ClustersDiscoveryNamePrefix, StringComparison.OrdinalIgnoreCase)) { if (WatcherNodesListNodeRegex.IsMatch(discoveryConfig)) templateConfig.WatcherNodesList = WatcherNodesListNodeRegex.Match(discoveryConfig).Groups[1].Value; } else if (discovery.Name.StartsWith(SeedDiscoveryNamePrefix, StringComparison.OrdinalIgnoreCase)) { if (SeedComputerNameNodeRegex.IsMatch(discoveryConfig)) templateConfig.SeedComputerName = SeedComputerNameNodeRegex.Match(discoveryConfig).Groups[1].Value; if (AmbariUriNodeRegex.IsMatch(discoveryConfig)) templateConfig.AmbariUri = AmbariUriNodeRegex.Match(discoveryConfig).Groups[1].Value; } } }
public bool LoadConfigurationXml(IPageContext pageContext) { var templateContext = pageContext as ITemplateContext; if (templateContext == null) throw new InvalidOperationException("No template context provided for Input Parser. Configuration could not be loaded."); var templateConfig = new TemplateInputConfig { Name = templateContext.OutputFolder.DisplayName, Description = templateContext.OutputFolder.Description, RunAsAccount = GetRunAsAccounts(templateContext), TemplateIdString = GetTemplateIdString(templateContext) }; GetDiscoveryConfig(templateContext, templateConfig); pageContext.ConfigurationXml = XmlHelper.Serialize(templateConfig, false); return true; }
public bool LoadConfigurationXml(IPageContext pageContext) { var templateContext = pageContext as ITemplateContext; if (templateContext == null) { throw new InvalidOperationException("No template context provided for Input Parser. Configuration could not be loaded."); } var templateConfig = new TemplateInputConfig { Name = templateContext.OutputFolder.DisplayName, Description = templateContext.OutputFolder.Description, RunAsAccount = GetRunAsAccounts(templateContext), TemplateIdString = GetTemplateIdString(templateContext) }; GetDiscoveryConfig(templateContext, templateConfig); pageContext.ConfigurationXml = XmlHelper.Serialize(templateConfig, false); return(true); }