Exemplo n.º 1
0
    def _add_version(self, parser):

        # Zato
        from zato.common.version import get_version

        parser.add_argument('--version',
                            action='version',
                            version=get_version())
Exemplo n.º 2
0
    def store_initial_info(self, target_dir, component):

        # stdlib
        import os
        from datetime import datetime

        # Zato
        from zato.common.json_internal import dumps
        from zato.common.version import get_version

        zato_version = get_version()

        info = {'version': zato_version, # noqa
                'created_user_host': self._get_user_host(),
                'created_ts': datetime.utcnow().isoformat(), # noqa
                'component': component
                }
        open(os.path.join(target_dir, ZATO_INFO_FILE), 'w').write(dumps(info))
Exemplo n.º 3
0
def main():

    # stdlib
    import sys

    # Special-case the most commonly used commands to make the parser build quickly in these cases.
    has_args = len(sys.argv) > 1

    # First, zato --version
    if has_args and sys.argv[1] == '--version':

        # Zato
        from zato.common.version import get_version

        sys.stdout.write(get_version() + '\n')
        sys.exit(0)

    # Now, zato start ...
    elif has_args and sys.argv[1] == 'start':
        parser = command_store.load_start_parser()

    # All the other commands
    else:
        parser = command_store.load_full_parser()

    # Parse the arguments
    args = parser.parse_args()

    # Exit if no known command was found among arguments ..
    if not hasattr(args, 'command'):
        parser.print_help()

    # .. otherwise, run the command now.
    else:

        # Zato
        from zato.cli import run_command

        return run_command(args)
Exemplo n.º 4
0
# Django
from django.core.urlresolvers import resolve

# Zato
from zato.admin.settings import ADMIN_INVOKE_NAME, ADMIN_INVOKE_PASSWORD, ADMIN_INVOKE_PATH, lb_tls_verify, \
     lb_use_tls, SASession, settings_db
from zato.admin.web.forms import SearchForm
from zato.admin.web.models import ClusterColorMarker
from zato.admin.web.util import get_user_profile
from zato.client import AnyServiceInvoker
from zato.common.json_internal import loads
from zato.common.odb.model import Cluster
from zato.common.version import get_version

# Zato version
version = get_version()

# Code below is taken from http://djangosnippets.org/snippets/136/
# Slightly modified for Zato's purposes.

###
# Copyright (c) 2006-2007, Jared Kuolt
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
#     * Redistributions of source code must retain the above copyright notice,
#       this list of conditions and the following disclaimer.
#     * Redistributions in binary form must reproduce the above copyright
#       notice, this list of conditions and the following disclaimer in the