Skip to content

Block update when instance is provisioned #11

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

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

niket-intc
Copy link

PULL DESCRIPTION

Provide a 1-2 line brief overview of the changes submitted through the Pull Request...

Impact Analysis

Info Please fill out this column
Root Cause Specifically for bugs, empty in case of no variants
Jira ticket ITEP-23276

CODE MAINTAINABILITY

  • Added required new tests relevant to the changes and the URL has been included
  • Updated Documentation as relevant to the changes
  • PR change contains code related to security
  • PR introduces changes that break compatibility with other modules/services (If YES, please provide description)

Code must act as a teacher for future developers

Copy link
Contributor

Choose a reason for hiding this comment

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

do a test case without field in the fm as well

Copy link
Contributor

Choose a reason for hiding this comment

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

please do this as well - to avoid future surprise

// transition from Untrusted to any other state than DELETED is not allowed
return slices.Contains(fieldmask.GetPaths(), instanceresource.FieldDesiredState) &&
instanceq.CurrentState == instanceresource.CurrentStateINSTANCE_STATE_UNTRUSTED &&
in.DesiredState != computev1.InstanceState_INSTANCE_STATE_DELETED
in.DesiredState != computev1.InstanceState_INSTANCE_STATE_DELETED ||
Copy link
Contributor

Choose a reason for hiding this comment

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

my suggestion was to borrow the logic (and create a similar function) that check if
slices.Contains(fieldmask.GetPaths(), instanceresource.FieldCurrentState) AND...

in.DesiredState != computev1.InstanceState_INSTANCE_STATE_DELETED
in.DesiredState != computev1.InstanceState_INSTANCE_STATE_DELETED ||
instanceq.CurrentState != instanceresource.CurrentStateINSTANCE_STATE_UNSPECIFIED &&
instanceq.CurrentState != "" && in.GetLocalaccount() != nil
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
instanceq.CurrentState != "" && in.GetLocalaccount() != nil
&& in.GetLocalaccount() != nil

in *computev1.InstanceResource,
) bool {
return slices.Contains(fieldmask.GetPaths(), instanceresource.EdgeLocalaccount) &&
in.GetLocalaccount() != nil &&
Copy link
Contributor

Choose a reason for hiding this comment

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

I dont believe we need to check if it is not nil

return slices.Contains(fieldmask.GetPaths(), instanceresource.EdgeLocalaccount) &&
in.GetLocalaccount() != nil &&
(instanceq.CurrentState != instanceresource.CurrentStateINSTANCE_STATE_UNSPECIFIED &&
len(instanceq.CurrentState) != 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need len check?

},
"UpdateInstanceLocalAccount": {
"UpdateInstanceDetailStatus": {
Copy link
Contributor

Choose a reason for hiding this comment

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

what is this change about ?

Copy link
Contributor

@pierventre pierventre left a comment

Choose a reason for hiding this comment

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

I would rather merge this post-release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants