-
Notifications
You must be signed in to change notification settings - Fork 142
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
OC Migrate Blocks to using AttributeHandlers #269
Conversation
…d). No Read function for ElasticSearch and FTP to align with master
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 is looking great! Really happy with how it's turned out. My review comments are very minor relating to comment/documentation style. @mccurdyc has picked up most of the code issues so I'll leave those to his review.
- Very pedantic but is Wasm not WASM. Per: https://webassembly.org/
- Slightly pedantic, per the golang code review guidelines we prefer comments to be full sentences including ending with a period. I know a lot of this code base doesn't follow this, but I try to pick it up where-ever possible on function comments, inline ones can be left as-is.
- Some places I've asked for comments to be added to help document the pattern more.
- Lastly, It would be great if you can add a detailed description to this PR for future maintainers, if they stubble upon the large changeset and want to understand the reasoning why we went with this pattern.
fastly/base_fastly_service_v1.go
Outdated
// New versions are not immediately found in the API, or are not | ||
// immediately mutable, so we need to sleep a few and let Fastly ready | ||
// itself. Typically, 7 seconds is enough | ||
log.Print("[DEBUG] Sleeping 7 seconds to allow Fastly Version to be available") | ||
time.Sleep(7 * time.Second) |
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.
@thommahoney not blocking for this PR, but I'd like to understand why this is the case.
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.
Just those two places identified in #267 that need to use GetKey
. Otherwise, LGTM!
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.
Did another pass. LGTM.
@@ -208,3 +94,7 @@ func TestEscapePercentSign(t *testing.T) { | |||
}) | |||
} | |||
} | |||
|
|||
func appendNewLine(s string) string { |
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.
Not blocking. I think this may be dead now.
// MustProcess returns whether we must process the resource (usually HasChange==true but allowing exceptions). | ||
// For example: at present, the settings attributeHandler (block_fastly_service_v1_settings.go) must process when | ||
// default_ttl==0 and it is the initialVersion - as well as when default_ttl or default_host have changed. | ||
MustProcess(d *schema.ResourceData, initialVersion bool) bool |
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.
Just noting that we talked offline about how it is okay that we just use initialVersion
here for now rather than solving the more general use of this method.
This is a large change which refactors how attributes are processed for service resources. The change is motivated primarily to enable composition of different attribute sets for services of type Wasm and VCL; secondarily to tidy up the codebase and refactor large files.
AttributesHandlers provide contributions to the resource schema (Register), resource processing (Process) and resource state refresh (Read). These functions are delegated to AttributeHandlers by a new Base codebase shared between Wasm and VCL service resources.