Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add error if user has not the permissions for ns #1428

Merged
merged 2 commits into from
Apr 20, 2021

Conversation

jLopezbarb
Copy link
Contributor

Signed-off-by: Javier López Barba javier@okteto.com

Fixes #1417

Proposed changes

  • Checks if user can get the namespace before updating context. If the user has not access to the namespace it throws an error

Signed-off-by: Javier López Barba <javier@okteto.com>
@codecov
Copy link

codecov bot commented Apr 19, 2021

Codecov Report

Merging #1428 (5a21306) into master (a273ab8) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1428   +/-   ##
=======================================
  Coverage   36.29%   36.29%           
=======================================
  Files          79       79           
  Lines        7237     7237           
=======================================
  Hits         2627     2627           
  Misses       4285     4285           
  Partials      325      325           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a273ab8...5a21306. Read the comment docs.


_, err = namespaces.Get(ctx, namespace, client)
if err != nil {
return fmt.Errorf("Cannot get '%s' namespace. Please make sure it's created and you have the right permissions.", namespace)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add the second sentence as a hint instead?

Suggested change
return fmt.Errorf("Cannot get '%s' namespace. Please make sure it's created and you have the right permissions.", namespace)
return fmt.Errorf("Namespace '%s' not found. Please verify that the namespace exists and that you have access to it.", namespace)

Signed-off-by: Javier López Barba <javier@okteto.com>
@jLopezbarb jLopezbarb merged commit 7377c87 into master Apr 20, 2021
@jLopezbarb jLopezbarb deleted the jlopezbarb/namespace-error-if-not-permissions branch April 20, 2021 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

okteto namespace should log an error if I don't have access to the namespace
3 participants