Skip to content

Commit c589bbb

Browse files
committed
remove some more cache scaffolding bits
1 parent 0f84994 commit c589bbb

File tree

10 files changed

+69
-316
lines changed

10 files changed

+69
-316
lines changed

src/Common/Commands.Common/Properties/Resources.Designer.cs

Lines changed: 1 addition & 128 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Common/Commands.Common/Properties/Resources.resx

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -171,18 +171,6 @@
171171
<data name="AzureDirectoryName" xml:space="preserve">
172172
<value>Windows Azure Powershell</value>
173173
</data>
174-
<data name="AzureEmulatorDirectory" xml:space="preserve">
175-
<value>Emulator</value>
176-
</data>
177-
<data name="AzureEmulatorNotInstalledMessage" xml:space="preserve">
178-
<value>Azure Emulator is not installed and is required</value>
179-
</data>
180-
<data name="AzureEmulatorPathPortion" xml:space="preserve">
181-
<value>Azure Emulator\emulator</value>
182-
</data>
183-
<data name="AzureEmulatorRegistryKey" xml:space="preserve">
184-
<value>SOFTWARE\Microsoft\Windows Azure Emulator</value>
185-
</data>
186174
<data name="AzurePortalUrl" xml:space="preserve">
187175
<value>https://manage.windowsazure.com</value>
188176
</data>
@@ -192,22 +180,6 @@
192180
<data name="AzureSdkDirectory" xml:space="preserve">
193181
<value>Azure SDK\{0}\</value>
194182
</data>
195-
<data name="AzureSdkInstallPathRegistryKeyValue" xml:space="preserve">
196-
<value>InstallPath</value>
197-
</data>
198-
<data name="AzureSdkRegistryKeyName" xml:space="preserve">
199-
<value>SOFTWARE\Microsoft\Microsoft SDKs\ServiceHosting</value>
200-
</data>
201-
<data name="AzureSdkVersionNotSupported" xml:space="preserve">
202-
<value>The installed Azure SDK version is not supported. Make sure you version is between {0} and {1} inclusive</value>
203-
</data>
204-
<data name="AzureException_WrapExistingError_DetailedErrorFormat" xml:space="preserve">
205-
<value>Azure service management error
206-
{0}</value>
207-
</data>
208-
<data name="AzureToolsNotInstalledMessage" xml:space="preserve">
209-
<value>Azure Authoring Tools are not installed and are required. Installation of Azure SDK for .NET is recommended with Microsoft Web Platform Installer (PI) available at http://www.microsoft.com/web/downloads/platform.aspx.</value>
210-
</data>
211183
<data name="BaseUriEmpty" xml:space="preserve">
212184
<value>Base Uri was empty.</value>
213185
<comment>WAPackIaaS</comment>
@@ -227,9 +199,6 @@
227199
<data name="BlobEndpointUriEnv" xml:space="preserve">
228200
<value>AZURE_BLOBSTORAGE_TEMPLATE</value>
229201
</data>
230-
<data name="CacheMismatchMessage" xml:space="preserve">
231-
<value>Please upgrade the cache runtime of role '{0}' to '{1}' using Set-AzureServiceProjectRole -RoleName {0} -Runtime Cache -Version {1}</value>
232-
</data>
233202
<data name="CacheRuntimeUrl" xml:space="preserve">
234203
<value>CACHERUNTIMEURL</value>
235204
</data>
@@ -676,18 +645,6 @@ Please follow these steps in the portal:
676645
<data name="ManifestUri" xml:space="preserve">
677646
<value>http://az413943.vo.msecnd.net/node/runtimemanifest_0.7.5.2.xml</value>
678647
</data>
679-
<data name="MaxSupportAzureSdkVersion" xml:space="preserve">
680-
<value>v2.5</value>
681-
</data>
682-
<data name="MemcacheEndpointName" xml:space="preserve">
683-
<value>memcache_default</value>
684-
</data>
685-
<data name="MemcacheEndpointPort" xml:space="preserve">
686-
<value>11211</value>
687-
</data>
688-
<data name="MinSupportAzureSdkVersion" xml:space="preserve">
689-
<value>v2.5</value>
690-
</data>
691648
<data name="MissingPythonPreReq" xml:space="preserve">
692649
<value>Python 2.7 is not installed. Please install it as well as Django 1.4.</value>
693650
</data>

