public async Task<IEnumerable<AppIdentity>> FetchDeployments(string deploymentId)
        {
            var apps = new HashSet<AppIdentity>();

            DeploymentConfig deploymentConfig = await _deploymentRepository.FetchDeploymentConfig();
            foreach (string appId in deploymentConfig.ListApplications(deploymentId))
            {
                foreach (string version in deploymentConfig.ListVersions(appId, deploymentId))
                {
                    AppIdentity appIdentity = new AppIdentity(appId, version);
                    try
                    {
                        if (!await _deploymentRepository.HasApplicationBinaries(appIdentity))
                        {
                            Trace.TraceError($"Could not binaries for application {appIdentity} in the yams repository");
                            continue;
                        }

                        apps.Add(appIdentity);
                    }
                    catch (Exception e)
                    {
                        Trace.TraceError($"Exception occured while loading application {appIdentity}, Exception: {e}");
                    }
                }
            }
            return apps;
        }
 public Task<string> ResolveSymbol(AppIdentity appIdentity, string symbol)
 {
     string symbolValue = symbol;
     switch (symbol)
     {
         case "Id":
             symbolValue = appIdentity.Id;
             break;
         case "Version":
             symbolValue = appIdentity.Version.ToString();
             break;
         case "Version.Major":
             symbolValue = appIdentity.Version.Major.ToString();
             break;
         case "Version.Minor":
             symbolValue = appIdentity.Version.Minor.ToString();
             break;
         case "Version.Build":
             symbolValue = appIdentity.Version.Build.ToString();
             break;
         case "DeploymentId":
             symbolValue = _deploymentId;
             break;
         case "InstanceId":
             symbolValue = _instanceId;
             break;
     }
     return Task.FromResult(symbolValue);
 }
Example #3
0
        public async Task TestAddApplication()
        {
            AppIdentity appIdentity = new AppIdentity("test.myapp", new Version(1, 0, 0));
            await AddApplication(appIdentity);

            Assert.IsNotNull(_applicationPool.GetApplication(appIdentity));
            Assert.AreEqual("TestProcess.exe foo1 foo2", GetOutput(appIdentity));
        }
Example #4
0
 public IApplication GetApplication(AppIdentity appIdentity)
 {
     if (!HasApplication(appIdentity))
     {
         return null;
     }
     return _applications[appIdentity];
 }
        private async Task<ApplicationConfig> Parse(ApplicationConfigData appConfigData, AppIdentity identity)
        {
            string id = identity.Id;
            Version version = new Version(identity.Version.ToString());
            string args = await SubstituteSymbols(appConfigData.ExeArgs, identity);

            return new ApplicationConfig(new AppIdentity(id, version), appConfigData.ExeName, args);
        }
 public async Task DeleteApplicationBinaries(AppIdentity appIdentity)
 {
     CloudBlobDirectory blobDirectory = GetBlobDirectory(appIdentity);
     if (!await blobDirectory.ExistsAsync())
     {
         throw new BinariesNotFoundException(
             $"Cannot delete binaries for application {appIdentity} because they were not found");
     }
     await blobDirectory.DeleteAsync();
 }
Example #7
0
 public async Task RemoveApplication(AppIdentity appIdentity)
 {
     IApplication application;
     if (!_applications.TryRemove(appIdentity, out application))
     {
         throw new ArgumentException(string.Format("Cannot remove application {0} because it doesn't exist in the pool", appIdentity));
     }
     application.Exited -= OnApplicationExited;
     await application.Stop();
     await Task.Delay(5000);
 }
        public async Task TestInstallApplication()
        {
            _applicationPool = new ApplicationPoolStub();
            IApplicationFactory applicationFactory = new ApplicationFactoryStub();
            _applicationInstaller = new ApplicationInstaller(_applicationsRoot, null, applicationFactory, _applicationPool);

            AppIdentity appIdentity = new AppIdentity("test.app", new SemVersion(1,0,0));
            await _applicationInstaller.Install(new AppInstallConfig(appIdentity));

            Assert.True(_applicationPool.HasApplicationBeenAdded(appIdentity));
        }
