This class exists to provide backwards compataility to the pre 3.4.0 changes to machine state. As of 3.4.0 the MachineModelStatus enum has been marked as obselete to be replaced with MachineModelHealthStatus
コード例 #1
0
        protected override async Task Execute()
        {
            var provider = new HealthStatusProvider(Repository, Log, statuses, healthStatuses);
            var environmentResources = await GetEnvironments().ConfigureAwait(false);
            IEnumerable<MachineResource> environmentMachines = await FilterByEnvironments(environmentResources).ConfigureAwait(false);
            environmentMachines = FilterByState(environmentMachines, provider);

            LogFilteredMachines(environmentMachines, provider, environmentResources);
        }
コード例 #2
0
        protected override void Execute()
        {
            var provider             = new HealthStatusProvider(Repository, Log, statuses, healthStatuses);
            var environmentResources = GetEnvironments();
            var environmentMachines  = FilterByEnvironments(environmentResources);

            environmentMachines = FilterByState(environmentMachines, provider);

            LogFilteredMachines(environmentMachines, provider, environmentResources);
        }
コード例 #3
0
 private void LogFilteredMachines(IEnumerable<MachineResource> environmentMachines, HealthStatusProvider provider, List<EnvironmentResource> environmentResources)
 {
     var orderedMachines = environmentMachines.OrderBy(m => m.Name).ToList();
     Log.Information("Machines: {Count}", orderedMachines.Count);
     foreach (var machine in orderedMachines)
     {
         Log.Information(" - {Machine:l} {Status:l} (ID: {MachineId:l}) in {Environments:l}", machine.Name, provider.GetStatus(machine), machine.Id,
             string.Join(" and ", machine.EnvironmentIds.Select(id => environmentResources.First(e => e.Id == id).Name)));
     }
 }
コード例 #4
0
        protected override async Task Execute()
        {
            var provider             = new HealthStatusProvider(Repository, Log, statuses, healthStatuses);
            var environmentResources = await GetEnvironments().ConfigureAwait(false);

            IEnumerable <MachineResource> environmentMachines = await FilterByEnvironments(environmentResources).ConfigureAwait(false);

            environmentMachines = FilterByState(environmentMachines, provider);

            LogFilteredMachines(environmentMachines, provider, environmentResources);
        }
コード例 #5
0
        private IEnumerable<MachineResource> FilterByState(IEnumerable<MachineResource> environmentMachines)
        {
            var provider = new HealthStatusProvider(Repository, Log, statuses, healthStatuses);
            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;
        }
コード例 #6
0
        private IEnumerable <MachineResource> FilterByState(IEnumerable <MachineResource> environmentMachines)
        {
            var provider = new HealthStatusProvider(Repository, Log, statuses, healthStatuses);

            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);
        }
コード例 #7
0
        private void LogFilteredMachines(IEnumerable <MachineResource> environmentMachines, HealthStatusProvider provider, List <EnvironmentResource> environmentResources)
        {
            var orderedMachines = environmentMachines.OrderBy(m => m.Name).ToList();

            Log.Information("Machines: {Count}", orderedMachines.Count);
            foreach (var machine in orderedMachines)
            {
                Log.Information(" - {Machine:l} {Status:l} (ID: {MachineId:l}) in {Environments:l}", machine.Name, provider.GetStatus(machine), machine.Id,
                                string.Join(" and ", machine.EnvironmentIds.Select(id => environmentResources.First(e => e.Id == id).Name)));
            }
        }