Skip to content

Commit

Permalink
Logged more when session times out
Browse files Browse the repository at this point in the history
  • Loading branch information
bhillkeyfactor committed Jun 26, 2024
1 parent b201794 commit 3ad1ecb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions PaloAlto/Jobs/Inventory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ private JobResult PerformInventory(InventoryJobConfiguration config, SubmitInven

return BuildInventoryItem(c.Name, c.PublicKey, c.PrivateKey?.Length>0, false);
}
catch
catch(Exception e)
{
_logger.LogWarning(
$"Could not fetch the certificate: {c.Name} associated with issuer {c.Issuer}.");
$"Could not fetch the certificate: {c.Name} associated with issuer {c.Issuer} error {LogHandler.FlattenException(e)}.");
sb.Append(
$"Could not fetch the certificate: {c.Name} associated with issuer {c.Issuer}.{Environment.NewLine}");
warningFlag = true;
Expand All @@ -133,16 +133,17 @@ private JobResult PerformInventory(InventoryJobConfiguration config, SubmitInven
{
_logger.LogTrace($"Building Trusted Root Inventory Item Alias: {trustedRootCert.Name}");
var certificatePem = client.GetCertificateByName(trustedRootCert.Name);
_logger.LogTrace($"Certificate String Back From Palo Pem: {certificatePem.Result}");
var bytes = Encoding.ASCII.GetBytes(certificatePem.Result);
var cert = new X509Certificate2(bytes);
_logger.LogTrace(
$"Building Trusted Root Inventory Item Pem: {certificatePem.Result} Has Private Key: {cert.HasPrivateKey}");
inventoryItems.Add(BuildInventoryItem(trustedRootCert.Name, certificatePem.Result, cert.HasPrivateKey, true));
}
catch
catch(Exception e)
{
_logger.LogWarning(
$"Could not fetch the certificate: {trustedRootCert.Name} associated with issuer {trustedRootCert.Issuer}.");
$"Could not fetch the certificate: {trustedRootCert.Name} associated with issuer {trustedRootCert.Issuer} error {LogHandler.FlattenException(e)}.");
sb.Append(
$"Could not fetch the certificate: {trustedRootCert.Name} associated with issuer {trustedRootCert.Issuer}.{Environment.NewLine}");
warningFlag = true;
Expand Down

0 comments on commit 3ad1ecb

Please sign in to comment.