Skip to content

Commit

Permalink
Fix #689: correctly pass job name to GraphStatement (#1355)
Browse files Browse the repository at this point in the history
### Summary
> Describe your changes.

Fixes job name not being correctly passed to the graph statement from
the data model.



### Checklist

Provide proof that this works (this makes reviews move faster). Please
perform one or more of the following:
- [x] Include console log trace showing what happened before and after
your changes.

Before

```
INFO:cartography.graph.statement:Completed None statement #None
INFO:cartography.graph.statement:Completed None statement #None
INFO:cartography.graph.job:Finished job EMRCluster
```

```
INFO:cartography.intel.aws.inspector:Running AWS Inspector cleanup
INFO:cartography.graph.statement:Completed None statement #None
INFO:cartography.graph.statement:Completed None statement #None
INFO:cartography.graph.statement:Completed None statement #None
INFO:cartography.graph.statement:Completed None statement #None
INFO:cartography.graph.statement:Completed None statement #None
INFO:cartography.graph.job:Finished job AWSInspectorFinding
INFO:cartography.graph.statement:Completed None statement #None
INFO:cartography.graph.statement:Completed None statement #None
INFO:cartography.graph.statement:Completed None statement #None
INFO:cartography.graph.job:Finished job AWSInspectorPackage
```

After

```
INFO:cartography.graph.statement:Completed EMRCluster statement #1
INFO:cartography.graph.statement:Completed EMRCluster statement #2
INFO:cartography.graph.job:Finished job EMRCluster
```

```
INFO:cartography.intel.aws.inspector:Running AWS Inspector cleanup
INFO:cartography.graph.statement:Completed AWSInspectorFinding statement #1
INFO:cartography.graph.statement:Completed AWSInspectorFinding statement #2
INFO:cartography.graph.statement:Completed AWSInspectorFinding statement #3
INFO:cartography.graph.statement:Completed AWSInspectorFinding statement #4
INFO:cartography.graph.statement:Completed AWSInspectorFinding statement #5
INFO:cartography.graph.job:Finished job AWSInspectorFinding
INFO:cartography.graph.statement:Completed AWSInspectorPackage statement #1
INFO:cartography.graph.statement:Completed AWSInspectorPackage statement #2
INFO:cartography.graph.statement:Completed AWSInspectorPackage statement #3
INFO:cartography.graph.job:Finished job AWSInspectorPackage
```
  • Loading branch information
achantavy authored Sep 18, 2024
1 parent 910d8b6 commit c9500db
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cartography/graph/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,14 @@ def from_node_schema(
)

statements: List[GraphStatement] = [
GraphStatement(query, parameters=parameters, iterative=True, iterationsize=100) for query in queries
GraphStatement(
query,
parameters=parameters,
iterative=True,
iterationsize=100,
parent_job_name=node_schema.label,
parent_job_sequence_num=idx,
) for idx, query in enumerate(queries, start=1)
]

return cls(
Expand Down

0 comments on commit c9500db

Please sign in to comment.