Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrected priority issue and sql upsert #255 #256

Merged
merged 1 commit into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading