~andrewjbeach/juju-ci-tools/make-local-patcher

« back to all changes in this revision

Viewing changes to 20-cli/juju

  • Committer: Aaron Bentley
  • Date: 2016-03-01 21:23:25 UTC
  • mto: This revision was merged to the branch mainline in revision 1305.
  • Revision ID: aaron.bentley@canonical.com-20160301212325-ogp6t6l979xvbxq6
Use revision-build for parallel streams.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
import os
 
3
import subprocess
 
4
import sys
 
5
 
 
6
 
 
7
def main():
 
8
    substitutes = {
 
9
        '-m': ['-e'],
 
10
        'run-action': ['action', 'do'],
 
11
        'show-action-output': ['action', 'fetch'],
 
12
        'remove-service': ['destroy-service'],
 
13
        'create-backup': ['backups', 'create'],
 
14
        'restore-backup': ['backups', 'restore'],
 
15
        'enable-ha': ['ensure-availability'],
 
16
        'list-space': ['space', 'list'],
 
17
        'add-space': ['space', 'create'],
 
18
        'add-subnet': ['subnet', 'add'],
 
19
        'set-config': ['set'],
 
20
        'get-config': ['get'],
 
21
        'show-status': ['status'],
 
22
    }
 
23
    args = []
 
24
    for val in substitutes.values():
 
25
        for subval in val:
 
26
            assert subval not in sys.argv, '{} not permitted.'.format(subval)
 
27
    for arg in sys.argv[1:]:
 
28
        arg = substitutes.get(arg, [arg])
 
29
        args.extend(arg)
 
30
    if '--version' in args:
 
31
        print '2.0-alpha2-fake-wrapper'
 
32
        return 0
 
33
    return subprocess.call([os.environ['REAL_JUJU']] + args)
 
34
 
 
35
 
 
36
if __name__ == '__main__':
 
37
    sys.exit(main())