-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(inventory): always use fresh cache on new cached session (#404)
##### SUMMARY The class scoped `cache` dict was being shared across all `cached_session`, we now make sure that the cache is instance scoped. Fixes #403 ##### ISSUE TYPE - Bugfix Pull Request
- Loading branch information
Showing
4 changed files
with
48 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
bugfixes: | ||
- hcloud inventory - Ensure the API client use a new cache for every *cached session*. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
- name: Demonstrate the usage of 'refresh_inventory' | ||
hosts: localhost | ||
connection: local | ||
|
||
tasks: | ||
- name: Print hostvars | ||
ansible.builtin.debug: | ||
var: hostvars | ||
|
||
- name: Create new server | ||
hetzner.hcloud.server: | ||
name: my-server | ||
server_type: cx11 | ||
image: debian-12 | ||
|
||
- name: Refresh inventory | ||
ansible.builtin.meta: refresh_inventory | ||
|
||
- name: Run tests | ||
block: | ||
- name: Print updated inventory | ||
ansible.builtin.debug: | ||
var: hostvars | ||
|
||
- name: Verify hostvars is not empty | ||
ansible.builtin.assert: | ||
that: | ||
- hostvars != {} | ||
|
||
always: | ||
- name: Cleanup server | ||
hetzner.hcloud.server: | ||
name: my-server | ||
state: absent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters