Preflight check for log dirs

Bug #663133 reported by Robert Collins
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Triaged
Low
Unassigned

Bug Description

We just had an inscrutable error about missing logdirs:
 /home/mthaddon/bzr-sftp-qastaging start
Starting bzr-sftp: twistdTraceback (most recent call last):
  File "/srv/bazaar.qastaging.launchpad.net/qastaging/launchpad/bin/twistd", line 26, in <module>
    twisted.scripts.twistd.run()
  File "/srv/bazaar.qastaging.launchpad.net/qastaging/launchpad-rev-11738/eggs/Twisted-10.1.0-py2.6-linux-x86_64.egg/twisted/scripts/twistd.py", line 27, in run
    app.run(runApp, ServerOptions)
  File "/srv/bazaar.qastaging.launchpad.net/qastaging/launchpad-rev-11738/eggs/Twisted-10.1.0-py2.6-linux-x86_64.egg/twisted/application/app.py", line 626, in run
    runApp(config)
  File "/srv/bazaar.qastaging.launchpad.net/qastaging/launchpad-rev-11738/eggs/Twisted-10.1.0-py2.6-linux-x86_64.egg/twisted/scripts/twistd.py", line 23, in runApp
    _SomeApplicationRunner(config).run()
  File "/srv/bazaar.qastaging.launchpad.net/qastaging/launchpad-rev-11738/eggs/Twisted-10.1.0-py2.6-linux-x86_64.egg/twisted/application/app.py", line 376, in run
    self.logger.start(self.application)
  File "/srv/bazaar.qastaging.launchpad.net/qastaging/launchpad-rev-11738/eggs/Twisted-10.1.0-py2.6-linux-x86_64.egg/twisted/application/app.py", line 216, in start
    observer = self._getLogObserver()
  File "/srv/bazaar.qastaging.launchpad.net/qastaging/launchpad-rev-11738/eggs/Twisted-10.1.0-py2.6-linux-x86_64.egg/twisted/scripts/_twistd_unix.py", line 139, in _getLogObserver
    logFile = logfile.LogFile.fromFullPath(self._logfilename)
  File "/srv/bazaar.qastaging.launchpad.net/qastaging/launchpad-rev-11738/eggs/Twisted-10.1.0-py2.6-linux-x86_64.egg/twisted/python/logfile.py", line 49, in fromFullPath
    os.path.dirname(logPath), *args, **kwargs)
  File "/srv/bazaar.qastaging.launchpad.net/qastaging/launchpad-rev-11738/eggs/Twisted-10.1.0-py2.6-linux-x86_64.egg/twisted/python/logfile.py", line 162, in __init__
    BaseLogFile.__init__(self, name, directory, defaultMode)
  File "/srv/bazaar.qastaging.launchpad.net/qastaging/launchpad-rev-11738/eggs/Twisted-10.1.0-py2.6-linux-x86_64.egg/twisted/python/logfile.py", line 34, in __init__
    assert os.path.isdir(self.directory)
AssertionError
.

The assertion can be improved but it would be nice to have a preflight check that this problem doesn't exist (for use before we shutdown services to start a bait-and-switch deployment).

Tom Haddon (mthaddon)
tags: added: canonical-losa-lp
Tim Penhey (thumper)
Changed in launchpad-code:
status: New → Triaged
status: Triaged → In Progress
status: In Progress → New
affects: launchpad-code → launchpad-foundations
Revision history for this message
Aaron Bentley (abentley) wrote :

I don't know what a preflight check is, but it sounds like look before you leap. It would make sense to have a way to create all necessary directories, and it would make sense to have a sane error message if we don't have the necessary log file directory, but do we really need a preflight check?

Revision history for this message
Gary Poster (gary) wrote :

I'm afraid I don't have enough context as to what Twisted bits "bzr-sftp-qastaging start" is running. Could someone clarify?

Changed in launchpad-foundations:
status: New → Incomplete
Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 663133] Re: Preflight check for log dirs

On production, the user running as a daemon may well not have
permission to create the directories we need; so having something to
create those directories won't assist with this case.

Yes, its a form of LBYL, but its one of the cases where it makes sense, I think.

Revision history for this message
Tom Haddon (mthaddon) wrote :
Changed in launchpad:
status: Incomplete → Triaged
importance: Undecided → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.