22
22
namespace Pulumi . Automation . Commands
23
23
{
24
24
/// <summary>
25
- /// Options to configure a <see cref="LocalPulumiCmd "/> instance.
25
+ /// Options to configure a <see cref="LocalPulumiCommand "/> instance.
26
26
/// </summary>
27
- public class LocalPulumiCmdOptions
27
+ public class LocalPulumiCommandOptions
28
28
{
29
29
/// <summary>
30
30
/// The version of the Pulumi CLI to install or the minimum version requirement for an existing installation.
@@ -41,9 +41,9 @@ public class LocalPulumiCmdOptions
41
41
}
42
42
43
43
/// <summary>
44
- /// A <see cref="IPulumiCmd "/> implementation that uses a locally installed Pulumi CLI.
44
+ /// A <see cref="IPulumiCommand "/> implementation that uses a locally installed Pulumi CLI.
45
45
/// </summary>
46
- public class LocalPulumiCmd : IPulumiCmd
46
+ public class LocalPulumiCommand : IPulumiCommand
47
47
{
48
48
// TODO: move to shared place with LocalWorkspace
49
49
private static string SkipVersionCheckVar = "PULUMI_AUTOMATION_API_SKIP_VERSION_CHECK" ;
@@ -57,13 +57,13 @@ public class LocalPulumiCmd : IPulumiCmd
57
57
public SemVersion ? Version { get => _version ; }
58
58
59
59
/// <summary>
60
- /// Creates a new LocalPulumiCmd instance.
60
+ /// Creates a new LocalPulumiCommand instance.
61
61
/// </summary>
62
- /// <param name="options">Options to configure the LocalPulumiCmd .</param>
62
+ /// <param name="options">Options to configure the LocalPulumiCommand .</param>
63
63
/// <param name="cancellationToken">A cancellation token.</param>
64
64
/// <returns></returns>
65
- public static async Task < LocalPulumiCmd > CreateAsync (
66
- LocalPulumiCmdOptions ? options = null ,
65
+ public static async Task < LocalPulumiCommand > CreateAsync (
66
+ LocalPulumiCommandOptions ? options = null ,
67
67
CancellationToken cancellationToken = default )
68
68
{
69
69
var command = "pulumi" ;
@@ -80,10 +80,10 @@ public static async Task<LocalPulumiCmd> CreateAsync(
80
80
81
81
var optOut = options ? . SkipVersionCheck ?? Environment . GetEnvironmentVariable ( SkipVersionCheckVar ) != null ;
82
82
var version = await GetPulumiVersionAsync ( minimumVersion , command , optOut , cancellationToken ) ;
83
- return new LocalPulumiCmd ( command , version ) ;
83
+ return new LocalPulumiCommand ( command , version ) ;
84
84
}
85
85
86
- private LocalPulumiCmd ( string command , SemVersion ? version )
86
+ private LocalPulumiCommand ( string command , SemVersion ? version )
87
87
{
88
88
_command = command ;
89
89
_version = version ;
@@ -104,11 +104,11 @@ private LocalPulumiCmd(string command, SemVersion? version)
104
104
}
105
105
106
106
/// <summary>
107
- /// Installs the Pulumi CLI if it is not already installed and returns a new LocalPulumiCmd instance.
107
+ /// Installs the Pulumi CLI if it is not already installed and returns a new LocalPulumiCommand instance.
108
108
/// </summary>
109
- /// <param name="options">Options to configure the LocalPulumiCmd .</param>
109
+ /// <param name="options">Options to configure the LocalPulumiCommand .</param>
110
110
/// <param name="cancellationToken">A cancellation token.</param>
111
- public static async Task < LocalPulumiCmd > Install ( LocalPulumiCmdOptions ? options = null , CancellationToken cancellationToken = default )
111
+ public static async Task < LocalPulumiCommand > Install ( LocalPulumiCommandOptions ? options = null , CancellationToken cancellationToken = default )
112
112
{
113
113
var _assemblyVersion = Assembly . GetExecutingAssembly ( ) . GetName ( ) . Version ;
114
114
if ( _assemblyVersion == null )
@@ -118,7 +118,7 @@ public static async Task<LocalPulumiCmd> Install(LocalPulumiCmdOptions? options
118
118
var assemblyVersion = new SemVersion ( _assemblyVersion . Major , _assemblyVersion . Minor , _assemblyVersion . Build ) ;
119
119
var version = options ? . Version ?? assemblyVersion ;
120
120
var home = Environment . GetFolderPath ( Environment . SpecialFolder . UserProfile ) ;
121
- var optionsWithDefaults = new LocalPulumiCmdOptions
121
+ var optionsWithDefaults = new LocalPulumiCommandOptions
122
122
{
123
123
Version = version ,
124
124
Root = options ? . Root ?? Path . Combine ( home , ".pulumi" , "versions" , version . ToString ( ) )
@@ -285,22 +285,22 @@ private async Task<CommandResult> RunAsyncInner(
285
285
stdErrPipe = PipeTarget . Merge ( stdErrPipe , PipeTarget . ToDelegate ( onStandardError ) ) ;
286
286
}
287
287
288
- var pulumiCmd = Cli . Wrap ( "pulumi" )
288
+ var pulumiCommand = Cli . Wrap ( "pulumi" )
289
289
. WithArguments ( PulumiArgs ( args , eventLogFile ) , escape : true )
290
290
. WithWorkingDirectory ( workingDir )
291
291
. WithEnvironmentVariables ( PulumiEnvironment ( additionalEnv , _command , debugCommands : eventLogFile != null ) )
292
292
. WithStandardOutputPipe ( stdOutPipe )
293
293
. WithStandardErrorPipe ( stdErrPipe )
294
294
. WithValidation ( CommandResultValidation . None ) ; // we check non-0 exit code ourselves
295
295
296
- var pulumiCmdResult = await pulumiCmd . ExecuteAsync ( cancellationToken ) ;
296
+ var pulumiCommandResult = await pulumiCommand . ExecuteAsync ( cancellationToken ) ;
297
297
298
298
var result = new CommandResult (
299
- pulumiCmdResult . ExitCode ,
299
+ pulumiCommandResult . ExitCode ,
300
300
standardOutput : stdOutBuffer . ToString ( ) ,
301
301
standardError : stdErrBuffer . ToString ( ) ) ;
302
302
303
- if ( pulumiCmdResult . ExitCode != 0 )
303
+ if ( pulumiCommandResult . ExitCode != 0 )
304
304
{
305
305
throw CommandException . CreateFromResult ( result ) ;
306
306
}
0 commit comments