Example #1
0
def weblab():
    if len(sys.argv) == 2 and sys.argv[1] in HIDDEN_COMMANDS:
        if sys.argv[1] in ('--version', '-version', '-V'):
            print weblab_version
        else:
            print >> sys.stderr, "Command %s not implemented" % sys.argv[1]
        sys.exit(0)
    if len(sys.argv) in (1, 2) or sys.argv[1] not in COMMANDS:
        command_list = ""
        max_size = max((len(command) for command in COMMANDS))
        for command, help_text in SORTED_COMMANDS:
            filled_command = command + ' ' * (max_size - len(command))
            command_list += "\t%s\t%s\n" % (filled_command, help_text)
        print >> sys.stderr, "Usage: %s option DIR [option arguments]\n\n%s\n" % (sys.argv[0], command_list)
        sys.exit(0)
    main_command = sys.argv[1]
    if main_command == 'create':
        weblab_create(sys.argv[2])
        sys.exit(0)

    if main_command == 'start':
        weblab_start(sys.argv[2])
    elif main_command == 'stop':
        weblab_stop(sys.argv[2])
    elif main_command == 'monitor':
        weblab_monitor(sys.argv[2])
    elif main_command == 'admin':
        weblab_admin(sys.argv[2])
    elif main_command == 'upgrade':
        weblab_upgrade(sys.argv[2])
    elif main_command == '--version':
        print weblab_version
    else:
        print >>sys.stderr, "Command %s not yet implemented" % sys.argv[1]
Example #2
0
def weblab():
    if len(sys.argv) == 2 and sys.argv[1] in HIDDEN_COMMANDS:
        if sys.argv[1] in ('--version', '-version', '-V'):
            print(weblab_version)
            sys.exit(2)
        else:
            print("Command %s not implemented" % sys.argv[1], file=sys.stderr)
            sys.exit(0)
    if len(sys.argv) in (1, 2) or sys.argv[1] not in COMMANDS:
        command_list = ""
        max_size = max((len(command) for command in COMMANDS))
        for command, help_text in SORTED_COMMANDS:
            filled_command = command + ' ' * (max_size - len(command))
            command_list += "\t%s\t%s\n" % (filled_command, help_text)
        print("Usage: %s option DIR [option arguments]\n\n%s\n" %
              (sys.argv[0], command_list),
              file=sys.stderr)
        sys.exit(2)
    main_command = sys.argv[1]
    if main_command == 'create':
        weblab_create(sys.argv[2])
        return

    if main_command == 'start':
        weblab_start(sys.argv[2])
    elif main_command == 'stop':
        weblab_stop(sys.argv[2])
    elif main_command == 'monitor':
        weblab_monitor(sys.argv[2])
    elif main_command == 'upgrade':
        weblab_upgrade(sys.argv[2])
    elif main_command == 'locations':
        weblab_locations(sys.argv[2])
    elif main_command == 'httpd-config-generate':
        weblab_httpd_config_generate(sys.argv[2])
    elif main_command == '--version':
        print(weblab_version)
    else:
        print("Command %s not yet implemented" % sys.argv[1], file=sys.stderr)
        exit(2)
Example #3
0
def weblab():
    if len(sys.argv) == 2 and sys.argv[1] in HIDDEN_COMMANDS:
        if sys.argv[1] in ('--version', '-version', '-V'):
            print(weblab_version)
            sys.exit(2)
        else:
            print("Command %s not implemented" % sys.argv[1], file = sys.stderr)
            sys.exit(0)
    if len(sys.argv) in (1, 2) or sys.argv[1] not in COMMANDS:
        command_list = ""
        max_size = max((len(command) for command in COMMANDS))
        for command, help_text in SORTED_COMMANDS:
            filled_command = command + ' ' * (max_size - len(command))
            command_list += "\t%s\t%s\n" % (filled_command, help_text)
        print("Usage: %s option DIR [option arguments]\n\n%s\n" % (sys.argv[0], command_list), file = sys.stderr)
        sys.exit(2)
    main_command = sys.argv[1]
    if main_command == 'create':
        weblab_create(sys.argv[2])
        return

    if main_command == 'start':
        weblab_start(sys.argv[2])
    elif main_command == 'stop':
        weblab_stop(sys.argv[2])
    elif main_command == 'monitor':
        weblab_monitor(sys.argv[2])
    elif main_command == 'upgrade':
        weblab_upgrade(sys.argv[2])
    elif main_command == 'locations':
        weblab_locations(sys.argv[2])
    elif main_command == 'httpd-config-generate':
        weblab_httpd_config_generate(sys.argv[2])
    elif main_command == '--version':
        print(weblab_version)
    else:
        print("Command %s not yet implemented" % sys.argv[1], file = sys.stderr)
        exit(2)
Example #4
0
from weblab.admin.script.creation import weblab_create


if __name__ == "__main__":

    folder = u"/home/lrg/.weblab.sixx"

    options = {'db_engine': 'mysql', 'admin_user': u'admin', 'federated_logic': True, 'coord_engine': 'redis',
               'system_identifier': u'sixx', 'coord_redis_port': 6379L, 'start_ports': 14001, 'admin_name': u'*****@*****.**',
               'logo_path': '/', 'federated_visir': True, 'db_passwd': 'weblab', 'db_user': '******',
               'base_url': u'w/sixx', 'admin_mail': u'*****@*****.**', 'server_host': 'weblab.deusto.es',
               'federated_submarine': True, 'db_name': 'wcloud2', 'admin_password': u'password', 'cores': 3,
               'coord_redis_db': 2L, 'entity_link': u'http://sixx.com'}

    weblab_create(u"/home/lrg/.weblab/sixxx", options)