Ejemplo n.º 1
0
        public IReportStatus Execute(ServerConfig server, IReportStatus status, ConDepOptions options)
        {
            bool sectionAdded = false;

            try
            {
                if (ConDepGlobals.ServersWithPreOps.ContainsKey(server.Name))
                {
                    return(status);
                }

                ConDepGlobals.ServersWithPreOps.Add(server.Name, server);
                Logger.LogSectionStart("Pre-Operations");
                sectionAdded = true;

                var remotePreOps = new PreRemoteOps(server, this, options, _webDeploy);
                remotePreOps.Configure();
                remotePreOps.Execute(status);

                foreach (var element in _sequence)
                {
                    if (element is IOperateRemote)
                    {
                        ((IOperateRemote)element).Execute(server, status, options);
                        if (status.HasErrors)
                        {
                            return(status);
                        }
                    }
                    else if (element is CompositeSequence)
                    {
                        ((CompositeSequence)element).Execute(server, status, options);
                    }
                    else
                    {
                        throw new NotSupportedException();
                    }

                    if (status.HasErrors)
                    {
                        return(status);
                    }
                }

                return(status);
            }
            finally
            {
                if (sectionAdded)
                {
                    Logger.LogSectionEnd("Pre-Operations");
                }
            }
        }
Ejemplo n.º 2
0
 public static void ExecutePreOps(ConDepSettings conDepSettings, IReportStatus status, CancellationToken token)
 {
     Logger.WithLogSection("Executing pre-operations", () =>
     {
         foreach (var server in conDepSettings.Config.Servers)
         {
             Logger.WithLogSection(server.Name, () =>
             {
                 //Todo: This will not work with ConDep server. After first run, this key will always exist.
                 if (!ConDepGlobals.ServersWithPreOps.ContainsKey(server.Name))
                 {
                     var remotePreOps = new PreRemoteOps();
                     remotePreOps.Execute(server, status, conDepSettings, token);
                     ConDepGlobals.ServersWithPreOps.Add(server.Name, server);
                 }
             });
         }
     });
 }