question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Generic update should convert camelCased keys to python_case

See original GitHub issue

Description

When i run:

az vm update -n VM_NAME-g VM_GROUP --add osProfile.secrets '{"sourceVault":{"id":"valid key vault uri"},"vaultCertificates":[{"certificateUrl": "valid uri to certificate"}]}'

I receive:

ERROR: 'sourceVault'
Traceback (most recent call last):
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\azure\cli\main.py", line 36, in main
    cmd_result = APPLICATION.execute(args)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\azure\cli\core\application.py", line 211, in execute
    result = expanded_arg.func(params)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\azure\cli\core\commands\__init__.py", line 346, in __call__
    return self.handler(*args, **kwargs)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\azure\cli\core\commands\arm.py", line 407, in handler
    raise ex
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\azure\cli\core\commands\arm.py", line 390, in handler
    opres = setter(client, **setterargs) if client else setter(**setterargs)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\azure\mgmt\compute\compute\v2016_04_30_preview\operations\virtual_machines_operations.py", line 180, in create_or_update
    body_content = self._serialize.body(parameters, 'VirtualMachine')
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\msrest\serialization.py", line 301, in body
    data = _convert_to_datatype(data, data_type, self.dependencies)
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\msrest\serialization.py", line 182, in _convert_to_datatype
    getattr(data, attr), mapconfig['type'], localtypes))
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\msrest\serialization.py", line 182, in _convert_to_datatype
    getattr(data, attr), mapconfig['type'], localtypes))
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\msrest\serialization.py", line 156, in _convert_to_datatype
    param, data_type[1:-1], localtypes) for param in data
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\msrest\serialization.py", line 156, in <listcomp>
    param, data_type[1:-1], localtypes) for param in data
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\msrest\serialization.py", line 171, in _convert_to_datatype
    localtypes) for key in data
  File "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\lib\site-packages\msrest\serialization.py", line 171, in <dictcomp>
    localtypes) for key in data
KeyError: 'sourceVault'

I guess updating osProfile.secrets is not yet supported (although–secrets in az vm create are) but would like to get this in Azure CLI as I am now forced to use Powershell’s Add-​Azure​Rm​VM​Secret which seems to be the only option which works now for uploading certificates to VMs.


Environment summary

Install Method: How did you install the CLI? (e.g. pip, interactive script, apt-get, Docker, MSI, nightly)
Answer here: MSI

CLI Version: What version of the CLI and modules are installed? (Use az --version)
Answer here: 2.0.9

OS Version: What OS and version are you using?
Answer here: Windows 7 Enterprise

Shell Type: What shell are you using? (e.g. bash, cmd.exe, Bash on Windows)
Answer here: tested in both cmd.exe and gitbash, same results

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
tjprescottcommented, Aug 2, 2017

The changes @lmazuel is making to the SDK should automagically fix this, but I’ll do the testing and verification on the CLI side.

0reactions
tjprescottcommented, Aug 23, 2017

Thanks to @lmazuel this has been fixed for the entire Python SDK! Thanks @lmazuel!! 🎉 🎉

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript convert generic object from snake to camel case
From keysToCamelCase() It splits word by the regular expression named at the top through types and the helper function, then changes those words ......
Read more >
improve docs about snake case and camel case #1295 - GitHub
I'm running into an issue with a marshmallow/swagger/javascript interaction. In javascript (and serialized json in general), field names are ...
Read more >
How to UPPER_CASE to camelCase in raw Typescript generics
Today's challenge is to retype an UPPER_CASE static string into camelCase and apply this transformation recursively to the object keys. Preview.
Read more >
Can I change Python SDK API response keys from snake case ...
Is there any way to maybe change the configuration of the Python SDK so the keys in the API responses are in camel...
Read more >
How to deal with cases mismatch between Django and React
In this article, we explore how to deal with the casing mismatch between the JavaScript world (using camel case) and the Python /...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found