Example #9
0
 public Task DeleteApplicationBinaries(AppIdentity appIdentity)
 {
     string path = GetBinariesPath(appIdentity);
     if (FileUtils.DirectoryDoesntExistOrEmpty(path))
     {
         throw new BinariesNotFoundException(
             $"Cannot delete binaries for application {appIdentity} because they were not found");
     }
     Directory.Delete(path, true);
     return Task.CompletedTask;
 }
        public async Task TestParseApplicationConfig()
        {
            string path = Path.Combine(Directory.GetCurrentDirectory(), "Data\\ApplicationConfigParser\\AppConfig.json");
            const string deploymentId = "deployment_id";
            const string instanceId = "instance_id";
            AppIdentity identity = new AppIdentity("HelloApp", new Version(1,0,0));
            ApplicationConfig appConfig = await new ApplicationConfigParser(new ApplicationConfigSymbolResolver(deploymentId, instanceId)).ParseFile(path, identity);

            Assert.AreEqual(identity, appConfig.Identity);
            Assert.AreEqual("HelloApp.exe", appConfig.ExeName);
            Assert.AreEqual("HelloApp_1.0_instance_id OrleansConfiguration.xml deploymentId=HelloApp_1.0_deployment_id", appConfig.ExeArgs);
        }
        private async Task<string> SubstituteSymbols(string str, AppIdentity appIdentity)
        {
            ISet<string> symbols = new HashSet<string>();
            const string pattern = @"\{(.*?)\}";
            foreach (Match m in Regex.Matches(str, pattern))
            {
                symbols.Add(m.Groups[1].ToString());
            }

            foreach (string symbol in symbols)
            {
                str = await SubstitueSymbol(str, symbol, appIdentity);
            }
            return str;
        }
Example #12
0
 public IEnumerable<string> ListDeploymentIds(AppIdentity appIdentity)
 {
     string appId = appIdentity.Id;
     string version = appIdentity.Version.ToString();
     if (!_apps.ContainsKey(appId))
     {
         return new string[] {};
     }
     var appConfig = _apps[appId];
     if (!appConfig.Versions.ContainsKey(version))
     {
         return new string[] {};
     }
     return _apps[appId].Versions[version].DeploymentIds;
 }
Example #13
0
 public async Task DownloadApplication(AppIdentity appIdentity)
 {
     try
     {
         string destPath = Path.Combine(_applicationRootPath,
             ApplicationUtils.GetApplicationRelativePath(appIdentity));
         await
             _deploymentRepository.DownloadApplicationBinaries(appIdentity, destPath,
                 ConflictResolutionMode.OverwriteExistingBinaries);
     }
     catch (BinariesNotFoundException)
     {
         Trace.TraceError(
             $"{appIdentity} could not be downloaded because it was not found in the Yams repository");
     }
 }
        public async Task TestParseApplicationConfig()
        {
            string path = Path.Combine(Directory.GetCurrentDirectory(), "Data\\ApplicationConfigParser\\AppConfig.json");
            const string clusterId = "clusterid1";
            const string instanceId = "instanceid1";
            
            AppIdentity identity = new AppIdentity("HelloApp", new SemVersion(1,0,0));
            Dictionary<string, string> properties = new Dictionary<string, string> {["NodeType"] = "PROD"};
            AppDeploymentConfig appDeploymentConfig = new AppDeploymentConfig(identity, new [] {clusterId}, properties);
            ApplicationConfig appConfig = await new ApplicationConfigParser(new ApplicationConfigSymbolResolver(clusterId, instanceId),
                new JsonSerializer(new DiagnosticsTraceWriter())).ParseFile(path, appDeploymentConfig);

            Assert.Equal(identity, appConfig.Identity);
            Assert.Equal("HelloApp.exe", appConfig.ExeName);
            Assert.Equal("HelloApp_1.0_instanceid1 foo bar=HelloApp_1.0_clusterid1 nodeType=PROD", appConfig.ExeArgs);
        }
Example #15
0
 public async Task DownloadApplication(AppIdentity appIdentity)
 {
     IRemoteDirectory appDeploymentDir =
         await _deploymentsRootDirectory.GetDirectory(appIdentity.Id);
     if (await appDeploymentDir.Exists())
     {
         IRemoteDirectory versionDir = await appDeploymentDir.GetDirectory(appIdentity.Version.ToString());
         if (await versionDir.Exists())
         {
             await
                 versionDir.Download(Path.Combine(_applicationRootPath,
                     ApplicationUtils.GetApplicationRelativePath(appIdentity)));
         }
         return;
     }
     Trace.TraceError("{0} could not be downloaded because it was not found in the blob storage", appIdentity);
 }
