-
Notifications
You must be signed in to change notification settings - Fork 171
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
[x509] Fix certificates without organization assigned #34 #61
Conversation
c812d02
to
64c69cf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test is missing.
This is not the right place where to put this code, you can delete it entirely.
Write a test failing first that replicates the issue I described in #34.
You have to dig deeper and find where the auto-cert feature is written in django-netjsonconfig, override that method here and solve the issue.
Keep in mind the commit message must explicitly say Closes #34
at the end of the commit message to use the auto-close feature of github, so please adhere strictly to our commit guidelines.
0a10d7c
to
67c39d9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this for the commit head?
[x509] Auto-generated cert for object without org
Inside the square brackets, we usually want to classify the pull request ! 😄
8116b4f
to
18e7250
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shashwat1002 great progress! 👍
I tested to ensure the test fails without your fix and it does, so that's good!
I need to ask you some final adjustments before I'm able to merge:
- the commit message is too complicated and long, please change it to the following:
[vpn-client] Fixed auto-certificates without organization #34
This bug happened only with shared VPNs and shared VPN-client templates.
Fixes #34
- see my other inline comment below
from ..models import Ca, Cert | ||
|
||
|
||
class TestModels(TestCase, TestPkiMixin, TestOrganizationMixin): | ||
class TestModels(TestCase, TestVpnX509Mixin, TestOrganizationMixin, CreateConfigTemplateMixin): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to learn the concept of modules and how they interact otherwise you will never understand openwisp.
The PKI app of openwisp-controller (which handles certification authorities and certificates) is not aware of the internal logic of the Config app (which handles device configurations), so adding this test in the PKI app is a violation of this concept.
I think the best place to put this test is here: https://github.com/openwisp/openwisp-controller/blob/master/openwisp_controller/config/tests/test_template.py
(the Config app instead is aware of the PKI app because it needs it as a dependency so that's fine)
36b4107
to
77c99df
Compare
This bug happened only with shared VPNs and shared VPN-client templates. Fixes openwisp#34
77c99df
to
9ac2ea2
Compare
@@ -39,7 +39,7 @@ install: | |||
- pipenv install $DJANGO | |||
# fix issues with travis | |||
- pipenv install --skip-lock "attrs>=17.4.0" | |||
- pipenv install --skip-lock "six>=1.11.0" | |||
- pipenv install --skip-lock "six" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is travis failing with "six>=1.11.0"
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be, these kind of builds are weird sometimes, I'll accept it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good job! 👍
@nemesisdesign, @atb00ker thanks! |
This code effectively, overrides the save() function of Cert to check for a corresponding device every time a Certificate is created and then checks for the organization of that device and updates the cert object accordingly and saves it.