How to use the tomcatmanager.models.TomcatApplication.sort_by_state_by_path_by_version function in tomcatmanager

To help you get started, we’ve selected a few tomcatmanager examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tomcatmanager / tomcatmanager / tests / test_models.py View on Github external
/shiny:running:12:shiny##v2.0.8
/manager:running:0:/usr/share/tomcat8-admin/manager
/shiny:running:15:shiny##v2.0.7
"""
    sorted_apps = """/:running:0:ROOT
/contacts:running:8:running
/contacts:running:3:running##4.1
/manager:running:0:/usr/share/tomcat8-admin/manager
/shiny:running:15:shiny##v2.0.7
/shiny:running:12:shiny##v2.0.8
/host-manager:stopped:0:/usr/share/tomcat8-admin/host-manager
/shiny:stopped:0:shiny##v2.0.5
/shiny:stopped:17:shiny##v2.0.6
"""
    apps = parse_apps(raw_apps)
    apps.sort(key=tm.models.TomcatApplication.sort_by_state_by_path_by_version)
    result = ''
    strapps = map(str, apps)
    result = '\n'.join(strapps) + '\n'
    assert result == sorted_apps
github tomcatmanager / tomcatmanager / src / tomcatmanager / interactive_tomcat_manager.py View on Github external
We rely on the `TomcatApplication` object to determine the sort order.

        :return: a list of `TomcatApplication` objects
        """
        rtn = []
        # select the apps that should be included
        if args.state:
            rtn = filter(lambda app: app.state == args.state, apps)
        else:
            rtn = apps
        # now sort them
        if args.by == 'path':
            rtn = sorted(rtn, key=tm.models.TomcatApplication.sort_by_path_by_version_by_state)
        else:
            rtn = sorted(rtn, key=tm.models.TomcatApplication.sort_by_state_by_path_by_version)
        return rtn