|
102 | 102 | 'flavors:list': """Usage: deis flavors:list |
103 | 103 | """, |
104 | 104 | 'formations:create': """Usage: deis formations:create --flavor=<flavor> [--image=<image> --id=<id>] |
| 105 | +""", |
| 106 | + 'formations:list': """Usage: deis formations:info |
105 | 107 | """, |
106 | 108 | 'formations:list': """Usage: deis formations:list |
107 | 109 | """, |
|
112 | 114 | 'formations:calculate': """Usage: deis formations:calculate |
113 | 115 | """, |
114 | 116 | 'formations:balance': """Usage: deis formations:balance |
| 117 | +""", |
| 118 | + 'info': """Usage: deis info |
115 | 119 | """, |
116 | 120 | 'keys:add': """Usage: deis keys:add [<key>] |
117 | 121 | """, |
|
146 | 150 | """, |
147 | 151 | 'nodes:list': """Usage: deis nodes:list |
148 | 152 | """, |
149 | | - 'nodes:delete': """Usage: deis nodes:delete <id> |
| 153 | + 'nodes:destroy': """Usage: deis nodes:destroy <id> |
150 | 154 | """, |
151 | 155 | 'providers:create': """Usage: deis providers:create --type=<type> [--id=<id> --creds=<creds>] |
152 | 156 | """, |
@@ -567,6 +571,17 @@ def formations_list(self, args): |
567 | 571 | else: |
568 | 572 | print('Error!', response.text) |
569 | 573 |
|
| 574 | + def formations_info(self, args): |
| 575 | + """Retrieve formation info""" |
| 576 | + formation = args.get('<formation>') |
| 577 | + if not formation: |
| 578 | + formation = self._session.formation |
| 579 | + response = self._dispatch('get', '/api/formations/{}'.format(formation)) |
| 580 | + if response.status_code == requests.codes.ok: # @UndefinedVariable |
| 581 | + print(json.dumps(response.json(), indent=2)) |
| 582 | + else: |
| 583 | + print('Error!', response.text) |
| 584 | + |
570 | 585 | def formations_destroy(self, args): |
571 | 586 | formation = args.get('<formation>') |
572 | 587 | if not formation: |
@@ -787,13 +802,18 @@ def nodes_list(self, args): |
787 | 802 | else: |
788 | 803 | print('Error!', response.text) |
789 | 804 |
|
790 | | - def nodes_delete(self, args): |
791 | | - """Delete a node by ID.""" |
| 805 | + def nodes_destroy(self, args): |
| 806 | + """Destroy a node by ID.""" |
| 807 | + formation = args.get('--formation') |
| 808 | + if not formation: |
| 809 | + formation = self._session.formation |
792 | 810 | node = args['<id>'] |
793 | 811 | response = self._dispatch('delete', |
794 | | - '/api/nodes/{}'.format(node)) |
| 812 | + '/api/formations/{formation}/nodes/{node}'.format(**locals())) |
| 813 | + sys.stdout.write('Destroying {}... '.format(node)) |
| 814 | + sys.stdout.flush() |
795 | 815 | if response.status_code == requests.codes.no_content: # @UndefinedVariable |
796 | | - print('Node deleted successfully') |
| 816 | + print('done') |
797 | 817 | else: |
798 | 818 | print('Error!', response.status_code, response.text) |
799 | 819 |
|
@@ -899,6 +919,7 @@ def main(): |
899 | 919 | 'login': cli.auth_login, |
900 | 920 | 'logout': cli.auth_logout, |
901 | 921 | 'create': cli.formations_create, |
| 922 | + 'info': cli.formations_info, |
902 | 923 | 'destroy': cli.formations_destroy, |
903 | 924 | 'scale': cli.containers_scale, |
904 | 925 | 'calculate': cli.formations_calculate, |
|
0 commit comments