Fixed comparison of None with constants

There are comparisons of `None` with constant values (e.g. `'size' is None`) resulting in the comparison always being `True` or `False`.
I replaced the constant values with variable names.

I work for Semmle and I noticed these issues with out LGTM code analyzer
https://lgtm.com/projects/g/saltstack/salt/alerts/?mode=tree&ruleFocus=3980086
This commit is contained in:
damianos 2019-03-06 15:40:04 +00:00 committed by Ch3LL
parent 7ab1281a7d
commit b4e31837af
No known key found for this signature in database
GPG key ID: 132B55A7C13EFA73
2 changed files with 3 additions and 3 deletions

View file

@ -1828,7 +1828,7 @@ def create_disk(kwargs=None, call=None):
)
return False
if 'size' is None and 'image' is None and 'snapshot' is None:
if size is None and image is None and snapshot is None:
log.error(
'Must specify image, snapshot, or size.'
)

View file

@ -1256,9 +1256,9 @@ def edit_team(name,
parameters = {}
if name is not None:
parameters['name'] = name
if 'description' is not None:
if description is not None:
parameters['description'] = description
if 'privacy' is not None:
if privacy is not None:
parameters['privacy'] = privacy
if permission is not None:
parameters['permission'] = permission