Skip to content

Commit d590357

Browse files
committed
Taking offline pr comments
1 parent 07750ad commit d590357

File tree

4 files changed

+15
-21
lines changed

4 files changed

+15
-21
lines changed

src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/PSRecoveryServicesClient/PSRecoveryServicesClientHelper.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ public void ValidateStorageAccountAssociation(
146146
catch (Exception)
147147
{
148148
validationSuccessful = false;
149+
locationValid = false;
150+
return;
149151
}
150152

151153
foreach (var storage in azureStorageListResponse.StorageAccounts)
@@ -164,20 +166,26 @@ public void ValidateStorageAccountAssociation(
164166
if (!associatedAccount)
165167
{
166168
validationSuccessful = false;
169+
locationValid = false;
170+
return;
167171
}
168172

169173
// Validate that the Geo Location of the storage account is the same as that of the vault.
170174
if (string.IsNullOrEmpty(currentStorageAccount.Properties.Location))
171175
{
172176
validationSuccessful = false;
177+
locationValid = false;
178+
return;
173179
}
174180

175181
if (0 != string.Compare(
176182
currentStorageAccount.Properties.Location,
177183
vaultLocation,
178184
StringComparison.OrdinalIgnoreCase))
179185
{
186+
validationSuccessful = true;
180187
locationValid = true;
188+
return;
181189
}
182190

183191
validationSuccessful = true;

src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Properties/Resources.Designer.cs

Lines changed: 0 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Properties/Resources.resx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,4 @@ Please provide a storage account with the same location as that of the vault.</v
253253
<data name="StorageAccountValidationUnsuccessful" xml:space="preserve">
254254
<value>The Subscription or Storage account couldn’t be validated. For failovers to be successful, the Subscription should belong to your account, the Storage account to the Subscription and Storage account location must be the same as location of your Vault.</value>
255255
</data>
256-
<data name="LocationInvalidWarning" xml:space="preserve">
257-
<value>The Location couldn’t be validated. For failovers to be successful, Storage account location must be the same as location of your Vault.</value>
258-
</data>
259256
</root>

src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Service/CreateAzureSiteRecoveryProtectionProfileObject.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -216,20 +216,18 @@ private void EnterpriseToAzureProtectionProfileObject()
216216
out validationSuccessful,
217217
out locationValid);
218218

219+
if (!validationSuccessful)
220+
{
221+
this.WriteWarning(string.Format(Properties.Resources.StorageAccountValidationUnsuccessful));
222+
}
223+
219224
if (!locationValid)
220225
{
221226
this.WriteWarning(string.Format(Properties.Resources.StorageIsNotInTheSameLocationAsVault));
222-
this.ConfirmAction(
223-
this.Force.IsPresent,
224-
string.Format(Properties.Resources.LocationInvalidWarning, this.targetName),
225-
string.Format(Properties.Resources.NewProtectionProfileObjectWhatIfMessage),
226-
this.targetName,
227-
new Action(this.ProceedToCreateProtectionProfileObject));
228227
}
229-
else if (!validationSuccessful)
230-
{
231-
this.WriteWarning(string.Format(Properties.Resources.StorageAccountValidationUnsuccessful));
232228

229+
if (!validationSuccessful || !locationValid)
230+
{
233231
this.ConfirmAction(
234232
this.Force.IsPresent,
235233
string.Format(Properties.Resources.ValidationUnsuccessfulWarning, this.targetName),

0 commit comments

Comments
 (0)