Git Product home page Git Product logo

Comments (4)

jaqx0r avatar jaqx0r commented on July 28, 2024

Comment #1 originally posted by jaqx0r on 2008-08-11T01:05:02.000Z:

Well I agree that we can do a better job of handling the LDAP error, but if all the
LDAP module is telling us is that there's no such object in the dc=mycompany,dc=com
tree, then there's not a lot of interpretation that we can put on top of it.

I think the fix for this specific error is to catch the NO_SUCH_OBJECT and tell you
what we were trying to look up, and perhaps with a more elegant failure than dumping
the traceback :)

from nsscache.

jaqx0r avatar jaqx0r commented on July 28, 2024

Comment #2 originally posted by jaqx0r on 2013-07-01T13:58:04.000Z:

I think catching this error should lead to the returning of the empty set, so I've fixed it this way
(The comment is that it looked before)
nss_cache/sources/ldapsource.py:
# result_type, data = self.conn.result(self.message_id, all=0,
# timeout=self.conf['timelimit'])
try:
result_type, data = self.conn.result(self.message_id, all=0,
timeout=self.conf['timelimit'])
except ldap.NO_SUCH_OBJECT:
self.log.debug('Returning due to ldap.NO_SUCH_OBJECT')
return

After that I've caught another error, which seems like a small bug to me:
Traceback (most recent call last):
  File "/opt/lxc/manage/scripts/nsscache/nsscache", line 33, in <module>
    return_value = nsscache_app.Run(sys.argv[1:], os.environ)
  File "/opt/lxc/manage/scripts/nsscache/nss_cache/app.py", line 242, in Run
    retval = command_callable().Run(conf=conf, args=args)
  File "/opt/lxc/manage/scripts/nsscache/nss_cache/command.py", line 235, in Run
    force_lock=options.force_lock)
  File "/opt/lxc/manage/scripts/nsscache/nss_cache/command.py", line 308, in UpdateMaps
    force_write=force_write)
  File "/opt/lxc/manage/scripts/nsscache/nss_cache/update/updater.py", line 256, in UpdateFromSource
    force_write, location=None)
  File "/opt/lxc/manage/scripts/nsscache/nss_cache/update/map_updater.py", line 79, in UpdateCacheFromSource
    return_val += self.FullUpdateFromMap(cache, source_map, force_write)
  File "/opt/lxc/manage/scripts/nsscache/nss_cache/update/map_updater.py", line 148, in FullUpdateFromMap
    self.WriteModifyTimestamp(new_map.GetModifyTimestamp())
  File "/opt/lxc/manage/scripts/nsscache/nss_cache/update/updater.py", line 231, in WriteModifyTimestamp
    return self._WriteTimestamp(timestamp, self.modify_file)
  File "/opt/lxc/manage/scripts/nsscache/nss_cache/update/updater.py", line 165, in _WriteTimestamp
    time_string = time.strftime('%Y-%m-%dT%H:%M:%SZ', timestamp)
TypeError: argument must be 9-item sequence, not None


Since it's stated everywhere, that timestamp can be None, I think it should be fixed in nss_cache/update/map_updater.py(line 165) this way:

#      self.WriteModifyTimestamp(new_map.GetModifyTimestamp())
      modify_timestamp = new_map.GetModifyTimestamp()
      if not modify_timestamp is None: 
         self.WriteModifyTimestamp(modify_timestamp)

from nsscache.

jaqx0r avatar jaqx0r commented on July 28, 2024

Comment #3 originally posted by jaqx0r on 2013-07-30T09:30:29.000Z:

I've decided to fix the latter issue by testing for None in WriteMOdifyTimestamp, and exiting early; there are three call sites in map_updater.py that need the test so it makes sense to put it inside the method.

from nsscache.

jaqx0r avatar jaqx0r commented on July 28, 2024

Comment #4 originally posted by jaqx0r on 2013-07-30T09:33:59.000Z:

This issue was closed by revision 08267c1d0d02.

from nsscache.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.