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

Evaluate string "true" and "false" to Booleans in openstack_config #214

Open
EarthmanT opened this issue Mar 6, 2018 · 0 comments
Open

Comments

@EarthmanT
Copy link
Collaborator

EarthmanT commented Mar 6, 2018

This code tests that the insecure variable is True or False. This is assuming that the user is providing a YAML value. However, if this value is set via an intrinsic function, the value will be evaluated as string, because all intrinsic function values are strings.

Basically, want to change something from fig 1 to something essentially the same as fig2 :

fig 1:

verify = not (cfg[AUTH_PARAM_INSECURE] is True)

fig 2:

cfg_insecure = cfg[AUTH_PARAM_INSECURE]
if isinstance(cfg_insecure, basestring) and cfg_insecure.Capitalize() == 'True':
    cfg[AUTH_PARAM_INSECURE] = True
verify = not (cfg[AUTH_PARAM_INSECURE] is True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant