@@ -51,13 +51,11 @@ public Inventory(IPAMSecretResolver pam, ILogger<Inventory> logger)
5151 public JobResult ProcessJob ( InventoryJobConfiguration jobConfiguration , SubmitInventoryUpdate submitInventoryUpdate )
5252 {
5353 Logger . MethodEntry ( ) ;
54- Logger . LogTrace ( $ "Deserializing Cert Store Properties: { jobConfiguration . CertificateStoreDetails . Properties } ") ;
54+
55+ Logger . LogTrace ( "Deserializing Store Properties to AuthCustomFieldParameters object." ) ;
5556 AuthCustomFieldParameters customFields = JsonConvert . DeserializeObject < AuthCustomFieldParameters > ( jobConfiguration . CertificateStoreDetails . Properties ,
5657 new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling . Populate } ) ;
57- //
58- // TODO: Prevent logging of credentials, changes to custom fields in this release means logging this object (AND Properties above) logs credentials!!
59- //
60- Logger . LogTrace ( $ "Populated ACMCustomFields: { JsonConvert . SerializeObject ( customFields ) } ") ;
58+ Logger . LogTrace ( "Deserialized Store Properties." ) ;
6159
6260 AuthenticationParameters authParams = new AuthenticationParameters
6361 {
@@ -67,9 +65,23 @@ public JobResult ProcessJob(InventoryJobConfiguration jobConfiguration, SubmitIn
6765 } ;
6866
6967 Logger . LogTrace ( "Resolving AWS Credentials object." ) ;
70- AwsExtensionCredential providedCredentials = AuthUtilities . GetCredentials ( authParams ) ;
71-
68+ AwsExtensionCredential providedCredentials ;
69+ try
70+ {
71+ providedCredentials = AuthUtilities . GetCredentials ( authParams ) ;
72+ }
73+ catch ( Exception ex )
74+ {
75+ Logger . LogError ( "An error occurred while trying to get AWS Credentials." ) ;
76+ return new JobResult
77+ {
78+ Result = OrchestratorJobStatusJobResult . Failure ,
79+ JobHistoryId = jobConfiguration . JobHistoryId ,
80+ FailureMessage = ex . Message
81+ } ;
82+ }
7283 Logger . LogTrace ( "AWS Credentials resolved. Performing Inventory." ) ;
84+
7385 return PerformInventory ( providedCredentials , jobConfiguration , submitInventoryUpdate ) ;
7486 }
7587
0 commit comments