Skip to content

Commit e436766

Browse files
author
begoldsm
committed
Remove private packages, fix tracing
1 parent eea07b1 commit e436766

15 files changed

+171
-43
lines changed

src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics.Test/Commands.DataLakeAnalytics.Test.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@
6262
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.2.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
6363
<Private>True</Private>
6464
</Reference>
65-
<Reference Include="Microsoft.Azure.Management.DataLake.Analytics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
65+
<Reference Include="Microsoft.Azure.Management.DataLake.Analytics, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
6666
<SpecificVersion>False</SpecificVersion>
67-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.DataLake.Analytics.1.0.2\lib\net45\Microsoft.Azure.Management.DataLake.Analytics.dll</HintPath>
67+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.DataLake.Analytics.2.0.0\lib\net45\Microsoft.Azure.Management.DataLake.Analytics.dll</HintPath>
6868
<Private>True</Private>
6969
</Reference>
7070
<Reference Include="Microsoft.Azure.Management.DataLake.Store, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">

src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics.Test/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
66
<package id="Microsoft.Azure.Gallery" version="2.6.2-preview" targetFramework="net45" />
77
<package id="Microsoft.Azure.Management.Authorization" version="2.0.0" targetFramework="net45" />
8-
<package id="Microsoft.Azure.Management.DataLake.Analytics" version="1.0.2" targetFramework="net45" />
8+
<package id="Microsoft.Azure.Management.DataLake.Analytics" version="2.0.0" targetFramework="net45" />
99
<package id="Microsoft.Azure.Management.DataLake.Store" version="1.0.3" targetFramework="net45" />
1010
<package id="Microsoft.Azure.Management.ResourceManager" version="1.1.1-preview" targetFramework="net45" />
1111
<package id="Microsoft.Azure.Management.Resources" version="2.20.0-preview" targetFramework="net45" />

src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics/Commands.DataLakeAnalytics.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@
4545
<Reference Include="Microsoft.Azure.Common.NetFramework">
4646
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll</HintPath>
4747
</Reference>
48-
<Reference Include="Microsoft.Azure.Management.DataLake.Analytics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
48+
<Reference Include="Microsoft.Azure.Management.DataLake.Analytics, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
4949
<SpecificVersion>False</SpecificVersion>
50-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.DataLake.Analytics.1.0.2\lib\net45\Microsoft.Azure.Management.DataLake.Analytics.dll</HintPath>
50+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.DataLake.Analytics.2.0.0\lib\net45\Microsoft.Azure.Management.DataLake.Analytics.dll</HintPath>
5151
<Private>True</Private>
5252
</Reference>
5353
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">

src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<package id="Hyak.Common" version="1.0.3" targetFramework="net45" />
44
<package id="Microsoft.Azure.Common" version="2.1.0" targetFramework="net45" />
55
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
6-
<package id="Microsoft.Azure.Management.DataLake.Analytics" version="1.0.2" targetFramework="net45" />
6+
<package id="Microsoft.Azure.Management.DataLake.Analytics" version="2.0.0" targetFramework="net45" />
77
<package id="Microsoft.Azure.Management.Resources" version="2.20.0-preview" targetFramework="net45" />
88
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net45" />
99
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net45" />

src/ResourceManager/DataLakeStore/Commands.DataLakeStore.Test/Commands.DataLakeStore.Test.csproj

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,12 @@
6262
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.2.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
6363
<Private>True</Private>
6464
</Reference>
65-
<Reference Include="Microsoft.Azure.Management.DataLake.Store, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
66-
<SpecificVersion>False</SpecificVersion>
65+
<Reference Include="Microsoft.Azure.Management.DataLake.Store">
6766
<HintPath>..\..\..\packages\Microsoft.Azure.Management.DataLake.Store.1.0.3\lib\net45\Microsoft.Azure.Management.DataLake.Store.dll</HintPath>
6867
<Private>True</Private>
6968
</Reference>
70-
<Reference Include="Microsoft.Azure.Management.DataLake.StoreUploader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
71-
<SpecificVersion>False</SpecificVersion>
72-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.DataLake.StoreUploader.1.0.0-preview\lib\net45\Microsoft.Azure.Management.DataLake.StoreUploader.dll</HintPath>
69+
<Reference Include="Microsoft.Azure.Management.DataLake.StoreUploader">
70+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.DataLake.StoreUploader.1.0.1-preview\lib\net45\Microsoft.Azure.Management.DataLake.StoreUploader.dll</HintPath>
7371
<Private>True</Private>
7472
</Reference>
7573
<Reference Include="Microsoft.Azure.Management.ResourceManager, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">

