Skip to content

Commit c0fecc7

Browse files
remove nullability but add exception on access
1 parent e629b48 commit c0fecc7

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

sdk/Pulumi/Deployment/Deployment.cs

+14-2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ internal static IDeploymentInternal InternalInstance
8585

8686
private readonly string _organizationName;
8787
private readonly string _projectName;
88-
private readonly string _rootDirectory;
88+
private readonly string? _rootDirectory;
8989
private readonly string _stackName;
9090
private readonly bool _isDryRun;
9191
private readonly ConcurrentDictionary<string, bool> _featureSupport = new ConcurrentDictionary<string, bool>();
@@ -173,7 +173,19 @@ internal Deployment(IEngine engine, IMonitor monitor, TestOptions? options)
173173

174174
string IDeployment.OrganizationName => _organizationName;
175175
string IDeployment.ProjectName => _projectName;
176-
string? IDeployment.RootDirectory => _rootDirectory;
176+
string IDeployment.RootDirectory
177+
{
178+
get
179+
{
180+
if (_rootDirectory == null)
181+
{
182+
throw new InvalidOperationException("Root directory is not available in your version of the pulumi CLI, please upgrade to the latest version");
183+
}
184+
185+
return _rootDirectory;
186+
}
187+
}
188+
177189
string IDeployment.StackName => _stackName;
178190
bool IDeployment.IsDryRun => _isDryRun;
179191

sdk/Pulumi/Deployment/DeploymentInstance.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ internal DeploymentInstance(IDeployment deployment)
2727
/// <summary>
2828
/// Root directory, that is the location of the Pulumi.yaml file.
2929
/// </summary>
30-
public string? RootDirectory => _deployment.RootDirectory;
30+
public string RootDirectory => _deployment.RootDirectory;
3131

3232
/// <summary>
3333
/// Returns the current organization name.

sdk/Pulumi/Deployment/Deployment_Inline.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ private Deployment(IDeploymentBuilder builder, InlineDeploymentSettings settings
1717

1818
_organizationName = settings.Organization ?? "organization";
1919
_projectName = settings.Project;
20-
_rootDirectory = settings.RootDirectory;
20+
// TODO(#535) Propagate this from the Construct RPC
21+
_rootDirectory = null;
2122
_stackName = settings.Stack;
2223
_isDryRun = settings.IsDryRun;
2324
SetAllConfig(settings.Config, settings.ConfigSecretKeys);

0 commit comments

Comments
 (0)