コード例 #1
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);
        }
コード例 #2
0
        public async Task <IEnumerable <AppIdentity> > FetchDeployments(string deploymentId)
        {
            var apps = new HashSet <AppIdentity>();

            DeploymentDirectoryConfig deploymentDirectoryConfig = await FetchDeploymentConfig(_deploymentRootDir);

            foreach (DeploymentConfig deploymentConfig in deploymentDirectoryConfig.DeploymentsConfigs.Where(deploymentConfig => deploymentConfig.DeploymentIds.Contains(deploymentId)))
            {
                try
                {
                    IRemoteDirectory deploymentDir = await _deploymentRootDir.GetDirectory(deploymentConfig.AppIdentity.Id);

                    if (await deploymentDir.Exists())
                    {
                        deploymentDir = await deploymentDir.GetDirectory(deploymentConfig.AppIdentity.Version.ToString());
                    }
                    if (!await deploymentDir.Exists())
                    {
                        Trace.TraceError("Could not find deployment {0}", deploymentConfig.AppIdentity);
                        continue;
                    }
                    if (apps.Contains(deploymentConfig.AppIdentity))
                    {
                        Trace.TraceError(
                            "Application {0} has already been deployed, the request will be ignored.", deploymentConfig.AppIdentity);
                        continue;
                    }

                    apps.Add(deploymentConfig.AppIdentity);
                }
                catch (Exception e)
                {
                    Trace.TraceError("Exception occured while loading application {0}, Exception: {1}", deploymentConfig.AppIdentity, e);
                }
            }
            return(apps);
        }