lint
This commit is contained in:
parent
f81ff2e1de
commit
afb98724d3
6 changed files with 10 additions and 8 deletions
|
@ -1,6 +1,7 @@
|
|||
import json
|
||||
|
||||
from flask import Blueprint, request, Response
|
||||
from flask.typing import ResponseReturnValue
|
||||
|
||||
from app.extensions import db
|
||||
from app.models.tfstate import TerraformState
|
||||
|
@ -9,7 +10,7 @@ tfstate = Blueprint("tfstate", __name__)
|
|||
|
||||
|
||||
@tfstate.route("/<key>", methods=['GET'])
|
||||
def handle_get(key):
|
||||
def handle_get(key: str) -> ResponseReturnValue:
|
||||
state = TerraformState.query.filter(TerraformState.key == key).first()
|
||||
if state is None or state.state is None:
|
||||
return "Not Found", 404
|
||||
|
@ -17,7 +18,7 @@ def handle_get(key):
|
|||
|
||||
|
||||
@tfstate.route("/<key>", methods=['POST', 'DELETE', 'UNLOCK'])
|
||||
def handle_update(key):
|
||||
def handle_update(key: str) -> ResponseReturnValue:
|
||||
state = TerraformState.query.filter(TerraformState.key == key).first()
|
||||
if not state:
|
||||
if request.method in ["DELETE", "UNLOCK"]:
|
||||
|
@ -38,7 +39,7 @@ def handle_update(key):
|
|||
|
||||
|
||||
@tfstate.route("/<key>", methods=['LOCK'])
|
||||
def handle_lock(key):
|
||||
def handle_lock(key: str) -> ResponseReturnValue:
|
||||
state = TerraformState.query.filter(TerraformState.key == key).with_for_update().first()
|
||||
if state is None:
|
||||
state = TerraformState(key=key)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue