Exemple #1
0
def get_file_contents(version_filename):
    env = Environment()
    install_dir = env.get_install_dir()
    path = '/src/client/tactic_client_lib'
    fullPath = install_dir + path + '/' + version_filename
    f = open(fullPath, 'r')
    version_string = f.read()
    f.close()
    return version_string
Exemple #2
0
def print_file_location_msg():
    env = Environment()
    install_dir = env.get_install_dir()
    print '  The version files are located here:'
    print '    %s/VERSION' % install_dir
    print '    %s/src/context/VERSION' % install_dir
    print '    %s/src/client/tactic_client_lib/VERSION' % install_dir
    print '    %s/src/pyasm/application/common/interpreter/tactic_client_lib/VERSION' % install_dir
    print ''
    print '  The client tactic.zip is located here:'
    print '    %s/src/client/tactic_client_lib/tactic.zip' % install_dir
Exemple #3
0
def set_string_in_version_file(pathList, version_filename, version_string):
    print '--'
    print
    print '  Updating string to "%s" in version file: %s ' % (version_string,
                                                              version_filename)
    print
    env = Environment()
    install_dir = env.get_install_dir()
    pathCount = len(pathList)
    for index, path in enumerate(pathList):
        fullPath = install_dir + path + '/' + version_filename
        f = open(fullPath, 'w')
        print '  Output: %i of %i - Writing %s to:' % (index + 1, pathCount,
                                                       version_filename)
        print '                     %s' % fullPath
        # Write the give command line argument as the version string in the file.
        f.write(version_string)
        print '                 - Done.  Closing file.'
        f.close()
        print ''
Exemple #4
0
class CherryPyStartup(object):
    def __init__(my, port=''):

        # It is possible on startup that the database is not running.
        from pyasm.common import Environment
        from pyasm.search import DbContainer, DatabaseException, Sql
        plugin_dir = Environment.get_plugin_dir()
        sys.path.insert(0, plugin_dir)

        try:
            sql = DbContainer.get("sthpw")
            if sql.get_database_type() != "MongoDb":
                # before batch, clean up the ticket with a NULL code
                if os.getenv('TACTIC_MODE') != 'production':
                    sql.do_update('DELETE from "ticket" where "code" is NULL;')
                else:
                    start_port = Config.get_value("services", "start_port")
                    if start_port:
                        start_port = int(start_port)
                    else:
                        start_port = 8081
                    if port and int(port) == start_port:
                        sql.do_update(
                            'DELETE from "ticket" where "code" is NULL;')
        except DatabaseException, e:
            # TODO: need to work on this
            print "ERROR: could not connect to [sthpw] database"
            #os.environ["TACTIC_CONFIG_PATH"] = Config.get_default_config_path()
            #Sql.set_default_vendor("Sqlite")

            Config.set_tmp_config()
            Config.reload_config()

            # try connecting again
            try:
                sql = DbContainer.get("sthpw")
            except:
                print "Could not connect to the database."
                raise

        # is it CherryPyStartup's responsibility to start batch?
        from pyasm.security import Batch
        Batch()

        my.site_dir = os.getenv("TACTIC_SITE_DIR")
        my.install_dir = os.getenv("TACTIC_INSTALL_DIR")

        # set up a simple environment.  May need a more complex one later
        my.env = Environment()

        my.setup_env()
        my.config = my.setup_sites()

        my.init_only = False

        cherrypy.startup = my

        # this initializes the web.
        # - sets up virtual implied tiggers
        from web_init import WebInit
        WebInit().execute()

        # Windows should handle fine
        #start up the caching system if it's not windows
        cache_mode = Config.get_value("install", "cache_mode")
        if not cache_mode:
            cache_mode = 'complete'
            if os.name == 'nt':
                cache_mode = 'basic'

        from cache_startup import CacheStartup
        cmd = CacheStartup(mode=cache_mode)
        cmd.execute()
        cmd.init_scheduler()

        # DEPRECATED (but keeping it around"
        """
        # start up the queue system ...
        if Config.get_value("sync", "enabled") == "true":
            # start up the sync system ...
            print "Starting Transaction Sync ..."
            from tactic.command import TransactionQueueManager
            TransactionQueueManager.start()

            # start up the sync system ...
            print "Starting Watch Folder Service ..."
            from tactic.command import WatchServerFolderTask
            WatchServerFolderTask.start()
        """

        # start up scheduled triggers
        #from tactic.command import ScheduledTriggerMonitor
        #ScheduledTriggerMonitor.start()

        #from pyasm.web import Translation
        #Translation.install()

        # close all the threads in this startup thread
        from pyasm.search import DbContainer
        DbContainer.close_thread_sql()

        version = Environment.get_release_version()
        print
        print "Starting TACTIC v%s ..." % version
        print
Exemple #5
0
def run_create_zip():
    env = Environment()
    install_dir = env.get_install_dir()
    print install_dir
    os.system('cd ' + install_dir + '/src/context/client; ./create_zip.sh')