Uploaded image for project: 'CFEngine Community'
  1. CFEngine Community
  2. CFE-1339

selectservers returns null first array element

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.6.0
    • Component/s: None
    • Labels:
      None
    • Platform:
      Any
    • Found in version (details):
      3.6.0rc1

      Description

      3.6.0rc1:

      <pre>
      cf-agent -KIf ./selectserver.cf
      R: Number of active servers 2
      R: First server $(alive_servers[0]) fails over to corsair
      R: [ servers ] = corsair
      R: [ servers ] = raptor
      </pre>

      3.5.3:

      <pre>
      cf-agent -KIf ./selectserver.cf
      2014-04-11T08:18:11-0500 notice: R: Number of active servers 2
      2014-04-11T08:18:11-0500 notice: R: First server corsair fails over to raptor
      2014-04-11T08:18:11-0500 notice: R: [ servers ] = corsair
      2014-04-11T08:18:11-0500 notice: R: [ servers ] = raptor
      </pre>

      <pre>
      bundle agent test
      {
      vars:
      "hosts" slist =>

      { "corsair", "raptor" }

      ;
      "up_servers" int => selectservers("@(hosts)","5308","","","100","alive_servers");
      "servers" slist => getvalues("alive_servers");

      classes:
      "someone_alive" expression => isgreaterthan("$(up_servers)","0");
      "i_am_a_server" expression => regarray("up_servers","$(host)|$(fqhost)");

      reports:
      someone_alive::
      "Number of active servers $(up_servers)";
      "First server $(alive_servers[0]) fails over to $(alive_servers[1])";

      "[ servers ] = $(servers)";
      }
      </pre>

        Attachments

          Activity

            People

            • Assignee:
              a10038 jimis (Dimitrios Apostolou)
              Reporter:
              ringersoll Bob Ingersoll
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Summary Panel