Skip to content

cli/command/container: don't mutate ConfigFile.DetachKeys#4337

Merged
thaJeztah merged 4 commits intodocker:masterfrom
thaJeztah:dont_mutate_configfile
Jun 12, 2023
Merged

cli/command/container: don't mutate ConfigFile.DetachKeys#4337
thaJeztah merged 4 commits intodocker:masterfrom
thaJeztah:dont_mutate_configfile

Conversation

@thaJeztah
Copy link
Copy Markdown
Member

cli/command/container: attach: rename var that collided with import

cli/command/container: TestCreateContainerImagePullPolicy: use sub-tests

cli/command/container: createContainer(): return container-ID

This function returned the whole response, but we already handled the
warnings included in the response as part of the function. All consumers
of this function only used the container-ID, so let's simplify and return
just that (it's a non-exported func, so we can change the signature again
if we really need it).

cli/command/container: don't mutate ConfigFile.DetachKeys

This code was introduced in moby/moby@15aa2a6 (moby/moby#15666),
but from those changes, it appears that overwriting the config value was
merely out of convenience, and that struct being used as an intermediate.

While changing the config here should be mostly ephemeral, and not written
back to the config-file, let's be clear on intent, and not mutatte the config
as part of this code.

thaJeztah added 4 commits June 8, 2023 16:54
This function returned the whole response, but we already handled the
warnings included in the response as part of the function. All consumers
of this function only used the container-ID, so let's simplify and return
just that (it's a non-exported func, so we can change the signature again
if we really need it).

Signed-off-by: Sebastiaan van Stijn <[email protected]>
This code was introduced in moby/moby@15aa2a6,
but from those changes, it appears that overwriting the config value was
merely out of convenience, and that struct being used as an intermediate.

While changing the config here should be mostly ephemeral, and not written
back to the config-file, let's be clear on intent, and not mutatte the config
as part of this code.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah thaJeztah added status/2-code-review kind/refactor PR's that refactor, or clean-up code labels Jun 8, 2023
@thaJeztah
Copy link
Copy Markdown
Member Author

@laurazard ptal 🤗

Copy link
Copy Markdown
Member

@laurazard laurazard left a comment

Choose a reason for hiding this comment

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

LGTM

@thaJeztah thaJeztah merged commit 7d723e2 into docker:master Jun 12, 2023
@thaJeztah thaJeztah deleted the dont_mutate_configfile branch June 12, 2023 19:37
@thaJeztah thaJeztah added this to the 25.0.0 milestone Jun 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/refactor PR's that refactor, or clean-up code status/2-code-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants