Esempio n. 1
0
        public void RestoreContainers(string containerRoot, string wardenUsersGroup)
        {
            if (Directory.Exists(containerRoot))
            {
                var fileSystem       = new FileSystemManager();
                var containerService = ContainerService.Warden_RestoreFromContainerBasePath(containerRoot, wardenUsersGroup);

                var containers = containerService.GetContainers();

                // Recover containers primarily for deletion
                foreach (var container in containers)
                {
                    try
                    {
                        var containerClient = new ContainerClient(containerService, container, fileSystem);
                        containerClients.TryAdd(containerClient.Handle, containerClient);
                    }
                    catch (Exception ex)
                    {
                        log.ErrorException(ex);
                    }
                }

                Task.Run(async() =>
                {
                    try
                    {
                        await RemoveAllContainersAsync();
                    }
                    catch (Exception ex)
                    {
                        log.ErrorException(ex);
                    }
                });
            }
        }