Update relation info script
This commit is contained in:
parent
e9befdfca5
commit
24c20055f7
@ -1,11 +1,10 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import asyncio
|
||||
|
||||
from juju.model import Model
|
||||
|
||||
from juju import jasyncio
|
||||
|
||||
|
||||
async def main(args):
|
||||
|
||||
@ -45,19 +44,22 @@ async def _check_binding(unit, binding):
|
||||
|
||||
rel_info = await unit.run('relation-get -r {} - {}'.format(
|
||||
rel, unit.name))
|
||||
if 'Stdout' in rel_info.results:
|
||||
await rel_info.fetch_output()
|
||||
if 'stdout' in rel_info.results:
|
||||
print(seperator)
|
||||
print('Relation info for {} - {}\n'.format(unit.name, rel))
|
||||
print(rel_info.results['Stdout'])
|
||||
print(rel_info.results['stdout'])
|
||||
print(seperator)
|
||||
|
||||
|
||||
async def _get_rel_ids(unit, binding):
|
||||
rel_ids = []
|
||||
relation_ids = await unit.run('relation-ids {}'.format(binding))
|
||||
|
||||
if 'Stdout' in relation_ids.results:
|
||||
rel_ids = relation_ids.results['Stdout'].split()
|
||||
relation_ids = await unit.run('relation-ids {}'.format(binding))
|
||||
await relation_ids.fetch_output()
|
||||
|
||||
if 'stdout' in relation_ids.results:
|
||||
rel_ids = relation_ids.results['stdout'].split()
|
||||
|
||||
return rel_ids
|
||||
|
||||
@ -77,4 +79,4 @@ def _parse_args():
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
jasyncio.run(main(_parse_args()))
|
||||
asyncio.run(main(_parse_args()))
|
||||
|
Loading…
Reference in New Issue
Block a user