-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[Digital Ocean] Code cleanup with no functional modifications #11592
Conversation
Please edit commit history so reviewers don't have to see the back-and-forth. A series of smaller commits is better, making it easier for reviewers to verify that any given refactoring has no functional modification, but the stream should not add an unrelated file and then delete it later. |
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.
Looks good from a DO perspective. I'll leave the official approval to those that bear the right powers. :)
/unassign |
@srikiz please edit the commit stream so it doesn't add |
@johngmyers - is it okay if I squash all the commits once I fix couple of bazel issues? |
/hold |
@srikiz I'm concerned this might be a bit too big to review in one go. It's easier to review if code is moved in one commit and then cleaned up in a separate commit. |
@johngmyers - that sounds like a plan. Once I get the issues resolved, I will close this pull request, and create a new one with 2 commits as you suggested. I'll just move the file in the first commit and keep the rest of the changes in a different commit. |
@srikiz alternatively you could force-push to this PR. |
…/cloudup/do directory
@johngmyers - Hopefully, I got it right :) All other changes are updating the dependencies to point to the new interface. Thanks ! |
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.
Unfortunately, the second commit is to big. I cannot easily follow to verify the lack of functional modifications. The fact that functions are being reordered at the same time as they or other things are being modified makes the diffs extremely hard to follow.
It also looks like the first commit won't compile, but is fixed up in the second commit. I can work around some of that, but it makes reviewing a harder task.
upup/pkg/fi/cloudup/do/cloud.go.new
Outdated
@@ -0,0 +1,566 @@ | |||
/* |
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.
This file should not be added then removed. Please edit it out of the commit stream.
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.
Sure, Removed it.
@johngmyers - Apologize, its creating a problem in reviewing this. My first commit is failing since I just moved the same file over to upup/pkg/fi/cloudup/do. But I fixed all issues in my second commit, but placing of the functions didn't match well with the original code. |
(I haven't yet had time to review your latest push.) @srikiz my primary task as reviewer is to verify the claim that there are no functional modifications. Like any human, I have limited short-term memory, so the fewer things I have to track at once the more practical the task. So the request is to have a series of self-contained commits, so that I can review one commit, then discard most state about that commit and move to the next. As an exception to the expectation that each commit should be self-contained and compile, it is customary for larger changes to automatically generated files to be in a separate commit. You might find it helpful to look at some of my refactoring PRs, for example #11219 (though that has functional changes mixed in). |
/retest |
@johngmyers - thank you for your time on this. My updated commit stream should hopefully make it easier now. I have re-ordered the functions so it is in-line with the changes in the first commit. Please feel free to let me know if you need further modifications. Thanks again, for the help !! |
upup/pkg/fi/cloudup/do/cloud.go
Outdated
// DOCloud exposes all the interfaces required to operate on DigitalOcean resources | ||
type DOCloud interface { | ||
fi.Cloud | ||
//Client() *godo.Client |
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.
nit: this should be removed
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.
Sure, updated.
//Client() *godo.Client | ||
DropletsService() godo.DropletsService | ||
DropletActionService() godo.DropletActionsService | ||
VolumeService() godo.StorageService |
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.
Since this is specific to DO, perhaps it should stick with the DO terminology.
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'll probably keep this as-is for now, and rename this to StorageService as a separate PR.
upup/pkg/fi/cloudup/do/cloud.go
Outdated
|
||
dns dnsprovider.Interface | ||
|
||
// region holds the DO region |
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.
nit: should be a complete sentence, including punctuation:
// region holds the DO region | |
// region holds the DO region. |
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.
Sure, updated.
upup/pkg/fi/cloudup/do/cloud.go
Outdated
func (c *Cloud) DNS() (dnsprovider.Interface, error) { | ||
return c.dns, nil | ||
func (c *doCloudImplementation) DNS() (dnsprovider.Interface, error) { | ||
provider := dns.NewProvider(c.Client) |
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 doesn't this return c.dns
?
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.
Missed that, updated it.
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.
These comments are all small enough to leave to follow-up work.
Thank you, that was much easier to review.
upup/pkg/fi/cloudup/do/cloud.go
Outdated
|
||
// FindVPCInfo is not implemented, it's only here to satisfy the fi.Cloud interface | ||
func (c *doCloudImplementation) FindVPCInfo(id string) (*fi.VPCInfo, error) { | ||
return nil, errors.New("Not implemented") |
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.
Go errors should always start with lowercase letters
return nil, errors.New("Not implemented") | |
return nil, errors.New("not implemented") |
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.
sure, updated.
// MockLoadBalancers godo.LoadBalancersService | ||
// MockDomain godo.DomainsService | ||
// MockActions godo.ActionsService | ||
// } |
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.
Remove commented-out code.
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.
Sure, removed.
|
||
// FindVPCInfo is not implemented, it's only here to satisfy the fi.Cloud interface | ||
func (c *doCloudMockImplementation) FindVPCInfo(id string) (*fi.VPCInfo, error) { | ||
return nil, errors.New("Not implemented") |
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.
lowercase
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.
sure, updated.
} | ||
|
||
func (c *doCloudMockImplementation) DeleteInstance(instance *cloudinstances.CloudInstance) error { | ||
return errors.New("Not tested") |
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.
lowercase
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.
Done.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: johngmyers, timoreimann 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 |
/lgtm |
/hold cancel |
FYI - @timoreimann