Skip to content

Commit

Permalink
Merge pull request #140 from qduk/ab_vul_log_message
Browse files Browse the repository at this point in the history
Add log_info for each CVE in the vulnerability job
  • Loading branch information
bradh11 committed Mar 29, 2023
2 parents f963b27 + 34d3efd commit 4c98847
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion nautobot_device_lifecycle_mgmt/jobs/cve_tracking.py
@@ -1,7 +1,7 @@
"""Jobs for the CVE Tracking portion of the Device Lifecycle plugin."""
from datetime import datetime

from nautobot.extras.jobs import Job, StringVar
from nautobot.extras.jobs import Job, StringVar, BooleanVar
from nautobot.extras.models import Relationship, RelationshipAssociation

from nautobot_device_lifecycle_mgmt.models import (
Expand Down Expand Up @@ -31,6 +31,9 @@ class Meta: # pylint: disable=too-few-public-methods
"""Meta class for the job."""

commit_default = True
field_order = ["published_after", "_task_queue", "debug", "_commit"]

debug = BooleanVar(description="Enable for more verbose logging.")

def run(self, data, commit): # pylint: disable=too-many-locals
"""Check if software assigned to each device is valid. If no software is assigned return warning message."""
Expand All @@ -40,6 +43,8 @@ def run(self, data, commit): # pylint: disable=too-many-locals
count_before = VulnerabilityLCM.objects.count()

for cve in cves:
if data["debug"]:
self.log_info(obj=cve, message="Generating vulnerabilities for CVE {cve}")
software_rels = RelationshipAssociation.objects.filter(relationship__slug="soft_cve", destination_id=cve.id)
for soft_rel in software_rels:

Expand Down

0 comments on commit 4c98847

Please sign in to comment.