~jimbaker/juju-jitsu/watch-failfast

« back to all changes in this revision

Viewing changes to sub-commands/topodump

  • Committer: Mark Mims
  • Date: 2012-06-15 18:08:53 UTC
  • mfrom: (40.1.25 watch-subcommand)
  • Revision ID: mark.mims@canonical.com-20120615180853-c2s5uqfed5svi88k
Tags: 0.11
mergedĀ lp:~jimbaker/juju-jitsu/watch-subcommand

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
 
 
3
from twisted.internet.defer import inlineCallbacks
 
4
from aiki.cli import make_arg_parser, setup_logging, run_command
 
5
from juju.state.base import StateBase
 
6
 
 
7
 
 
8
def main():
 
9
    parser = make_arg_parser()
 
10
    options = parser.parse_args()
 
11
    setup_logging(options)
 
12
    print "options", options
 
13
    run_command(topodump, options)
 
14
 
 
15
 
 
16
@inlineCallbacks
 
17
def topodump(result, client, options):
 
18
    Dumper = TopoDump(client)
 
19
    yield Dumper.dump()
 
20
 
 
21
 
 
22
class TopoDump(StateBase):
 
23
 
 
24
    @inlineCallbacks
 
25
    def dump(self):
 
26
        topology = yield self._read_topology()
 
27
        print topology.dump()
 
28
 
 
29
 
 
30
if __name__ == '__main__':
 
31
    main()