docs: def _pre_flight(self):
          '''
          Run pre flight checks. If anything in this method fails then the master
          should not start up.
          '''
          errors = []
          critical_errors = []
  
          try:
              os.chdir('/')
          except OSError as err:
              errors.append(
                  'Cannot change to root directory ({0})'.format(err)
              )
  
          if self.opts.get('fileserver_verify_config', True):
              # Avoid circular import
              import salt.fileserver
              fileserver = salt.fileserver.Fileserver(self.opts)
              if not fileserver.servers:
                  errors.append(
                      '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 salt.exceptions.FileserverConfigError as exc:
                      critical_errors.append('{0}'.format(exc))
  
          if not self.opts['fileserver_backend']:
              errors.append('No fileserver backends are configured')
  
          # Check to see if we need to create a pillar cache dir
          if self.opts['pillar_cache'] and not os.path.isdir(os.path.join(self.opts['cachedir'], 'pillar_cache')):
              try:
                  with salt.utils.files.set_umask(0o077):
                      os.mkdir(os.path.join(self.opts['cachedir'], 'pillar_cache'))
              except OSError:
                  pass
  
          if self.opts.get('git_pillar_verify_config', True):
              try:
                  git_pillars = [
                      x for x in self.opts.get('ext_pillar', [])
                      if 'git' in x
                      and not isinstance(x['git'], six.string_types)
                  ]
              except TypeError:
                  git_pillars = []
                  critical_errors.append(
                      'Invalid ext_pillar configuration. It is likely that the '
                      'external pillar type was not specified for one or more '
                      'external pillars.'
                  )
              if git_pillars:
                  try:
                      new_opts = copy.deepcopy(self.opts)
                      import salt.pillar.git_pillar
                      for repo in git_pillars:
                          new_opts['ext_pillar'] = [repo]
                          try:
                              git_pillar = salt.utils.gitfs.GitPillar(
                                  new_opts,
                                  repo['git'],
                                  per_remote_overrides=salt.pillar.git_pillar.PER_REMOTE_OVERRIDES,
                                  per_remote_only=salt.pillar.git_pillar.PER_REMOTE_ONLY,
                                  global_only=salt.pillar.git_pillar.GLOBAL_ONLY)
                          except salt.exceptions.FileserverConfigError as exc:
                              critical_errors.append(exc.strerror)
                  finally:
                      del new_opts
  
          if errors or critical_errors:
              for error in errors:
                  log.error(error)
              for error in critical_errors:
                  log.critical(error)
              log.critical('Master failed pre flight checks, exiting\n')
              sys.exit(salt.defaults.exitcodes.EX_GENERIC)