Checking for the existence of a fact
Closed this issue · 4 comments
Unless I missing the obvious it does not seem easy achievable to check for the presence or absence of a fact.
For example I want to check if networking.interfaces.ib0 is present as this would indicate that I have an Infiniband interface present and can then add the Infininband class.
yup, dont think its possible, you could make a custom fact though i guess?
I tried the following:
classifier::rules:
InfiniBand:
match: all
rules:
- fact: "%{facts.networking.interfaces.enp0s8.mtu}"
operator: ==
value: 1500
classes:
- example
however it does not result in a box with interface name enp0s8 getting the example class.
I also tried:
operator: >
value: 1
but then get an error saying I am trying to compare against ''. So for some reason there is no value, but I am not sure why.
closing as we resolved it on slack - operator and value should be quoted
I will try and find time for a PR to give an extra example and to update the existing examples to show quoted operators.