~hopem/charms/trusty/keystone/fix-ssl-disable

« back to all changes in this revision

Viewing changes to hooks/keystone_context.py

  • Committer: Edward Hope-Morley
  • Date: 2015-02-16 13:35:14 UTC
  • mfrom: (117.1.3 keystone.strbools)
  • Revision ID: edward.hope-morley@canonical.com-20150216133514-byi9r8zk30a4ffz2
[hopem,r=gnuoy]

Synced charm-helpers to get core.strutils and replaced
str-to-bool logic with bool_from_string()

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
    INFO,
22
22
)
23
23
 
 
24
from charmhelpers.core.strutils import (
 
25
    bool_from_string,
 
26
)
 
27
 
24
28
from charmhelpers.contrib.hahelpers.apache import install_ca_cert
25
29
 
26
30
CA_CERT_PATH = '/usr/local/share/ca-certificates/keystone_juju_ca_cert.crt'
179
183
                                                singlenode_mode=True)
180
184
        ctxt['public_port'] = determine_api_port(api_port('keystone-public'),
181
185
                                                 singlenode_mode=True)
182
 
        ctxt['debug'] = config('debug') in ['yes', 'true', 'True']
183
 
        ctxt['verbose'] = config('verbose') in ['yes', 'true', 'True']
 
186
 
 
187
        debug = config('debug')
 
188
        ctxt['debug'] = debug and bool_from_string(debug)
 
189
        verbose = config('verbose')
 
190
        ctxt['verbose'] = verbose and bool_from_string(verbose)
 
191
 
184
192
        ctxt['identity_backend'] = config('identity-backend')
185
193
        ctxt['assignment_backend'] = config('assignment-backend')
186
194
        if config('identity-backend') == 'ldap':
194
202
                flags = context.config_flags_parser(ldap_flags)
195
203
                ctxt['ldap_config_flags'] = flags
196
204
 
197
 
        if config('enable-pki') not in ['false', 'False', 'no', 'No']:
 
205
        enable_pki = config('enable-pki')
 
206
        if enable_pki and bool_from_string(enable_pki):
198
207
            ctxt['signing'] = True
199
208
 
200
209
        # Base endpoint URL's which are used in keystone responses
214
223
    def __call__(self):
215
224
        ctxt = {}
216
225
        debug = config('debug')
217
 
        if debug and debug.lower() in ['yes', 'true']:
 
226
        if debug and bool_from_string(debug):
218
227
            ctxt['root_level'] = 'DEBUG'
219
228
 
220
229
        return ctxt