Example #16
0
        public static string GetTestApplicationOutput(string applicationRootPath, AppIdentity appIdentity)
        {
            string processOutputPath = Path.Combine(Path.Combine(applicationRootPath,ApplicationUtils.GetApplicationRelativePath(appIdentity)), "TestProcess.exe.out");

            int maxRetry = 10;
            while (maxRetry-- > 0)
            {
                Thread.Sleep(100);
                if (File.Exists(processOutputPath))
                {
                    break;
                }
            }

            using (StreamReader reader = new StreamReader(processOutputPath))
            {
                return reader.ReadToEnd();
            }
        }
        public DeploymentConfig Deserialize(string data)
        {
            DeploymentConfig deploymentConfig = new DeploymentConfig();
            Dictionary<string, AppDeploymentConfig> apps = new Dictionary<string, AppDeploymentConfig>();
            if (string.IsNullOrEmpty(data))
            {
                return deploymentConfig;
            }

            var appDeploymentConfigs = new List<AppDeploymentConfig>();
            ApplicationsData appsData = _jsonSerializer.Deserialize<ApplicationsData>(data);
            foreach (ApplicationData appData in appsData.Applications)
            {
                AppIdentity appIdentity = new AppIdentity(appData.Id, appData.Version);
                AppDeploymentConfig appDeploymentConfig 
                    = new AppDeploymentConfig(appIdentity, appData.TargetClusters, appData.Properties);
                appDeploymentConfigs.Add(appDeploymentConfig);
            }
            return new DeploymentConfig(appDeploymentConfigs);
        }
        public async Task TestRemoveApplication()
        {
            _applicationPool = new ApplicationPoolStub();
            IApplicationFactory applicationFactory = new ApplicationFactoryStub();
            _applicationInstaller = new ApplicationInstaller(_applicationsRoot, null, applicationFactory, _applicationPool);

            AppIdentity appIdentity = new AppIdentity("test.app", new SemVersion(1, 0, 0));
            _applicationInstaller.Install(new AppInstallConfig(appIdentity)).Wait();

            // make sure the app directory exists because uninstall will try to delete it
            string appPath = Path.Combine(_applicationsRoot, "test.app", "1.0.0");
            if (!Directory.Exists(appPath))
            {
                Directory.CreateDirectory(appPath);
            }
            await _applicationInstaller.UnInstall(appIdentity);

            Assert.False(_applicationPool.HasApplication(appIdentity));
            Assert.False(Directory.Exists(appPath));
        }
 public async Task DownloadApplicationBinaries(AppIdentity appIdentity, string localPath,
     ConflictResolutionMode conflictResolutionMode)
 {
     bool exists = !FileUtils.DirectoryDoesntExistOrEmpty(localPath);
     if (exists)
     {
         if (conflictResolutionMode == ConflictResolutionMode.DoNothingIfBinariesExist)
         {
             return;
         }
         if (conflictResolutionMode == ConflictResolutionMode.FailIfBinariesExist)
         {
             throw new DuplicateBinariesException(
                 $"Cannot download the binaries because the destination directory {localPath} contains files");
         }
     }
     CloudBlobDirectory blobDirectory = GetBlobDirectory(appIdentity);
     if (!await blobDirectory.ExistsAsync())
     {
         throw new BinariesNotFoundException("The binaries were not found in the Yams repository");
     }
     await BlobUtils.DownloadBlobDirectory(blobDirectory, localPath);
 }
Example #20
0
        public Task UploadApplicationBinaries(AppIdentity appIdentity, string localPath, ConflictResolutionMode conflictResolutionMode)
        {
            if (FileUtils.DirectoryDoesntExistOrEmpty(localPath))
            {
                throw new BinariesNotFoundException(
                    $"Binaries were not be uploaded because they were not found at the given path {localPath}");
            }

            string destPath = GetBinariesPath(appIdentity);
            bool binariesExist = FileUtils.DirectoryDoesntExistOrEmpty(destPath);
            if (binariesExist)
            {
                if (conflictResolutionMode == ConflictResolutionMode.DoNothingIfBinariesExist)
                {
                    return Task.CompletedTask;
                }
                if (conflictResolutionMode == ConflictResolutionMode.FailIfBinariesExist)
                {
                    throw new DuplicateBinariesException();
                }
            }
            return FileUtils.CopyDir(_path, localPath, true);
        }
