← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1841486] Re: federation mapping debug has useless direct_maps information

 

Reviewed:  https://review.opendev.org/678700
Committed: https://git.openstack.org/cgit/openstack/keystone/commit/?id=b33abb4b070d72c16af914e4292adb205bdee5fa
Submitter: Zuul
Branch:    master

commit b33abb4b070d72c16af914e4292adb205bdee5fa
Author: John Dennis <jdennis@xxxxxxxxxx>
Date:   Mon Aug 26 19:32:22 2019 -0400

    Federation mapping debug should show direct_maps values
    
    If you use keystone-manage mapping_engine --engine-debug to test your
    rules (or when debug logging is on during run time) the diagnostic
    output fails to emit a piece of crucial information, the contents
    direct map array. What you'll get instead is this:
    
    direct_maps: <keystone.federation.utils.DirectMaps object at 0x7f7121887b00>
    
    That's because the DirectMaps class does not have a __str__() method
    and Python resorts to __ref__() in the absence of __str__() and all
    __ref__() does is print the class name and it's memory location, not
    very useful.
    
    This patch adds a __str__() method to the DirectMaps class so the
    debug output now includes the actual direct map data like this:
    
    direct_maps: [['jdoe@xxxxxxxxxxx'], ['Group1', 'Group3']]
    
    Co-Authored-By: Lance Bragstad <lbragstad@xxxxxxxxx>
    Change-Id: I07643fbe3e1e712b7eac716a7f671a2d513e920b
    Closes-Bug: 1841486
    Signed-off-by: John Dennis <jdennis@xxxxxxxxxx>


** Changed in: keystone
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Identity (keystone).
https://bugs.launchpad.net/bugs/1841486

Title:
  federation mapping debug has useless direct_maps information

Status in OpenStack Identity (keystone):
  Fix Released

Bug description:
  If you use keystone-manage mapping_engine --engine-debug to test your
  rules (or when debug logging is on during run time) the diagnostic
  output fails to emit a piece of crucial information, the contents
  direct map array. What you'll get instead is this:

  direct_maps: <keystone.federation.utils.DirectMaps object at
  0x7f7121887b00>

  That's because the DirectMaps class does not have a __str__() method
  and Python resorts to __ref__() in the absence of __str__() and all
  __ref__() does is print the class name and it's memory location, not
  very useful.

  If DirectMaps had a __str__() function like this:

      def __str__(self):
          return '%s' % self._matches

  
  the debug output would include the actual direct map data like this:

  direct_maps: [['jdoe@xxxxxxxxxxx'], ['Group1', 'Group3']]

To manage notifications about this bug go to:
https://bugs.launchpad.net/keystone/+bug/1841486/+subscriptions


References