Example #1
0
        async Task <IEnumerable <WorkerResource> > FilterByState(IEnumerable <WorkerResource> workers)
        {
            var rootDocument = await Repository.LoadRootDocument().ConfigureAwait(false);

            var provider = new HealthStatusProvider(Repository,
                                                    new HashSet <MachineModelStatus>(),
                                                    healthStatuses,
                                                    commandOutputProvider,
                                                    rootDocument);

            workers = provider.Filter(workers);

            if (isDisabled.HasValue)
            {
                workers = workers.Where(m => m.IsDisabled == isDisabled.Value);
            }
            if (isCalamariOutdated.HasValue)
            {
                workers = workers.Where(m => m.HasLatestCalamari == !isCalamariOutdated.Value);
            }
            if (isTentacleOutdated.HasValue)
            {
                workers = workers.Where(m => (m.Endpoint as ListeningTentacleEndpointResource)?.TentacleVersionDetails.UpgradeSuggested == isTentacleOutdated.Value);
            }
            return(workers);
        }
Example #2
0
        private IEnumerable <WorkerResource> FilterByState(IEnumerable <WorkerResource> workers)
        {
            var provider = new HealthStatusProvider(Repository, new HashSet <string>(StringComparer.OrdinalIgnoreCase), healthStatuses, commandOutputProvider);

            workers = provider.Filter(workers);

            if (isDisabled.HasValue)
            {
                workers = workers.Where(m => m.IsDisabled == isDisabled.Value);
            }
            if (isCalamariOutdated.HasValue)
            {
                workers = workers.Where(m => m.HasLatestCalamari == !isCalamariOutdated.Value);
            }
            if (isTentacleOutdated.HasValue)
            {
                workers = workers.Where(m => (m.Endpoint as ListeningTentacleEndpointResource)?.TentacleVersionDetails.UpgradeSuggested == isTentacleOutdated.Value);
            }
            return(workers);
        }
        private IEnumerable <MachineResource> FilterByState(IEnumerable <MachineResource> environmentMachines)
        {
            var provider = new HealthStatusProvider(Repository, statuses, healthStatuses, commandOutputProvider);

            environmentMachines = provider.Filter(environmentMachines);

            if (isDisabled.HasValue)
            {
                environmentMachines = environmentMachines.Where(m => m.IsDisabled == isDisabled.Value);
            }
            if (isCalamariOutdated.HasValue)
            {
                environmentMachines = environmentMachines.Where(m => m.HasLatestCalamari == !isCalamariOutdated.Value);
            }
            if (isTentacleOutdated.HasValue)
            {
                environmentMachines = environmentMachines.Where(m => (m.Endpoint as ListeningTentacleEndpointResource)?.TentacleVersionDetails.UpgradeSuggested == isTentacleOutdated.Value);
            }
            return(environmentMachines);
        }
        private IEnumerable <WorkerResource> FilterByState(IEnumerable <WorkerResource> poolMachines, HealthStatusProvider provider)
        {
            poolMachines = provider.Filter(poolMachines);

            if (isDisabled.HasValue)
            {
                poolMachines = poolMachines.Where(m => m.IsDisabled == isDisabled.Value);
            }
            if (isCalamariOutdated.HasValue)
            {
                poolMachines = poolMachines.Where(m => m.HasLatestCalamari == !isCalamariOutdated.Value);
            }
            if (isTentacleOutdated.HasValue)
            {
                poolMachines =
                    poolMachines.Where(
                        m =>
                        (m.Endpoint as ListeningTentacleEndpointResource)?.TentacleVersionDetails.UpgradeSuggested ==
                        isTentacleOutdated.Value);
            }
            return(poolMachines);
        }