Product Documentation

Repeat-condition construct

May 24, 2018

The repeat-condition construct is evaluated in each iteration of a repeat construct and the result determines whether to build the configuration object in that iteration or to move to the next iteration. The following example shows the use of the repeat-condition construct:

Example:

components

      -

         name: der-key-files-comp

         type: ns::systemfile  

         repeat:

              repeat-list: $parameters.certificates

              repeat-item: certificate

              repeat-condition: $certificate.ssl-inform == DER

         properties:

               filecontent: base64($certificate.keyfile.contents)

               fileencoding: BASE64

               filelocation: /nsconfig/ssl

               filename: $certificate.keyfile.file
 

In this example, the der-key-files-comp component iterates over all the certificates given by the user but it only builds configuration objects that correspond to certificates with DER encoding. In each iteration, the repeat-condition expression is evaluated to test whether the certificate encoding is of type DER. If it is not of type DER, no configuration object is built in the current iteration, and the iteration moves to the next certificate in the list.