Skip to content

Commit e506a2b

Browse files
committed
Standardize handling of verbose param in inspect_network
Signed-off-by: Joffrey F <[email protected]>
1 parent abd5370 commit e506a2b

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

docker/api/network.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -168,24 +168,23 @@ def remove_network(self, net_id):
168168
self._raise_for_status(res)
169169

170170
@minimum_version('1.21')
171-
def inspect_network(self, net_id, verbose=False):
171+
def inspect_network(self, net_id, verbose=None):
172172
"""
173173
Get detailed information about a network.
174174
175175
Args:
176176
net_id (str): ID of network
177-
verbose (bool): If set shows the service details across the cluster
178-
in swarm mode
177+
verbose (bool): Show the service details across the cluster in
178+
swarm mode.
179179
"""
180-
if verbose is True:
180+
params = {}
181+
if verbose is not None:
181182
if version_lt(self._version, '1.28'):
182-
raise InvalidVersion(
183-
'Verbose option was introduced in API 1.28'
184-
)
185-
url = self._url("/networks/{0}?verbose=true", net_id)
186-
else:
187-
url = self._url("/networks/{0}", net_id)
188-
res = self._get(url)
183+
raise InvalidVersion('verbose was introduced in API 1.28')
184+
params['verbose'] = verbose
185+
186+
url = self._url("/networks/{0}", net_id)
187+
res = self._get(url, params=params)
189188
return self._result(res, json=True)
190189

191190
@check_resource

0 commit comments

Comments
 (0)