Esempio n. 1
0
        private static IDisposable StartLogStream(ApplicationManager appManager)
        {
            LogStreamWaitHandle waitHandle = null;
            Task task = null;

            if (Debugger.IsAttached)
            {
                // Set to verbose level
                appManager.SettingsManager.SetValue("SCM_TRACE_LEVEL", "4").Wait();

                RemoteLogStreamManager mgr = appManager.CreateLogStreamManager("kudu");
                waitHandle = new LogStreamWaitHandle(mgr.GetStream().Result);
                task       = Task.Factory.StartNew(() =>
                {
                    string line = null;
                    var trace   = new DefaultTraceListener();
                    while ((line = waitHandle.WaitNextLine(-1)) != null)
                    {
                        trace.WriteLine(line);
                    }
                });
            }

            return(new DisposableAction(() =>
            {
                if (waitHandle != null)
                {
                    waitHandle.Dispose();
                    task.Wait();
                }
            }));
        }
Esempio n. 2
0
        internal ApplicationManager(ISiteManager siteManager, Site site, string appName, ISettingsResolver settingsResolver)
        {
            _siteManager      = siteManager;
            _site             = site;
            _appName          = appName;
            _settingsResolver = settingsResolver;

            // Always null in public Kudu, but makes the code more similar to private Kudu
            NetworkCredential credentials = null;

            SiteUrl    = site.SiteUrl.ToString();
            ServiceUrl = site.ServiceUrl.ToString();

            DeploymentManager     = new RemoteDeploymentManager(site.ServiceUrl + "api", credentials);
            SettingsManager       = new RemoteDeploymentSettingsManager(site.ServiceUrl + "api/settings", credentials);
            LegacySettingsManager = new RemoteDeploymentLegacySettingsManager(site.ServiceUrl + "settings", credentials);
            LogStreamManager      = new RemoteLogStreamManager(site.ServiceUrl + "api/logstream", credentials);
            SSHKeyManager         = new RemoteSSHKeyManager(site.ServiceUrl + "api/sshkey", credentials);
            VfsManager            = new RemoteVfsManager(site.ServiceUrl + "api/vfs", credentials);
            VfsWebRootManager     = new RemoteVfsManager(site.ServiceUrl + "api/vfs/site/wwwroot", credentials);
            LiveScmVfsManager     = new RemoteVfsManager(site.ServiceUrl + "api/scmvfs", credentials);
            ZipManager            = new RemoteZipManager(site.ServiceUrl + "api/zip", credentials);
            RuntimeManager        = new RemoteRuntimeManager(site.ServiceUrl + "api/diagnostics/runtime", credentials);
            CommandExecutor       = new RemoteCommandExecutor(site.ServiceUrl + "api/command", credentials);
            ProcessManager        = new RemoteProcessManager(site.ServiceUrl + "api/processes", credentials);
            WebHooksManager       = new RemoteWebHooksManager(site.ServiceUrl + "api/hooks", credentials);
            RepositoryManager     = new RemoteRepositoryManager(site.ServiceUrl + "api/scm", credentials);
            JobsManager           = new RemoteJobsManager(site.ServiceUrl + "api", credentials);
            LogFilesManager       = new RemoteLogFilesManager(site.ServiceUrl + "api/logs", credentials);
            SiteExtensionManager  = new RemoteSiteExtensionManager(site.ServiceUrl + "api", credentials);

            var repositoryInfo = RepositoryManager.GetRepositoryInfo().Result;

            GitUrl = repositoryInfo.GitUrl.OriginalString;
        }
Esempio n. 3
0
        internal ApplicationManager(ISiteManager siteManager, Site site, string appName, ISettingsResolver settingsResolver)
        {
            _siteManager      = siteManager;
            _site             = site;
            _appName          = appName;
            _settingsResolver = settingsResolver;

            SiteUrl    = site.SiteUrl;
            ServiceUrl = site.ServiceUrl;

            DeploymentManager = new RemoteDeploymentManager(site.ServiceUrl + "deployments");
            SettingsManager   = new RemoteDeploymentSettingsManager(site.ServiceUrl + "settings");
            LogStreamManager  = new RemoteLogStreamManager(site.ServiceUrl + "logstream");
            SSHKeyManager     = new RemoteSSHKeyManager(site.ServiceUrl + "sshkey");
            VfsManager        = new RemoteVfsManager(site.ServiceUrl + "vfs");
            VfsWebRootManager = new RemoteVfsManager(site.ServiceUrl + "vfs/site/wwwroot");
            LiveScmVfsManager = new RemoteVfsManager(site.ServiceUrl + "scmvfs");
            ZipManager        = new RemoteZipManager(site.ServiceUrl + "zip");
            CommandExecutor   = new RemoteCommandExecutor(site.ServiceUrl + "command");
            ProcessManager    = new RemoteProcessManager(site.ServiceUrl + "diagnostics/processes");
            WebHooksManager   = new RemoteWebHooksManager(site.ServiceUrl + "hooks");
            RepositoryManager = new RemoteRepositoryManager(site.ServiceUrl + "scm");

            var repositoryInfo = RepositoryManager.GetRepositoryInfo().Result;

            GitUrl = repositoryInfo.GitUrl.OriginalString;
        }
Esempio n. 4
0
        public void TestLogStreamNotFound()
        {
            string appName = KuduUtils.GetRandomWebsiteName("TestLogStreamNotFound");

            ApplicationManager.Run(appName, appManager =>
            {
                RemoteLogStreamManager manager = new RemoteLogStreamManager(appManager.ServiceUrl + "/logstream/notfound");
                var ex = KuduAssert.ThrowsUnwrapped<WebException>(() => manager.GetStream().Wait());
                Assert.Equal(((HttpWebResponse)ex.Response).StatusCode, HttpStatusCode.NotFound);
            });
        }
        public void TestLogStreamNotFound()
        {
            string appName = "TestLogStreamNotFound";

            ApplicationManager.Run(appName, appManager =>
            {
                RemoteLogStreamManager manager = new RemoteLogStreamManager(appManager.ServiceUrl + "/logstream/notfound");
                using (var waitHandle = new LogStreamWaitHandle(manager.GetStream().Result))
                {
                    string line = waitHandle.WaitNextLine(10000);
                    Assert.True(!String.IsNullOrEmpty(line) && line.Contains("Welcome"), "check welcome message: " + line);
                }
            });
        }