Skip to content

Commit 3752414

Browse files
author
aliasgar16
committed
Fixed minor bugs.
Signed-off-by: aliasgar16 <[email protected]>
1 parent dc3e25b commit 3752414

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

src/ResourceManager/Compute/Commands.Compute/Extension/Chef/SetAzureVMChefExtension.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -433,19 +433,23 @@ private void ValidateParameters()
433433
bool IsClientRbEmpty = string.IsNullOrEmpty(this.ClientRb);
434434
bool IsChefServerUrlEmpty = string.IsNullOrEmpty(this.ChefServerUrl);
435435
bool IsValidationClientNameEmpty = string.IsNullOrEmpty(this.ValidationClientName);
436+
bool IsDaemonEmpty = string.IsNullOrEmpty(this.Daemon);
436437
// Validate ClientRb or ChefServerUrl and ValidationClientName should exist.
437438
if (IsClientRbEmpty && (IsChefServerUrlEmpty || IsValidationClientNameEmpty))
438439
{
439440
throw new ArgumentException(
440441
"Required -ClientRb or -ChefServerUrl and -ValidationClientName options.");
441442
}
442443

443-
bool IsDaemonValueInvalid = Array.IndexOf(new String[2] {"none", "service"}, this.Daemon) == -1;
444-
// Validation against the invalid use of Daemon option.
445-
if (IsDaemonValueInvalid || this.Linux.IsPresent)
444+
if (!IsDaemonEmpty)
446445
{
447-
throw new ArgumentException(
448-
"Invalid use of -Daemon option.");
446+
bool IsDaemonValueInvalid = Array.IndexOf(new String[2] {"none", "service"}, this.Daemon) == -1;
447+
// Validation against the invalid use of Daemon option.
448+
if (IsDaemonValueInvalid || this.Linux.IsPresent)
449+
{
450+
throw new ArgumentException(
451+
"Invalid use of -Daemon option.");
452+
}
449453
}
450454

451455
if (!string.IsNullOrEmpty(this.SecretFile) && !File.Exists(this.SecretFile))

src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/Chef/SetAzureVMChefExtension.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -293,19 +293,23 @@ protected override void ValidateParameters()
293293
bool IsClientRbEmpty = string.IsNullOrEmpty(this.ClientRb);
294294
bool IsChefServerUrlEmpty = string.IsNullOrEmpty(this.ChefServerUrl);
295295
bool IsValidationClientNameEmpty = string.IsNullOrEmpty(this.ValidationClientName);
296+
bool IsDaemonEmpty = string.IsNullOrEmpty(this.Daemon);
296297
// Validate ClientRb or ChefServerUrl and ValidationClientName should exist.
297298
if (IsClientRbEmpty && (IsChefServerUrlEmpty || IsValidationClientNameEmpty))
298299
{
299300
throw new ArgumentException(
300301
"Required -ClientRb or -ChefServerUrl and -ValidationClientName options.");
301302
}
302303

303-
bool IsDaemonValueInvalid = Array.IndexOf(new String[2] {"none", "service"}, this.Daemon) == -1;
304-
// Validation against the invalid use of Daemon option.
305-
if (IsDaemonValueInvalid || this.Linux.IsPresent)
304+
if (!IsDaemonEmpty)
306305
{
307-
throw new ArgumentException(
308-
"Invalid use of -Daemon option.");
306+
bool IsDaemonValueInvalid = Array.IndexOf(new String[2] {"none", "service"}, this.Daemon) == -1;
307+
// Validation against the invalid use of Daemon option.
308+
if (IsDaemonValueInvalid || this.Linux.IsPresent)
309+
{
310+
throw new ArgumentException(
311+
"Invalid use of -Daemon option.");
312+
}
309313
}
310314

311315
if (!string.IsNullOrEmpty(this.SecretFile) && !File.Exists(this.SecretFile))

src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/Chef/VirtualMachineChefExtensionCmdletBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class VirtualMachineChefExtensionCmdletBase : VirtualMachineExtensionCmdl
2121
protected const string ExtensionDefaultPublisher = "Chef.Bootstrap.WindowsAzure";
2222
protected const string ExtensionDefaultName = "ChefClient";
2323
protected const string LinuxExtensionName = "LinuxChefClient";
24-
protected const string PrivateConfigurationTemplate = "{{\"validation_key\":\"{0}\"}}";
24+
protected const string PrivateConfigurationTemplate = "validation_key";
2525
protected const string ClientRbTemplate = "client_rb";
2626
protected const string BootstrapVersionTemplate = "bootstrap_version";
2727
protected const string BootStrapOptionsTemplate = "bootstrap_options";

0 commit comments

Comments
 (0)