11
root_dir = opd(opd(opd((os.path.abspath(__file__)))))
16
# FIXME: Running amulet with sentries is vurrently bogus in multiple ways
17
# and we can get juju status ourselves -- vila 2013-12-18
18
depl = amulet.Deployment(sentries=False)
19
jd_path = os.path.join(root_dir, 'juju-deployer', 'ppa-assigner.yaml')
20
with open(jd_path) as f:
21
jd_script = yaml.safe_load(f.read())
22
# Override the juju env provided by ppa-assigner or amulet gets confused
23
script = {depl.juju_env: jd_script.values()[0]}
25
# This is a no-op if (as expected) the ppa-assigner has already been
26
# deployed, but it *will* be deployed if needed anyway.
29
status = amulet.waiter.status(depl.juju_env)
30
units = status['services']['django']['units']
31
ip = units['django/0']['public-address']
32
port, _ = units['django/0']['open-ports'][0].split('/')
33
# Issue a simple command against the ppa assigner API
34
url = 'http://{}:{}/api/v1/ppa'.format(ip, port)
35
client = httplib2.Http()
36
resp, content = client.request(url, 'GET')
37
jcontent = json.loads(content)
39
# self.assertEqual('200', resp['status'])
40
# self.assertNotEqual([], jcontent['objects'])
41
if '200' != resp['status']:
43
if [] == jcontent['objects']:
47
if __name__ == "__main__":