-
Notifications
You must be signed in to change notification settings - Fork 53
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
HTTPConfig
: Add http_content to be served
#43
Conversation
…before returning In unit tests we would get before the server was up, causing failures
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.
Is this done? I made you some questions.
I haven't tested but the code looks good so far.
// `boot_command`. This is covered in more detail below. Example: Setting | ||
// `"foo/bar"="baz", will allow you to http get on | ||
// `http://{http_ip}:{http_port}/foo/bar`. | ||
HTTPContent map[string]string `mapstructure:"http_content"` |
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 not a backward incompatibility but it is something that will require all builder components using http_config to update their hcl2spec files in order to be compatible with this feature.
If I'm right, I have two questions:
- Are you planning to write a blog post for this?
- Should this be officially released on 1.8.0?
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.
Good questions!
Should this be officially released on 1.8.0?
The earlier we merge this one, the less manual updates we will have to do in plugins in order to support this. So my guess would be to merge this one now-ish.
Are you planning to write a blog post for this?
🤔 I wasn't planning on doing that ! But you are right !
This definitely could use a new guide or help section too.
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.
Nice! We just need to remember to run generate on Packer when this one is merged. So that 1.7.1 will be compatible with these changes.
…eing up before returning" This reverts commit 3d20a49.
…venshtein.Distance
cosmetic changes
the levenshtein import is now direct
if sug := didyoumean.NameSuggestion(path, paths); sug != "" { | ||
err += fmt.Sprintf("Did you mean %q?", sug) | ||
} |
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 makes lives easier <3 !
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.
( even saved me a few times in tests mode already )
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 super cool :D
This is ready for review 🙂 |
to avoid stutter
I pulled this to try and test and I can't get it working; on at least on the QEMU builder it is trying to read from a port 0 which seems wrong. Can you give a more complete example? |
if sug := didyoumean.NameSuggestion(path, paths); sug != "" { | ||
err += fmt.Sprintf("Did you mean %q?", sug) | ||
} |
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 super cool :D
@@ -70,6 +126,8 @@ func (s *StepHTTPServer) Run(ctx context.Context, state multistep.StateBag) mult | |||
func (s *StepHTTPServer) Cleanup(multistep.StateBag) { | |||
if s.l != nil { | |||
// Close the listener so that the HTTP server stops | |||
s.l.Close() | |||
if err := s.l.Close(); err != nil { | |||
log.Printf("Failed closing http server on port %d: %v", s.l.Port, 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.
should this error print to the UI?
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.
Good question, this error should be temporary and won't prevent Packer from working. We check if ports are already open for new calls to Listen
. Finally, when Packer terminates: the connection will be auto closed on most systems. Though on some system it could take some time and cause a FS leak if it happened A LOT of times. Yup this should be at least be shown in the UI.
be clearer about the file function tip
remove unused //go:generate mapstructure-to-hcl2 -type TestHttpConfig
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.
LGTM!
Tested with virtualbox-iso building and alpine image and it worked good! 👍🏼
@@ -0,0 +1,24 @@ | |||
package didyoumean |
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 like the package name!
This imports hashicorp/packer-plugin-sdk#43 * code generate things * update docs * update guides * update examples We want to add a new guide.
This imports hashicorp/packer-plugin-sdk#43 * code generate things * update docs * update guides * update examples We want to add a new guide.
This imports hashicorp/packer-plugin-sdk#43 * code generate things * update docs * update guides * update examples We want to add a new guide.
This imports hashicorp/packer-plugin-sdk#43 * code generate things * update docs * update guides * update examples We want to add a new guide.
This imports hashicorp/packer-plugin-sdk#43 * code generate things * update docs * update guides * update examples We want to add a new guide.
This imports hashicorp/packer-plugin-sdk#43 * code generate things * update docs * update guides * update examples We want to add a new guide.
This imports hashicorp/packer-plugin-sdk#43 * code generate things * update docs * update guides * update examples We want to add a new guide.
This imports hashicorp/packer-plugin-sdk#43 * code generate things * update docs * update guides * update examples We want to add a new guide.
This imports hashicorp/packer-plugin-sdk#43 * code generate things * update docs * update guides * update examples We want to add a new guide.
This will allow to