forked from Netflix/lemur
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Netflix#1509 from intgr/fill-missing-rotation-policy
Fill in missing cert rotation_policy; don't ignore validation errors when re-issuing certs
- Loading branch information
Showing
5 changed files
with
50 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
"""Add default rotation_policy to certs where it's missing | ||
Revision ID: 1db4f82bc780 | ||
Revises: 3adfdd6598df | ||
Create Date: 2018-08-03 12:56:44.565230 | ||
""" | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = '1db4f82bc780' | ||
down_revision = '3adfdd6598df' | ||
|
||
import logging | ||
|
||
from alembic import op | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
|
||
def upgrade(): | ||
connection = op.get_bind() | ||
|
||
result = connection.execute("""\ | ||
UPDATE certificates | ||
SET rotation_policy_id=(SELECT id FROM rotation_policies WHERE name='default') | ||
WHERE rotation_policy_id IS NULL | ||
RETURNING id | ||
""") | ||
log.info("Filled rotation_policy for %d certificates" % result.rowcount) | ||
|
||
|
||
def downgrade(): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters