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): ...@@ -168,24 +168,23 @@ class NetworkApiMixin(object):
self._raise_for_status(res) self._raise_for_status(res)
@minimum_version('1.21') @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. Get detailed information about a network.
Args: Args:
net_id (str): ID of network net_id (str): ID of network
verbose (bool): If set shows the service details across the cluster verbose (bool): Show the service details across the cluster in
in swarm mode swarm mode.
""" """
if verbose is True: params = {}
if verbose is not None:
if version_lt(self._version, '1.28'): if version_lt(self._version, '1.28'):
raise InvalidVersion( raise InvalidVersion('verbose was introduced in API 1.28')
'Verbose option was introduced in API 1.28' params['verbose'] = verbose
)
url = self._url("/networks/{0}?verbose=true", net_id) url = self._url("/networks/{0}", net_id)
else: res = self._get(url, params=params)
url = self._url("/networks/{0}", net_id)
res = self._get(url)
return self._result(res, json=True) return self._result(res, json=True)
@check_resource @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