From f7e984b21719462c4f6ac78c9ffc533cece30643 Mon Sep 17 00:00:00 2001 From: Dmitry Kolinchuk Date: Thu, 18 Mar 2021 10:40:37 +0200 Subject: [PATCH 1/4] #542 Try to resolve instance type using short version if Release is null --- src/SIM.Instances/Instance.cs | 24 +++++++++++++++---- .../Buttons/CreateSupportPatchButton.cs | 13 +++++++++- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/SIM.Instances/Instance.cs b/src/SIM.Instances/Instance.cs index 259e5c7f..349c5fee 100644 --- a/src/SIM.Instances/Instance.cs +++ b/src/SIM.Instances/Instance.cs @@ -475,19 +475,33 @@ public InstanceType Type return InstanceType.SitecoreContainer; } - if (Product == Product.Undefined || Product.Release == null) + if (Product == Product.Undefined) { return InstanceType.SitecoreMember; } - if (Product.Release.Version.MajorMinorInt < 90) + int version; + + if (Product.Release != null) + { + version = Product.Release.Version.MajorMinorInt; + } + else { - return InstanceType.Sitecore8AndEarlier; + int.TryParse(Product.ShortVersion, out version); } - if (Product.Release.Version.MajorMinorInt >= 90) + if (version != default(int)) { - return InstanceType.Sitecore9AndLater; + if (version < 90) + { + return InstanceType.Sitecore8AndEarlier; + } + + if (version >= 90) + { + return InstanceType.Sitecore9AndLater; + } } return InstanceType.Unknown; diff --git a/src/SIM.Tool.Windows/MainWindowComponents/Buttons/CreateSupportPatchButton.cs b/src/SIM.Tool.Windows/MainWindowComponents/Buttons/CreateSupportPatchButton.cs index 45b92655..a6ce904f 100644 --- a/src/SIM.Tool.Windows/MainWindowComponents/Buttons/CreateSupportPatchButton.cs +++ b/src/SIM.Tool.Windows/MainWindowComponents/Buttons/CreateSupportPatchButton.cs @@ -18,7 +18,18 @@ public override bool IsVisible(Window mainWindow, Instance instance) if (base.IsVisible(mainWindow, instance)) { // Check if instance is Sitecore XP 9.0 or earlier - if (instance.Product.Release.Version.MajorMinorInt <= 90) + int version; + + if (instance.Product.Release != null) + { + version = instance.Product.Release.Version.MajorMinorInt; + } + else + { + int.TryParse(instance.Product.ShortVersion, out version); + } + + if (version != default(int) && version <= 90) { return true; } From 60ba78f26e9fe3ababc0a163a215a3df89eb85c4 Mon Sep 17 00:00:00 2001 From: Dmitry Kolinchuk Date: Thu, 18 Mar 2021 10:52:45 +0200 Subject: [PATCH 2/4] #542 Fix instance version resolving for groups --- .../Groups/InstanceOnlyGroup.cs | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/SIM.Tool.Windows/MainWindowComponents/Groups/InstanceOnlyGroup.cs b/src/SIM.Tool.Windows/MainWindowComponents/Groups/InstanceOnlyGroup.cs index 1df12de2..b979e68f 100644 --- a/src/SIM.Tool.Windows/MainWindowComponents/Groups/InstanceOnlyGroup.cs +++ b/src/SIM.Tool.Windows/MainWindowComponents/Groups/InstanceOnlyGroup.cs @@ -63,7 +63,7 @@ protected bool IsSitecoreContainer(Instance selectedInstance) protected bool IsSitecoreMember(Instance selectedInstance) { - if (selectedInstance.Product == Product.Undefined || selectedInstance.Product.Release == null) + if (selectedInstance.Product == Product.Undefined) { return true; } @@ -73,7 +73,9 @@ protected bool IsSitecoreMember(Instance selectedInstance) protected bool IsSitecore9AndLater(Instance selectedInstance) { - if (selectedInstance.Product.Release.Version.MajorMinorInt >= 90) + int version = this.GetSitecoreVersion(selectedInstance); + + if (version != default(int) && version >= 90) { return true; } @@ -83,7 +85,9 @@ protected bool IsSitecore9AndLater(Instance selectedInstance) protected bool IsSitecore8AndEarlier(Instance selectedInstance) { - if (selectedInstance.Product.Release.Version.MajorMinorInt < 90) + int version = this.GetSitecoreVersion(selectedInstance); + + if (version != default(int) && version < 90) { return true; } @@ -91,6 +95,22 @@ protected bool IsSitecore8AndEarlier(Instance selectedInstance) return false; } + protected int GetSitecoreVersion(Instance selectedInstance) + { + int version; + + if (selectedInstance.Product.Release != null) + { + version = selectedInstance.Product.Release.Version.MajorMinorInt; + } + else + { + int.TryParse(selectedInstance.Product.ShortVersion, out version); + } + + return version; + } + #endregion } } From ceeb13bbf7aaf55042225ac96b3a227e245c3a5f Mon Sep 17 00:00:00 2001 From: Andrey Filchenkov <22079019+AndreyFilchenkov@users.noreply.github.com> Date: Sun, 4 Apr 2021 00:33:47 +0300 Subject: [PATCH 3/4] EnvModel does not fail if env file contains comments --- src/SIM.ContainerInstaller/EnvModel.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/SIM.ContainerInstaller/EnvModel.cs b/src/SIM.ContainerInstaller/EnvModel.cs index 1b062240..a117ab6b 100644 --- a/src/SIM.ContainerInstaller/EnvModel.cs +++ b/src/SIM.ContainerInstaller/EnvModel.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections; +using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; @@ -232,9 +231,16 @@ public static EnvModel LoadFromFile(string path) while (!string.IsNullOrEmpty(line)) { int num = line.IndexOf('='); - string key = line.Substring(0, num); - string value = line.Substring(num + 1); - model[key] = value; + + if (num > 0) + { + string key = line.Substring(0, num); + + string value = line.Substring(num + 1); + + model[key] = value; + } + line = reader.ReadLine(); } } From 4946cad24d4fa7de95a71c5f095f161276ecc329 Mon Sep 17 00:00:00 2001 From: Andrey Filchenkov <22079019+AndreyFilchenkov@users.noreply.github.com> Date: Tue, 6 Apr 2021 20:37:25 +0300 Subject: [PATCH 4/4] Fix: 572"hosts" file could be corrupted Sif version for SC910 has been changed from 2.0.0 to 2.1.0 --- .../GlobalParamsConfig/XM/GlobalParams_9.1.0_XM1.json | 4 ++-- .../GlobalParamsConfig/XP/GlobalParams_9.1.0_XP0.json | 4 ++-- .../GlobalParamsConfig/XP/GlobalParams_9.1.0_XP1.json | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/SIM.Tool/GlobalParamsConfig/XM/GlobalParams_9.1.0_XM1.json b/src/SIM.Tool/GlobalParamsConfig/XM/GlobalParams_9.1.0_XM1.json index 9b26b791..fa1c6304 100644 --- a/src/SIM.Tool/GlobalParamsConfig/XM/GlobalParams_9.1.0_XM1.json +++ b/src/SIM.Tool/GlobalParamsConfig/XM/GlobalParams_9.1.0_XM1.json @@ -1,7 +1,7 @@ { "Parameters": { //global - "SIFVersion": "2.0.0", + "SIFVersion": "2.1.0", "SqlServer": "", "SqlAdminUser": "", "SqlAdminPassword": "", @@ -57,7 +57,7 @@ "InstallSIF": { "Type": "SIM.Sitecore9Installer.Tasks.InstallSIFTask, SIM.Sitecore9Installer", "TaskOptions": { - "InstallVersion": "2.0.0", + "InstallVersion": "2.1.0", "Repository": "https://sitecore.myget.org/F/sc-powershell/api/v2", "ExecutionOrder": "-100" } diff --git a/src/SIM.Tool/GlobalParamsConfig/XP/GlobalParams_9.1.0_XP0.json b/src/SIM.Tool/GlobalParamsConfig/XP/GlobalParams_9.1.0_XP0.json index 3f0209cf..b8603500 100644 --- a/src/SIM.Tool/GlobalParamsConfig/XP/GlobalParams_9.1.0_XP0.json +++ b/src/SIM.Tool/GlobalParamsConfig/XP/GlobalParams_9.1.0_XP0.json @@ -1,7 +1,7 @@ { "Parameters": { //global - "SIFVersion": "2.0.0", + "SIFVersion": "2.1.0", "SqlServer": "", "SqlAdminUser": "", "SqlAdminPassword": "", @@ -122,7 +122,7 @@ "InstallSIF": { "Type": "SIM.Sitecore9Installer.Tasks.InstallSIFTask, SIM.Sitecore9Installer", "TaskOptions": { - "InstallVersion": "2.0.0", + "InstallVersion": "2.1.0", "Repository": "https://sitecore.myget.org/F/sc-powershell/api/v2", "ExecutionOrder": "-100" } diff --git a/src/SIM.Tool/GlobalParamsConfig/XP/GlobalParams_9.1.0_XP1.json b/src/SIM.Tool/GlobalParamsConfig/XP/GlobalParams_9.1.0_XP1.json index 8cc106f9..7179ae07 100644 --- a/src/SIM.Tool/GlobalParamsConfig/XP/GlobalParams_9.1.0_XP1.json +++ b/src/SIM.Tool/GlobalParamsConfig/XP/GlobalParams_9.1.0_XP1.json @@ -1,7 +1,7 @@ { "Parameters": { //global - "SIFVersion": "2.0.0", + "SIFVersion": "2.1.0", "SqlServer": "", "SqlAdminUser": "", "SqlAdminPassword": "", @@ -112,7 +112,7 @@ "InstallSIF": { "Type": "SIM.Sitecore9Installer.Tasks.InstallSIFTask, SIM.Sitecore9Installer", "TaskOptions": { - "InstallVersion": "2.0.0", + "InstallVersion": "2.1.0", "Repository": "https://sitecore.myget.org/F/sc-powershell/api/v2", "ExecutionOrder": "-100" }