Example #21
0
        protected override void ProcessRecord()
        {
            try
            {
                if (string.IsNullOrWhiteSpace(ConnectionString))
                {
                    throw new ArgumentException(nameof(ConnectionString));
                }
                if (ClustersIds.Length != AppsIds.Length)
                {
                    throw new ArgumentException(nameof(ClustersIds));
                }
                if (Versions.Length != AppsIds.Length)
                {
                    throw new ArgumentException(nameof(Versions));
                }
                if (BinariesPath != null && BinariesPath.Length != AppsIds.Length)
                {
                    throw new ArgumentException(nameof(BinariesPath));
                }
                if (AppsIds.Length == 0)
                {
                    throw new ArgumentException(nameof(AppsIds));
                }

                int activityId     = 0;
                var progressRecord = new ProgressRecord(activityId++, "Connect to blob storage",
                                                        "Connecting to blob storage");
                WriteProgress(progressRecord);
                var deploymentRepository = BlobStorageDeploymentRepository.Create(ConnectionString);
                progressRecord.RecordType = ProgressRecordType.Completed;
                WriteProgress(progressRecord);

                if (BinariesPath != null)
                {
                    var tasks = new List <Task>();
                    for (int i = 0; i < AppsIds.Length; ++i)
                    {
                        string appId        = AppsIds[i];
                        string version      = Versions[i];
                        string binariesPath = BinariesPath[i];

                        var newAppIdentity = new AppIdentity(appId, version);

                        if (BinariesPath != null)
                        {
                            tasks.Add(deploymentRepository.UploadApplicationBinaries(newAppIdentity, binariesPath,
                                                                                     BinariesConflictResolutionMode));
                        }
                    }
                    progressRecord = new ProgressRecord(activityId++, "UploadApplicationBinaries",
                                                        "Uploading binaries to blob storage");
                    WriteProgress(progressRecord);
                    Task.WhenAll(tasks).Wait();
                    progressRecord.RecordType = ProgressRecordType.Completed;
                    WriteProgress(progressRecord);
                }

                if (Deploy)
                {
                    progressRecord = new ProgressRecord(activityId++, "FetchDeploymentConfig",
                                                        "Fetching DeploymentConfig.json from blob storage");
                    WriteProgress(progressRecord);
                    var deploymentConfig = deploymentRepository.FetchDeploymentConfig().Result;
                    progressRecord.RecordType = ProgressRecordType.Completed;
                    WriteProgress(progressRecord);

                    for (int i = 0; i < AppsIds.Length; ++i)
                    {
                        string appId     = AppsIds[i];
                        string version   = Versions[i];
                        string clusterId = ClustersIds[i];

                        if (RemoveOldVersions && deploymentConfig.HasApplication(appId))
                        {
                            deploymentConfig = deploymentConfig.RemoveApplication(appId);
                        }

                        var newAppIdentity = new AppIdentity(appId, version);

                        if (deploymentConfig.HasApplication(newAppIdentity, clusterId) == false)
                        {
                            deploymentConfig = deploymentConfig.AddApplication(newAppIdentity, clusterId);
                        }
                    }

                    progressRecord = new ProgressRecord(activityId++, "PublishDeploymentConfig",
                                                        "Publishing DeploymentConfig.json to blob storage");
                    WriteProgress(progressRecord);
                    deploymentRepository.PublishDeploymentConfig(deploymentConfig).Wait();
                    progressRecord.RecordType = ProgressRecordType.Completed;
                    WriteProgress(progressRecord);

                    WriteObject(deploymentConfig);
                }

                if (WaitForDeploymentsToComplete)
                {
                    var waitForDeploymentsProgressRecord = new ProgressRecord(activityId++,
                                                                              "WaitForDeploymentsToComplete",
                                                                              "Waiting for all deployments to complete");
                    WriteProgress(waitForDeploymentsProgressRecord);

                    List <AppInfo> pendingApps = new List <AppInfo>();
                    for (int i = 0; i < AppsIds.Length; ++i)
                    {
                        AppInfo app = new AppInfo
                        {
                            Id        = AppsIds[i],
                            Version   = Versions[i],
                            ClusterId = ClustersIds[i]
                        };
                        pendingApps.Add(app);
                    }

                    while (pendingApps.Any())
                    {
                        var appDeployments = new List <AppDeploymentStatus>();
                        var fetchTasks     = new List <Task <ClusterDeploymentStatus> >();

                        progressRecord = new ProgressRecord(activityId++, "FetchClusterDeploymentStatus",
                                                            "Fetching deployments status");
                        WriteProgress(progressRecord);
                        foreach (string clusterId in ClustersIds)
                        {
                            fetchTasks.Add(
                                deploymentRepository.FetchClusterDeploymentStatus(clusterId, ttlSeconds: 60));
                        }
                        progressRecord.RecordType = ProgressRecordType.Completed;
                        WriteProgress(progressRecord);

                        ClusterDeploymentStatus[] result = Task.WhenAll(fetchTasks).Result;
                        foreach (var clusterDeploymentStatus in result)
                        {
                            appDeployments.AddRange(clusterDeploymentStatus.ListAll());
                        }

                        foreach (var appDeploymentStatus in appDeployments)
                        {
                            AppInfo app = pendingApps.FirstOrDefault(
                                appInfo => appInfo.ClusterId == appDeploymentStatus.ClusterId &&
                                appInfo.Id == appDeploymentStatus.Id &&
                                appInfo.Version == appDeploymentStatus.Version);
                            if (app != null)
                            {
                                pendingApps.Remove(app);
                                float quotient = (float)(AppsIds.Length - pendingApps.Count) / AppsIds.Length;
                                waitForDeploymentsProgressRecord.PercentComplete = (int)(100 * quotient);
                                WriteProgress(waitForDeploymentsProgressRecord);
                            }
                        }
                        Task.Delay(TimeSpan.FromSeconds(1)).Wait();
                    }

                    waitForDeploymentsProgressRecord.RecordType = ProgressRecordType.Completed;
                    WriteProgress(waitForDeploymentsProgressRecord);
                }
            }
            catch (Exception e)
            {
                ThrowTerminatingError(new ErrorRecord(e, "0", ErrorCategory.OperationStopped, null));
            }
        }
