-
Notifications
You must be signed in to change notification settings - Fork 57
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
Actually activate inventory caching #97
Actually activate inventory caching #97
Conversation
Codecov Report
@@ Coverage Diff @@
## main #97 +/- ##
==========================================
+ Coverage 63.75% 70.78% +7.03%
==========================================
Files 30 1 -29
Lines 2163 89 -2074
Branches 417 16 -401
==========================================
- Hits 1379 63 -1316
+ Misses 551 24 -527
+ Partials 233 2 -231 Continue to review full report at Codecov.
|
Not sure what codecov did here, but those numbers are definitely broken. It looks like we are comparing full coverage with partial coverage (only lines that I changed), but since I do not use codecov personally, I have no experience with these things. |
@gundalow Can you help us with the failing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this, LGTM:
❯ grep cache digitalocean.yml
cache: yes
cache_plugin: jsonfile
cache_timeout: 300
cache_connection: /tmp/do_inventory
cache_prefix: do_
❯ head /tmp/do_inventory/do_community.digitalocean.digitalocean_bccfds_7fdd2
[
{
"backup_ids": [],
"created_at": "2021-05-24T23:40:20Z",
"disk": 25,
"features": [
"private_networking"
],
"id": 247480313,
"image": {
@tadeboro Want to add a quick changelog fragment? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changelog fragment please.
6dc9d2f
to
51115c3
Compare
@mamercad I wanted to add a changelog fragment once I knew the PR number, but then the code coverage distracted me ;) |
Could you try changing coverage:
status:
project:
default:
informational: true # Don't fail CI if percentage drops
patch:
default:
informational: true # Don't fail CI if percentage drops
# Don't count lines of code in these directories
ignore:
- tests
fixes:
- "ansible_collections/community/digitalocean/::" |
51115c3
to
fc7b4b8
Compare
The inventory plugin advertises support for caching, but the implementation was missing the required pieces to make it work properly. This commit split the inventory construction into two stages. The first stage is responsible for fetching remote data (interacting with the DigitalOcean's API). The second stage extracts the relevant data from the API responses and populated the inventory. Caching support then came almost for free. All we had to do is only fetch data if: 1. User does not want to use cache at all. 2. User does use cache and wants data refreshed. 3. User does use cache but the cache is empty. There is some additional logic that makes sure we write the data to cache if data refresh is requested, but nothing too complex.
fc7b4b8
to
aa2fc1b
Compare
I rebased the changes onto the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this!
SUMMARY
The inventory plugin advertises support for caching, but the implementation was missing the required pieces to make it work properly.
This commit split the inventory construction into two stages. The first stage is responsible for fetching remote data (interacting with the DigitalOcean's API). The second stage extracts the relevant data from the API responses and populated the inventory.
Caching support then came almost for free. All we had to do is only fetch data if:
Some additional logic makes sure we write the data to cache if data refresh is requested, but nothing too complex.
ISSUE TYPE
COMPONENT NAME
community.digitalocean.digitalocean
inventory plugin