src/ResourceManager/DataLakeStore/Commands.DataLakeStore.Test/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<package id="Microsoft.Azure.Gallery" version="2.6.2-preview" targetFramework="net45" />
77
<package id="Microsoft.Azure.Management.Authorization" version="2.0.0" targetFramework="net45" />
88
<package id="Microsoft.Azure.Management.DataLake.Store" version="1.0.3" targetFramework="net45" />
9-
<package id="Microsoft.Azure.Management.DataLake.StoreUploader" version="1.0.0-preview" targetFramework="net45" />
9+
<package id="Microsoft.Azure.Management.DataLake.StoreUploader" version="1.0.1-preview" targetFramework="net45" />
1010
<package id="Microsoft.Azure.Management.ResourceManager" version="1.1.1-preview" targetFramework="net45" />
1111
<package id="Microsoft.Azure.Management.Resources" version="2.20.0-preview" targetFramework="net45" />
1212
<package id="Microsoft.Azure.Test.Framework" version="1.0.6179.26854-prerelease" targetFramework="net45" />

src/ResourceManager/DataLakeStore/Commands.DataLakeStore/Commands.DataLakeStore.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
</Reference>
5353
<Reference Include="Microsoft.Azure.Management.DataLake.StoreUploader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
5454
<SpecificVersion>False</SpecificVersion>
55-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.DataLake.StoreUploader.1.0.0-preview\lib\net45\Microsoft.Azure.Management.DataLake.StoreUploader.dll</HintPath>
55+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.DataLake.StoreUploader.1.0.1-preview\lib\net45\Microsoft.Azure.Management.DataLake.StoreUploader.dll</HintPath>
5656
<Private>True</Private>
5757
</Reference>
5858
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">

src/ResourceManager/DataLakeStore/Commands.DataLakeStore/Commands/ExportAzureRmDataLakeStoreItem.cs

Lines changed: 70 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
using System;
2121
using System.Management.Automation;
2222
using System.Net;
23+
using Microsoft.Rest;
24+
using Microsoft.IdentityModel.Clients.ActiveDirectory;
2325

2426
namespace Microsoft.Azure.Commands.DataLakeStore
2527
{
@@ -30,6 +32,7 @@ public class ExportAzureDataLakeStoreItem : DataLakeStoreFileSystemCmdletBase
3032
// default number of threads
3133
private int numThreadsPerFile = 10;
3234
private int fileCount = 5;
35+
private LogLevel logLevel = LogLevel.None;
3336

3437
[Parameter(ValueFromPipelineByPropertyName = true, Position = 0, Mandatory = true,
3538
HelpMessage = "The DataLakeStore account to execute the filesystem operation in")]
@@ -78,11 +81,29 @@ public int ConcurrentFileCount
7881
HelpMessage = "Indicates that, if the file or folder exists, it should be overwritten")]
7982
public SwitchParameter Force { get; set; }
8083