Example #22
0
 public static string GetApplicationRelativePath(AppIdentity appIdentity)
 {
     return(Path.Combine(appIdentity.Id, appIdentity.Version.ToString()));
 }
Example #23
0
 public GracefulShutdownProcessDecorator(AppIdentity identity, YamsConfig config, IProcess process, IIpcConnection ipcConnection)
     : base(identity, process)
 {
     _config        = config;
     _ipcConnection = ipcConnection;
 }
Example #24
0
 public ApplicationStub(AppIdentity appIdentity, string path)
 {
     Identity = appIdentity;
     Path     = path;
 }
Example #25
0
        public async Task UnInstall(AppIdentity appIdentity)
        {
            await _applicationPool.RemoveApplication(appIdentity);

            await FileUtils.DeleteDirectoryIfAny(GetApplicationAbsolutePath(appIdentity), recursive : true);
        }
Example #26
0
 public static void ClassInitialize(TestContext cont)
 {
     _appIdentity = new AppIdentity("id", new Version("1.0.0"));
     _appConfig   = new ApplicationConfig(_appIdentity, ExeName, TestExeArgs);
 }
Example #27
0
 private async Task AddApplication(AppIdentity appIdentity, string deploymentId, string binariesPath)
 {
     StorageAccountConnectionInfo connectionInfo = GetCurrentConnection();
     IDeploymentRepository repository = _deploymentRepositoryManager.GetRepository(connectionInfo);
     BusyWindow busyWindow = new BusyWindow{Message = "Please wait..\n\n" + "The binaries are being uploaded to blob storage"};
     busyWindow.Show();
     await repository.UploadApplicationBinaries(appIdentity, binariesPath, ConflictResolutionMode.DoNothingIfBinariesExist);
     busyWindow.Close();
     _deploymentConfig = _deploymentConfig.AddApplication(appIdentity, deploymentId);
     SaveLocalDeploymentConfig(connectionInfo);
 }
