private static bool CheckFirewallEnabled(MachineHealthContainer machineHealthContainer) { SFDeployerTrace.WriteNoise(StringResources.Info_BPAWindowsFirewall); Parallel.ForEach( machineHealthContainer.GetHealthyMachineNames(), (string machineName) => { bool result = true; try { FabricDeployerServiceController.ServiceStartupType type = FabricDeployerServiceController.GetServiceStartupType(machineName, DMConstants.FirewallServiceName); if (type == FabricDeployerServiceController.ServiceStartupType.Disabled) { SFDeployerTrace.WriteError(StringResources.Error_BPAFirewallServiceDisabled, machineName); result = false; } } catch (Exception ex) { SFDeployerTrace.WriteError(StringResources.Error_BPAFirewallServiceQueryException, machineName, ex.Message); result = false; } try { ServiceController firewallSvc = FabricDeployerServiceController.GetService(DMConstants.FirewallServiceName, machineName); ServiceControllerStatus status = firewallSvc.Status; if (status == ServiceControllerStatus.Stopped || status == ServiceControllerStatus.StopPending) { SFDeployerTrace.WriteError(StringResources.Error_BPAFirewallServiceNotRunning, machineName, status.ToString()); result = false; } } catch (Exception ex) { SFDeployerTrace.WriteError(StringResources.Error_BPAFirewallServiceStatusException, machineName, ex.Message); result = false; } if (!result) { machineHealthContainer.MarkMachineAsUnhealthy(machineName); } }); return(machineHealthContainer.EnoughHealthyMachines()); }
private static bool CheckRemoteRegistryEnabled(MachineHealthContainer machineHealthContainer) { SFDeployerTrace.WriteNoise(StringResources.Info_BPARemoteRegistry); Parallel.ForEach( machineHealthContainer.GetHealthyMachineNames(), (string machineName) => { bool result = true; int retryCount = 5; for (int i = 0; i < retryCount; i++) { try { FabricDeployerServiceController.ServiceStartupType type = FabricDeployerServiceController.GetServiceStartupType(machineName, DMConstants.RemoteRegistryServiceName); if (type == FabricDeployerServiceController.ServiceStartupType.Disabled) { SFDeployerTrace.WriteError(StringResources.Error_BPARemoteRegistryServiceDisabled, machineName); result = false; } break; } catch (Exception ex) { SFDeployerTrace.WriteError(StringResources.Error_BPARemoteRegistryQueryException, machineName, ex.Message, i); if (i < retryCount - 1) { Thread.Sleep(TimeSpan.FromSeconds(10)); } else { result = false; } } } if (!result) { machineHealthContainer.MarkMachineAsUnhealthy(machineName); } }); return(machineHealthContainer.EnoughHealthyMachines()); }