Uploaded image for project: 'Mender'
  1. Mender
  2. MEN-2377

Clarify "device_identity" JSON Sub-string Behavior

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Open
    • Priority: Low
    • Resolution: Unresolved
    • Affects Version/s: 1.4.0
    • Fix Version/s: None
    • Environment:
      Linux 3.10 - Yocto Morty

      Description

      The string construction for the device_identity JSON substring needs to be documented in the Mender documentation and the examples corrected.

      The issue is that the "device_identity" JSON substring is compared via an exact string match including the JSON itself. This means, that i.e. 

      someattribute: somevalue
      

      is not the same as

       

       

      someattribute:somevalue
      

       

      The spaces matter, and so does the ordering. It appears that the board client formats the strings without spaces in between colons, and also it puts them in alphabetical order.

       

      So for the abstract device_identity set:

       

      device_identity={
      mac=00:01:02:03:04:05
      sku=My Device 1
      sn=SN1234567890
      }
      

       

       

      The board mender client would build and POST a JSON string that looks like the following:

       

      "device_identity": "{\"mac\":\"00:01:02:03:04:05\",\"sku\":\"My Device 1\",\"sn\":\"SN1234567890\"}"
      

       

      However, the examples in the documentation show this as it would be:

       

      "device_identity" : "{\"mac\":\"00:01:02:03:04:05\", \"sku\":\"My Device 1\", \"sn\":\"SN1234567890\"}"
      

       

       

      Notice all the extra spaces in the substring with the attributes, those won't actually be there, so this example is incorrect and confusing especially considering this behavior doesn't seem to be documented.

       

      This should probably be mentioned here:

      https://docs.mender.io/1.4/apis/management-apis/device-admission#devices-post

      and maybe here too (or at least linked)

      https://docs.mender.io/1.4/client-configuration/identity

      Note that this appears to be identical in newer versions of Mender that use the v1 API. I haven't looked at v2 so I understand it may be different, but either way this should be documented.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ken.sloat Ken Sloat
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Summary Panel