Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

V2 create basic structure #671 #682

Merged
merged 8 commits into from
Jul 25, 2023

Conversation

miyunari
Copy link
Member

@miyunari miyunari commented Jul 24, 2023

closes #671

Signed-off-by: Janine Olear <pninak@web.de>
Signed-off-by: Janine Olear <pninak@web.de>
@codecov
Copy link

codecov bot commented Jul 24, 2023

Codecov Report

Patch coverage: 87.77% and project coverage change: -1.79% ⚠️

Comparison is base (a7a3a75) 93.90% compared to head (6088c9f) 92.11%.

❗ Current head 6088c9f differs from pull request most recent head ce70d85. Consider uploading reports for the commit ce70d85 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #682      +/-   ##
==========================================
- Coverage   93.90%   92.11%   -1.79%     
==========================================
  Files           9        9              
  Lines         410      482      +72     
  Branches       88      102      +14     
==========================================
+ Hits          385      444      +59     
- Misses         13       20       +7     
- Partials       12       18       +6     
Files Changed Coverage Δ
src/cloudimagedirectory/connection/connection.py 90.47% <50.00%> (-9.53%) ⬇️
src/cloudimagedirectory/transform/transform.py 91.01% <93.05%> (-0.90%) ⬇️
src/cloudimagedirectory/transformer.py 77.77% <100.00%> (+2.02%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Janine Olear <pninak@web.de>
@miyunari miyunari force-pushed the v2_create_basic_structure_#671 branch from 2ea5c05 to 5e3f76d Compare July 24, 2023 21:38
Signed-off-by: Janine Olear <pninak@web.de>
Signed-off-by: Janine Olear <pninak@web.de>
@miyunari miyunari self-assigned this Jul 25, 2023
@miyunari miyunari marked this pull request as ready for review July 25, 2023 08:06
Signed-off-by: Janine Olear <pninak@web.de>
@miyunari miyunari force-pushed the v2_create_basic_structure_#671 branch from 43e3931 to 6088c9f Compare July 25, 2023 09:00
filename = entry.filename.split("/")
if len(filename) < 3:
print("warn: could not determine region or provider of image: " + entry.filename)
continue

entry.content["provider"] = filename[1]
entry.content["region"] = filename[2]
entry.content["provider"] = filename[4]
Copy link
Member

@F-X64 F-X64 Jul 25, 2023

Choose a reason for hiding this comment

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

This is totally fine but I can imagine that these array access values might be confusing in the long run. Maybe we can use namedtuples in the future? It would at least make accessing the individual fields easier.

Just an example:

  from collections import namedtuple
  
  APIPath = namedtuple('APIPath', ['api_version', 'distro', 'provider', 'version','region','image_id'])
  
  split_path = "v2/rhel/google/9.0.0/us-east-1/asdasdasdadaf".split('/')
  api_path = APIPath(*split_path)
  
  print(api_path.api_version)
  print(api_path.image_id)

That api_path could be a property of the DataEntry object or something.

Copy link
Member Author

@miyunari miyunari Jul 25, 2023

Choose a reason for hiding this comment

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

I agree, that looks way better to maintain. 😄 Is it ok, when I adapt this in another pr? :)

Copy link
Member Author

Choose a reason for hiding this comment

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

I created a new issue for it :) #685

Copy link
Member

Choose a reason for hiding this comment

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

Absolutely, thanks for taking care of this.

@miyunari miyunari merged commit 0cf01a3 into redhatcloudx:main Jul 25, 2023
4 checks passed
@miyunari miyunari deleted the v2_create_basic_structure_#671 branch July 25, 2023 09:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API v2: Create basic structure
2 participants