cloudify-openstack-plugin icon indicating copy to clipboard operation
cloudify-openstack-plugin copied to clipboard

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

Open EarthmanT opened this issue 7 years ago • 0 comments

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)

EarthmanT avatar Mar 06 '18 16:03 EarthmanT