コード例 #1
0
        public override DeploymentDetails GenerateDeploymentDetails(IReadOnlyList <string> listPreprocessResult, string initiationSource, string recommendedBranchIP, IReadOnlyList <string> limitedToBranches)
        {
            try
            {
                Dictionary <string, string> v = _QueryResults[initiationSource];

                if (v != null)
                {
                    _QueryResults.Remove(initiationSource);

                    System.Collections.Generic.Dictionary <string, string> kvp = TemplateKVP.ToDictionary(i => i.Key, i => i.Value);

                    foreach (string k in v.Keys)
                    {
                        kvp[k] = v[k];
                    }

                    DeploymentDetails ret = base.GenerateDeploymentDetails(listPreprocessResult, initiationSource, recommendedBranchIP, limitedToBranches);

                    CustomizeInstructionSet(ret.ISet, kvp, ret.BranchIP, initiationSource, false);

                    return(ret);
                }
            }
            catch (Exception ex)
            {
                STEM.Sys.EventLog.WriteEntry("SQLController.GenerateDeploymentDetails", new Exception(initiationSource, ex).ToString(), STEM.Sys.EventLog.EventLogEntryType.Error);
            }

            return(null);
        }
コード例 #2
0
        public override DeploymentDetails GenerateDeploymentDetails(IReadOnlyList <string> listPreprocessResult, string initiationSource, string recommendedBranchIP, IReadOnlyList <string> limitedToBranches)
        {
            try
            {
                if (!_PreProcessResult.ContainsKey(initiationSource))
                {
                    return(null);
                }

                XmlDoc doc = _PreProcessResult[initiationSource];

                System.Collections.Generic.Dictionary <string, string> kvp = TemplateKVP.ToDictionary(i => i.Key, i => i.Value);

                lock (doc)
                {
                    if (!doc.Nodes.ContainsKey(initiationSource))
                    {
                        return(null);
                    }

                    XElement node = doc.Nodes[initiationSource];

                    foreach (XElement e in node.Descendants())
                    {
                        kvp[e.Name.LocalName] = e.Value;
                    }
                }

                InstructionSet clone = GetTemplateInstance(true);

                CustomizeInstructionSet(clone, kvp, recommendedBranchIP, initiationSource, false);

                DeploymentDetails dd = new DeploymentDetails(clone, recommendedBranchIP);

                lock (_Assignments)
                    _Assignments[dd.ISet.ID] = doc;

                return(dd);
            }
            catch (Exception ex)
            {
                STEM.Sys.EventLog.WriteEntry("XmlConsumingController.GenerateDeploymentDetails", new Exception(initiationSource, ex).ToString(), STEM.Sys.EventLog.EventLogEntryType.Error);
            }

            return(null);
        }
コード例 #3
0
        public override DeploymentDetails GenerateDeploymentDetails(IReadOnlyList <string> listPreprocessResult, string initiationSource, string recommendedBranchIP, IReadOnlyList <string> limitedToBranches)
        {
            try
            {
                Dictionary <string, string> v = _QueryResults[initiationSource];

                if (v != null)
                {
                    _QueryResults.Remove(initiationSource);

                    System.Collections.Generic.Dictionary <string, string> kvp = TemplateKVP.ToDictionary(i => i.Key, i => i.Value);

                    foreach (string k in v.Keys)
                    {
                        kvp[k] = v[k];
                    }

                    InstructionSet clone = GetTemplateInstance(true);

                    CustomizeInstructionSet(clone, kvp, recommendedBranchIP, initiationSource, false);

                    DeploymentDetails dd = new DeploymentDetails(clone, recommendedBranchIP);

                    if (dd != null)
                    {
                        foreach (Instruction ins in dd.ISet.Instructions)
                        {
                            foreach (PropertyInfo prop in ins.GetType().GetProperties().Where(p => p.PropertyType.IsSubclassOf(typeof(IAuthentication))))
                            {
                                IAuthentication a = prop.GetValue(ins) as IAuthentication;

                                if (a.VersionDescriptor.TypeName == "STEM.Surge.SQLServer.Authentication")
                                {
                                    PropertyInfo i = a.GetType().GetProperties().FirstOrDefault(p => p.Name == "SqlDatabaseAddress");
                                    if (i != null)
                                    {
                                        string k = i.GetValue(a) as string;
                                        if (String.IsNullOrEmpty(k))
                                        {
                                            i.SetValue(a, Authentication.SqlDatabaseAddress);

                                            i = a.GetType().GetProperties().FirstOrDefault(p => p.Name == "SqlUser");
                                            if (i != null)
                                            {
                                                i.SetValue(a, Authentication.SqlUser);
                                            }

                                            i = a.GetType().GetProperties().FirstOrDefault(p => p.Name == "SqlPassword");
                                            if (i != null)
                                            {
                                                i.SetValue(a, Authentication.SqlPassword);
                                            }

                                            i = a.GetType().GetProperties().FirstOrDefault(p => p.Name == "SqlDatabaseName");
                                            if (i != null)
                                            {
                                                i.SetValue(a, Authentication.SqlDatabaseName);
                                            }

                                            i = a.GetType().GetProperties().FirstOrDefault(p => p.Name == "UseIntegratedSecurity");
                                            if (i != null)
                                            {
                                                i.SetValue(a, Authentication.UseIntegratedSecurity);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }

                    return(dd);
                }
            }
            catch (Exception ex)
            {
                STEM.Sys.EventLog.WriteEntry("SQLController.GenerateDeploymentDetails", new Exception(initiationSource, ex).ToString(), STEM.Sys.EventLog.EventLogEntryType.Error);
            }

            return(null);
        }