(self)
| 409 | self._ioLoop = None |
| 410 | |
| 411 | def run(self): |
| 412 | if not self._allowRoot: |
| 413 | self._checkForRoot() |
| 414 | |
| 415 | global userManager |
| 416 | global eventManager |
| 417 | global loginManager |
| 418 | global debug |
| 419 | global softwareManager |
| 420 | global discoveryManager |
| 421 | global VERSION |
| 422 | global UI_API_KEY |
| 423 | |
| 424 | from tornado.wsgi import WSGIContainer |
| 425 | from tornado.httpserver import HTTPServer |
| 426 | from tornado.ioloop import IOLoop |
| 427 | from tornado.web import Application, FallbackHandler |
| 428 | |
| 429 | from astroprint.printfiles.watchdogs import UploadCleanupWatchdogHandler |
| 430 | |
| 431 | debug = self._debug |
| 432 | |
| 433 | # first initialize the settings singleton and make sure it uses given configfile and basedir if available |
| 434 | self._initSettings(self._configfile, self._basedir) |
| 435 | s = settings() |
| 436 | |
| 437 | if not s.getBoolean(['api', 'regenerate']) and s.getString(['api', 'key']): |
| 438 | UI_API_KEY = s.getString(['api', 'key']) |
| 439 | else: |
| 440 | UI_API_KEY = ''.join('%02X' % ord(z) for z in uuid.uuid4().bytes) |
| 441 | |
| 442 | # then initialize logging |
| 443 | self._initLogging(self._debug, self._logConf) |
| 444 | logger = logging.getLogger(__name__) |
| 445 | |
| 446 | if s.getBoolean(["accessControl", "enabled"]): |
| 447 | userManagerName = s.get(["accessControl", "userManager"]) |
| 448 | try: |
| 449 | clazz = util.getClass(userManagerName) |
| 450 | userManager = clazz() |
| 451 | except AttributeError, e: |
| 452 | logger.exception("Could not instantiate user manager %s, will run with accessControl disabled!" % userManagerName) |
| 453 | |
| 454 | softwareManager = swManager() |
| 455 | VERSION = softwareManager.versionString |
| 456 | |
| 457 | logger.info("Starting AstroBox (%s) - Commit (%s)" % (VERSION, softwareManager.commit)) |
| 458 | |
| 459 | from astroprint.migration import migrateSettings |
| 460 | migrateSettings() |
| 461 | |
| 462 | manufacturerPkgManager() |
| 463 | ppm = printerProfileManager() |
| 464 | pluginMgr = pluginManager() |
| 465 | pluginMgr.loadPlugins() |
| 466 | |
| 467 | eventManager = events.eventManager() |
| 468 | printer = printerManager(ppm.data['driver']) |
no test coverage detected