Skip to content

Commit 491ca70

Browse files
author
maddieclayton
committed
update implementation
1 parent fadaf9e commit 491ca70

File tree

14 files changed

+28
-37
lines changed

14 files changed

+28
-37
lines changed

src/Common/Commands.Common/AzurePSCmdlet.cs

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -137,26 +137,17 @@ protected string PSVersion
137137

138138
protected abstract string DataCollectionWarning { get; }
139139

140-
[Obsolete("Please use 'AsJobSessionState' in place of 'SessionState'", true)]
141-
public new SessionState SessionState
142-
{
143-
get
144-
{
145-
throw new Exception("Please use 'AsJobSessionState' in place of 'SessionState'");
146-
}
147-
}
140+
private SessionState _sessionState;
148141

149-
private SessionState _asJobSessionState;
150-
151-
public SessionState AsJobSessionState
142+
public new SessionState SessionState
152143
{
153144
get
154145
{
155-
return _asJobSessionState;
146+
return _sessionState;
156147
}
157148
set
158149
{
159-
_asJobSessionState = value;
150+
_sessionState = value;
160151
}
161152
}
162153

@@ -298,7 +289,7 @@ protected virtual void TearDownHttpClientPipeline()
298289
/// </summary>
299290
protected override void BeginProcessing()
300291
{
301-
AsJobSessionState = base.SessionState;
292+
SessionState = base.SessionState;
302293
var profile = _dataCollectionProfile;
303294
//TODO: Inject from CI server
304295
lock (lockObject)
@@ -336,8 +327,8 @@ protected string CurrentPath()
336327
{
337328
// SessionState is only available within PowerShell so default to
338329
// the TestMockSupport.TestExecutionFolder when being run from tests.
339-
return (AsJobSessionState != null) ?
340-
AsJobSessionState.Path.CurrentLocation.Path :
330+
return (SessionState != null) ?
331+
SessionState.Path.CurrentLocation.Path :
341332
TestMockSupport.TestExecutionFolder;
342333
}
343334

src/ResourceManager/Compute/Commands.Compute/Generated/VirtualMachine/VirtualMachineRunCommandMethod.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public override void ExecuteCmdlet()
128128
if (this.ScriptPath != null)
129129
{
130130
parameters.Script = new List<string>();
131-
PathIntrinsics currentPath = AsJobSessionState.Path;
131+
PathIntrinsics currentPath = SessionState.Path;
132132
var filePath = new System.IO.FileInfo(currentPath.GetUnresolvedProviderPathFromPSPath(this.ScriptPath));
133133
string fileContent = Commands.Common.Authentication.Abstractions.FileUtilities.DataStore.ReadFileAsText(filePath.FullName);
134134
parameters.Script = fileContent.Split(new string[] { "\r\n", "\n", "\r" }, StringSplitOptions.RemoveEmptyEntries);

src/ResourceManager/Compute/Commands.Compute/StorageServices/AddAzureVhdCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public UploadParameters ValidateParameters()
140140

141141
var storageCredentialsFactory = CreateStorageCredentialsFactory();
142142

143-
PathIntrinsics currentPath = AsJobSessionState.Path;
143+
PathIntrinsics currentPath = SessionState.Path;
144144
var filePath = new FileInfo(currentPath.GetUnresolvedProviderPathFromPSPath(LocalFilePath.ToString()));
145145

146146
using (var vds = new VirtualDiskStream(filePath.FullName))

src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Operation/NewAzureVMCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ async Task StrategyExecuteCmdletAsync(IAsyncCmdlet asyncCmdlet)
372372
#endif
373373
Location = Location
374374
});
375-
var filePath = new FileInfo(AsJobSessionState.Path.GetUnresolvedProviderPathFromPSPath(DiskFile));
375+
var filePath = new FileInfo(SessionState.Path.GetUnresolvedProviderPathFromPSPath(DiskFile));
376376
using (var vds = new VirtualDiskStream(filePath.FullName))
377377
{
378378
// 2 ^ 9 == 512

src/ResourceManager/DataLakeAnalytics/Commands.DataLakeAnalytics/Commands/SubmitAzureRmDataLakeAnalyticsJob.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ public override void ExecuteCmdlet()
383383
// Get the script
384384
if (string.IsNullOrEmpty(Script))
385385
{
386-
var powerShellDestinationPath = AsJobSessionState.Path.GetUnresolvedProviderPathFromPSPath(ScriptPath);
386+
var powerShellDestinationPath = SessionState.Path.GetUnresolvedProviderPathFromPSPath(ScriptPath);
387387
if (!File.Exists(powerShellDestinationPath))
388388
{
389389
throw new CloudException(string.Format(Resources.ScriptFilePathDoesNotExist,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public class ExportAzureDataLakeStoreItem : DataLakeStoreFileSystemCmdletBase
109109
public override void ExecuteCmdlet()
110110
{
111111
// We will let this throw itself if the path they give us is invalid
112-
var powerShellReadyPath = AsJobSessionState.Path.GetUnresolvedProviderPathFromPSPath(Destination);
112+
var powerShellReadyPath = SessionState.Path.GetUnresolvedProviderPathFromPSPath(Destination);
113113
ConfirmAction(
114114
VerbsData.Export,
115115
Path.TransformedPath,
@@ -120,7 +120,7 @@ public override void ExecuteCmdlet()
120120
if (ParameterSetName.Equals(DiagnosticParameterSetName) && DiagnosticLogLevel != LogLevel.None)
121121
{
122122
var diagnosticPath =
123-
AsJobSessionState.Path.GetUnresolvedProviderPathFromPSPath(DiagnosticLogPath);
123+
SessionState.Path.GetUnresolvedProviderPathFromPSPath(DiagnosticLogPath);
124124
DataLakeStoreFileSystemClient.SetupFileLogging(DiagnosticLogLevel, diagnosticPath);
125125
}
126126

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public class ImportAzureDataLakeStoreItem : DataLakeStoreFileSystemCmdletBase
118118

119119
public override void ExecuteCmdlet()
120120
{
121-
var powerShellSourcePath = AsJobSessionState.Path.GetUnresolvedProviderPathFromPSPath(Path);
121+
var powerShellSourcePath = SessionState.Path.GetUnresolvedProviderPathFromPSPath(Path);
122122
ConfirmAction(
123123
Resources.UploadFileMessage,
124124
Destination.TransformedPath,
@@ -129,7 +129,7 @@ public override void ExecuteCmdlet()
129129
if (ParameterSetName.Equals(DiagnosticParameterSetName) && DiagnosticLogLevel != LogLevel.None)
130130
{
131131
var diagnosticPath =
132-
AsJobSessionState.Path.GetUnresolvedProviderPathFromPSPath(DiagnosticLogPath);
132+
SessionState.Path.GetUnresolvedProviderPathFromPSPath(DiagnosticLogPath);
133133
DataLakeStoreFileSystemClient.SetupFileLogging(DiagnosticLogLevel, diagnosticPath);
134134
}
135135

src/ResourceManager/HDInsight/Commands.HDInsight/JobCommands/InvokeHiveCommand.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,11 @@ public InvokeHiveCommand()
105105
public override void ExecuteCmdlet()
106106
{
107107
//get variables from session
108-
var clusterConnection = AsJobSessionState.PSVariable.Get(UseAzureHDInsightClusterCommand.ClusterEndpoint).Value.ToString();
108+
var clusterConnection = SessionState.PSVariable.Get(UseAzureHDInsightClusterCommand.ClusterEndpoint).Value.ToString();
109109
var clusterCred =
110-
(PSCredential)AsJobSessionState.PSVariable.Get(UseAzureHDInsightClusterCommand.ClusterCred).Value;
110+
(PSCredential)SessionState.PSVariable.Get(UseAzureHDInsightClusterCommand.ClusterCred).Value;
111111
var resourceGroup =
112-
AsJobSessionState.PSVariable.Get(UseAzureHDInsightClusterCommand.CurrentResourceGroup).Value.ToString();
112+
SessionState.PSVariable.Get(UseAzureHDInsightClusterCommand.CurrentResourceGroup).Value.ToString();
113113

114114
_credential = new BasicAuthenticationCloudCredentials
115115
{

src/ResourceManager/HDInsight/Commands.HDInsight/JobCommands/UseAzureHDInsightClusterCommand.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ public override void ExecuteCmdlet()
7575

7676
var httpEndpoint = GetClusterConnection(ResourceGroupName, ClusterName);
7777

78-
AsJobSessionState.PSVariable.Set(ClusterEndpoint, httpEndpoint);
79-
AsJobSessionState.PSVariable.Set(ClusterCred, HttpCredential);
80-
AsJobSessionState.PSVariable.Set(CurrentResourceGroup, ResourceGroupName);
78+
SessionState.PSVariable.Set(ClusterEndpoint, httpEndpoint);
79+
SessionState.PSVariable.Set(ClusterCred, HttpCredential);
80+
SessionState.PSVariable.Set(CurrentResourceGroup, ResourceGroupName);
8181

8282
WriteObject(string.Format("Successfully connected to cluster {0} in resource group {1}", ClusterName,
8383
ResourceGroupName));

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ protected override void RunCmdlet()
6767

6868
if (!string.IsNullOrWhiteSpace(this.OutputFile))
6969
{
70-
var currentPath = this.AsJobSessionState.Path.CurrentFileSystemLocation.Path;
70+
var currentPath = this.SessionState.Path.CurrentFileSystemLocation.Path;
7171
var definitionFileFullPath =
7272
Path.IsPathRooted(this.OutputFile) ?
7373
this.OutputFile :

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ protected override void RunCmdlet()
5151
StringComparison.OrdinalIgnoreCase))
5252
{
5353
jsonDefinition = CmdletHelpers.GetWebServiceDefinitionFromFile(
54-
this.AsJobSessionState.Path.CurrentFileSystemLocation.Path,
54+
this.SessionState.Path.CurrentFileSystemLocation.Path,
5555
this.InputFile);
5656
}
5757

src/ResourceManager/MachineLearning/Commands.MachineLearning/Cmdlets/WebServices/NewAzureMLWebService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ protected override void RunCmdlet()
8787
{
8888
string jsonDefinition =
8989
CmdletHelpers.GetWebServiceDefinitionFromFile(
90-
this.AsJobSessionState.Path.CurrentFileSystemLocation.Path,
90+
this.SessionState.Path.CurrentFileSystemLocation.Path,
9191
this.DefinitionFile);
9292
var webServiceFromJson =
9393
ModelsSerializationUtil.GetAzureMLWebServiceFromJsonDefinition(jsonDefinition);

src/ResourceManager/Scheduler/Commands.Scheduler/Utilities/ExtensionMethods.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,20 +170,20 @@ public static T GetValueOrDefaultEnum<T>(this string targetValue, T defaultValue
170170
/// <param name="psCmdlet">Powershell cmdlet.</param>
171171
/// <param name="path">path.</param>
172172
/// <returns>Resolved PowerShell path.</returns>
173-
public static string ResolvePath(this AzurePSCmdlet psCmdlet, string path)
173+
public static string ResolvePath(this PSCmdlet psCmdlet, string path)
174174
{
175175
if (path == null)
176176
{
177177
return null;
178178
}
179179

180-
if (psCmdlet.AsJobSessionState == null)
180+
if (psCmdlet.SessionState == null)
181181
{
182182
return path;
183183
}
184184

185185
path = path.Trim('"', '\'', ' ');
186-
var result = psCmdlet.AsJobSessionState.Path.GetResolvedPSPathFromPSPath(path);
186+
var result = psCmdlet.SessionState.Path.GetResolvedPSPathFromPSPath(path);
187187
string fullPath = string.Empty;
188188

189189
if (result != null && result.Count > 0)

src/ResourceManager/Websites/Commands.Websites/Cmdlets/WebApps/NewAzureWebApp.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ protected override void ProcessRecord()
114114
{
115115
try
116116
{
117-
this.ExecuteSynchronouslyOrAsJob( (cmdlet) => cmdlet.ExecuteCmdletActions(this.AsJobSessionState));
117+
this.ExecuteSynchronouslyOrAsJob( (cmdlet) => cmdlet.ExecuteCmdletActions(this.SessionState));
118118
}
119119
catch (Exception ex) when (!IsTerminatingError(ex))
120120
{

0 commit comments

Comments
 (0)