VMware Cloud Community
gpepus
Contributor
Contributor

Rules and Actions -- isTrue is returning false when value is clearly matching (the log shows it) -- CONFUSION

Dear All

I have a choiceParameter to allow the user to specify OS and version target (e.g. Red Hat Linux 7).  I am able to see the list of OS options fine.  I set an actionList nested in a set of PostShowPageActionList and showProgressDialogs (see XML code snippet below) . The actionList by itself works great.  But when I attempt to put a ruleList adjacent (under it) with <isTrue value="opensuse15_1"/> it does not fire and skips my showProgressDialog and actionList runProgram etc -- and that's because it says in the LOG (see below) that the result (of isTrue is '0' even though the <value>:""opensuse15_1"" --> ""opensuse15_1"" which is clearly a match.


I'm confused so perhaps you might help me clarify why this isn't working.  The goal is for the user to select the OS, then to test which OS it is and run the right set of OS library installers for that version of linux -- i.e. if opensuse run zypper install (list of packages) or if redhat run yum or dkpg install (list of packages) etc.

    

Log snippet:

Evaluating set of rules with 'and' evaluation logic

Properties of element <isTrue>:

<negate> : "0" -> "0"

<value> : ""opensuse15_1"" -> ""opensuse15_1""

Evaluating rule <isTrue>

Result is '0'

Rule evaluation logic is 'and', no need to evaluate other rules

Rules are false

Rules do not match skipping action <showProgressDialog>

XML code snippet:

  <choiceParameter>

            <name>operatingSystem</name>

            <title>Select Operating System</title>

            <description>Operating system selection</description>

            <explanation>Choose the target Operating System</explanation>

            <value></value>

            <default>opensuse15_1</default>

            <allowEmptyValue>1</allowEmptyValue>

            <displayType>combobox</displayType>

            <ordering>default</ordering>

            <width>30</width>

            <optionList>

                <option description="Red Hat Linux 7" text="Red Hat 7" value="redhat7">

                    <image></image>

                </option>

                <option description="Centos Linux 7" text="Centos 7" value="centos7">

                    <image></image>

                </option>

                <option description="Red Hat Linux 8" text="Red Hat 8" value="redhat8">

                    <image></image>

                </option>

                <option description="Centos Linux 8" text="Centos 8" value="centos8">

                    <image></image>

                </option>

                <option description="OpenSUSE Linux Leap 15.1" text="OpenSUSE Leap 15.1" value="opensuse15_1">

                    <image></image>

                </option>

                <option description="SUSE Enterprise" text="SUSE Enterprise 15.2" value="suse15_2">

                    <image></image>

                </option>

                <option description="Ubuntu Linux" text="Ubuntu 18.04" value="ubuntu18_04">

                    <image></image>

                </option>

            </optionList>

            <postShowPageActionList>

                <showProgressDialog>

                    <title></title>

                    <actionList>

                        <runProgram progressText="Installing Local OS RPMs ...">

                            <program>zypper</program>

                            <programArguments>in -y which vim unzip python3 python3-pip python-virtualenvwrapper python3-devel libgnutlsxx-devel libgnutls-devel gcc-c++ gnutls libjson-c-devel libboost_python-py3-1_66_0 libboost_python-py3-1_66_0-devel libboost_headers1_66_0-devel patterns-devel-base-devel_basis libopenssl-devel tcl</programArguments>

                        </runProgram>

                    </actionList>

                    <ruleList>

                        <isTrue value="opensuse15_1" />

                    </ruleList>

                </showProgressDialog>

            </postShowPageActionList>

        </choiceParameter>

    </parameterList>

Labels (1)
0 Kudos
1 Reply
michiel_dhont
Enthusiast
Enthusiast

Hi,

You need to use the <compareText> rule to check for the value of the choiceParameter. For example:

        <ruleList>

            <compareText value="${operatingSystem}" logic="equals" text="opensuse15_1"/>

        </ruleList>

Best regards,

Michiel

0 Kudos