VMware Cloud Community
SergeyIW
Contributor
Contributor

Can some actions be repeated when the progress bar is shown?

Hello!

Please help me to solve the following problem:

I have a script that polls the state of some resource. I need to get resource state as zero before beginning of product installation. I'm trying to use the following code snippet in the InstallBuilder's project, but it not works because I can't call wait-setInstallerVariableFromScriptOutput actions one more time:

<showProgressDialog>

    <title>Get state for some resource</title>

    <actionList>

        ...

        <setInstallerVariableFromScriptOutput>

            <exec>sh</exec>

            <execArgs>get_resource_state.sh</execArgs>

            <name>resource_state_code</name>

            <progressText>Please wait ...</progressText>

            <workingDirectory>${action_scripts_dir}</workingDirectory>

        </setInstallerVariableFromScriptOutput>

        <!-- Need to repeat this actions if resource_state_code does not equal zero -->

        <wait>

            <ms>1000</ms>

            <progressText>Resource state: ${resource_state_code}</progressText>

            <ruleList>

                <compareValues>

                    <logic>does_not_equal</logic>

                    <value1>${resource_state_code}</value1>

                    <value2>0</value2>

                </compareValues>

            </ruleList>

        </wait>

        <setInstallerVariableFromScriptOutput>

            <exec>sh</exec>

            <execArgs>get_resource_state.sh</execArgs>

            <name>resource_state_code</name>

            <progressText>Resource state: ${resource_state_code}</progressText>

            <workingDirectory>${action_scripts_dir}</workingDirectory>

            <ruleList>

                <compareValues>

                    <logic>does_not_equal</logic>

                    <value1>${resource_state_code}</value1>

                    <value2>0</value2>

                </compareValues>

            </ruleList>

    </setInstallerVariableFromScriptOutput>

...

</showProgressDialog>

Important questions: can I repeat wait-setInstallerVariableFromScriptOutput actions calling until resource_state_code variable is not equals zero? Can I continue to show progress bar while it doing? If yes, how to do it?

Thanks in advance!

Labels (1)
0 Kudos
2 Replies
michiel_dhont
Enthusiast
Enthusiast

Hi SergeyIW,

You can use the <while> action to repeat a series of actions until a condition is met. For example, to wait for a file to exists before continuing an installation you can do the following:

         <while>

       <actionList>

         <showProgressDialog>

            <actionList>

              <wait progressText="Checking...">

                  <ms>2000</ms>

              </wait>

            </actionList>

         </showProgressDialog>

         <break progressText="File found">

           <ruleList>

             <fileExists>

                 <path>/tmp/testing</path>

             </fileExists>

           </ruleList>

         </break>

       </actionList>

     </while>

Regards,

Michiel

0 Kudos
SergeyIW
Contributor
Contributor

Hello, Michiel!

Your answer is very helpful, my project works properly now! Thank you very much!

0 Kudos