This adds support for the recommended CLI using the OpenStackClient,
without modifying the existing Blazar shell CLI.
The existing shell command classes are used, by introducing a check in
the base comand class to use either the client passed by Blazar shell,
or the client using the osc_lib client_manager.
The argument --physical-reservation is also removed for the create lease
command when using the OpenStack client.
Implements: blueprint openstackclient-support
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.
Signed-off-by: Sean McGinnis <firstname.lastname@example.org>
Python modules related to coding style checks (listed in blacklist.txt in
openstack/requirements repo) are dropped from lower-constraints.txt
they are not needed during installation.
Blazar APIs support directly fetching a resource (whether host, floating
ip, or lease) with its ID. However, the default logic for this includes
a block that supports additionally looking up the resource by name (to
allow looking up e.g., a lease by it's name.) This requires fetching the
entire list of all resources and iterating over them until a match is
found, which is very inefficient. Moreover, this branch would be taken
even if the input was already a UUID.
This commit changes that behavior so that if a UUID is provided, it is
used to directly fetch the resource, which seems to be what the original
intent was in the first place.