Skip to content

Commit 187ec8f

Browse files
authored
Removed NETSTANDARD2_0 IFDefs and added Brackets (#451)
* Removed NETSTANDARD2_0 IFDefs and Fixed some brackets it wouldn't let me build if I didn't fix them * Removed bracket changes * Fixed Formatting hopefully * Updated StartInfo.EnvironmentVariables from StartInfo.Environment so it is compatiable with 4.5.2 * Forgot I had changed this and didn't check git diff till now. My Bad * Missed a spot where it was referencing Envrionment and not EnvironmentVariables
1 parent f1a3586 commit 187ec8f

File tree

4 files changed

+223
-172
lines changed

4 files changed

+223
-172
lines changed

src/KubernetesClient/KubernetesClientConfiguration.ConfigFile.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
using System;
22
using System.Collections.Generic;
3-
#if NETSTANDARD2_0
43
using Newtonsoft.Json;
54
using System.Diagnostics;
6-
#endif
75
using System.IO;
86
using System.Linq;
97
using System.Runtime.InteropServices;
@@ -378,7 +376,6 @@ private void SetUserDetails(K8SConfiguration k8SConfig, Context activeContext)
378376
}
379377
}
380378

381-
#if NETSTANDARD2_0
382379
if (userDetails.UserCredentials.ExternalExecution != null)
383380
{
384381
if (string.IsNullOrWhiteSpace(userDetails.UserCredentials.ExternalExecution.Command))
@@ -397,7 +394,6 @@ private void SetUserDetails(K8SConfiguration k8SConfig, Context activeContext)
397394

398395
userCredentialsFound = true;
399396
}
400-
#endif
401397

402398
if (!userCredentialsFound)
403399
{
@@ -411,7 +407,6 @@ public static string RenewAzureToken(string tenantId, string clientId, string ap
411407
throw new KubeConfigException("Refresh not supported.");
412408
}
413409

414-
#if NETSTANDARD2_0
415410
/// <summary>
416411
/// Implementation of the proposal for out-of-tree client
417412
/// authentication providers as described here --
@@ -432,14 +427,12 @@ public static string ExecuteExternalCommand(ExternalExecution config)
432427

433428
var process = new Process();
434429

435-
process.StartInfo.Environment.Add("KUBERNETES_EXEC_INFO",
436-
JsonConvert.SerializeObject(execInfo));
437-
430+
process.StartInfo.EnvironmentVariables.Add("KUBERNETES_EXEC_INFO", JsonConvert.SerializeObject(execInfo));
438431
if (config.EnvironmentVariables != null)
439432
{
440433
foreach (var configEnvironmentVariableKey in config.EnvironmentVariables.Keys)
441434
{
442-
process.StartInfo.Environment.Add(key: configEnvironmentVariableKey,
435+
process.StartInfo.EnvironmentVariables.Add(key: configEnvironmentVariableKey,
443436
value: config.EnvironmentVariables[configEnvironmentVariableKey]);
444437
}
445438
}
@@ -493,7 +486,6 @@ public static string ExecuteExternalCommand(ExternalExecution config)
493486
throw new KubeConfigException($"external exec failed due to uncaught exception: {ex}");
494487
}
495488
}
496-
#endif
497489

498490
/// <summary>
499491
/// Loads entire Kube Config from default or explicit file path

0 commit comments

Comments
 (0)