Skip to content
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

[bugfix] LogOpts doesn't take effect in pouchd config file #2938

Merged
merged 1 commit into from
Jul 2, 2019

Conversation

zjumoon01
Copy link
Contributor

Configure LogOpts in /etc/pouch/config.json such as:
"default-log-config": {
"Type": "json-file",
"Config": {
"max-file": "5",
"max-size": "300m"
}
}
"max-file" and "max-size" are log options for pouchd.
We create a container which will set its log options from pouchd.
However, it doesn't take effect.

This patch will fix it. Config file and cmd flags will be merged.
So we should set LogOpts from cmd flags "--log-opt" before merging.

Signed-off-by: baijia.wr baijia.wr@antfin.com

Ⅰ. Describe what this PR did

We set log options in config file of pouchd(/etc/pouch/config.json) such as
"default-log-config": {
"Type": "json-file",
"Config": {
"max-file": "5",
"max-size": "300m"
}
}
It doesn't take effect because cfg.DefaultLogConfig.LogOpts is reset to logOpts which comes from --log-opt in cmd flag.
This patch will fix it.

Ⅱ. Does this pull request fix one issue?

NONE

Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

Configure LogOpts in /etc/pouch/config.json such as:
"default-log-config": {
    "Type": "json-file",
    "Config": {
        "max-file": "5",
        "max-size": "300m"
    }
}
"max-file" and "max-size" are log options for pouchd.
We create a container which will set its log options from pouchd.
However, it doesn't take effect.

This patch will fix it. Config file and cmd flags will be merged.
So we should set LogOpts from cmd flags "--log-opt" before merging.

Signed-off-by: baijia.wr <baijia.wr@antfin.com>
@codecov
Copy link

codecov bot commented Jul 2, 2019

Codecov Report

Merging #2938 into master will increase coverage by 1.34%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2938      +/-   ##
==========================================
+ Coverage   66.77%   68.11%   +1.34%     
==========================================
  Files         289      291       +2     
  Lines       18312    18343      +31     
==========================================
+ Hits        12227    12495     +268     
+ Misses       4647     4387     -260     
- Partials     1438     1461      +23
Flag Coverage Δ
#criv1alpha2_test 34.78% <ø> (?)
#integration_test_0 36.13% <ø> (ø) ⬆️
#integration_test_1 35.49% <ø> (-0.09%) ⬇️
#integration_test_2 36.15% <ø> (+0.04%) ⬆️
#integration_test_3 35.56% <ø> (ø) ⬆️
#node_e2e_test 34.27% <ø> (+0.15%) ⬆️
#unittest 27.96% <ø> (ø) ⬆️
Impacted Files Coverage Δ
pkg/streams/utils.go 82.14% <0%> (-9.53%) ⬇️
ctrd/supervisord/daemon.go 49.32% <0%> (-1.36%) ⬇️
ctrd/image.go 67.03% <0%> (-0.74%) ⬇️
daemon/mgr/container_utils.go 76.26% <0%> (-0.51%) ⬇️
daemon/mgr/spec_apparmor_linux.go 20% <0%> (ø)
daemon/mgr/spec_seccomp_linux.go 71.42% <0%> (ø)
daemon/mgr/container.go 60.35% <0%> (+0.41%) ⬆️
daemon/mgr/container_types.go 71.32% <0%> (+1.47%) ⬆️
ctrd/container.go 53.15% <0%> (+1.52%) ⬆️
cri/ocicni/cni_manager.go 62.26% <0%> (+1.88%) ⬆️
... and 13 more

@pouchrobot pouchrobot added areas/log kind/bug This is bug report for project size/XS labels Jul 2, 2019
Copy link
Contributor

@fuweid fuweid left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
areas/log kind/bug This is bug report for project size/XS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants