Skip to content

Commit

Permalink
Corrected priority issue and sql upsert #255
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveMcGrath committed May 20, 2024
1 parent aee87eb commit 4b5d9a6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions tenb2jira/jira/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def gen_priority(self, field_id: str) -> None:
"""
value = str(self.fields[field_id]).lower()
self.priority = str(self.idef.severity_map[value])
self.fields['priority'] = {'id': self.priority}

def gen_state(self, field_id: str):
"""
Expand Down
3 changes: 2 additions & 1 deletion tenb2jira/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def build_mapping_db_model(self,
issues.append(model(**item).asdict())
if issues:
stmt = insert(model).values(issues)\
.on_conflict_do_nothing()
.prefix_with('OR IGNORE')
s.execute(stmt)
s.commit()

Expand Down Expand Up @@ -431,6 +431,7 @@ def sync(self):
self.config['tenable']['last_run'] = ts
self.finished_time = datetime.now()

self.engine.dispose()
# Delete the mapping database.
with Path(self.config["mapping_database"].get("path")) as p:
p.unlink()
2 changes: 1 addition & 1 deletion tenb2jira/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = '2.0.2'
version = '2.0.3'
1 change: 1 addition & 0 deletions tests/jira/test_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ def test_generate(jira_config,
'summary': '[Test Name]',
'project': {'key': 'VULN'},
'issuetype': {'id': 1},
'priority': {'id': '1'},
}
assert tobj.priority == '1'
jql = ('project = "VULN" AND issuetype = "Task" '
Expand Down

0 comments on commit 4b5d9a6

Please sign in to comment.