Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attribute's metadata update fails when no value is given for such an attribute #766

Closed
frbattid opened this issue Feb 12, 2015 · 1 comment

Comments

@frbattid
Copy link
Member

Orion warns that updating an attribute's metadata when no value is given for such attribute is an offending operation:

$ cat updateContext.sh
(curl localhost:1026/v1/updateContext -s -S --header 'Content-Type: application/json' --header 'Accept: application/json' -d @- | python -mjson.tool) <<EOF
{
    "contextElements": [
        {
            "type": "Room",
            "isPattern": "false",
            "id": "Room1",
            "attributes": [
            {
                "name": "temperature",
                "type": "float",
                "metadatas": [
                {
                        "name": "max",
                        "type": "double",
                        "value": "50"
                }
                ]
            },
            {
                "name": "pressure",
                "type": "integer",
                "value": "763"
            }
            ]
        }
    ],
    "updateAction": "UPDATE"
}
EOF
$ ./updateContext.sh 
{
    "contextResponses": [
        {
            "contextElement": {
                "attributes": [
                    {
                        "name": "temperature", 
                        "type": "float", 
                        "value": ""
                    }
                ], 
                "id": "Room1", 
                "isPattern": "false", 
                "type": "Room"
            }, 
            "statusCode": {
                "code": "472", 
                "details": "action: UPDATE - entity: [Room1, Room, false] - offending attribute: temperature - empty attribute not allowed in APPEND or UPDATE", 
                "reasonPhrase": "request parameter is invalid/not allowed"
            }
        }
    ]
}

Why is it necessary to provide a value for the attribute? I mean, I'm updating the attribute's metadata, not the attribute itself. This kind of behavior avoids this data lifecycle I was implementing through Cygnus:

  1. An attribute's change is notified by Orion to Cygnus.
  2. Cygnus uses the notified value in order to update certain statistics about the attribute such as maximum and minimum value, or average value.
  3. Cygnus updates the attribute's metadata by pushing the calculated max, min, average, etc, but not updating the attribute itself.

Effort: 2 man day

@fgalan fgalan added this to the 0.19.0-next milestone Feb 12, 2015
@fgalan fgalan modified the milestones: 0.20.0, 0.21.0 Mar 25, 2015
@fgalan fgalan modified the milestones: 0.21.0, 0.22.0 Apr 15, 2015
@fgalan fgalan modified the milestones: 0.22.0, 0.23.0 May 24, 2015
@fgalan
Copy link
Member

fgalan commented Jun 16, 2015

Addressed in PR #1009

@fgalan fgalan closed this as completed Jun 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants