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

[bug] CA/Cert creation generates 2 SQL write queries instead of 1 #120

Open
nemesifier opened this issue Jul 18, 2021 · 0 comments
Open

Comments

@nemesifier
Copy link
Member

This code:

def save(self, *args, **kwargs):
generate = False
if not self.pk and not self.certificate and not self.private_key:
generate = True
super().save(*args, **kwargs)
if generate:
# automatically determine serial number
if not self.serial_number:
self.serial_number = self._generate_serial_number()
self._generate()
kwargs['force_insert'] = False
super().save(*args, **kwargs)

Generates two queries for creating a certificate and a CA.

I figured this out while working on openwisp/openwisp-controller#455.

I think this part could be optimized.

@nemesifier nemesifier added this to To do (general) in OpenWISP Contributor's Board via automation Jul 18, 2021
@nemesifier nemesifier added this to Backlog in OpenWISP Priorities for next releases via automation Jan 25, 2022
@nemesifier nemesifier moved this from Backlog to To do in OpenWISP Priorities for next releases Jan 25, 2022
@atb00ker atb00ker moved this from To do (general) to To do (ansible/docker) in OpenWISP Contributor's Board Jan 31, 2022
@atb00ker atb00ker moved this from To do (ansible/docker) to To do (Python & Django) in OpenWISP Contributor's Board Jan 31, 2022
@nemesifier nemesifier moved this from To do (Python & Django) to To do (ansible/docker) in OpenWISP Contributor's Board Jan 23, 2023
@nemesifier nemesifier moved this from To do (ansible/docker) to To do (Python & Django) in OpenWISP Contributor's Board Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
OpenWISP Contributor's Board
  
To do (Python & Django)
Development

No branches or pull requests

1 participant