StarlingX Distributed Cloud Client
Go to file
Joao Victor Portal e0d8e1fcc6 Fix DC error messages for forbidden requests
The CLI error messages for users with reader role were not clear to the
operator and this change fixes this.

The problem was caused by an exception in string manipulation that was
handled locally (the position "2" of the list of lines didn't exist,
check file "base.py").

The error messages of DC CLI commands have either the format
"<Explanation of why the operation failed>
ERROR (app) Unable to <do operation X on subcloud Y>"
or simply "ERROR (app) <Explanation of why the operation failed>".
In the case of command "dcmanager subcloud reconfig", that uses the
first format, the part where "<Explanation of why the operation failed>"
was printed was missing, so a "print(exception)" was added (see
"subcloud_manager.py" file, some other declarations of method
"_get_resources" in the same file use this pattern).

Test Plan:

PASS: In a DC with this change present, create a new openstack user with
reader role and through this user execute the commands:
dcmanager subcloud list
dcmanager subcloud manage subcloud1
dcmanager subcloud-group add --name test
dcmanager subcloud reconfig --deploy-config file001 subcloud1
and check that the "subcloud list" command is executed without errors
and that the error message of the other commands changes from
"b'<html>\n <head>\n  <title>403 Forbidden</title>\n </head>\n <body>\n
  <h1>403 Forbidden</h1>\n  Access was denied to this resource.<br /><br
 />\n\n\n\n </body>\n</html>'
ERROR (app) Unable to manage subcloud subcloud1",
"ERROR (app) b'<html>\n <head>\n  <title>403 Forbidden</title>\n </head>
\n <body>\n  <h1>403 Forbidden</h1>\n  Access was denied to this
resource.<br /><br />\n\n\n\n </body>\n</html>'" and
"ERROR (app) Unable to reconfigure subcloud subcloud1"
to
"Access was denied to this resource.
ERROR (app) Unable to manage subcloud subcloud1",
"ERROR (app) Access was denied to this resource." and
"Access was denied to this resource.
ERROR (app) Unable to reconfigure subcloud subcloud1".

Story: 2010149
Task: 46621

Signed-off-by: Joao Victor Portal <Joao.VictorPortal@windriver.com>
Change-Id: I254813df075e49d2dece0667cc26b42fc3676a51
2022-10-20 21:23:44 -03:00
distributedcloud-client Fix DC error messages for forbidden requests 2022-10-20 21:23:44 -03:00
doc Switch to newer openstackdocstheme and reno versions 2020-06-04 14:16:03 +02:00
releasenotes Switch to newer openstackdocstheme and reno versions 2020-06-04 14:16:03 +02:00
.gitignore Fix coverage reporting for stx-distcloud-client 2018-11-21 12:12:43 -06:00
.gitreview OpenDev Migration Patch 2019-04-19 19:52:34 +00:00
.mailmap StarlingX open source release updates 2018-08-07 11:51:16 -04:00
.zuul.yaml Make Tox compatible to Debian Python3.9 Environment - dc-client 2022-08-11 14:16:40 -04:00
CONTRIBUTING.rst StarlingX open source release updates 2018-08-07 11:51:16 -04:00
CONTRIBUTORS.wrs StarlingX open source release updates 2018-08-07 11:51:16 -04:00
HACKING.rst Update the URL in HACKING.rst 2018-09-23 16:31:32 +08:00
bindep.txt Adding py39 gate and removing py36 gates from zuul 2021-10-28 19:41:32 +00:00
centos_build_layer.cfg Build layering, add layer build config file 2019-11-08 08:42:11 +08:00
centos_dev_wheels.inc Update files for relocated repo 2019-11-04 16:12:27 -05:00
centos_iso_image.inc Update files for relocated repo 2019-11-04 16:12:27 -05:00
centos_pkg_dirs Update files for relocated repo 2019-11-04 16:12:27 -05:00
centos_stable_wheels.inc Update files for relocated repo 2019-11-04 16:12:27 -05:00
debian_build_layer.cfg Add debian_build_layer.cfg file 2021-10-05 14:07:20 -04:00
debian_pkg_dirs Add debian package for distributedcloud-client 2022-01-24 03:40:20 -03:00
requirements.txt Move content to subdir to support relocated packaging 2019-11-04 14:14:38 -05:00
test-requirements.txt Fix zuul jobs broken due to pip upversion 2020-12-18 13:39:36 -06:00
tox.ini Tox and Zuul job for the bandit code scan in stx/distrib-client 2020-06-08 03:59:38 +00:00