Comments (3)
No state is usually interpreted as "present" in DebOps roles, and the above logic doesn't really reflect that. But as far as I can remember, debops.debops.parse_kv_items
should set an undefined state
to present
. @BerkhanBerkdemir: what did your inventory look like when you triggered this behaviour?
Anyway, I guess the logic above could be improved. A first thought would be to replace selectattr("state", "eq", "present")
by rejectattr("state", "in", "[init, absent, ignore]")
...buuut that doesn't work because rejectattr
blows up when state
is undefined.
I think a better option might be to replace this:
ansible.builtin.set_fact:
bind__tmp_top_views: '{{ bind__combined_zones
| debops.debops.parse_kv_items(name="view")
| selectattr("state", "eq", "present") }}'
...
ansible.builtin.set_fact:
bind__tmp_top_zones: '{{ bind__combined_zones
| debops.debops.parse_kv_items(name="name")
| selectattr("state", "eq", "present") }}'
With something like this:
ansible.builtin.set_fact:
bind__tmp_top_views: '{{ bind__tmp_top_views | d([]) + [ item ] }}'
loop: '{{ bind__combined_zones
| debops.debops.parse_kv_items(name="view") }}'
loop_control:
label: '{{ item.view }}'
when: item.state | d("present") == "present"
...
ansible.builtin.set_fact:
bind__tmp_top_zones: '{{ bind__tmp_top_zones | d([]) + [ item ] }}'
loop: '{{ bind__combined_zones
| debops.debops.parse_kv_items(name="name") }}'
loop_control:
label: '{{ item.name }}'
when: item.state | d("present") == "present"
from debops.
What did your inventory look like when you triggered this behavior?
I have used the suggested inventory which is in the documentation. Currently there is nothing in the production system but I'm testing everything in a virtual environment before I make this DebOps role available to my network.
I liked your approach @Alphix, and I would like to try that in my own development environment.
from debops.
I am actually thinking different in this bug at this point. Since both variables are already filled with data, we should be checking only if it is NOT. So, why are we checking if it is == 0
? Let's check if it's > 0
.
from debops.
Related Issues (20)
- Please change handling of apt recommends installing
- [debops.nginx]: Support geo maps
- NodeJS nodesource repository change
- [debops] Installation instructions need to be updated
- [postgresql_server] Could do with some upgrade documentation
- postgresql role is broken with multiple problems
- Server side calls missing in multiple roles? HOT 1
- Role environment - debops v3.0.5 - type error bool instead of str
- DOC: Broken links to https://docs.debops.org/en/latest/debops-keyring/docs/index.html
- Secret is undefined HOT 5
- ubuntu noble removes /etc/apt/sources.list file HOT 6
- debops.debops.kmod: Unload kernel module fails at the first time HOT 1
- Swap file deletion
- extrepo: Why not for Ubuntu, only for Debian? HOT 2
- Nginx: Tag 'role::nginx:servers' no more applied? HOT 1
- Add a authorized_keys for a user that is not local on host HOT 2
- Dropbear initramfs : Renamed config path from /etc/dropbear-initramfs to /etc/dropbear/initramfs
- PKI: How to manually sign a CSR?
- PKI: ACME request not signed by Let's Encrypt but by our internal CA? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from debops.