Details
Description
Filing on behalf of customer request to create a class any time a single condition from a list is not met.
The initial pattern attempted:
classes: "legacy_hostname" not => or( regcmp( "$(bias_hostname_regex)", $(sys.uqhost) ), fileexists("$(cliqr_file)") ), comment => "hostname is not BIAS-compliant and not a CliQr host.";
But because the logical functions returns strings instead of Booleans the "not" attribute did not like that, we ended up with this:
classes: "legacy_hostname" expression => "any", ifvarclass => and( not( fileexists("$(flag_file)")), not( regcmp( "$(hostname_regex)", $(sys.uqhost) ) ) ), comment => "This is a legacy host if it doesnt have a new flag file, and the hostname regex doesnt match the current standard";
Another pattern that also works:
"legacy_hostname" expression => not( or( regcmp( $(reg_match), $(sys.uqhost) ), fileexists( $(flag_file) ) ) ), comment => "defined if '$(reg_match)' does not match '$(sys.uqhost)' AND '$(flag_file)' does not exist";
Could we have something like this, which would allow our intention to shine through and would have less syntax:
classes: "legacy_hostname" nor => { regcmp( "$(bias_hostname_regex)", $(sys.uqhost) ), fileexists("$(cliqr_file)") }, comment => "hostname is legacy.";