// Clean install requires machine be free of previous Fabric installations private static bool CheckForCleanInstall(StandAloneInstallerJsonModelBase config, MachineHealthContainer machineHealthContainer, bool isForcedRun = false) { SFDeployerTrace.WriteNoise(StringResources.Info_BPANoFabric); List <string> machineNamesTemp = StandaloneUtility.GetMachineNamesIncludingClient(machineHealthContainer.GetHealthyMachineNames()); var importantSettings = config.GetFabricSystemSettings(); string fabricDataRoot = importantSettings.ContainsKey(DMConstants.FabricDataRootString) ? importantSettings[DMConstants.FabricDataRootString] : null; bool localMachineFailed = false; Parallel.ForEach( machineNamesTemp, (string machineName) => { bool result = true; if (StandaloneUtility.IsFabricInstalled(machineName)) { SFDeployerTrace.WriteError(StringResources.Error_BPAPreviousFabricExists, machineName); result = false; } if (!isForcedRun) { if (fabricDataRoot != null) { IEnumerable <string> machineNodes = config.Nodes.Where(n => n.IPAddress == machineName).Select(n => n.NodeName); foreach (string node in machineNodes) { string nodeDirectory; if (StandaloneUtility.DataRootNodeExists(machineName, node, fabricDataRoot, out nodeDirectory)) { SFDeployerTrace.WriteError(StringResources.Error_BPADataRootNodeExists, node, machineName, nodeDirectory); result = false; } } } } if (!result) { if (Helpers.IsLocalIpAddress(machineName)) { localMachineFailed = true; } else { machineHealthContainer.MarkMachineAsUnhealthy(machineName); } } }); if (localMachineFailed) { return(false); } return(machineHealthContainer.EnoughHealthyMachines()); }
internal static bool ValidateRemoveNode(string machineName) { SFDeployerTrace.WriteInfo(StringResources.Info_BPAStart); //// TODO: (maburlik) Validate FabricClient connection var summary = new AnalysisSummary(); summary.LocalAdminPrivilege = CheckLocalAdminPrivilege(); IEnumerable <string> machineContainer = new List <string>() { machineName }; MachineHealthContainer machineHealthContainer = new MachineHealthContainer(machineContainer); summary.RequiredPortsOpen = StandaloneUtility.CheckRequiredPorts(machineHealthContainer); // Below depends on machines being reachable if (!summary.Passed) { SFDeployerTrace.WriteError(StringResources.Error_BPABailing); return(false); } summary.RpcCheckPassed = CheckRPCAccess(machineHealthContainer); // Below depend on remote registry access if (!summary.Passed) { SFDeployerTrace.WriteError(StringResources.Error_BPABailing); return(false); } bool hasFabricInstalled = StandaloneUtility.IsFabricInstalled(machineName); if (!hasFabricInstalled) { SFDeployerTrace.WriteError(StringResources.Error_BPARemoveNodeNeedsFabric, machineName); } LogResult(summary, hasFabricInstalled); return(summary.Passed && hasFabricInstalled); }
private static bool CheckAnyMachinesRemovable(IEnumerable <string> machineNames) { bool result = false; Parallel.ForEach( machineNames, (string machineName) => { if (StandaloneUtility.IsFabricInstalled(machineName)) { result = true; } }); if (!result) { SFDeployerTrace.WriteError(StringResources.Error_BPANoMachinesHaveFabricInstalled); } return(result); }