Uploaded image for project: 'Ambari'
  1. Ambari
  2. AMBARI-6056

Agent Custom Command Output Coerces Integers to Floats

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.6.1
    • 1.6.1
    • None
    • None
    • CentOS 6.4

    Description

      When posting a command such as

      {
        "RequestInfo": {
          "action": "check_host", 
          "context": "Check host", 
          "parameters": {
            "check_execute_list": "host_resolution_check", 
            "hosts": "c6401.ambari.apache.org, c6402.ambari.apache.org, c6403.ambari.apache.org, foobar", 
            "threshold": "20"
          }
        }, 
        "Requests/resource_filters": [
          {
            "hosts": "c6401.ambari.apache.org,c6402.ambari.apache.org"
          }
        ]
      

      The returned result from the custom action has some integer values coerced into floats:

          "structured_out" : {
            "host_resolution_check" : {
              "exit_code" : "0",
              "failed_count" : 0.0,
              "failures" : [ ],
              "message" : "All hosts resolved to an IP address.",
              "success_count" : 4.0
            }
      

      The structured_output written out to disk does NOT have the float values:

      {"host_resolution_check": {"failures": [], "message": "All hosts resolved to an IP address.", "failed_count": 0, "success_count": 4, "exit_code": "0"}}
      

      Therefore this is a problem with the framework and not the command.

      Attachments

        Issue Links

          Activity

            People

              jonathanhurley Jonathan Hurley
              jonathanhurley Jonathan Hurley
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: