diff --git a/acs/abac/core.py b/acs/abac/core.py index c6c17d2..3e90183 100644 --- a/acs/abac/core.py +++ b/acs/abac/core.py @@ -708,25 +708,32 @@ def get_all_sources(): def load_profile_by_dic(profile, dic): if not profile or not dic: + logger.error('load_profile_by_dic: \ + Missing profile or dictionnary') return for source in dic: - print "Found source in session: %s" % source + logger.debug('load_profile_by_dic: loading from source with name: %s' \ + % source) s = get_source_form_name(source) if s: - print "Found source in db: %s" % s - if 'attributes' in dic[source]: - print "attributes: %s" % dic[source]['attributes'] - for attr in dic[source]['attributes']: - print "With attribute %s of %s with values %s" % \ - (attr['name'], attr['namespace'], str([x for x in attr['values']])) - d = get_def_from_name_and_ns(attr['name'], attr['namespace']) - if not d: - print "definition not found for %s %s" %(attr['name'], attr['namespace']) - else: - print "definition found %s" %d - add_assertion_to_profile(profile, s, d, attr['values']) - else: - print "No attributes for this source" + logger.debug('load_profile_by_dic: attributes: %s' \ + % str(dic[source])) + for attr in dic[source]: + logger.debug('load_profile_by_dic: attribute %s of %s with values %s' \ + % (attr['name'], attr['namespace'], str([x for x in attr['values']]))) + d = get_def_from_name_and_ns(attr['name'], attr['namespace']) + if not d: + logger.error('load_profile_by_dic: \ + definition not found for %s %s' \ + % (attr['name'], attr['namespace'])) + else: + logger.debug('load_profile_by_dic: \ + definition %s found' % d) + add_assertion_to_profile(profile, s, d, attr['values']) + else: + logger.critical('load_profile_by_dic: \ + The source with name %s and attributes %s is unknown of the system' + % (str(source), str(dic[source]))) @transaction.commit_manually