Example #1
0
def create_and_configure_mysql_for_owl(args):
    if build_utils.get_build_info_option('owl', 'mysql') == 'created':
        return
    # Support both local and remote database
    choice = raw_input("Please choose Mysql server you want to use " \
      "(1 for Local, 2 for Remote): ")
    owl_prefix = raw_input("Please enter the prefix of your owl database name " \
      "(default: %s): " % getpass.getuser())
    if not owl_prefix:
        owl_prefix = getpass.getuser()
    database_name = "%s_owl" % owl_prefix

    # Using local mysql
    if int(choice) == 1:
        # Check mysql server is running
        cmd = 'ps -ef | grep mysqld | grep -v grep'
        error_message = "Please start mysql server firstly"
        build_utils.check_command_output(cmd, error_message=error_message)
        # Create owl database
        create_owl_database(args, database_name)
        # Configure mysql for owl
        configure_mysql_for_owl(database_name)

    # Using remote mysql
    elif int(choice) == 2:
        remote_address = raw_input("Please input the remote mysql " \
          "server's address (ip:port): ")
        remote_host, remote_port = remote_address.split(":")
        # Create owl database
        create_owl_database(args,
                            database_name,
                            host=remote_host,
                            port=remote_port)
        # Configure mysql for owl
        configure_mysql_for_owl(database_name, remote_host, remote_port)
    else:
        Log.print_critical("ERROR: invalid choice")

    # Mark mysql database created
    build_utils.output_build_info('owl', 'mysql', 'created')
Example #2
0
def create_and_configure_mysql_for_owl(args):
  if build_utils.get_build_info_option('owl', 'mysql') == 'created':
    return
  # Support both local and remote database
  choice = raw_input("Please choose Mysql server you want to use " \
    "(1 for Local, 2 for Remote): ")
  owl_prefix = raw_input("Please enter the prefix of your owl database name " \
    "(default: %s): " % getpass.getuser())
  if not owl_prefix:
    owl_prefix = getpass.getuser()
  database_name = "%s_owl" % owl_prefix

  # Using local mysql
  if int(choice) == 1:
    # Check mysql server is running
    cmd = 'ps -ef | grep mysqld | grep -v grep'
    error_message = "Please start mysql server firstly"
    build_utils.check_command_output(cmd, error_message=error_message)
    # Create owl database
    create_owl_database(args, database_name)
    # Configure mysql for owl
    configure_mysql_for_owl(database_name)

  # Using remote mysql
  elif int(choice) == 2:
    remote_address = raw_input("Please input the remote mysql " \
      "server's address (ip:port): ")
    remote_host, remote_port = remote_address.split(":")
    # Create owl database
    create_owl_database(args, database_name, host=remote_host, port=remote_port)
    # Configure mysql for owl
    configure_mysql_for_owl(database_name, remote_host, remote_port)
  else:
    Log.print_critical("ERROR: invalid choice")

  # Mark mysql database created
  build_utils.output_build_info('owl', 'mysql', 'created')
Example #3
0
def check_third_party_tool_exists(tool_name):
  cmd = "which %s" % tool_name
  error_message = "Please install %s firstly" % tool_name
  build_utils.check_command_output(cmd, error_message=error_message)
Example #4
0
def check_third_party_tool_exists(tool_name):
    cmd = "which %s" % tool_name
    error_message = "Please install %s firstly" % tool_name
    build_utils.check_command_output(cmd, error_message=error_message)