Skip to content

Fixes to set and remove diag extension cmdlets #484

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 15, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ public class RemoveAzureVMDiagnosticsExtensionCommand : VirtualMachineDiagnostic

internal void ExecuteCommand()
{
// We do not support this cmdlet for now...
throw new NotSupportedException();
ExtensionName = DiagnosticsExtensionType;
Publisher = DiagnosticsExtensionNamespace;

// RemovePredicateExtensions();
// WriteObject(VM);
RemovePredicateExtensions();
WriteObject(VM);
}

protected override void ProcessRecord()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

using System;
using System.IO;
using System.Linq;
using System.Management.Automation;
using System.Text;
using System.Xml;
Expand Down Expand Up @@ -121,6 +122,17 @@ protected override void ValidateParameters()
ValidateConfiguration();
ExtensionName = DiagnosticsExtensionType;
Publisher = DiagnosticsExtensionNamespace;

// If the user didn't specify an extension reference name and the input VM already has a diagnostics extension,
// reuse its reference name
if (string.IsNullOrEmpty(ReferenceName))
{
ResourceExtensionReference diagnosticsExtension = ResourceExtensionReferences.FirstOrDefault(ExtensionPredicate);
if (diagnosticsExtension != null)
{
ReferenceName = diagnosticsExtension.ReferenceName;
}
}
}

private void ValidateStorageAccount()
Expand Down