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

Fix #1289 EC2 get_images_in_use() failed with CypherSyntaxError when using Neo4J 5.16.0 #1290

Merged
merged 1 commit into from
Mar 21, 2024

Conversation

pvasilevich
Copy link
Contributor

No description provided.

Copy link
Contributor

@achantavy achantavy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for taking this on and very much appreciate the fix! Sorry for the lateness in this review

WHERE ltv.region = $Region
WITH collect(DISTINCT ltv.image_id)+images AS images
RETURN images
Copy link
Contributor

@achantavy achantavy Mar 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make sure I understand

(comment 1) If I understand correctly, this originally returns a list of image ids in a field called images.

WHERE ltv.region = $Region
WITH collect(DISTINCT ltv.image_id)+images AS images
RETURN images
RETURN DISTINCT(ltv.image_id) as image
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(comment 2) .. and this new code returns a list of image id strings without needing to put it in a field of any sort

"""
results = neo4j_session.run(get_images_query, AWS_ACCOUNT_ID=current_aws_account_id, Region=region)
images = []
for r in results:
images.extend(r['images'])
images.append(r['image'])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(comment 3) and because of that we can simply append to the existing array instead of extend

@achantavy achantavy merged commit 8f2b57a into cartography-cncf:master Mar 21, 2024
5 checks passed
chandanchowdhury pushed a commit to juju4/cartography that referenced this pull request Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EC2 get_images_in_use() failed with CypherSyntaxError when using Neo4J 5.16.0
2 participants