Parse required_floatingips parameter as a JSON array

An API request to create a floating IP reservation is expected to pass
the required_floatingips parameter as a list, not as a string. Modify
the CLI to parse required_floatingips as a JSON array so it can be
passed to the API in the right format.

Change-Id: Ia84ceb881f0889266c8f0349a1ffb047597bac2d
Closes-Bug: #1843258
This commit is contained in:
Pierre Riteau 2019-09-09 14:00:21 +02:00 committed by Tetsuro Nakamura
parent c464858149
commit 9183950833
2 changed files with 13 additions and 0 deletions

View File

@ -18,6 +18,7 @@ import datetime
import logging
import re
from oslo_serialization import jsonutils
from oslo_utils import strutils
from blazarclient import command
@ -172,6 +173,8 @@ class CreateLease(command.CreateCommand):
else:
if strutils.is_int_like(v):
request_params[k] = int(v)
elif isinstance(defaults[k], list):
request_params[k] = jsonutils.loads(v)
else:
request_params[k] = v

View File

@ -0,0 +1,10 @@
---
fixes:
- |
Parse the ``required_floatingips`` command-line parameter as a list instead
of a string, to pass it to the API in the expected format. For example,
this parameter can be used in the following fashion:
``blazar lease-create --reservation 'resource_type=virtual:floatingip,network_id=81fabec7-00ae-497a-b485-72f4bf187d3e,amount=2,required_floatingips=["172.24.4.2","172.24.4.3"]' fip-lease``
For more details, see `bug 1843258 <https://launchpad.net/bugs/1843258>`_.