Skip to content

Commit

Permalink
Catch FileserverConfigError exceptions on master startup
Browse files Browse the repository at this point in the history
This causes the master to fail to start when there are fileserver config
issues, leading people quicker to the log to investigate, where they
will find a meaningful error message. This should it much quicker and
easier for users to realize there are gitfs/hgfs/svnfs fileserver config
problems.

Fixes saltstack#21021.
  • Loading branch information
terminalmage authored and cro committed Feb 28, 2015
1 parent df284a7 commit 8e7158d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions salt/master.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import salt.utils.minions
import salt.utils.gzip_util
import salt.utils.process
from salt.exceptions import FileserverConfigError
from salt.utils.debug import enable_sigusr1_handler, enable_sigusr2_handler, inspect_stack
from salt.utils.event import tagify
import binascii
Expand Down Expand Up @@ -267,6 +268,13 @@ def _pre_flight(self):
'Failed to load fileserver backends, the configured backends '
'are: {0}'.format(', '.join(self.opts['fileserver_backend']))
)
else:
# Run init() for all backends which support the function, to
# double-check configuration
try:
fileserver.init()
except FileserverConfigError as exc:
errors.append('{0}'.format(exc))
if not self.opts['fileserver_backend']:
errors.append('No fileserver backends are configured')
if errors:
Expand Down

0 comments on commit 8e7158d

Please sign in to comment.