crowdsec icon indicating copy to clipboard operation
crowdsec copied to clipboard

cscli config test

Open LaurenceJJones opened this issue 2 years ago • 4 comments

#1624 Implementation

Looking forward to hearing some feedback on this.

LaurenceJJones avatar Jul 03 '22 20:07 LaurenceJJones

Codecov Report

Merging #1635 (8a73ae2) into master (e868ade) will decrease coverage by 0.09%. The diff coverage is 36.36%.

@@            Coverage Diff             @@
##           master    #1635      +/-   ##
==========================================
- Coverage   52.13%   52.04%   -0.10%     
==========================================
  Files         136      136              
  Lines       18866    18899      +33     
==========================================
  Hits         9836     9836              
- Misses       7959     7988      +29     
- Partials     1071     1075       +4     
Flag Coverage Δ
func-crowdsec 16.23% <25.00%> (+0.03%) :arrow_up:
func-cscli 44.58% <37.93%> (-0.10%) :arrow_down:
unit-linux 64.22% <ø> (-0.09%) :arrow_down:
unit-windows 53.57% <ø> (+0.09%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
cmd/crowdsec/main.go 30.96% <25.00%> (-0.13%) :arrow_down:
cmd/crowdsec-cli/config.go 44.20% <37.93%> (-0.48%) :arrow_down:
pkg/leakybucket/manager_run.go 67.02% <0.00%> (-1.42%) :arrow_down:
cmd/crowdsec-cli/machines.go 55.09% <0.00%> (-1.14%) :arrow_down:
pkg/acquisition/modules/cloudwatch/cloudwatch.go 77.53% <0.00%> (-1.00%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e868ade...8a73ae2. Read the comment docs.

codecov-commenter avatar Jul 03 '22 20:07 codecov-commenter

Hi @LaurenceJJones,

Sorry for the delay.

I guess you want to way for cscli to check crowdsec configuration which is a good idea. OTOH this relies on the PATH and the "crowdsec" name to work, which is I guess, not possible to assume in every case.

For this feature I would have used the same code as in crowdsec using the StartRunSvc function with the LintOnlyflag of Crowdsec configuration struct set to true. But it would raised another issue: that we duplicate code between crowdsec and cscli. So I would say this needs more thinking.

@buixor @sblot any more thoughts ?

Thanks for the contribution !

sabban avatar Aug 26 '22 12:08 sabban

Maybe we should document crowdsec -t as well

sabban avatar Aug 26 '22 12:08 sabban

As discussed, it might make more sense to simply improve crowdsec -t rather than adding some glue around it. Keeping it opened till we all agree to close it, but removing milestone.

buixor avatar Sep 14 '22 12:09 buixor

Conclusion update docs around crowdsec -t, install into users before systemctl restart crowdsec best practice to run this command and check logs.

LaurenceJJones avatar Oct 05 '22 12:10 LaurenceJJones