Skip to content

Commit a0653f9

Browse files
author
Lee Fine
committed
ab#80665
1 parent ddc34d1 commit a0653f9

3 files changed

Lines changed: 32 additions & 4 deletions

File tree

CitrixAdcOrchestratorJobExtension/CitrixAdcStore.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,16 @@ public CitrixAdcStore(ManagementJobConfiguration config, string serverUserName,
123123
// ReSharper disable once UnusedAutoPropertyAccessor.Local
124124
private ILogger Logger { get; }
125125

126-
public void Login()
126+
public void Login(uint? timeout)
127127
{
128128
Logger.MethodEntry(LogLevel.Debug);
129129
_nss ??= new nitro_service(_clientMachine, _useSsl ? "https" : "http");
130+
_nss.set_timeout(timeout == 0 ? Timeout : timeout);
131+
130132
base_response response = null;
131133
try
132134
{
133-
response = _nss.login(_username, _password, Timeout);
135+
response = _nss.login(_username, _password);
134136
Logger.LogDebug($"Login Response: {JsonConvert.SerializeObject(response)}");
135137
}
136138
catch (Exception ex)

CitrixAdcOrchestratorJobExtension/Inventory.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
using com.citrix.netscaler.nitro.resource.config.ssl;
2525
using Newtonsoft.Json;
26+
using Keyfactor.Orchestrators.Common.Enums;
2627

2728
namespace Keyfactor.Extensions.Orchestrator.CitricAdc
2829
{
@@ -55,7 +56,19 @@ public JobResult ProcessJob(InventoryJobConfiguration jobConfiguration, SubmitIn
5556
ServerUserName = ResolvePamField("ServerUserName", jobConfiguration.ServerUsername);
5657

5758
dynamic properties = JsonConvert.DeserializeObject(jobConfiguration.CertificateStoreDetails.Properties.ToString());
58-
var timeout = properties.timeout == null || string.IsNullOrEmpty(properties.timeout.Value) ? null : Convert.ToInt32(properties.timeout.Value);
59+
UInt32 timeout = 0;
60+
if (!UInt32.TryParse((properties.timeout == null || string.IsNullOrEmpty(properties.timeout.Value) ? "0" : properties.timeout.Value), out timeout))
61+
{
62+
string err = $"Invalid Custom Field 'timeout' value {properties.timeout.Value}. Value must be numeric";
63+
_logger.LogError(err);
64+
return new JobResult
65+
{
66+
Result = OrchestratorJobStatusJobResult.Failure,
67+
JobHistoryId = jobConfiguration.JobHistoryId,
68+
FailureMessage =
69+
$"Site {jobConfiguration.CertificateStoreDetails.StorePath} on server {jobConfiguration.CertificateStoreDetails.ClientMachine}: {err}."
70+
};
71+
}
5972

6073
_logger.LogDebug("Entering ProcessJob");
6174
CitrixAdcStore store = new CitrixAdcStore(jobConfiguration, ServerUserName, ServerPassword);

CitrixAdcOrchestratorJobExtension/Management.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,20 @@ public JobResult ProcessJob(ManagementJobConfiguration jobConfiguration)
6464

6565
dynamic properties = JsonConvert.DeserializeObject(jobConfiguration.CertificateStoreDetails.Properties.ToString());
6666
var linkToIssuer = properties.linkToIssuer == null || string.IsNullOrEmpty(properties.linkToIssuer.Value) ? false : Convert.ToBoolean(properties.linkToIssuer.Value);
67-
var timeout = properties.timeout == null || string.IsNullOrEmpty(properties.timeout.Value) ? null : Convert.ToInt32(properties.timeout.Value);
67+
68+
UInt32 timeout = 0;
69+
if (!UInt32.TryParse((properties.timeout == null || string.IsNullOrEmpty(properties.timeout.Value) ? "0" : properties.timeout.Value), out timeout))
70+
{
71+
string err = $"Invalid Custom Field 'timeout' value {properties.timeout.Value}. Value must be numeric";
72+
_logger.LogError(err);
73+
return new JobResult
74+
{
75+
Result = OrchestratorJobStatusJobResult.Failure,
76+
JobHistoryId = jobConfiguration.JobHistoryId,
77+
FailureMessage =
78+
$"Site {jobConfiguration.CertificateStoreDetails.StorePath} on server {jobConfiguration.CertificateStoreDetails.ClientMachine}: {err}."
79+
};
80+
}
6881

6982
ApplicationSettings.Initialize(this.GetType().Assembly.Location);
7083

0 commit comments

Comments
 (0)