Skip to content

Commit 0937684

Browse files
authored
Merge pull request #2810 from NonStatic2014/bugfix
Write current module version to Verbose channel.
2 parents eefe2ec + 996c67b commit 0937684

File tree

5 files changed

+26
-4
lines changed

5 files changed

+26
-4
lines changed

src/ResourceManager/MachineLearning/Commands.MachineLearning/Cmdlets/ExportWebServiceDefinition.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace Microsoft.Azure.Commands.MachineLearning.Cmdlets
2727
WebServicesCmdletBase.CommandletSuffix,
2828
SupportsShouldProcess = true)]
2929
[OutputType(typeof(string))]
30-
public class ExportWebServiceDefinition : AzureRMCmdlet
30+
public class ExportWebServiceDefinition : WebServicesCmdletBase
3131
{
3232
private const string ExportToFileParamSet = "Export to file.";
3333
private const string ExportToStringParamSet = "Export to JSON string.";
@@ -60,7 +60,7 @@ public class ExportWebServiceDefinition : AzureRMCmdlet
6060
HelpMessage = "Do not ask for confirmation.")]
6161
public SwitchParameter Force { get; set; }
6262

63-
public override void ExecuteCmdlet()
63+
protected override void RunCmdlet()
6464
{
6565
string serializedDefinition =
6666
ModelsSerializationUtil.GetAzureMLWebServiceDefinitionJsonFromObject(this.WebService);

src/ResourceManager/MachineLearning/Commands.MachineLearning/Cmdlets/ImportWebServiceDefinition.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace Microsoft.Azure.Commands.MachineLearning.Cmdlets
2323
{
2424
[Cmdlet(VerbsData.Import, WebServicesCmdletBase.CommandletSuffix)]
2525
[OutputType(typeof(WebService))]
26-
public class ImportWebServiceDefinition : AzureRMCmdlet
26+
public class ImportWebServiceDefinition : WebServicesCmdletBase
2727
{
2828
private const string ImportFromFileParamSet = "Import from JSON file.";
2929
private const string ImportFromStringParamSet = "Import from JSON string.";
@@ -42,7 +42,7 @@ public class ImportWebServiceDefinition : AzureRMCmdlet
4242
[ValidateNotNullOrEmpty]
4343
public string JsonString { get; set; }
4444

45-
public override void ExecuteCmdlet()
45+
protected override void RunCmdlet()
4646
{
4747
string jsonDefinition = this.JsonString;
4848
if (string.Equals(

src/ResourceManager/MachineLearning/Commands.MachineLearning/Cmdlets/WebServicesCmdletBase.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ protected override void BeginProcessing()
8282
}
8383
catch (Exception ex)
8484
{
85+
this.WriteVersionInfoToDebugChannel();
8586
if (this.IsFatalException(ex))
8687
{
8788
ThrowTerminatingError(
@@ -105,6 +106,7 @@ protected override void EndProcessing()
105106
}
106107
catch (Exception ex)
107108
{
109+
this.WriteVersionInfoToDebugChannel();
108110
if (this.IsFatalException(ex))
109111
{
110112
ThrowTerminatingError(
@@ -138,6 +140,7 @@ protected override void StopProcessing()
138140
}
139141
catch (Exception ex)
140142
{
143+
this.WriteVersionInfoToDebugChannel();
141144
if (this.IsFatalException(ex))
142145
{
143146
throw;
@@ -169,6 +172,8 @@ public override void ExecuteCmdlet()
169172
}
170173
catch (Exception ex)
171174
{
175+
this.WriteVersionInfoToDebugChannel();
176+
172177
if (this.IsFatalException(ex))
173178
{
174179
throw;
@@ -329,5 +334,10 @@ ex is SecurityException ||
329334
ex is SEHException;
330335
}
331336

337+
private void WriteVersionInfoToDebugChannel()
338+
{
339+
var versionInfo = this.MyInvocation.MyCommand.Module.Version;
340+
this.WriteDebug(Resources.VersionInfo.FormatInvariant(versionInfo.ToString(3)));
341+
}
332342
}
333343
}

src/ResourceManager/MachineLearning/Commands.MachineLearning/Resources.Designer.cs

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

src/ResourceManager/MachineLearning/Commands.MachineLearning/Resources.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,4 +135,7 @@
135135
<data name="UpdateServiceWarning" xml:space="preserve">
136136
<value>Are you sure you want to update the machine learning web service "{0}" ?</value>
137137
</data>
138+
<data name="VersionInfo" xml:space="preserve">
139+
<value>Azure Machine Learning Module Version: "{0}"</value>
140+
</data>
138141
</root>

0 commit comments

Comments
 (0)