pull/342/head
Andrey Dolgolev 2021-11-02 17:32:40 +03:00
rodzic abea758c4a
commit ae4a460e85
3 zmienionych plików z 10 dodań i 11 usunięć

Wyświetl plik

@ -1,9 +1,9 @@
{
"match": { "type": "subscriptions" },
"match": { "type": "subscription" },
"update": {
"abi": false,
"abi": null,
"backet": null,
"s3_path": null
},
"drop_keys": {}
"drop_keys": []
}

Wyświetl plik

@ -11,7 +11,6 @@ from sqlalchemy.sql.expression import update
from ..data import SubscriptionTypeResourceData
from ..settings import (
MOONSTREAM_ADMIN_ACCESS_TOKEN,
MOONSTREAM_APPLICATION_ID,
bugout_client as bc,
BUGOUT_REQUEST_TIMEOUT_SECONDS,
)
@ -20,7 +19,7 @@ from ..settings import (
def migrate_subscriptions(
match: Dict[str, Union[str, int]],
update: Dict[str, Union[str, int]],
drop_keys: Optional[Dict[str, Union[str, int]]],
drop_keys: Optional[List[str]],
):
"""
Search all subscriptinons and replace them one by one
@ -54,7 +53,7 @@ def cli_migrate_subscriptions(args: argparse.Namespace) -> None:
Handler for subscriptions migrate.
"""
drop_keys = None
drop_keys = []
if args.file is not None:
with open(args.file) as migration_json_file:
@ -69,7 +68,7 @@ def cli_migrate_subscriptions(args: argparse.Namespace) -> None:
match = migration_json["match"]
update = migration_json["update"]
if drop_keys in migration_json:
if "drop_keys" in migration_json:
drop_keys = migration_json["drop_keys"]
elif args.match is not None and args.update is not None:

Wyświetl plik

@ -118,7 +118,7 @@ async def add_subscription_handler(
address=subscription_resource.resource_data["address"],
color=subscription_resource.resource_data["color"],
label=subscription_resource.resource_data["label"],
abi=subscription_resource.resource_data["abi"],
abi=subscription_resource.resource_data.get("abi"),
subscription_type_id=subscription_resource.resource_data[
"subscription_type_id"
],
@ -151,7 +151,7 @@ async def delete_subscription_handler(request: Request, subscription_id: str):
address=deleted_resource.resource_data["address"],
color=deleted_resource.resource_data["color"],
label=deleted_resource.resource_data["label"],
abi=deleted_resource.resource_data["abi"],
abi=deleted_resource.resource_data.get("abi"),
subscription_type_id=deleted_resource.resource_data["subscription_type_id"],
updated_at=deleted_resource.updated_at,
created_at=deleted_resource.created_at,
@ -187,7 +187,7 @@ async def get_subscriptions_handler(request: Request) -> data.SubscriptionsListR
address=resource.resource_data["address"],
color=resource.resource_data["color"],
label=resource.resource_data["label"],
abi=resource.resource_data["abi"],
abi=resource.resource_data.get("abi"),
subscription_type_id=resource.resource_data["subscription_type_id"],
updated_at=resource.updated_at,
created_at=resource.created_at,
@ -275,7 +275,7 @@ async def update_subscriptions_handler(
address=resource.resource_data["address"],
color=resource.resource_data["color"],
label=resource.resource_data["label"],
abi=resource.resource_data["abi"],
abi=resource.resource_data.get("abi"),
subscription_type_id=resource.resource_data["subscription_type_id"],
updated_at=resource.updated_at,
created_at=resource.created_at,