Skip to content

cli/command/system: prettyPrintServerInfo: don't depend on IndexServerAddress and credential-store - #4205

Merged
thaJeztah merged 3 commits into
docker:masterfrom
thaJeztah:info_dont_depend_on_IndexServerAddress
Apr 26, 2023
Merged

cli/command/system: prettyPrintServerInfo: don't depend on IndexServerAddress and credential-store#4205
thaJeztah merged 3 commits into
docker:masterfrom
thaJeztah:info_dont_depend_on_IndexServerAddress

Conversation

@thaJeztah

@thaJeztahthaJeztah commented Apr 13, 2023

Copy link
Copy Markdown
Member

cli/command/system: prettyPrintServerInfo: simplify username

Starting with b4ca1c7 (#2819), docker login no longer depends on info.IndexServerAddress to determine the default registry.

The prettyPrintServerInfo() still depended on this information, which could potentially show the wrong information.

This patch changes it to also depend on the same information as docker login now does.

cli/command/system: prettyPrintServerInfo: move out collecting username

Make this function only print the info we have, and not read the username
from the credential-store.

This patch adds a Username field to the (local) info type, and sets it
when needed, so that prettyPrintServerInfo only has to format and print
the information, instead of calling out to the credential-store.

cli/command/system: printServerWarnings: use client API version from info

Set the client's API version that's used in the info, instead of requesting
it as part of printing.

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

Starting with b4ca1c7, docker login
no longer depends on info.IndexServerAddress to determine the default
registry.
The prettyPrintServerInfo() still depended on this information, which
could potentially show the wrong information.
This patch changes it to also depend on the same information as docker login
now does.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Make this function only _print_ the info we have, and not read the username
from the credential-store.
This patch adds a Username field to the (local) `info` type, and sets it
when needed, so that prettyPrintServerInfo only has to format and print
the information, instead of calling out to the credential-store.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
…info
Set the client's API version that's used in the info, instead of requesting
it as part of printing.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@codecov-commenter

codecov-commenter commented Apr 13, 2023

Copy link
Copy Markdown

Codecov Report

Merging #4205 (da3871f) into master (60d0659) will decrease coverage by 0.01%.
The diff coverage is 80.00%.

Additional details and impacted files
@@ Coverage Diff @@## master #4205 +/- ##
==========================================
- Coverage 58.86% 58.85% -0.01% 
==========================================
Files 572 572 Lines 49544 49538 -6 ==========================================
- Hits 29162 29158 -4 
Misses 18616 18616 + Partials 1766 1764 -2 

}
}

fprintlnNonEmpty(dockerCli.Out(), " Username:", info.UserName)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

FWIW, I'm also very much leaning towards moving this information to the Client: section, because nothing about it is part of the "Server:".

I think this was historically because it depended on the server (?) but no real idea.

Also;

  • because it's not part of the actual info.Info struct (i.e., the Server part), it's currently not even possible to use docker info --format <template> to show the name
  • ^^ so docker info --format=json won't show it
  • ^^ AND if a credentials-helper is used, it's not even filled in at all (it only looks in the config file
  • 🙃 🤷

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

So ... perhaps we should either remove it altogether, or make it use the actual credential-store in use, BUT reading info from that is not always .. fast, and I don't want docker info to become slow 😓

@thaJeztah
thaJeztah merged commit 04bf047 into docker:masterApr 26, 2023
@thaJeztah
thaJeztah deleted the info_dont_depend_on_IndexServerAddress branch April 26, 2023 11:07
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/distributionkind/refactorPR's that refactor, or clean-up codestatus/2-code-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@thaJeztah@codecov-commenter@vvoland@sam-thibault