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

Fix default type check #500

Merged
merged 5 commits into from Jan 15, 2018

Conversation

Projects
None yet
2 participants
@sijis
Contributor

sijis commented Jan 8, 2018

While working on #499, I noticed some discrepancies in the validation of the configs in FedmsgConfig.

This attempts to address those discrepancies.

I used the generated output from fedmsg-config as the source of truth on what these values should be.

@@ -254,8 +254,10 @@ class FedmsgConfig(dict):
'validator': None,
},
'relay_inbound': {
'default': u'tcp://127.0.0.1:2001',
'validator': _validate_none_or_type(six.text_type),

This comment has been minimized.

@jeremycline

jeremycline Jan 10, 2018

Member

It doesn't make much sense to have a relay binding to multiple sockets. Did you run into this by trying to specify a list of values?

This comment has been minimized.

@sijis

sijis Jan 10, 2018

Contributor

I did not run this using multiple entries.

I think the issue is mainly documentation related.

In my case, I just updated the example config and things worked fine. I never needed to add multiple values to this.

It is very likely I am wrong and reading the wrong documentation parts.

This comment has been minimized.

@jeremycline

jeremycline Jan 11, 2018

Member

Ah, well the history here is I wrote documentation. There wasn't any documentation before and I took wild guesses. Recently I tried to add defaults to every setting and picked what I thought were reasonable defaults.

Although it looks like lists and strings are both handled correctly, it's not a setting that makes a bunch of sense as a list so I'm in favor of changing the documentation and config in fedmsg.d (really, that directory should go away, but I have no doubt that'd break something weird relying on it 😢 )

This comment has been minimized.

@sijis

sijis Jan 11, 2018

Contributor

I will definitely change/revert that list change in this PR.
I could also include documentation changes so that it references it as a string, not list. This would keep everything consistent, at least.

At quick check, tests fail removing the fedmsg.d directory. I bet packaging would have issues too. Although, both of those could be solved.

This comment has been minimized.

@sijis

sijis Jan 12, 2018

Contributor

I've removed this commit completely.

@sijis sijis force-pushed the sijis:fix/default_type_checks branch from 0cf56a5 to 130c965 Jan 12, 2018

@sijis

This comment has been minimized.

Contributor

sijis commented Jan 12, 2018

Updated references of relay_inbound to be strings.

@sijis sijis force-pushed the sijis:fix/default_type_checks branch from 130c965 to 377fe4f Jan 12, 2018

@codecov

This comment has been minimized.

codecov bot commented Jan 12, 2018

Codecov Report

Merging #500 into develop will decrease coverage by 0.11%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #500      +/-   ##
===========================================
- Coverage    60.28%   60.17%   -0.12%     
===========================================
  Files           29       29              
  Lines         1750     1750              
  Branches       272      272              
===========================================
- Hits          1055     1053       -2     
- Misses         618      620       +2     
  Partials        77       77
Impacted Files Coverage Δ
fedmsg/core.py 45.6% <0%> (-1.1%) ⬇️

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 da90440...32e6e05. Read the comment docs.

@jeremycline

Sorry, I should have made an note on the other changes on the first review. One small thing, but other than that it looks really good, thanks!

@@ -294,8 +294,8 @@ class FedmsgConfig(dict):
'validator': _validate_none_or_type(six.text_type),
},
'crl_cache_expiry': {
'default': None,
'validator': _validate_none_or_type(six.text_type),
'default': 10,

This comment has been minimized.

@jeremycline

jeremycline Jan 12, 2018

Member

The docs say this is in seconds (although the docs are a little unreliable) so 10 is a really small default for a CRL. Maybe an hour is more reasonable?

This comment has been minimized.

@sijis

sijis Jan 12, 2018

Contributor

Good point. Updating...

This comment has been minimized.

@jeremycline

jeremycline Jan 12, 2018

Member

I think you missed updating it in a few places? Additionally, an hour would be 60*60 (3600) since this is seconds, not minutes.

This comment has been minimized.

@sijis

sijis Jan 12, 2018

Contributor

You don't want to to expire in 1 minute? 😂
Let me try this again.

This comment has been minimized.

@sijis

sijis Jan 12, 2018

Contributor

Totally missed several spots.
Alright I think it finally got this.
Also, sorry for the constant rebasing. Just trying to keep clean commits.

@sijis sijis force-pushed the sijis:fix/default_type_checks branch from fa1cd0a to 32e6e05 Jan 12, 2018

@jeremycline

This comment has been minimized.

Member

jeremycline commented Jan 15, 2018

Great, thanks for this!

@jeremycline jeremycline merged commit e753085 into fedora-infra:develop Jan 15, 2018

2 of 3 checks passed

codecov/project 60.17% (-0.12%) compared to da90440
Details
codecov/patch Coverage not affected when comparing da90440...32e6e05
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@sijis sijis deleted the sijis:fix/default_type_checks branch Jan 16, 2018

cha-ku added a commit to cha-ku/fedmsg that referenced this pull request May 17, 2018

Fix default type check (fedora-infra#500)
* fix: Use int validator for ca and crl cache expiry

* fix: Give expiry keys sane defaults

* test: Update expiry defaults

* fix: Update relay_inbound references to use str

* fix: Set crl_cache_expiry to a better default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment