Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"useMachineCredential": use_machine_credential
}
self.connection.ivanti_api.create_session_credential()
scan = self.connection.ivanti_api.start_patch_scan(payload)
try:
operation_location_url = scan.headers.get("Operation-Location")
polling2.poll(lambda: self.connection.ivanti_api.get_operation_location(operation_location_url)
.get("percentComplete") == 100, step=10, timeout=max_poll_time)
except KeyError as e:
raise PluginException(
cause=f'{e} not found within the header.',
assistance=f'If the issue persists please contact support.')
except polling2.TimeoutException as e:
raise PluginException(
cause='Action timeout.',
assistance=f'This scan has exceeded the maximum poll time of {max_poll_time}.')
operation_location = self.connection.ivanti_api.get_operation_location(operation_location_url)
scan_details = scan.json()
scan_details['isComplete'] = True
scan_details['updatedOn'] = operation_location['lastAction']
return {
Output.SCAN_DETAILS: scan_details
}