Example #28
0
        private async void OnUpdateVersion(object sender, RoutedEventArgs e)
        {
            StorageAccountConnectionInfo connectionInfo = GetCurrentConnection();
            string appId = GetSelectedAppId();
            string version = GetSelectedVersion();
	        AppIdentity appIdentity = new AppIdentity(appId, version);
			IEnumerable<string> availableDeploymentIds = _deploymentConfig.ListClusters(appIdentity);
            UpdateVersionDialog dialog = new UpdateVersionDialog(appId, version, availableDeploymentIds);
            if (dialog.ShowDialog() == true)
            {
                string newVersion = dialog.NewVersion;
                AppIdentity newAppIdentity = new AppIdentity(appIdentity.Id, newVersion);
                IEnumerable<string> selectedDeploymentIds = dialog.SelectedDeploymentIds;
                foreach (string deploymentId in selectedDeploymentIds)
                {
                    await AddApplication(newAppIdentity, deploymentId, dialog.BinariesPath);
                    _deploymentConfig = _deploymentConfig.RemoveApplication(appIdentity, deploymentId);
                }

                SaveLocalDeploymentConfig(connectionInfo);
            }
        }
Example #29
0
        private async Task AddApplication(AppIdentity appIdentity)
        {
            IApplication application = await _applicationFactory.CreateApplication(appIdentity, GetApplicationPath(appIdentity));

            await _applicationPool.AddApplication(application);
        }
Example #30
0
 private string GetApplicationPath(AppIdentity appIdentity)
 {
     return(Path.Combine(_applicationsRootPath, appIdentity.Id,
                         appIdentity.Version.ToString()));
 }
Example #31
0
 private string GetOutput(AppIdentity appIdentity)
 {
     return(TestUtils.GetTestApplicationOutput(_applicationsRootPath, appIdentity));
 }
Example #32
0
        public void TestThatGetApplicationReturnsNullIfApplicationDoesntExist()
        {
            AppIdentity appIdentity = new AppIdentity("test.myapp", new Version(1, 0, 0));

            Assert.Null(_applicationPool.GetApplication(appIdentity));
        }
Example #33
0
 public void Create(AppIdentity entity)
 {
     AIR.CRUD(entity, EntityState.Added);
 }
Example #34
0
 public Process(AppIdentity identity, string exePath, bool showProcessWindow)
 {
     _identity          = identity;
     _exePath           = exePath;
     _showProcessWindow = showProcessWindow;
 }
Example #35
0
 private static string GetDeploymentRelativePath(AppIdentity appIdentity)
 {
     return(Path.Combine(appIdentity.Id, appIdentity.Version.ToString()));
 }
Example #36
0
        public AppDeploymentStatus GetAppDeploymentStatus(string clusterId, string instanceId, AppIdentity appIdentity)
        {
            ClusterDeploymentStatus clusterDeploymentStatus;

            if (!_clusters.TryGetValue(clusterId, out clusterDeploymentStatus))
            {
                return(null);
            }
            return(clusterDeploymentStatus.GetAppDeploymentStatus(instanceId, appIdentity));
        }
        public async Task UploadApplicationBinaries(AppIdentity appIdentity, string localPath,
            ConflictResolutionMode conflictResolutionMode)
        {
            if (FileUtils.DirectoryDoesntExistOrEmpty(localPath))
            {
                throw new BinariesNotFoundException(
                    $"Binaries were not be uploaded because they were not found at the given path {localPath}");
            }

            if (conflictResolutionMode == ConflictResolutionMode.OverwriteExistingBinaries)
            {
                await DeleteApplicationBinaries(appIdentity);
            }
            else
            {
                bool exists = await HasApplicationBinaries(appIdentity);

                if (exists)
                {
                    if (conflictResolutionMode == ConflictResolutionMode.DoNothingIfBinariesExist)
                    {
                        return;
                    }

                    if (conflictResolutionMode == ConflictResolutionMode.FailIfBinariesExist)
                    {
                        throw new DuplicateBinariesException(
                            $"Cannot override binaries when flag {ConflictResolutionMode.FailIfBinariesExist} is used");
                    }
                }
            }

            // at this point we know that it is either OverwriteExistingBinaries mode or the binaries don't exist
            await BlobUtils.UploadDirectory(localPath, _blobContainer, GetBlobDirectoryRelPath(appIdentity));
        }
Example #38
0
 private string GetApplicationAbsolutePath(AppIdentity appIdentity)
 {
     return(Path.Combine(_applicationsRootPath, ApplicationUtils.GetApplicationRelativePath(appIdentity)));
 }
