-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Retry for deleting default DHCP options, plus pagination plus a test sweeper #8907
Conversation
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.
Nicely done!I left a few nits to help consolidate things a bit in the test sweeper, but otherwise good to go.
var domainName string | ||
var defaultDomainNameFound, defaultDomainNameServersFound bool | ||
|
||
if region == "us-east-1" { |
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 lets start with domainName = region + ".compute.internal"
then use the if to change the value is the condition region == "us-east-1"
is true.
## remove 'var domainName string' on line #33
domainName := region + ".compute.internal"
if region == "us-east-1" {
domainName = "ec2.internal"
}
domainName = region + ".compute.internal" | ||
} | ||
|
||
for _, dhcpConfiguration := range dhcpOption.DhcpConfigurations { |
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.
Would be helpful to add a comment that here indicating that we are skipping the default DHCP options here.
|
||
for _, dhcpConfiguration := range dhcpOption.DhcpConfigurations { | ||
if aws.StringValue(dhcpConfiguration.Key) == "domain-name" { | ||
if len(dhcpConfiguration.Values) == 0 || len(dhcpConfiguration.Values) > 1 { |
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 to help grok the conditional
if len(dhcpConfiguration.Values) == 0 || len(dhcpConfiguration.Values) > 1 { | |
if len(dhcpConfiguration.Values) != 1 || dhcpConfiguration.Values[0] == nil { |
continue | ||
} | ||
|
||
if dhcpConfiguration.Values[0] != nil && aws.StringValue(dhcpConfiguration.Values[0].Value) == domainName { |
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 applying the above you can change this to the following
if dhcpConfiguration.Values[0] != nil && aws.StringValue(dhcpConfiguration.Values[0].Value) == domainName { | |
if aws.StringValue(dhcpConfiguration.Values[0].Value) == domainName { |
defaultDomainNameFound = true | ||
} | ||
} else if aws.StringValue(dhcpConfiguration.Key) == "domain-name-servers" { | ||
if len(dhcpConfiguration.Values) == 0 || len(dhcpConfiguration.Values) > 1 { |
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.
Same changes from above can be applied here.
continue | ||
} | ||
|
||
if dhcpConfiguration.Values[0] != nil && aws.StringValue(dhcpConfiguration.Values[0].Value) == "AmazonProvidedDNS" { |
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.
ditto ☝️
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Community Note
References #7873
Release note for CHANGELOG:
Output from acceptance testing: