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 async Task <IEnumerable <AppDeploymentConfig> > FetchDeployments() { var apps = new HashSet <AppDeploymentConfig>(); DeploymentConfig deploymentConfig = await _deploymentRepository.FetchDeploymentConfig(); foreach (AppDeploymentConfig appDeploymentConfig in deploymentConfig.Where(_appDeploymentMatcher.IsMatch)) { AppIdentity appIdentity = appDeploymentConfig.AppIdentity; try { if (!await _deploymentRepository.HasApplicationBinaries(appIdentity)) { Trace.TraceError($"Could not find binaries for application {appIdentity} in the yams repository"); continue; } apps.Add(appDeploymentConfig); } catch (Exception e) { Trace.TraceError($"Exception occured while loading application {appIdentity}, Exception: {e}"); } } return(apps); }
private async Task <DeploymentConfig> FetchDeploymentConfig(StorageAccountConnectionInfo connectionInfo) { string path = GetDeploymentConfigLocalPath(connectionInfo.AccountName); if (File.Exists(path)) { return(new DeploymentConfig(File.ReadAllText(path))); } IDeploymentRepository connection = _deploymentRepositoryManager.GetRepository(connectionInfo); DeploymentConfig deploymentConfig = await connection.FetchDeploymentConfig(); SaveLocalDeploymentConfig(connectionInfo, deploymentConfig.RawData()); return(deploymentConfig); }
private async void OnSyncFromBlob(object sender, RoutedEventArgs e) { MessageBoxResult res = MessageBox.Show("This will ovewrite any local changes\n\n Are you sure you want to continue?", "Sync From Blob", MessageBoxButton.YesNo); if (res == MessageBoxResult.Yes) { StorageAccountConnectionInfo connectionInfo = GetCurrentConnection(); IDeploymentRepository connection = _deploymentRepositoryManager.GetRepository(connectionInfo); DeploymentConfig deploymentConfig = await connection.FetchDeploymentConfig(); SaveLocalDeploymentConfig(connectionInfo, deploymentConfig.RawData()); } }
public async Task TestGetDeploymentConfigWhenTheFileIsNotThere() { DeploymentConfig deploymentConfig = await _deploymentRepository.FetchDeploymentConfig(); Assert.False(deploymentConfig.ListApplications().Any()); }