Skip to content

get_agents returns an invalid json with two entries for osDescription #268

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

Closed
atbagga opened this issue Sep 11, 2019 · 4 comments
Closed
Assignees
Labels

Comments

@atbagga
Copy link

atbagga commented Sep 11, 2019

As reported here - Azure/azure-devops-cli-extension#755

The get_agents function returns a json object as below -

[                                                          
  {                                                        
    "accessPoint": "CodexAccessMapping",                   
    "assignedAgentCloudRequest": null,                     
    "assignedRequest": null,                               
    "authorization": {                                     
      "authorizationUrl": null,                            
      ..
       ..
      }                                                    
    },                                                     
    "createdOn": "2019-09-11T06:38:19.797000+00:00",       
    "enabled": true,                                       
    "id": 89,                                              
    "lastCompletedRequest": null,                          
    "maxParallelism": 1,                                   
    "name": "ATBAGGA-Agent",                             
    "oSDescription": null,                                 
    "osDescription": "Microsoft Windows 10.0.18362 ",      
    "pendingUpdate": null,                                 
    "properties": null,                                    
    "provisioningState": "Provisioned",                    
    "status": "online",                                    
    "statusChangedOn": null,                               
    "systemCapabilities": null,                            
    "userCapabilities": null,                              
    "version": "2.155.1"                                   
  }                                                        
]                                                          

The issue is due to different case in key (osDescription) returned by the API than the object in python client here where it is (oSDescription).

@tedchamb
Copy link
Member

tedchamb commented Sep 12, 2019

Serialization/Deserialization is controlled by this line for 5.1:

'oSDescription': {'key': 'osDescription', 'type': 'str'},

The oSDescription is the python property name. The key value is osDescription, which is the json name to serialize to or deserialize from. It is basically saying to take the the value of the json kvp with key 'osDescription and assign that value to the python property oSDescription, so I expcect this to work fine.

The property name oSDescription does not follow python naming guidance, and should be os_description, but that should not cause the problem you mention.

The value in the 5.0 version of the api is wrong on this line, so i expect you are using 5.0 APIs or an older version of the sdk:

'oSDescription': {'key': 'oSDescription', 'type': 'str'},

I will fix both the improper naming of the property and the 5.0 deserialization issue.

@tedchamb tedchamb added the bug label Sep 12, 2019
@tedchamb tedchamb self-assigned this Sep 12, 2019
@tedchamb
Copy link
Member

#269 for the 5.0 APIs.

@tedchamb
Copy link
Member

#270 for the 5.1 APIs.

@tedchamb
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants