I am writing an Fixlet where first part must be executed if it found Linux 8 else it should go for second part which is RHEL 7.
I worked hard to fix this but it does not execute first part and always went for second part. Then i saw that relevance part is not working. So i had tried a different relevance based on OS to troubleshoot the issue but that relevance gave true on qna but when i run it through the bigfix action script it always went for second part.
Q: if exists file “/etc/redhat-release” whose (exists line whose (exists match (regex “Red Hat Enterprise Linux release 8”) of it) of it) then “true” else "false"
A: true
T: 5248
if exists file “/etc/redhat-release” whose (exists line whose (exists match (regex “Red Hat Enterprise Linux release 8”) of it) of it)
1st part wait mkdir /tmp/gs1 else
2nd part wait mkdir /tmp/gs2
if {(name of it contains "Red" and major version of it = 7) of operating system}
wait mkdir /tmp/gs1
elseif
{(name of it contains "Red" and major version of it = 8) of operating system}
wait mkdir /tmp/gs2
endif
Else-statement doesn’t allow condition, it’s always unconditional. If you want second condition use elseif for it but if you do have elseif-statement, you do need else-statement even if there is nothing in it…
if {(name of it contains "Red" and major version of it = 7) of operating system}
wait mkdir /tmp/gs1
elseif {(name of it contains "Red" and major version of it = 8) of operating system}
wait mkdir /tmp/gs2
else
//do nothing
endif
However, the else (whether there is and elseif or not) is optional.
These both work (but have no useful purpose other than prove valid syntax):
if {Monday = day_of_week of current date}
parameter "x"="{"Monday"}"
elseif {Tuesday = day_of_week of current date}
parameter "x"="{"Tuesday"}"
endif
if {Monday = day_of_week of current date}
parameter "y"="{"Monday"}"
elseif {Tuesday = day_of_week of current date}
parameter "y"="{"Tuesday"}"
else
parameter "y"="{"Other"}"
endif