From 3fa8dde15f3a0a36cd3a2edccb50fa68a4e59680 Mon Sep 17 00:00:00 2001 From: Raj Kamal Singh Date: Wed, 25 Mar 2015 12:24:03 +0530 Subject: [PATCH 1/3] Fix bug 2074697 - Set-ASSDevice silently terminates when no optional params are provided --- .../Cmdlets/DeviceDetails/SetAzureStorSimpleDevice.cs | 10 ++++++++++ .../Properties/Resources.Designer.cs | 9 +++++++++ .../Commands.StorSimple/Properties/Resources.resx | 3 +++ 3 files changed, 22 insertions(+) diff --git a/src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/DeviceDetails/SetAzureStorSimpleDevice.cs b/src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/DeviceDetails/SetAzureStorSimpleDevice.cs index ebe881ab5aba..51c51cacf12d 100644 --- a/src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/DeviceDetails/SetAzureStorSimpleDevice.cs +++ b/src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/DeviceDetails/SetAzureStorSimpleDevice.cs @@ -135,6 +135,16 @@ public override void ExecuteCmdlet() private bool ProcessParameters() { + // Make sure that atleast one of the settings has been provided. + // Its no use making a request when the user didnt specify any of + // the settings. + if (string.IsNullOrEmpty(NewName) && TimeZone == null && + string.IsNullOrEmpty(SecondaryDnsServer) && + (StorSimpleNetworkConfig == null || StorSimpleNetworkConfig.Count() < 1)) + { + throw new ArgumentException(Resources.SetASSDeviceNoSettingsProvided); + } + // Make sure that the DeviceId property has the appropriate value irrespective of the parameter set if (ParameterSetName == StorSimpleCmdletParameterSet.IdentifyByName) { diff --git a/src/ServiceManagement/StorSimple/Commands.StorSimple/Properties/Resources.Designer.cs b/src/ServiceManagement/StorSimple/Commands.StorSimple/Properties/Resources.Designer.cs index dce6956f6fc5..c9b3fab944d4 100644 --- a/src/ServiceManagement/StorSimple/Commands.StorSimple/Properties/Resources.Designer.cs +++ b/src/ServiceManagement/StorSimple/Commands.StorSimple/Properties/Resources.Designer.cs @@ -1014,6 +1014,15 @@ internal static string SecretsValidationCompleteMessage { } } + /// + /// Looks up a localized string similar to No settings were provided for updating device details.. + /// + internal static string SetASSDeviceNoSettingsProvided { + get { + return ResourceManager.GetString("SetASSDeviceNoSettingsProvided", resourceCulture); + } + } + /// /// Looks up a localized string similar to Parameter Skip cannot be <0. /// diff --git a/src/ServiceManagement/StorSimple/Commands.StorSimple/Properties/Resources.resx b/src/ServiceManagement/StorSimple/Commands.StorSimple/Properties/Resources.resx index 3a016e9ef77f..38083bf5e3bd 100644 --- a/src/ServiceManagement/StorSimple/Commands.StorSimple/Properties/Resources.resx +++ b/src/ServiceManagement/StorSimple/Commands.StorSimple/Properties/Resources.resx @@ -513,4 +513,7 @@ Invalid value for Registration Key. CIK provided couldnt be used to decrypt the secrets! The exact exception while decrypting is "{0}"! + + No settings were provided for updating device details. + \ No newline at end of file From a274d99d9ed2da3e71fd5650edcdca304c9f7ad7 Mon Sep 17 00:00:00 2001 From: Raj Kamal Singh Date: Wed, 25 Mar 2015 12:41:07 +0530 Subject: [PATCH 2/3] change the resource message --- .../Commands.StorSimple/Properties/Resources.Designer.cs | 4 ++-- .../StorSimple/Commands.StorSimple/Properties/Resources.resx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ServiceManagement/StorSimple/Commands.StorSimple/Properties/Resources.Designer.cs b/src/ServiceManagement/StorSimple/Commands.StorSimple/Properties/Resources.Designer.cs index c9b3fab944d4..5e719c371334 100644 --- a/src/ServiceManagement/StorSimple/Commands.StorSimple/Properties/Resources.Designer.cs +++ b/src/ServiceManagement/StorSimple/Commands.StorSimple/Properties/Resources.Designer.cs @@ -1017,9 +1017,9 @@ internal static string SecretsValidationCompleteMessage { /// /// Looks up a localized string similar to No settings were provided for updating device details.. /// - internal static string SetASSDeviceNoSettingsProvided { + internal static string SetAzureStorSimpleDeviceNoSettingsProvided { get { - return ResourceManager.GetString("SetASSDeviceNoSettingsProvided", resourceCulture); + return ResourceManager.GetString("SetAzureStorSimpleDeviceNoSettingsProvided", resourceCulture); } } diff --git a/src/ServiceManagement/StorSimple/Commands.StorSimple/Properties/Resources.resx b/src/ServiceManagement/StorSimple/Commands.StorSimple/Properties/Resources.resx index 38083bf5e3bd..f5f51db79f44 100644 --- a/src/ServiceManagement/StorSimple/Commands.StorSimple/Properties/Resources.resx +++ b/src/ServiceManagement/StorSimple/Commands.StorSimple/Properties/Resources.resx @@ -513,7 +513,7 @@ Invalid value for Registration Key. CIK provided couldnt be used to decrypt the secrets! The exact exception while decrypting is "{0}"! - + No settings were provided for updating device details. \ No newline at end of file From 7262852b688b27a8b4107bdf446b5df1e293362c Mon Sep 17 00:00:00 2001 From: Raj Kamal Singh Date: Wed, 25 Mar 2015 15:14:30 +0530 Subject: [PATCH 3/3] Fix resource name --- .../Cmdlets/DeviceDetails/SetAzureStorSimpleDevice.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/DeviceDetails/SetAzureStorSimpleDevice.cs b/src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/DeviceDetails/SetAzureStorSimpleDevice.cs index 51c51cacf12d..f960cb18d7d6 100644 --- a/src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/DeviceDetails/SetAzureStorSimpleDevice.cs +++ b/src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/DeviceDetails/SetAzureStorSimpleDevice.cs @@ -142,7 +142,7 @@ private bool ProcessParameters() string.IsNullOrEmpty(SecondaryDnsServer) && (StorSimpleNetworkConfig == null || StorSimpleNetworkConfig.Count() < 1)) { - throw new ArgumentException(Resources.SetASSDeviceNoSettingsProvided); + throw new ArgumentException(Resources.SetAzureStorSimpleDeviceNoSettingsProvided); } // Make sure that the DeviceId property has the appropriate value irrespective of the parameter set