Esempio n. 1
0
def _buildpage(page):
    """
    Construct the requested page.
    
    If the ui_dev setting is true, we'll load every file from disk for every request.
    Otherwise, much of this content is cached in memory when the service starts.
    """
    if catoconfig.CONFIG["ui_dev_mode"]:
        logger.info("Server is operating in DEV mode, performance is reduced.")
        b = uiCommon._loadfile(os.path.join(web_root, "templates", "base.html"))
        hdr = uiCommon._loadfile(os.path.join(web_root, "static", "_header.html"))
    else:
        b = uiGlobals.static_content["base"]
        hdr = uiGlobals.static_content["mainheader"]

    pp = os.path.join(web_root, "templates", "%s.html" % (page))
    x = uiCommon.Assembler(pp, base=b, header=hdr)
    return x.html
Esempio n. 2
0
    '/automate/taskPrint', 'taskPrint',
    '/automate/taskRunLog', 'taskRunLog',
    '/automate/taskActivityLog', 'taskActivityLog',
    '/automate/taskManage', 'taskManage',
    '/automate/systemStatus', 'systemStatus',
    '/automate/taskStatus', 'taskStatus',
    '/automate/deploymentEdit', 'deploymentEdit',
    '/automate/deploymentManage', 'deploymentManage',
    '/automate/depTemplateEdit', 'depTemplateEdit',
    '/automate/depTemplateManage', 'depTemplateManage',
    '/automate/userEdit', 'userEdit',
    '/automate/assetEdit', 'assetEdit',
    '/automate/tagEdit', 'tagEdit',
    '/automate/imageEdit', 'imageEdit',
    '/automate/credentialEdit', 'credentialEdit',
    '/automate/upload', 'upload',
    '/automate/search', 'search',
    '/automate/settings', 'settings',
    '/automate/recache', 'recache'
)

basetemplate = os.path.join(os.environ["CSK_HOME"], "cato", "ui", "cskui", "templates", "base")
render = web.template.render(os.path.join(web_root, "templates"), base=basetemplate)
render_plain = web.template.render(os.path.join(web_root, "templates"))
render_popup = web.template.render(os.path.join(web_root, "templates"), base='popup')


# these globals are read once when the process starts, and are used in each request
uiGlobals.static_content["automatefooter"] = uiCommon._loadfile(os.path.join(web_root, "static", "_footer.html"))
uiGlobals.static_content["automateafter"] = uiCommon._loadfile(os.path.join(web_root, "static", "_after.html"))
Esempio n. 3
0
if not os.path.exists(uicachepath):
    raise Exception("UI file cache directory defined in cato.conf does not exist. [%s]" % uicachepath)
    exit()

# Hack to make session play nice with the reloader (in debug mode)
if web.config.get('_session') is None:
    session = web.session.Session(app, web.session.ShelfStore(shelve.open('%s/cskuisession.shelf' % uicachepath)))
    web.config._session = session
else:
    session = web.config._session

uiGlobals.session = session
uiGlobals.app_name = app_name

# these globals are read once when the process starts, and are used in each request
uiGlobals.static_content["base"] = uiCommon._loadfile(os.path.join(web_root, "templates", "base.html"))
uiGlobals.static_content["mainheader"] = uiCommon._loadfile(os.path.join(web_root, "static", "_header.html"))


def main():
    # CATOPROCESS STARTUP

    dbglvl = 20
    if "csk_ui_debug" in catoconfig.CONFIG:
        try:
            dbglvl = int(catoconfig.CONFIG["csk_ui_debug"])
        except:
            raise Exception("csk_ui_debug setting in cato.conf must be an integer between 0-50.")
    catolog.DEBUG = dbglvl

    # this is a service, which has a db connection.