Skip to content

[18.09] Refine how metadata dir is handled - #1388

Merged
andrewhsu merged 1 commit into
docker:18.09from
dhiltgen:revamp_18.09
Sep 28, 2018
Merged

[18.09] Refine how metadata dir is handled#1388
andrewhsu merged 1 commit into
docker:18.09from
dhiltgen:revamp_18.09

Conversation

@dhiltgen

@dhiltgendhiltgen commented Sep 22, 2018

Copy link
Copy Markdown
Contributor

This is a follow up PR to #1381 to address some of the review comments
we didn't get to.

Signed-off-by: Daniel Hiltgen daniel.hiltgen@docker.com

@codecov-io

codecov-io commented Sep 28, 2018

Copy link
Copy Markdown

Codecov Report

Merging #1388 into 18.09 will decrease coverage by 0.05%.
The diff coverage is 46.96%.

@@ Coverage Diff @@## 18.09 #1388 +/- ##
==========================================
- Coverage 54.15% 54.09% -0.06% 
==========================================
Files 290 290 Lines 19298 19313 +15 ==========================================
- Hits 10451 10448 -3 - Misses 8181 8201 +20 + Partials 666 664 -2

@dhiltgendhiltgen changed the title [WIP] Refine how docker root dir is handledRefine how metadata dir is handledSep 28, 2018
@dhiltgen

Copy link
Copy Markdown
ContributorAuthor

Note: this depends on the packaging change PR(s)

@thaJeztahthaJeztah changed the title Refine how metadata dir is handled[18.09] Refine how metadata dir is handledSep 28, 2018
@thaJeztahthaJeztah added this to the 18.09.0 milestone Sep 28, 2018

@thaJeztahthaJeztah left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Did a quick read over the code, left some comments

authConfig *types.AuthConfig, healthfn func(context.Context) error) error {
authConfig *types.AuthConfig, healthfn func(context.Context) error, runtimeMetadataDir string) error {

// If the user didn't specify an image, detemrine the correct enterprise image to use

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: typo; s/detemrine/determine/

return err
}
if strings.Contains(strings.ToLower(serverVersion.Platform.Name), "enterprise") {
return nil

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should either treat this as an error-situation, or inform the user that no changes were made. In the "happy path", a message will be printed "Successfully activated engine". If we're already on EE, I'd expect some form of feedback as well.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

sound good to make this change

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@dhiltgen follow-up PR ^^^

// ActivateEngine will switch the image from the CE to EE image
func (c *baseClient) ActivateEngine(ctx context.Context, opts clitypes.EngineInitOptions, out clitypes.OutStream,
authConfig *types.AuthConfig, healthfn func(context.Context) error) error {
authConfig *types.AuthConfig, healthfn func(context.Context) error, runtimeMetadataDir string) error {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Instead of adding another argument, can we add runtimeMetadataDir as a field on clitypes.EngineInitOptions ?

Comment threadcli/command/engine/client_test.go Outdated
out clitypes.OutStream,
authConfig *types.AuthConfig,
healthfn func(context.Context) error) error {
healthfn func(context.Context) error, runtimeMetadataDir string) error {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same here; Instead of adding another argument, can we add runtimeMetadataDir as a field on clitypes.EngineInitOptions ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Wait: what's that healthfn argument actually for? Looks like it's only used for testing? That really shouldn't be in there; I'm sure that can be set on the mock during testing?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Hmm.. hold over from prior implementations... we really need to get this in ASAP so let me excise that part in a follow up if you don't mind.

Comment threadcli/command/engine/activate.go Outdated
_, err := client.Ping(ctx)
return err
}); err != nil {
}, clitypes.RuntimeMetadataDir); err != nil {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Related to my other comments about adding this option to the clitypes.EngineInitOptions; it looks like currently we only pass the default value.

We could get that default in client.ActivateEngine() / client.DoUpdate(), i.e., something like

func (c*baseClient) DoUpdate(ctx context.Context, opts clitypes.EngineInitOptions, out clitypes.OutStream,
authConfig*types.AuthConfig, healthfnfunc(context.Context) error) error {
ifopts.MetaDataDir=="" {
opts.MetaDataDir=clitypes.RuntimeMetadataDir
}
...
}

Doing so, makes the default (empty string) a useful value

@thaJeztah

Copy link
Copy Markdown
Member

ping @silvin-lubecki@vdemeester PTAL

@dhiltgen

Copy link
Copy Markdown
ContributorAuthor

@thaJeztah if you're still online, could you take a quick peek? We'd like to get this in today if we can so we can cut a beta1.8 build to wrap up a number of remaining P0's.

@thaJeztahthaJeztah left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

changes SGTM, but could use some more eyes on this one

please squash the commits

@crosbymichael

Copy link
Copy Markdown
Contributor

LGTM

This is a follow up PR to docker#1381 to address some of the review comments
we didn't get to.
Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>

@andrewhsuandrewhsu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@dhiltgen@codecov-io@thaJeztah@crosbymichael@andrewhsu@GordonTheTurtle