smc-python icon indicating copy to clipboard operation
smc-python copied to clipboard

Non-standard kwargs in `Engine.vpn.vpn_client`

Open stdedos opened this issue 7 years ago • 0 comments

On a "properly configured" engine with VPN and 'VPN Client'-attaching enabled,

Engine('Name').vpn.vpn_client.update(windows_update=False, antivirus=False)

fails:

  File ".py", line 56, in main
    Engine('Name').vpn.vpn_client.update(windows_update=False, antivirus=False)
  File "/home/sntentos/Documents/Forcepoint/PycharmProjects/createMLConfiguration/venv/lib/python3.5/site-packages/smc/base/model.py", line 460, in update
    result = request.update()
  File "/home/sntentos/Documents/Forcepoint/PycharmProjects/createMLConfiguration/venv/lib/python3.5/site-packages/smc/api/common.py", line 72, in update
    return self._make_request(method='PUT')
  File "/home/sntentos/Documents/Forcepoint/PycharmProjects/createMLConfiguration/venv/lib/python3.5/site-packages/smc/api/common.py", line 101, in _make_request
    raise err
smc.api.exceptions.UpdateElementFailed: Invalid JSON format: At line 1 and column 1674, windows_update is not recognized as JSON attribute.

Key is windows-update, but you cannot set that like update(windows_update=False, antivirus=False)

Can we implement fuzzy key match for [_-], do something else from here, or talk to the SMC API team?


Workaround:

    kwargs = {'windows-update': False, 'antivirus': False}
    Engine('Name').vpn.vpn_client.update(**kwargs)

Remember to update: https://smc-python.readthedocs.io/en/latest/pages/reference.html?highlight=vpn%20client%20antivirus#smc.core.engine.InternalGateway

stdedos avatar Nov 19 '18 16:11 stdedos