Kaydet (Commit) e506a2b8 authored tarafından Joffrey F's avatar Joffrey F

Standardize handling of verbose param in inspect_network

Signed-off-by: 's avatarJoffrey F <joffrey@docker.com>
üst abd5370d
......@@ -168,24 +168,23 @@ class NetworkApiMixin(object):
self._raise_for_status(res)
@minimum_version('1.21')
def inspect_network(self, net_id, verbose=False):
def inspect_network(self, net_id, verbose=None):
"""
Get detailed information about a network.
Args:
net_id (str): ID of network
verbose (bool): If set shows the service details across the cluster
in swarm mode
verbose (bool): Show the service details across the cluster in
swarm mode.
"""
if verbose is True:
params = {}
if verbose is not None:
if version_lt(self._version, '1.28'):
raise InvalidVersion(
'Verbose option was introduced in API 1.28'
)
url = self._url("/networks/{0}?verbose=true", net_id)
else:
url = self._url("/networks/{0}", net_id)
res = self._get(url)
raise InvalidVersion('verbose was introduced in API 1.28')
params['verbose'] = verbose
url = self._url("/networks/{0}", net_id)
res = self._get(url, params=params)
return self._result(res, json=True)
@check_resource
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment