-
Notifications
You must be signed in to change notification settings - Fork 711
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
verifying EnvironmentID before creating infrastructure #4484
verifying EnvironmentID before creating infrastructure #4484
Conversation
Signed-off-by: Dhanush0369 <dhanush789245@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@Saranya-jena can you PTAL.
@Saranya-jena shall I close this pr and make another pr. It seems I have merged using the wrong method. Edit: The method is correct, the wrong method was about the merge commit. |
Sure @Dhanush0369 please open another PR if you deem this wrong |
@@ -86,6 +86,11 @@ func (in *infraService) RegisterInfra(c context.Context, projectID string, input | |||
return nil, errors.New("infra already exists in this project with the same name") | |||
} | |||
|
|||
// Check if EnvironmentID is valid | |||
if _, err := in.envOperator.GetEnvironmentDetails(c, input.EnvironmentID, projectID); err != nil { | |||
return nil, errors.New("Invalid EnvironmentID") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Dhanush0369 have you tested these changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I have attached the graphql playground pic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀
@@ -86,6 +86,11 @@ func (in *infraService) RegisterInfra(c context.Context, projectID string, input | |||
return nil, errors.New("infra already exists in this project with the same name") | |||
} | |||
|
|||
// Check if EnvironmentID is valid | |||
if _, err := in.envOperator.GetEnvironmentDetails(c, input.EnvironmentID, projectID); err != nil { | |||
return nil, errors.New("Invalid EnvironmentID") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Invalid EnvironmentID - > environment does not exist.
if _, err := in.envOperator.GetEnvironmentDetails(c, input.EnvironmentID, projectID); err != nil { | ||
return nil, errors.New("Invalid EnvironmentID") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if _, err := in.envOperator.GetEnvironmentDetails(c, input.EnvironmentID, projectID); err != nil { | |
return nil, errors.New("Invalid EnvironmentID") | |
if env, err := in.envOperator.GetEnvironmentDetails(c, input.EnvironmentID, projectID); err != nil || env.EnvironmentID == "" { | |
return nil, errors.New("Invalid EnvironmentID") |
Proposed changes
Fixes #4463
Summarize your changes here to communicate with the maintainers and make sure to put the link of that issue
Types of changes
What types of changes does your code introduce to Litmus? Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Dependency
Special notes for your reviewer: