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

Bug 1802580: return ProjectRequestMessage if it is set with login,project cmds #406

Merged
merged 1 commit into from May 21, 2020

Conversation

sallyom
Copy link
Contributor

@sallyom sallyom commented May 5, 2020

This PR updates return msg to users that cannot create projects for oc login, oc new-project, and oc project
If ProjectRequestMessage is set, and user without self-provisioner clusterrole logs in or tries to create projects, return the ProjectRequestMessage. This is consistent with console.

If no ProjectRequestMessage set, then return the same message for login|project|new-project:

$ oc project
You may not request a new project via this API.

oc project without this PR is misleading:

$ oc project
No project has been set. Pass a project name to make that the default.

see comment below to set projectRequestMsg and remove self-provisioner clusterrole

@openshift-ci-robot openshift-ci-robot added the bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. label May 5, 2020
@openshift-ci-robot
Copy link

@sallyom: This pull request references Bugzilla bug 1802577, which is invalid:

  • expected the bug to be open, but it isn't
  • expected the bug to be in one of the following states: NEW, ASSIGNED, ON_DEV, POST, POST, but it is CLOSED (ERRATA) instead

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

Bug 1802577: return ProjectRequestMessage if it is set with login,project cmds

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot openshift-ci-robot added the bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. label May 5, 2020
@sallyom
Copy link
Contributor Author

sallyom commented May 5, 2020

to test

$ oc edit project.config.openshift.io/cluster 

add this:

spec:
  projectRequestMessage: Contact your system administrator admin@company.com
$ oc adm policy remove-cluster-role-from-group self-provisioner  system:authenticated:oauth
$ oc login -u user1 -p pass1
Login successful.

Contact your system administrator admin@company.com
$ oc project
Contact your system administrator admin@company.com
$ oc new-project testproj
Error from server (Forbidden): Contact your system administrator admin@company.com

@sallyom sallyom changed the title Bug 1802577: return ProjectRequestMessage if it is set with login,project cmds Bug 1802580: return ProjectRequestMessage if it is set with login,project cmds May 5, 2020
@openshift-ci-robot openshift-ci-robot added bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. and removed bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. labels May 5, 2020
@openshift-ci-robot
Copy link

@sallyom: This pull request references Bugzilla bug 1802580, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.5.0) matches configured target release for branch (4.5.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1802580: return ProjectRequestMessage if it is set with login,project cmds

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@sallyom sallyom force-pushed the bzprojreq1802577 branch 2 times, most recently from da87a64 to 8e0c245 Compare May 5, 2020 12:52
@openshift-ci-robot
Copy link

@sallyom: This pull request references Bugzilla bug 1802580, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.5.0) matches configured target release for branch (4.5.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1802580: return ProjectRequestMessage if it is set with login,project cmds

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

1 similar comment
@openshift-ci-robot
Copy link

@sallyom: This pull request references Bugzilla bug 1802580, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.5.0) matches configured target release for branch (4.5.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1802580: return ProjectRequestMessage if it is set with login,project cmds

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot
Copy link

@sallyom: This pull request references Bugzilla bug 1802580, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.5.0) matches configured target release for branch (4.5.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1802580: return ProjectRequestMessage if it is set with login,project cmds

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

6 similar comments
@openshift-ci-robot
Copy link

@sallyom: This pull request references Bugzilla bug 1802580, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.5.0) matches configured target release for branch (4.5.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1802580: return ProjectRequestMessage if it is set with login,project cmds

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot
Copy link

@sallyom: This pull request references Bugzilla bug 1802580, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.5.0) matches configured target release for branch (4.5.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1802580: return ProjectRequestMessage if it is set with login,project cmds

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot
Copy link

@sallyom: This pull request references Bugzilla bug 1802580, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.5.0) matches configured target release for branch (4.5.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1802580: return ProjectRequestMessage if it is set with login,project cmds

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot
Copy link

@sallyom: This pull request references Bugzilla bug 1802580, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.5.0) matches configured target release for branch (4.5.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1802580: return ProjectRequestMessage if it is set with login,project cmds

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot
Copy link

@sallyom: This pull request references Bugzilla bug 1802580, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.5.0) matches configured target release for branch (4.5.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1802580: return ProjectRequestMessage if it is set with login,project cmds

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot
Copy link

@sallyom: This pull request references Bugzilla bug 1802580, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.5.0) matches configured target release for branch (4.5.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1802580: return ProjectRequestMessage if it is set with login,project cmds

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@sallyom sallyom force-pushed the bzprojreq1802577 branch 2 times, most recently from d086566 to 20e2137 Compare May 5, 2020 22:43
@sallyom
Copy link
Contributor Author

sallyom commented May 7, 2020

/retest

1 similar comment
@sallyom
Copy link
Contributor Author

sallyom commented May 9, 2020

/retest

@openshift-ci-robot
Copy link

@sallyom: This pull request references Bugzilla bug 1802580, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.5.0) matches configured target release for branch (4.5.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1802580: return ProjectRequestMessage if it is set with login,project cmds

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot
Copy link

@sallyom: This pull request references Bugzilla bug 1802580, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.5.0) matches configured target release for branch (4.5.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1802580: return ProjectRequestMessage if it is set with login,project cmds

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

1 similar comment
@openshift-ci-robot
Copy link

@sallyom: This pull request references Bugzilla bug 1802580, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.5.0) matches configured target release for branch (4.5.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1802580: return ProjectRequestMessage if it is set with login,project cmds

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link
Member

@soltysh soltysh left a comment

Choose a reason for hiding this comment

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

Two nits and you're good to go.

pkg/cli/login/loginoptions.go Show resolved Hide resolved
}
if err := client.RESTClient().Get().Resource("projectrequests").Do(context.TODO()).Into(&metav1.Status{}); err != nil {
fmt.Fprintf(o.Out, "%v\n", err)
return nil
Copy link
Member

Choose a reason for hiding this comment

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

If this is error, just return err is the best option.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated, fixed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but this changes behavior of oc project to return an error.
As/is, if user w/out self-provisioner role runs oc project they'll see this:

$ oc project
No project has been set. Pass a project name to make that the default.

and now, with this PR, it will be this:

$ oc project
Error from server (Forbidden): This is a friendly message...

or, if no projectRequestMessageSet, this:

$ oc project
Error from server (Forbidden): You may not request a new project via this API.

(this message without the set projRequestMessage is now consistent with the error a user gets with oc new-project foo now, which makes more sense to me)

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 19, 2020
@sallyom
Copy link
Contributor Author

sallyom commented May 20, 2020

/retest

Copy link
Member

@soltysh soltysh left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

pkg/cli/login/loginoptions.go Show resolved Hide resolved
@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label May 21, 2020
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sallyom, soltysh

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@sallyom
Copy link
Contributor Author

sallyom commented May 21, 2020

/retest

@openshift-merge-robot openshift-merge-robot merged commit 44354e2 into openshift:master May 21, 2020
@openshift-ci-robot
Copy link

@sallyom: All pull requests linked via external trackers have merged: openshift/oc#406. Bugzilla bug 1802580 has been moved to the MODIFIED state.

In response to this:

Bug 1802580: return ProjectRequestMessage if it is set with login,project cmds

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants