Updated list-cartridges-group command Signed-off-by: Imesh Gunaratne <[email protected]>
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/5d7df719 Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/5d7df719 Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/5d7df719 Branch: refs/heads/stratos-4.1.x Commit: 5d7df7196cebda246b47672277279b303dfbe9d3 Parents: 8d227ea Author: Milindu Sanoj Kumarage <[email protected]> Authored: Sun Aug 2 13:10:03 2015 +0530 Committer: Imesh Gunaratne <[email protected]> Committed: Tue Oct 13 16:32:47 2015 +0530 ---------------------------------------------------------------------- .../src/main/python/cli/CLI.py | 9 +++++---- .../src/main/python/cli/Stratos.py | 16 ++-------------- 2 files changed, 7 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/5d7df719/components/org.apache.stratos.python.cli/src/main/python/cli/CLI.py ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.python.cli/src/main/python/cli/CLI.py b/components/org.apache.stratos.python.cli/src/main/python/cli/CLI.py index ae083cf..1bc773c 100755 --- a/components/org.apache.stratos.python.cli/src/main/python/cli/CLI.py +++ b/components/org.apache.stratos.python.cli/src/main/python/cli/CLI.py @@ -149,13 +149,14 @@ class CLI(Cmd): make_option('-p', '--password', type="str", help="Password of the user") ]) @auth - def do_list_cartridges_group(self, line , opts=None): + def do_list_cartridge_groups(self, line , opts=None): """Illustrate the base class method use.""" - cartridges_groups = Stratos.list_cartridges_group() + cartridge_groups = Stratos.list_cartridge_groups() table = PrintableTable() rows = [["Name", "No. of cartridges", "No of groups", "Dependency scaling"]] - for cartridges_group in cartridges_groups: - rows.append([cartridges_group['name'], cartridges_group['category'], cartridges_group['displayName'], cartridge['description'], cartridge['version'], cartridge['multiTenant']]) + for cartridge_group in cartridge_groups: + rows.append([cartridge_group['name'], len(cartridge_group['cartridges']), + len(cartridge_group['cartridges']), cartridge_group['groupScalingEnabled']]) table.add_rows(rows) table.print_table() http://git-wip-us.apache.org/repos/asf/stratos/blob/5d7df719/components/org.apache.stratos.python.cli/src/main/python/cli/Stratos.py ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.python.cli/src/main/python/cli/Stratos.py b/components/org.apache.stratos.python.cli/src/main/python/cli/Stratos.py index 3cfea19..5990b4c 100755 --- a/components/org.apache.stratos.python.cli/src/main/python/cli/Stratos.py +++ b/components/org.apache.stratos.python.cli/src/main/python/cli/Stratos.py @@ -79,20 +79,8 @@ class Stratos: return r.json() @staticmethod - def list_cartridges_groups(): - r = requests.get(Configs.stratos_api_url + 'cartridgeGroups', - auth=(Configs.stratos_username, Configs.stratos_password), verify=False) - if r.status_code == 200: - return r.json() - elif r.status_code == 400: - raise requests.HTTPError() - elif r.status_code == 401: - raise AuthenticationError() - elif r.status_code == 404: - if r.json() and r.json()['errorMessage'] == "No cartridges found": - return [] - else: - raise requests.HTTPError() + def list_cartridge_groups(): + return Stratos.get('cartridgeGroups', errorMessage='No cartridge groups found') """ # Kubernetes Clusters
