2013-09-23 23:29:55 -07:00
|
|
|
"""
|
|
|
|
Copyright 2013 Rackspace, Inc.
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
"""
|
|
|
|
|
2014-01-06 12:56:27 -08:00
|
|
|
import argparse
|
|
|
|
|
2013-12-20 12:57:38 -08:00
|
|
|
from teeth_agent import decom
|
2014-01-10 16:11:01 -08:00
|
|
|
from teeth_agent import logging
|
2013-12-17 15:13:30 -08:00
|
|
|
|
2013-09-23 23:29:55 -07:00
|
|
|
|
2013-12-16 15:38:02 -08:00
|
|
|
def run():
|
2014-01-06 12:56:27 -08:00
|
|
|
parser = argparse.ArgumentParser(
|
|
|
|
description='Run the teeth-agent in decom mode')
|
|
|
|
|
|
|
|
parser.add_argument('--api-url',
|
|
|
|
required=True,
|
|
|
|
help='URL of the Teeth agent API')
|
|
|
|
|
2014-01-13 16:46:27 -08:00
|
|
|
parser.add_argument('--listen-port',
|
|
|
|
default=9999,
|
|
|
|
type=int,
|
|
|
|
help='The port to listen on')
|
|
|
|
|
|
|
|
parser.add_argument('--advertise-port',
|
|
|
|
type=int,
|
|
|
|
help=('The port to advertise. Defaults to listen-port.'
|
|
|
|
' Useful when running behind a proxy.'))
|
2014-01-06 12:56:27 -08:00
|
|
|
|
2014-01-13 16:46:27 -08:00
|
|
|
args = parser.parse_args()
|
2014-01-10 16:11:01 -08:00
|
|
|
logging.configure()
|
2014-01-13 16:46:27 -08:00
|
|
|
advertise_port = args.advertise_port or args.listen_port
|
|
|
|
decom.DecomAgent(args.listen_port, advertise_port, args.api_url).run()
|