Ejemplo n.º 1
0
        //private void CopyResourceFiles(Assembly assembly, IEnumerable<string> resources, ServerConfig server, ConDepSettings settings)
        //{
        //    if (resources == null || assembly == null) return;

        //    var scriptPublisher = new PowerShellScriptPublisher(settings);
        //    scriptPublisher.PublishDslScripts(server);
        //}

        private void PublishConDepNode(ServerConfig server, ConDepSettings settings)
        {
            Logger.WithLogSection("Validating ConDepNode", () =>
            {
                string path;

                var executionPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "ConDepNode.exe");
                if (!File.Exists(executionPath))
                {
                    var currentPath = Path.Combine(Directory.GetCurrentDirectory(), "ConDepNode.exe");
                    if (!File.Exists(currentPath))
                    {
                        throw new FileNotFoundException("Could not find ConDepNode.exe. Paths tried: \n" +
                                                        executionPath + "\n" + currentPath);
                    }
                    path = currentPath;
                }
                else
                {
                    path = executionPath;
                }

                var nodeUrl = new ConDepNodeUrl(server, settings);

                var nodePublisher = new ConDepNodePublisher(path, Path.Combine(server.GetServerInfo().OperatingSystem.ProgramFilesFolder, "ConDepNode", Path.GetFileName(path)), nodeUrl);
                nodePublisher.Execute(server);
                if (!nodePublisher.ValidateNode(nodeUrl, server.DeploymentUser.UserName, server.DeploymentUser.Password, server))
                {
                    throw new ConDepNodeValidationException("Unable to make contact with ConDep Node or return content from API.");
                }

                Logger.Info(string.Format("ConDep Node successfully validated on {0}", server.Name));
                Logger.Info(string.Format("Node listening on {0}", nodeUrl.ListenUrl));
            });
        }
Ejemplo n.º 2
0
        private void PublishConDepNode(ServerConfig server, ConDepSettings settings)
        {
            Logger.WithLogSection("Validating ConDepNode", () =>
                {
                    string path;

                    var executionPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "ConDepNode.exe");
                    if (!File.Exists(executionPath))
                    {
                        var currentPath = Path.Combine(Directory.GetCurrentDirectory(), "ConDepNode.exe");
                        if (!File.Exists(currentPath))
                        {
                            throw new FileNotFoundException("Could not find ConDepNode.exe. Paths tried: \n" +
                                                            executionPath + "\n" + currentPath);
                        }
                        path = currentPath;
                    }
                    else
                    {
                        path = executionPath;
                    }

                    var nodeUrl = new ConDepNodeUrl(server);

                    var nodePublisher = new ConDepNodePublisher(path, Path.Combine(server.GetServerInfo().OperatingSystem.ProgramFilesFolder, "ConDepNode", Path.GetFileName(path)), nodeUrl, new PowerShellExecutor());
                    nodePublisher.Execute(server);
                    if (!nodePublisher.ValidateNode(nodeUrl, server.DeploymentUser.UserName, server.DeploymentUser.Password, server))
                    {
                        throw new ConDepNodeValidationException("Unable to make contact with ConDep Node or return content from API.");
                    }

                    Logger.Info(string.Format("ConDep Node successfully validated on {0}", server.Name));
                    Logger.Info(string.Format("Node listening on {0}", nodeUrl.ListenUrl));
                });
        }