parse the ipaddr argument

This commit is contained in:
Jim Rollenhagen 2014-03-14 16:19:20 -07:00
parent 5a596157da
commit c1c6425e93
3 changed files with 12 additions and 5 deletions

View File

@ -107,9 +107,10 @@ class TeethAgentHeartbeater(threading.Thread):
class TeethAgent(object):
def __init__(self, api_url, listen_address):
def __init__(self, api_url, listen_address, ipaddr):
self.api_url = api_url
self.listen_address = listen_address
self.ipaddr = ipaddr
self.mode_implementation = None
self.version = pkg_resources.get_distribution('teeth-agent').version
self.api = api.TeethAgentAPIServer(self)
@ -217,5 +218,5 @@ def _load_mode_implementation(mode_name):
return mgr.driver
def build_agent(api_url, listen_host, listen_port):
return TeethAgent(api_url, (listen_host, listen_port))
def build_agent(api_url, listen_host, listen_port, ipaddr):
return TeethAgent(api_url, (listen_host, listen_port), ipaddr)

View File

@ -39,8 +39,13 @@ def run():
type=int,
help='The port to listen on')
parser.add_argument('--ipaddr',
required=True,
help='The external IP address to advertise to ironic')
args = parser.parse_args()
logging.configure()
agent.build_agent(args.api_url,
args.listen_host,
args.listen_port).run()
args.listen_port,
args.ipaddr).run()

View File

@ -121,7 +121,8 @@ class TestBaseAgent(unittest.TestCase):
encoding.SerializationViews.PUBLIC,
indent=4)
self.agent = agent.TeethAgent('https://fake_api.example.org:8081/',
('localhost', 9999))
('localhost', 9999),
'192.168.1.1')
def assertEqualEncoded(self, a, b):
# Evidently JSONEncoder.default() can't handle None (??) so we have to