some refactoring and tidying
- some inlining - compile regexps once - consistent error messages - always mention container id in startContainerInterceptor errors
This commit is contained in:
1 parent
ca4b8e6f8e
commit
126d4f4079
4 files changed
+51
-84
No files matched your search
@@ -34,7 +34,7 @@ func (i *createContainerInterceptor) InterceptRequest(r *http.Request) (*http.Re
|
||||
}
|
||||
|
||||
if _, ok := weaveCIDRsFromConfig(container.Config); ok {
|
||||
i.addToVolumesFrom(container.HostConfig, "weaveproxy")
|
||||
container.HostConfig.VolumesFrom = append(container.HostConfig.VolumesFrom, "weaveproxy")
|
||||
if err := i.setWeaveWaitEntrypoint(container.Config); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -53,10 +53,6 @@ func (i *createContainerInterceptor) InterceptRequest(r *http.Request) (*http.Re
|
||||
return r, nil
|
||||
}
|
||||
|
||||
func (i *createContainerInterceptor) addToVolumesFrom(config *docker.HostConfig, mounts ...string) {
|
||||
config.VolumesFrom = append(config.VolumesFrom, mounts...)
|
||||
}
|
||||
|
||||
func (i *createContainerInterceptor) setWeaveWaitEntrypoint(container *docker.Config) error {
|
||||
var image *docker.Config
|
||||
if !configHasEntrypoint(container) || !configHasCmd(container) {
|
||||
@@ -104,6 +100,6 @@ func (i *createContainerInterceptor) setWeaveDNS(container *createContainerReque
|
||||
return nil
|
||||
}
|
||||
|
||||
func (i *createContainerInterceptor) InterceptResponse(res *http.Response) (*http.Response, error) {
|
||||
return res, nil
|
||||
func (i *createContainerInterceptor) InterceptResponse(r *http.Response) (*http.Response, error) {
|
||||
return r, nil
|
||||
}
|
||||
Reference in new issue
Block a user