src/ServiceManagement/Services/Commands.Test/CloudService/Utilities/AzureServiceTests.cs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -554,17 +554,27 @@ public void TestResolveRuntimePackageUrls()
554554
addNodeWorkerCmdlet = new AddAzureNodeWorkerRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime, Name = overrideWorkerRoleName, Instances = 2 };
555555
addNodeWorkerCmdlet.ExecuteCmdlet();
556556

557-
string cacheWebRoleName = "cacheWebRole";
558-
string cacheRuntimeVersion = "1.7.0";
559-
AddAzureNodeWebRoleCommand addAzureWebRole = new AddAzureNodeWebRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime, Name = cacheWebRoleName };
557+
string webRole2Name = "WebRole2";
558+
AddAzureNodeWebRoleCommand addAzureWebRole = new AddAzureNodeWebRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime, Name = webRole2Name };
560559
addAzureWebRole.ExecuteCmdlet();
561560

562561
CloudServiceProject testService = new CloudServiceProject(rootPath, FileUtilities.GetContentFilePath("Services"));
563562
RuntimePackageHelper.SetRoleRuntime(testService.Components.Definition, matchWebRoleName, testService.Paths, version: "0.8.2");
564563
RuntimePackageHelper.SetRoleRuntime(testService.Components.Definition, matchWorkerRoleName, testService.Paths, version: "0.8.2");
565564
RuntimePackageHelper.SetRoleRuntime(testService.Components.Definition, overrideWebRoleName, testService.Paths, overrideUrl: "http://OVERRIDE");
566565
RuntimePackageHelper.SetRoleRuntime(testService.Components.Definition, overrideWorkerRoleName, testService.Paths, overrideUrl: "http://OVERRIDE");
567-
testService.AddRoleRuntime(testService.Paths, cacheWebRoleName, Resources.CacheRuntimeValue, cacheRuntimeVersion, RuntimePackageHelper.GetTestManifest(files));
566+
567+
bool exceptionWasThrownOnSettingCacheRole = false;
568+
try
569+
{
570+
string cacheRuntimeVersion = "1.7.0";
571+
testService.AddRoleRuntime(testService.Paths, webRole2Name, Resources.CacheRuntimeValue, cacheRuntimeVersion, RuntimePackageHelper.GetTestManifest(files));
572+
}
573+
catch (NotSupportedException)
574+
{
575+
exceptionWasThrownOnSettingCacheRole = true;
576+
}
577+
Assert.True(exceptionWasThrownOnSettingCacheRole);
568578
testService.Components.Save(testService.Paths);
569579

570580
// Get the publishing process started by creating the package
@@ -578,7 +588,6 @@ public void TestResolveRuntimePackageUrls()
578588
RuntimePackageHelper.ValidateRoleRuntime(updatedService.Components.Definition, matchWebRoleName, "http://cdn/node/foo.exe;http://cdn/iisnode/default.exe", null);
579589
RuntimePackageHelper.ValidateRoleRuntime(updatedService.Components.Definition, overrideWebRoleName, null, "http://OVERRIDE");
580590
RuntimePackageHelper.ValidateRoleRuntime(updatedService.Components.Definition, overrideWorkerRoleName, null, "http://OVERRIDE");
581-
RuntimePackageHelper.ValidateRoleRuntimeVariable(updatedService.Components.GetRoleStartup(cacheWebRoleName), Resources.CacheRuntimeVersionKey, cacheRuntimeVersion);
582591
}
583592
}
584593
}

