Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

discovery_auth should accept True as well #137

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion rtslib/fabric.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,11 @@ def _set_discovery_enable_auth(self, enable):
self._check_self()
self._assert_feature('discovery_auth')
path = "%s/discovery_auth/enforce_discovery_auth" % self.path
if int(enable):
if enable == 'True':
enable = 1
elif enable == 'False':
enable = 0
elif int(enable):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think the user know about python booleans always, so if they do false/true instead of False/True we will crash here due to int() not being able to convert it. I think it needs to be a enable.isdigit() or maybe a try/except ValueError to detect bad input. Whatever we normally do for input validation I guess.

enable = 1
else:
enable = 0
Expand Down