84+
[Parameter(ValueFromPipelineByPropertyName = true, Mandatory = false,
85+
HelpMessage = "Optionally indicates the diagnostic log level to use to record events during the file or folder import. Default is none, and specifying -Debug overwrites this value and sets it to Debug.")]
86+
public LogLevel DiagnosticLogLevel
87+
{
88+
get { return logLevel; }
89+
set { logLevel = value; }
90+
}
91+
92+
[Parameter(ValueFromPipelineByPropertyName = true, Mandatory = false,
93+
HelpMessage = "Optionally specifies the path for the diagnostic log to record events to during the file or folder import. If logging is enabled, the default is in %LOCALAPPDATA%\\ADLDataTransfer.")]
94+
[ValidateNotNullOrEmpty]
95+
public string DiagnosticLogPath { get; set; }
96+
8197
public override void ExecuteCmdlet()
8298
{
8399
// We will let this throw itself if the path they give us is invalid
84100
// TODO: perhaps in the future catch this and throw a cmdlet specific exception
85101
var powerShellReadyPath = SessionState.Path.GetUnresolvedProviderPathFromPSPath(Destination);
102+
string diagnosticPath = string.Empty;
103+
if (!string.IsNullOrEmpty(DiagnosticLogPath))
104+
{
105+
diagnosticPath = SessionState.Path.GetUnresolvedProviderPathFromPSPath(DiagnosticLogPath);
106+
}
86107

87108
FileType type;
88109
ConfirmAction(
@@ -95,20 +116,59 @@ public override void ExecuteCmdlet()
95116
throw new CloudException(string.Format(Resources.InvalidExportPathType, Path.TransformedPath));
96117
}
97118

98-
if (type == FileType.FILE)
119+
DataLakeStoreTraceLogger logger = null;
120+
var originalLevel = AdalTrace.TraceSource.Switch.Level;
121+
var originalLegacyLevel = AdalTrace.LegacyTraceSwitch.Level;
122+
try
99123
{
100-
DataLakeStoreFileSystemClient.CopyFile(powerShellReadyPath, Account, Path.TransformedPath, CmdletCancellationToken,
101-
isDownload: true, overwrite: Force, cmdletRunningRequest: this, threadCount: PerFileThreadCount, resume: Resume);
124+
if (DiagnosticLogLevel != LogLevel.None)
125+
{
126+
logger = new DataLakeStoreTraceLogger(this, diagnosticPath, DiagnosticLogLevel);
127+
if (logger.SdkTracingInterceptor != null)
128+
{
129+
ServiceClientTracing.AddTracingInterceptor(logger.SdkTracingInterceptor);
130+
}
131+
132+
// only log all ADAL messages when the level is debug.
133+
// In all other cases only log Warning and above.
134+
if (DiagnosticLogLevel != LogLevel.Debug)
135+
{
136+
AdalTrace.TraceSource.Switch.Level = System.Diagnostics.SourceLevels.Warning;
137+
AdalTrace.LegacyTraceSwitch.Level = System.Diagnostics.TraceLevel.Warning;
138+
}
139+
}
140+
if (type == FileType.FILE)
141+
{
142+
DataLakeStoreFileSystemClient.CopyFile(powerShellReadyPath, Account, Path.TransformedPath, CmdletCancellationToken,
143+
isDownload: true, overwrite: Force, cmdletRunningRequest: this, threadCount: PerFileThreadCount, resume: Resume);
144+
}
145+
else
146+
{
147+
DataLakeStoreFileSystemClient.CopyDirectory(powerShellReadyPath, Account, Path.TransformedPath,
148+
CmdletCancellationToken,
149+
isDownload: true, overwrite: Force, cmdletRunningRequest: this,
150+
perFileThreadCount: PerFileThreadCount, concurrentFileCount: ConcurrentFileCount, recursive: Recurse, resume: Resume);
151+
}
152+
153+
WriteObject(powerShellReadyPath);
102154
}
103-
else
155+
finally
104156
{
105-
DataLakeStoreFileSystemClient.CopyDirectory(powerShellReadyPath, Account, Path.TransformedPath,
106-
CmdletCancellationToken,
107-
isDownload: true, overwrite: Force, cmdletRunningRequest: this,
108-
perFileThreadCount: PerFileThreadCount, concurrentFileCount: ConcurrentFileCount, recursive: Recurse, resume: Resume);
109-
}
157+
if (logger != null)
158+
{
159+
if (logger.SdkTracingInterceptor != null)
160+
{
161+
ServiceClientTracing.RemoveTracingInterceptor(logger.SdkTracingInterceptor);
162+
}
110163

111-
WriteObject(powerShellReadyPath);
164+
// dispose and free the logger.
165+
logger.Dispose();
166+
logger = null;
167+
}
168+
169+
AdalTrace.TraceSource.Switch.Level = originalLevel;
170+
AdalTrace.LegacyTraceSwitch.Level = originalLegacyLevel;
171+
}
112172
});
113173
}
114174
}

