Skip to content

Commit 31ae30f

Browse files
author
Hao Chen
committed
Merge pull request #1662 from haocs/trailingslash-fix
[#111344356]Added trailing backslash to PSMoudlePath during msi installation.
2 parents a752edd + 0342f3a commit 31ae30f

File tree

4 files changed

+91
-3
lines changed

4 files changed

+91
-3
lines changed

setup/azurecmd.wxs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@
3131
<RegistrySearch Id="PSCOMPATIBLEVERSION" Root="HKLM" Key="SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine" Name="PSCompatibleVersion" Type="raw" />
3232
</Property>
3333

34-
<SetProperty Action="SetBase64" Id="BaseModulesFolder" Value="[ProgramFiles64Folder]WindowsPowerShell\Modules" Before="AppSearch">
34+
<SetProperty Action="SetBase64" Id="BaseModulesFolder" Value="[ProgramFiles64Folder]WindowsPowerShell\Modules\" Before="AppSearch">
3535
VersionNT64
3636
</SetProperty>
3737

38-
<SetProperty Action="SetBase32" Id="BaseModulesFolder" Value="[ProgramFilesFolder]WindowsPowerShell\Modules" Before="AppSearch">
38+
<SetProperty Action="SetBase32" Id="BaseModulesFolder" Value="[ProgramFilesFolder]WindowsPowerShell\Modules\" Before="AppSearch">
3939
NOT VersionNT64
4040
</SetProperty>
4141

@@ -81,7 +81,7 @@
8181
<Component Id="PSModulePath.System" Guid="273525B9-7AAB-421A-90C8-8E50A1840B8D">
8282
<CreateFolder />
8383
<!-- Work around bug that PowerShell does not always consider default module paths. -->
84-
<Environment Id="PSModulePath.SystemAppRoot" Action="set" Name="PSMODULEPATH" Part="last" Value="[BaseModulesFolder];[PowerShellFolder]ResourceManager\AzureResourceManager;[PowerShellFolder]ServiceManagement" System="yes" />
84+
<Environment Id="PSModulePath.SystemAppRoot" Action="set" Name="PSMODULEPATH" Part="last" Value="[BaseModulesFolder];[PowerShellFolder]ResourceManager\AzureResourceManager\;[PowerShellFolder]ServiceManagement\" System="yes" />
8585
</Component>
8686
</DirectoryRef>
8787

src/Common/Commands.Common/AzurePSCmdlet.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
using System.Text;
2828
using System.Linq;
2929
using System.Threading;
30+
using Microsoft.Rest;
3031

3132
namespace Microsoft.WindowsAzure.Commands.Utilities.Common
3233
{
@@ -40,6 +41,9 @@ public abstract class AzurePSCmdlet : PSCmdlet, IDisposable
4041
private RecordingTracingInterceptor _httpTracingInterceptor;
4142

4243
private DebugStreamTraceListener _adalListener;
44+
45+
private ServiceClientTracingInterceptor _serviceClientTracingInterceptor;
46+
4347
protected static AzurePSDataCollectionProfile _dataCollectionProfile = null;
4448
protected static string _errorRecordFolderPath = null;
4549
protected const string _fileTimeStampSuffixFormat = "yyyy-MM-dd-THH-mm-ss-fff";
@@ -216,8 +220,10 @@ protected override void BeginProcessing()
216220

217221
_httpTracingInterceptor = _httpTracingInterceptor ?? new RecordingTracingInterceptor(_debugMessages);
218222
_adalListener = _adalListener ?? new DebugStreamTraceListener(_debugMessages);
223+
_serviceClientTracingInterceptor = _serviceClientTracingInterceptor ?? new ServiceClientTracingInterceptor(_debugMessages);
219224
RecordingTracingInterceptor.AddToContext(_httpTracingInterceptor);
220225
DebugStreamTraceListener.AddAdalTracing(_adalListener);
226+
ServiceClientTracing.AddTracingInterceptor(_serviceClientTracingInterceptor);
221227

222228
ProductInfoHeaderValue userAgentValue = new ProductInfoHeaderValue(
223229
ModuleName, string.Format("v{0}", ModuleVersion));
@@ -237,6 +243,7 @@ protected override void EndProcessing()
237243

238244
RecordingTracingInterceptor.RemoveFromContext(_httpTracingInterceptor);
239245
DebugStreamTraceListener.RemoveAdalTracing(_adalListener);
246+
ServiceClientTracingInterceptor.RemoveTracingInterceptor(_serviceClientTracingInterceptor);
240247
FlushDebugMessages();
241248

242249
AzureSession.ClientFactory.UserAgents.RemoveWhere(u => u.Product.Name == ModuleName);

src/Common/Commands.Common/Commands.Common.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@
170170
<Compile Include="ProfileClientExtensions.cs" />
171171
<Compile Include="ClientCreatedArgs.cs" />
172172
<Compile Include="CmdletExtensions.cs" />
173+
<Compile Include="ServiceClientTracingInterceptor.cs" />
173174
<Compile Include="TestMockSupport.cs" />
174175
<Compile Include="PSAzureAccount.cs" />
175176
<Compile Include="Properties\AssemblyInfo.cs" />
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.Rest;
16+
using System;
17+
using System.Collections.Concurrent;
18+
using System.Collections.Generic;
19+
using System.Diagnostics;
20+
using System.Linq;
21+
using System.Text;
22+
using System.Threading.Tasks;
23+
24+
namespace Microsoft.WindowsAzure.Commands.Common
25+
{
26+
class ServiceClientTracingInterceptor : IServiceClientTracingInterceptor
27+
{
28+
public ServiceClientTracingInterceptor(ConcurrentQueue<string> queue)
29+
{
30+
MessageQueue = queue;
31+
}
32+
33+
public ConcurrentQueue<string> MessageQueue { get; private set; }
34+
35+
public void Configuration(string source, string name, string value)
36+
{
37+
// Ignore
38+
}
39+
40+
public void EnterMethod(string invocationId, object instance, string method, IDictionary<string, object> parameters)
41+
{
42+
// Ignore
43+
}
44+
45+
public void ExitMethod(string invocationId, object returnValue)
46+
{
47+
// Ignore
48+
}
49+
50+
public void Information(string message)
51+
{
52+
MessageQueue.Enqueue(message);
53+
}
54+
55+
public void ReceiveResponse(string invocationId, System.Net.Http.HttpResponseMessage response)
56+
{
57+
string responseAsString = response == null ? string.Empty : response.AsFormattedString();
58+
MessageQueue.Enqueue(responseAsString);
59+
}
60+
61+
public void SendRequest(string invocationId, System.Net.Http.HttpRequestMessage request)
62+
{
63+
string requestAsString = request == null ? string.Empty : request.AsFormattedString();
64+
MessageQueue.Enqueue(requestAsString);
65+
}
66+
67+
public void TraceError(string invocationId, Exception exception)
68+
{
69+
// Ignore
70+
}
71+
72+
public static void RemoveTracingInterceptor(ServiceClientTracingInterceptor interceptor)
73+
{
74+
if (interceptor != null)
75+
{
76+
ServiceClientTracing.RemoveTracingInterceptor(interceptor);
77+
}
78+
}
79+
}
80+
}

0 commit comments

Comments
 (0)