-
Notifications
You must be signed in to change notification settings - Fork 20
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
refactor(dns): Update dns manipulation to egoscale v3 #640
base: master
Are you sure you want to change the base?
Conversation
1a8531f
to
f3a9161
Compare
cmd/dns_add.go
Outdated
}) | ||
ctx := gContext | ||
err = decorateAsyncOperations(fmt.Sprintf("Adding DNS record %q to %q...", rType, domain.UnicodeName), func() 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.
cmd/dns_add.go
Outdated
}) | ||
|
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 PR looks very good, :) I will do a second review once you applied some of them |
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.
thanks!
@@ -55,8 +55,7 @@ func addDomainRecord(domainIdent, name, rType, content string, ttl int64, priori | |||
|
|||
ctx := gContext | |||
err = decorateAsyncOperations(fmt.Sprintf("Adding DNS record %q to %q...", rType, domain.UnicodeName), func() error { | |||
|
|||
recordType, err := StringToDNSDomainRecordRequestType(rType) | |||
recordType := v3.CreateDNSDomainRecordRequestType("TEST") |
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 like you forgot to change this?
cmd/dns_remove.go
Outdated
@@ -54,11 +54,7 @@ func removeDomainRecord(domainIdent, recordIdent string, force bool) error { | |||
} | |||
|
|||
_, err = globalstate.EgoscaleV3Client.Wait(ctx, op, v3.OperationStateSuccess) | |||
if err != nil { | |||
return fmt.Errorf("exoscale: error while waiting DNS record deletion: %w", err) |
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.
You're right that these can be removed, but I like these error messages. Makes it easier to find out where an error happened when you read the logs. IMHO these can be kept :)
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.
@mlec1 What I wanted to point out here in this PR, if you were not wrapping/modifying the error, it was not needed to add an extra condition and return it directly instead.
But in the case you want to add more context on the error like here, that is fine 👍 you can keep it.
I have no strong opinion here, but if you decided to add more context to the error here, looks good to me.
// Function to get the DNSDomainRecordRequestType from a string | ||
func StringToDNSDomainRecordRequestType(recordType string) (v3.CreateDNSDomainRecordRequestType, 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.
// Function to get the DNSDomainRecordRequestType from a string | |
func StringToDNSDomainRecordRequestType(recordType string) (v3.CreateDNSDomainRecordRequestType, error) { | |
// StringToDNSDomainRecordRequestType gets the DNSDomainRecordRequestType from a string | |
func StringToDNSDomainRecordRequestType(recordType string) (v3.CreateDNSDomainRecordRequestType, error) { |
|
||
// Function to get the DNSDomainRecordRequestType from a string | ||
func StringToDNSDomainRecordRequestType(recordType string) (v3.CreateDNSDomainRecordRequestType, error) { | ||
// Lookup the record type in the map |
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.
// Lookup the record type in the map |
IMHO code is enough explicit here
Description
Update dns manipulation to egoscale v3
Checklist
(For exoscale contributors)
Testing
Manual test of the different dns manipulation.