src/ResourceManager/DataLakeStore/Commands.DataLakeStore/Commands/ImportAzureRmDataLakeStoreItem.cs

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
using Microsoft.Azure.Commands.DataLakeStore.Models;
1616
using Microsoft.Azure.Commands.DataLakeStore.Properties;
17+
using Microsoft.IdentityModel.Clients.ActiveDirectory;
1718
using Microsoft.Rest;
1819
using System.IO;
1920
using System.Management.Automation;
@@ -107,7 +108,7 @@ public override void ExecuteCmdlet()
107108
}
108109

109110
// Setting -Debug overwrites LogLevel to debug.
110-
if (MyInvocation.BoundParameters.ContainsKey("Debug") && (bool)MyInvocation.BoundParameters["Debug"])
111+
if (MyInvocation.BoundParameters.ContainsKey("Debug") && (SwitchParameter)MyInvocation.BoundParameters["Debug"])
111112
{
112113
// TODO: Decide if we don't support outputting to the debug stream as well (since it is synchronous).
113114
DiagnosticLogLevel = LogLevel.Debug;
@@ -119,14 +120,25 @@ public override void ExecuteCmdlet()
119120
() =>
120121
{
121122
DataLakeStoreTraceLogger logger = null;
122-
if (DiagnosticLogLevel != LogLevel.None)
123-
{
124-
logger = new DataLakeStoreTraceLogger(this, diagnosticPath, DiagnosticLogLevel);
125-
ServiceClientTracing.AddTracingInterceptor(logger.SdkTracingInterceptor);
126-
}
127-
123+
var originalLevel = AdalTrace.TraceSource.Switch.Level;
124+
var originalLegacyLevel = AdalTrace.LegacyTraceSwitch.Level;
128125
try
129126
{
127+
if (DiagnosticLogLevel != LogLevel.None)
128+
{
129+
logger = new DataLakeStoreTraceLogger(this, diagnosticPath, DiagnosticLogLevel);
130+
if (logger.SdkTracingInterceptor != null)
131+
{
132+
ServiceClientTracing.AddTracingInterceptor(logger.SdkTracingInterceptor);
133+
}
134+
135+
if (DiagnosticLogLevel != LogLevel.Debug)
136+
{
137+
AdalTrace.TraceSource.Switch.Level = System.Diagnostics.SourceLevels.Warning;
138+
AdalTrace.LegacyTraceSwitch.Level = System.Diagnostics.TraceLevel.Warning;
139+
}
140+
}
141+
130142
if (Directory.Exists(powerShellSourcePath))
131143
{
132144
DataLakeStoreFileSystemClient.CopyDirectory(
@@ -168,8 +180,18 @@ public override void ExecuteCmdlet()
168180
{
169181
if (logger != null)
170182
{
171-
ServiceClientTracing.RemoveTracingInterceptor(logger.SdkTracingInterceptor);
183+
if (logger.SdkTracingInterceptor != null)
184+
{
185+
ServiceClientTracing.RemoveTracingInterceptor(logger.SdkTracingInterceptor);
186+
}
187+
188+
// dispose and free the logger.
189+
logger.Dispose();
190+
logger = null;
172191
}
192+
193+
AdalTrace.TraceSource.Switch.Level = originalLevel;
194+
AdalTrace.LegacyTraceSwitch.Level = originalLegacyLevel;
173195
}
174196
});
175197
}

0 commit comments

Comments
 (0)