Skip to content

Commit

Permalink
Merge pull request #4969 from jtschladen/jschladen/reissue-serial
Browse files Browse the repository at this point in the history
Fix "Working outside of application context" error, plus fix incorrect arg ordering for rotate by serial number
  • Loading branch information
jtschladen authored Sep 30, 2024
2 parents a580396 + 53281e1 commit 6dd0d4b
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 17 deletions.
8 changes: 5 additions & 3 deletions lemur/acme_providers/cli.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import time
import json
import time

import arrow
import click

from flask import current_app

from flask.cli import with_appcontext
from sentry_sdk import capture_exception

from lemur.common.utils import check_validation
from lemur.constants import SUCCESS_METRIC_STATUS
from lemur.plugins import plugins
Expand All @@ -14,6 +15,7 @@


@click.group(name="acme", help="Handles all ACME related tasks")
@with_appcontext
def cli():
pass

Expand Down
4 changes: 3 additions & 1 deletion lemur/certificates/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import arrow
import click
from flask import current_app
from flask.cli import with_appcontext
from flask_principal import Identity, identity_changed
from sentry_sdk import capture_exception
from sqlalchemy import or_
Expand Down Expand Up @@ -50,6 +51,7 @@


@click.group(name="certificates", help="Handles all certificate related tasks.")
@with_appcontext
def cli():
pass

Expand Down Expand Up @@ -577,7 +579,7 @@ def rotate_region(endpoint_name, new_certificate_name, old_certificate_name, mes
help="Persist changes.",
)
def reissue_command(old_certificate_name, serial_numbers, notify, commit):
reissue(old_certificate_name, serial_numbers, notify, commit)
reissue(old_certificate_name, notify, commit, serial_numbers)


def reissue(old_certificate_name, notify, commit, serial_numbers):
Expand Down
6 changes: 4 additions & 2 deletions lemur/dns_providers/cli.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import sys
import click

import click
from flask.cli import with_appcontext
from sentry_sdk import capture_exception

from lemur.constants import SUCCESS_METRIC_STATUS
from lemur.plugins.lemur_acme.acme_handlers import AcmeDnsHandler
from lemur.dns_providers.service import get_all_dns_providers, set_domains
from lemur.extensions import metrics
from lemur.plugins.lemur_acme.acme_handlers import AcmeDnsHandler


@click.group(name="dns_providers", help="Iterates through all DNS providers and sets DNS zones in the database.")
@with_appcontext
def cli():
pass

Expand Down
5 changes: 3 additions & 2 deletions lemur/notifications/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,21 @@
.. moduleauthor:: Kevin Glisson <[email protected]>
"""
import click

from flask import current_app
from flask.cli import with_appcontext
from sentry_sdk import capture_exception

from lemur.certificates.service import get_expiring_deployed_certificates
from lemur.constants import SUCCESS_METRIC_STATUS, FAILURE_METRIC_STATUS
from lemur.extensions import metrics
from lemur.notifications.messaging import send_authority_expiration_notifications
from lemur.notifications.messaging import send_expiration_notifications, \
send_expiring_deployed_certificate_notifications
from lemur.notifications.messaging import send_authority_expiration_notifications
from lemur.notifications.messaging import send_security_expiration_summary


@click.group(name="notify", help="Handles notification related tasks.")
@with_appcontext
def cli():
pass

Expand Down
4 changes: 3 additions & 1 deletion lemur/pending_certificates/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
.. moduleauthor:: Curtis Castrapel <[email protected]>
"""

import click
import copy
import sys

import click
from flask import current_app
from flask.cli import with_appcontext

from lemur.authorities.service import get as get_authority
from lemur.constants import ACME_ADDITIONAL_ATTEMPTS
Expand All @@ -19,6 +20,7 @@


@click.group(name="pending_certs", help="Handles pending certificate related tasks.")
@with_appcontext
def cli():
pass

Expand Down
2 changes: 2 additions & 0 deletions lemur/policies/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
.. moduleauthor:: Kevin Glisson <[email protected]>
"""
import click
from flask.cli import with_appcontext

from lemur.policies import service as policy_service


@click.group(name="policy", help="Handles all policy related tasks.")
@with_appcontext
def cli():
pass

Expand Down
3 changes: 2 additions & 1 deletion lemur/reporting/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
.. moduleauthor:: Kevin Glisson <[email protected]>
"""
import click

from flask.cli import with_appcontext
from tabulate import tabulate

from lemur.reporting.service import fqdns, expiring_certificates


@click.group(name="report", help="Reporting related tasks.")
@with_appcontext
def cli():
pass

Expand Down
14 changes: 7 additions & 7 deletions lemur/sources/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@
:license: Apache, see LICENSE for more details.
.. moduleauthor:: Kevin Glisson <[email protected]>
"""
from copy import deepcopy
import click
import sys
import time
from copy import deepcopy

from tabulate import tabulate
import click
from flask import current_app
from flask.cli import with_appcontext
from sentry_sdk import capture_exception
from tabulate import tabulate

from lemur.certificates import service as certificate_service
from lemur.constants import SUCCESS_METRIC_STATUS, FAILURE_METRIC_STATUS

from lemur.destinations import service as dest_service
from lemur.extensions import metrics
from lemur.plugins.base import plugins
from lemur.plugins.utils import get_plugin_option, set_plugin_option

from lemur.destinations import service as dest_service
from lemur.sources import service as source_service
from lemur.users import service as user_service
from lemur.certificates import service as certificate_service


@click.group(name="source", help="Handles all source related tasks.")
@with_appcontext
def cli():
pass

Expand Down

0 comments on commit 6dd0d4b

Please sign in to comment.