Modify

Ticket #695 (closed enhancement: fixed)

Opened 14 years ago

Last modified 14 years ago

bcfg2-server should log CoreInitExceptions to syslog

Reported by: Mike McCallister <[email protected]…> Owned by: desai
Priority: minor Milestone: Bcfg2 1.0.0 Release
Component: bcfg2-server Version: 1.0
Keywords: Cc:

Description

In upgrading my configuration from 0.9.5.7 to ~1.0 pre5 (r5389), I missed the need to have a Metadata plugin in my bcfg2.conf file. When I started bcfg2-server using the init script, it exits with no indication of an error in syslog or anywhere else I can see. When I run it in debug mode from the console, I see the following traceback:

Traceback (most recent call last):
  File "/usr/sbin/bcfg2-server", line 64, in ?
    ca=setup['ca'],
  File "/usr/lib/python2.4/site-packages/Bcfg2/Component.py", line 60, in run_component
    component = component_cls(**cls_kwargs)
  File "/usr/lib/python2.4/site-packages/Bcfg2/Server/Core.py", line 83, in __init__
    raise CoreInitError, "No Metadata Plugin"
Bcfg2.Server.Core.CoreInitError: No Metadata Plugin

My expectation is that when run in daemon mode, even (or especially) fatal errors should be logged to syslog if at all possible. Something like this might work for CoreInitException:

    try:
        Bcfg2.Component.run_component(Bcfg2.Server.Core.Core,
                                      location=setup['location'],
                                      daemon = setup['daemon'],
                                      pidfile_name = setup['daemon'],
                                      protocol = setup['protocol'],
                                      register=False,
                                      cls_kwargs={'repo':setup['repo'],
                                                  'plugins':setup['plugins'],
                                                  'password':setup['password'],
                                                  'encoding':setup['encoding'],
                                                  'ca':setup['ca'],
                                                  'filemonitor':setup['fm'],
                                                  'start_fam_thread':True},
                                      keyfile=setup['key'],
                                      certfile=setup['cert'],
                                      ca=setup['ca'],
                                      )
    except Bcfg2.Server.Core.CoreInitError, msg:
        logger.error("Core load failed because %s" % msg)
    except KeyboardInterrupt:
        sys.exit(1)

If any other exceptions could occur, they should also be caught and reported appropriately.

Attachments

Change History

comment:1 Changed 14 years ago by solj

  • Milestone set to Bcfg2 1.0 Release

comment:2 Changed 14 years ago by solj

  • Status changed from new to closed
  • Resolution set to fixed

Narayan fixed this in [209841df3fbada4f15cdf36070c63e63c3ead6e5] (SVN r5391).

WARNING! You need to establish a session before you can create or edit tickets. Otherwise the ticket will get treated as spam.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.