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

[x509] Add Swapper #86 #87

Merged
merged 1 commit into from
May 31, 2020
Merged

[x509] Add Swapper #86 #87

merged 1 commit into from
May 31, 2020

Conversation

atb00ker
Copy link
Member

@atb00ker atb00ker commented Apr 4, 2020

Commands used to convert mkv to gif in the README

ffmpeg -i  vid.mkv -vf fps=7,scale=1366:-1:flags=lanczos,palettegen palette.png
ffmpeg -i vid.mkv -i palette.png -filter_complex "fps=7,scale=1366:-1:flags=lanczos[x];[x][1:v]paletteuse" sixthtry.gif

Closes #86

@coveralls
Copy link

coveralls commented Apr 4, 2020

Coverage Status

Coverage increased (+0.01%) to 99.281% when pulling 26e8487 on atb00ker:swapper into a5cd3df on openwisp:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 99.187% when pulling d3a817c on atb00ker:swapper into 056b7b9 on openwisp:master.

Copy link
Member

@nemesifier nemesifier left a comment

Choose a reason for hiding this comment

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

Great progress.

Can you add some docs regarding the swapper feature?

Regarding the rest, I'd use this structure for the tests:

tests/
tests/openwisp2/  (project name)
tests/openwisp2/settings.py  (project settings)
tests/openwisp2/sample_x509/ ... (files of the sample app here)

The sample_x509 directory should contain the logic which is executed only when SAMPLE_APP=1.
The rest goes /tests/openwisp2.

@atb00ker
Copy link
Member Author

atb00ker commented Apr 5, 2020

Can you add some docs regarding the swapper feature?

Docs for extending django-x509 already exist.
I'll add the docs for the swapper settings, i.e DJANGO_X509_CA_MODEL & DJANGO_X509_CERT_MODEL ! 😄

Other than this, admin, models & settings.py seem already documented for extending. If there is a specific change I am missing please let me know! 😄

@atb00ker atb00ker force-pushed the swapper branch 4 times, most recently from 437a82a to 2694522 Compare April 5, 2020 09:22
Copy link
Member

@nemesifier nemesifier left a comment

Choose a reason for hiding this comment

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

Looks good, I will dedicate some time to test it asap.

django_x509/base/models.py Outdated Show resolved Hide resolved
@atb00ker atb00ker force-pushed the swapper branch 4 times, most recently from f6d0c5d to 4d5c8af Compare April 9, 2020 08:39
@atb00ker
Copy link
Member Author

atb00ker commented Apr 9, 2020

Rebased with master! 😄

Copy link
Member

@nemesifier nemesifier left a comment

Choose a reason for hiding this comment

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

Great work. It's almost ready to merge, I left some comments below regarding minor improvements.

As part of the improvement we're making, can you add some screenshots (and/or animated gifs if you fancy this) in the initial part of the README like we have on some other modules? As part of the merge process I would like to standardize this and ensure we have nice images that help us to promote the modules.

For example:

  • importing a CA cert
  • creating a CA or cert
  • showing page where details of the certificates are presented
  • renewing a CA

I think we have to add the black reformatting in a separate PR as we did in other repos, but we can do after merging this PR, I created the issue: #90

PS: could you rebase on the latest master as well please?

.travis.yml Outdated Show resolved Hide resolved
README.rst Show resolved Hide resolved
@nemesifier nemesifier changed the title [improvement] Add Swapper #86 [x509] Add Swapper #86 May 13, 2020
@atb00ker atb00ker force-pushed the swapper branch 9 times, most recently from 503be3c to 5913c95 Compare May 13, 2020 11:50
django_x509/admin.py Outdated Show resolved Hide resolved
ca.save()
return ca

def _create_cert(self, cert_model=None, **kwargs):
Copy link
Member Author

Choose a reason for hiding this comment

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

Comment: #87 (comment)

tests/openwisp2/sample_x509/models.py Show resolved Hide resolved
django_x509/admin.py Outdated Show resolved Hide resolved
@atb00ker atb00ker force-pushed the swapper branch 8 times, most recently from c3ba0d9 to 38a5f19 Compare May 22, 2020 19:04
@atb00ker atb00ker force-pushed the swapper branch 3 times, most recently from e71cd61 to 6c8515d Compare May 23, 2020 12:44
Copy link
Member

@nemesifier nemesifier left a comment

Choose a reason for hiding this comment

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

I did one last test in openwisp-controller, I tried pulling these changes and use it with the current openwisp-controller, but an error comes up:

ImportError: cannot import name 'TestX509Mixin' from 'django_x509.tests' (/home/nemesis/Code/openwisp/django-x509/django_x509/tests/__init__.py)

There may be others.

Can you patch these changes to make them backward compatible please?

You can test using the current openwisp-controller version.

See my comments below as well please.

README.rst Outdated Show resolved Hide resolved
README.rst Outdated Show resolved Hide resolved
@atb00ker atb00ker force-pushed the swapper branch 2 times, most recently from be58a08 to 9b80242 Compare May 28, 2020 14:46
@atb00ker
Copy link
Member Author

atb00ker commented May 28, 2020

@nemesisdesign Now, you only need to add:

DJANGO_X509_CA_MODEL = 'pki.Ca'
DJANGO_X509_CERT_MODEL = 'pki.Cert'

To test it in the current openwisp-controller version.

requirements.txt Outdated
@@ -3,3 +3,4 @@ django-model-utils>=4.0
jsonfield>=3.1.0,<4.0.0
cryptography>=2.4.0,<2.10.0
pyopenssl>=17.5.0,<20.0.0
swapper~=1.1.0
Copy link
Member

Choose a reason for hiding this comment

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

I think this should be swapper~=1.1
Pay attention: openwisp/openwisp-ipam@af5ad60
Let's make sure all dependencies are pinned

Copy link
Member Author

Choose a reason for hiding this comment

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

swapper~=1.1.0 == swapper>=1.1,swapper<1.2
While,
swapper~=1.1 == swapper>=1.1,swapper<2

Wouldn't having upper limit as swapper<2 be very lenient given swapper updates are infrequent and not documented?

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for clarifying, I think we can relax the requirement because this module is pretty stable.

Copy link
Member

@nemesifier nemesifier left a comment

Choose a reason for hiding this comment

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

Great work @atb00ker 👍 🎉

@nemesifier nemesifier merged commit 7c3032f into openwisp:master May 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[models] Implement swappable models
4 participants