Skip to content
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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

mlec1
Copy link
Contributor

@mlec1 mlec1 commented Sep 21, 2024

Description

Update dns manipulation to egoscale v3

Checklist

(For exoscale contributors)

  • Changelog updated (under Unreleased block)
  • Testing

Testing

Manual test of the different dns manipulation.

@pierre-emmanuelJ pierre-emmanuelJ requested a review from a team September 26, 2024 08:55
cmd/dns_add.go Outdated
})
ctx := gContext
err = decorateAsyncOperations(fmt.Sprintf("Adding DNS record %q to %q...", rType, domain.UnicodeName), func() error {

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

cmd/dns_add.go Outdated Show resolved Hide resolved
cmd/dns_add.go Outdated
})

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

cmd/dns_create.go Outdated Show resolved Hide resolved
cmd/dns_list.go Outdated Show resolved Hide resolved
@pierre-emmanuelJ
Copy link
Member

This PR looks very good, :) I will do a second review once you applied some of them

Copy link
Member

@sauterp sauterp left a comment

Choose a reason for hiding this comment

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

thanks!

cmd/dns.go Outdated Show resolved Hide resolved
cmd/dns_add.go Outdated Show resolved Hide resolved
@@ -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")
Copy link
Member

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?

@@ -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)
Copy link
Member

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 :)

Copy link
Member

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.

Comment on lines +41 to +42
// Function to get the DNSDomainRecordRequestType from a string
func StringToDNSDomainRecordRequestType(recordType string) (v3.CreateDNSDomainRecordRequestType, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// 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
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// Lookup the record type in the map

IMHO code is enough explicit here

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

Successfully merging this pull request may close these issues.

3 participants