示例#1
0
def main():
    ship_name, consul_mode, ship_ips, datacenter = _get_runtime_settings()
    ship_external_ip = os.environ.get('SHIP_EXTERNAL_IP', '')
    consul_config_content = consul_config.get_consul_config(**locals())

    with open(consul_config.CONFIG_PATH, 'w') as config_file:
        config_file.write(consul_config_content)

    command = 'consul agent -config-file {config_path}'.format(config_path=consul_config.CONFIG_PATH)
    print 'RUNNING: ' + command

    with open('/tmp/consul.log', 'a') as output_f:
        subprocess.call(command.split(), stdout=output_f, stderr=output_f)
示例#2
0
def main():
    ship_name, consul_mode, ship_ips, datacenter = _get_runtime_settings()
    ship_external_ip = os.environ.get('SHIP_EXTERNAL_IP', '')
    consul_config_content = consul_config.get_consul_config(**locals())

    with open(consul_config.CONFIG_PATH, 'w') as config_file:
        config_file.write(consul_config_content)

    command = '/usr/local/bin/consul agent -config-file {config_path}'.format(config_path=consul_config.CONFIG_PATH)
    print 'RUNNING: ' + command

    args = command.split()
    os.execv(args[0], args)
示例#3
0
def main():
    consul_mode, ship_ips, datacenter, ship_name = _get_runtime_settings()
    ship_external_ip = os.environ.get('SHIP_EXTERNAL_IP', '')
    if ship_name is None:
        ship_name = ship_external_ip
    consul_config_content = consul_config.get_consul_config(
        consul_mode, ship_ips, datacenter, ship_external_ip, ship_name)

    with open(consul_config.CONFIG_PATH, 'w') as config_file:
        config_file.write(consul_config_content)

    command = '/usr/local/bin/consul agent -config-file {config_path}'.format(
        config_path=consul_config.CONFIG_PATH)
    get_logger().info('RUNNING: {}'.format(command))

    args = command.split()
    os.execv(args[0], args)