-
Notifications
You must be signed in to change notification settings - Fork 31
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
Feature/userdel diffs #584
Conversation
@@ -217,19 +183,10 @@ func (u *User) Check(context.Context, resource.Renderer) (resource.TaskStatus, e | |||
|
|||
// Apply changes for user | |||
func (u *User) Apply(context.Context) (resource.TaskStatus, error) { |
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.
why couldn't apply use the status that you've created already, again? I feel like we had this discussion, but a) I don't remember and b) has the answer changed?
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.
I don't believe we can since we no longer keep status
as a field of the task struct.
@@ -401,6 +336,40 @@ func (u *User) DiffAdd(status *resource.Status) (*AddUserOptions, error) { | |||
return options, nil | |||
} | |||
|
|||
// DiffDel checks for differences between the current and desired state for the | |||
// user to be deleted indicated by the User fields. | |||
func (u *User) DiffDel(status *resource.Status, userByName *user.User, nameNotFound bool) error { |
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.
nitpick: should this be public?
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.
It makes sense to be private, but is public for testing purposes.
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.
IMO it would be better to make the tests part of the package than it would be to expose extra members. But it's definitely not a blocker. :)
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.
After some discussion, we've concluded to leave as is for user
since testing is currently performed for a package <name>
in package <name_test>
. In the next resource added to Converge, we will try testing as part of the package.
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.
🤘 ticket?
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.
Opened #585
case nameNotFound: | ||
return nil | ||
case userByName != nil: | ||
switch { |
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.
nitpick: this if … else
in fancier clothes
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.
I thought you liked switch better. ;) I will change it back to if...else
.
} | ||
} | ||
|
||
if resource.AnyChanges(status.Differences) { |
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.
possible enhancement: why isn't this a method on status
? (cc @rebeccaskinner)
Improve diffs used when deleting a user.
Implements #445