Example #39
0
 public AppDeploymentConfig(AppIdentity appIdentity, IEnumerable<string> targetClusters,
     IReadOnlyDictionary<string, string> properties) : base(appIdentity, properties)
 {
     TargetClusters = new HashSet<string>(targetClusters);
 }
        public Task <bool> HasApplicationBinaries(AppIdentity appIdentity)
        {
            string path = GetBinariesPath(appIdentity);

            return(Task.FromResult(!FileUtils.DirectoryDoesntExistOrEmpty(path)));
        }
Example #41
0
 public static string GetDeploymentRelativePath(AppIdentity appIdentity)
 {
     return Path.Combine(appIdentity.Id, appIdentity.Version.ToString());
 }
Example #42
0
 public GetLookups(
     PublicServiceSoapClient c,
     AppIdentity app) : base(c, app)
 {
 }
Example #43
0
 public static ILookupCalls Init(AppIdentity app) =>
 new GetLookups(new PublicServiceSoapClient(EndpointConfiguration.PublicServiceSoap12), app);
Example #44
0
 public bool HasApplication(AppIdentity appIdentity)
 {
     return(_apps.ContainsKey(appIdentity));
 }
Example #45
0
 public Task UnInstall(AppIdentity appIdentity)
 {
     _applicationPool.RemoveApplication(appIdentity);
     return(Task.CompletedTask);
 }
 private string GetBlobDirectoryRelPath(AppIdentity appIdentity)
 {
     return(appIdentity.Id + "/" + appIdentity.Version);
 }
Example #47
0
 public void Edit(AppIdentity entity)
 {
     AIR.CRUD(entity, EntityState.Modified);
 }
Example #48
0
 public AppDeploymentConfig(AppIdentity appIdentity) : base(appIdentity)
 {
 }
 public Task <bool> HasApplicationBinaries(AppIdentity appIdentity)
 {
     return(GetBlobDirectory(appIdentity).ExistsAsync());
 }
Example #50
0
 public AppDeploymentConfig(AppIdentity appIdentity, IEnumerable<string> clustersIds) : this(appIdentity, clustersIds,
     new Dictionary<string, string>())
 {
 }
Example #51
0
 public DeploymentInfo(AppIdentity appIdentity, string deploymentId)
 {
     AppIdentity  = appIdentity;
     DeploymentId = deploymentId;
 }
Example #52
0
 public Task<IApplication> CreateApplication(AppIdentity appIdentity, string appPath)
 {
     return Task.FromResult((IApplication)new ApplicationStub(appIdentity, appPath));
 }
Example #53
0
 public ApplicationConfig(AppIdentity identity, string exeName, string exeArgs)
 {
     Identity = identity;
     ExeArgs  = exeArgs;
     ExeName  = exeName;
 }
Example #54
0
 private void OnVersionAddDeployment(object sender, RoutedEventArgs e)
 {
     StorageAccountConnectionInfo connectionInfo = GetCurrentConnection();
     string appId = GetSelectedAppId();
     string version = GetSelectedVersion();
     AddNewDeploymentDialog dialog = new AddNewDeploymentDialog(appId, version);
     if (dialog.ShowDialog() == true)
     {
         AppIdentity appIdentity = new AppIdentity(appId, SemVersion.Parse(version));
         _deploymentConfig = _deploymentConfig.AddApplication(appIdentity, dialog.DeploymentId);
         SaveLocalDeploymentConfig(connectionInfo);
     }
 }
        private CloudBlobDirectory GetBlobDirectory(AppIdentity appIdentity)
        {
            string relPath = GetBlobDirectoryRelPath(appIdentity);

            return(_blobContainer.GetDirectoryReference(relPath));
        }
Example #56
0
 private async void OnAddApplication(object sender, RoutedEventArgs e)
 {
     StorageAccountConnectionInfo connectionInfo = GetCurrentConnection();
     AddNewApplicationDialog dialog = new AddNewApplicationDialog();
     if (dialog.ShowDialog() == true)
     {
         AppIdentity appIdentity = new AppIdentity(dialog.ApplicationName, SemVersion.Parse(dialog.Version));
         await AddApplication(appIdentity, dialog.DeploymentId, dialog.BinariesPath);
     }
 }
Example #57
0
 private string GetBinariesPath(AppIdentity appIdentity)
 {
     return(Path.Combine(_path, GetDeploymentRelativePath(appIdentity)));
 }