src/ServiceManagement/Services/Commands.Utilities/Commands.Utilities.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@
192192
<Compile Include="CloudService\Model\UpgradeStatus.cs" />
193193
<Compile Include="CloudService\Model\VirtualIP.cs" />
194194
<Compile Include="CloudService\SetSettings.cs" />
195+
<Compile Include="Common\AzureTools\AzureSdkVersionInfo.cs" />
195196
<Compile Include="Common\AzureTools\AzureTool.cs" />
196197
<Compile Include="Common\AzureTools\CsEncrypt.cs" />
197198
<Compile Include="Common\AzureTools\CsPack.cs" />
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
namespace Microsoft.WindowsAzure.Commands.Utilities.Common.AzureTools
16+
{
17+
internal class AzureSdkVersionInfo
18+
{
19+
//When intergrate with new Azure SDK, please update the versions here.
20+
//If you find there are other version strings to update, please move them to here.
21+
public const string SupportAzureSdkVersionRegKey = "v2.5";
22+
public const string SupportAzureSdkVersion = "2.5.0";
23+
}
24+
}

src/ServiceManagement/Services/Commands.Utilities/Common/AzureTools/AzureTool.cs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,15 @@
1717
using System.IO;
1818
using System.Linq;
1919
using Microsoft.Win32;
20-
using Microsoft.WindowsAzure.Commands.Common.Properties;
20+
using Microsoft.WindowsAzure.Commands.Utilities.Properties;
21+
using Microsoft.WindowsAzure.Commands.Utilities.Common.AzureTools;
2122

2223
namespace Microsoft.WindowsAzure.Commands.Utilities.CloudService.AzureTools
2324
{
2425
public class AzureTool
2526
{
27+
public const string SupportAzureSdkVersion = "2.5.0";
28+
2629
public static void Validate()
2730
{
2831
// This instantiation will throw if user is running with incompatible Microsoft Azure SDK version.
@@ -82,9 +85,7 @@ public static string GetStorageEmulatorDirectory()
8285

8386
private static string GetSdkVersionRegistryValue()
8487
{
85-
string version = string.Empty;
86-
string min = Resources.MinSupportAzureSdkVersion;
87-
string max = Resources.MaxSupportAzureSdkVersion;
88+
string version = string.Empty;
8889
try
8990
{
9091
using (RegistryKey key = Registry.LocalMachine.OpenSubKey(Resources.AzureSdkRegistryKeyName))
@@ -93,13 +94,11 @@ private static string GetSdkVersionRegistryValue()
9394
{
9495
throw new InvalidOperationException(Resources.AzureToolsNotInstalledMessage);
9596
}
96-
version = key.GetSubKeyNames()
97-
.Where(n => (n.CompareTo(min) == 1 && n.CompareTo(max) == -1) || n.CompareTo(min) == 0 || n.CompareTo(max) == 0)
98-
.Max<string>();
97+
version = key.GetSubKeyNames().FirstOrDefault(n => n == AzureSdkVersionInfo.SupportAzureSdkVersionRegKey);
9998

10099
if (string.IsNullOrEmpty(version) && key.GetSubKeyNames().Length > 0)
101100
{
102-
throw new InvalidOperationException(string.Format(Resources.AzureSdkVersionNotSupported, min, max));
101+
throw new InvalidOperationException(string.Format(Resources.AzureSdkVersionNotSupported, AzureSdkVersionInfo.SupportAzureSdkVersionRegKey));
103102
}
104103
else if (string.IsNullOrEmpty(version) && key.GetSubKeyNames().Length == 0)
105104
{
@@ -109,10 +108,9 @@ private static string GetSdkVersionRegistryValue()
109108
}
110109
catch (InvalidOperationException)
111110
{
112-
//temporary workaround: catch exception and fall back to v2.5
113111
if (IgnoreMissingSDKError)
114112
{
115-
version = "v2.5";
113+
version = AzureSdkVersionInfo.SupportAzureSdkVersionRegKey;
116114
}
117115
else
118116
{

0 commit comments

Comments
 (0)