Skip to content

Commit c86c46c

Browse files
authored
Bump fideslog to v1.1.3, update usage patterns (#453)
* Update the usage of `AnalyticsClient.send`, bump fideslog to v1.1.0 Fideslog v1.1.0 changes the `AnalyticsClient.send` interface such that it automatically executes the request in a separate event loop. There is no longer a need to manually wrap the call in `asyncio.run` or similar. These changes were introduced in ethyca/fideslog#50 * Use the new `OPT_OUT_PROMPT` constant * `AnalyticsException` --> `AnalyticsError` * Bump fideslog to v1.1.1 * Bump fideslog to v1.1.2 * Bump fideslog to v1.1.3
1 parent 8c474f5 commit c86c46c

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

fidesctl/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ click>=7.1.2,<8
33
colorama>=0.4.3
44
cryptography>=36
55
deepdiff==5.5
6-
fideslog==1.0.1
6+
fideslog==1.1.3
77
loguru>=0.5,<0.6
88
openpyxl==3.0.9
99
pandas==1.4

fidesctl/src/fidesctl/cli/commands/util.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
import os
33

44
import click
5-
from fideslog.sdk.python.utils import OPT_OUT_COPY
65
import toml
76

7+
from fideslog.sdk.python.utils import OPT_OUT_COPY, OPT_OUT_PROMPT
8+
89
import fidesctl
910
from fidesctl.cli.utils import check_server, with_analytics
1011
from fidesctl.core.utils import echo_green, echo_red
@@ -62,7 +63,8 @@ def init(ctx: click.Context, fides_directory_location: str) -> None:
6263
config_docs_url = "https://ethyca.github.io/fides/installation/configuration/"
6364
config_message = f"""Created a config file at '{config_path}'. To learn more, see:
6465
{config_docs_url}"""
65-
config.user.analytics_opt_out = bool(input(OPT_OUT_COPY).lower() == "n")
66+
click.echo(OPT_OUT_COPY)
67+
config.user.analytics_opt_out = bool(input(OPT_OUT_PROMPT).lower() == "n")
6668
with open(config_path, "w") as config_file:
6769
config_dict = config.dict(include=included_values)
6870
toml.dump(config_dict, config_file)

fidesctl/src/fidesctl/cli/utils.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@
22

33
import json
44
import sys
5-
from asyncio import run
65
from datetime import datetime, timezone
76
from os import getenv
87
from typing import Any, Callable, Dict
98

109
import click
1110
import requests
1211
from fideslog.sdk.python.event import AnalyticsEvent
13-
from fideslog.sdk.python.exceptions import AnalyticsException
14-
from fideslog.sdk.python.utils import OPT_OUT_COPY
12+
from fideslog.sdk.python.exceptions import AnalyticsError
13+
from fideslog.sdk.python.utils import OPT_OUT_COPY, OPT_OUT_PROMPT
1514

1615
from fidesctl.core import api as _api
1716
from fidesctl.core.config.utils import get_config_from_file, update_config_file
@@ -74,8 +73,9 @@ def check_and_update_analytics_config(ctx: click.Context, config_path: str) -> N
7473

7574
config_updates: Dict[str, Dict] = {}
7675
if ctx.obj["CONFIG"].user.analytics_opt_out is None:
76+
click.echo(OPT_OUT_COPY)
7777
ctx.obj["CONFIG"].user.analytics_opt_out = bool(
78-
input(OPT_OUT_COPY).lower() == "n"
78+
input(OPT_OUT_PROMPT).lower() == "n"
7979
)
8080

8181
config_updates.update(
@@ -138,6 +138,6 @@ def with_analytics(ctx: click.Context, command_handler: Callable, **kwargs: Dict
138138
)
139139

140140
try:
141-
run(ctx.meta["ANALYTICS_CLIENT"].send(event))
142-
except AnalyticsException:
141+
ctx.meta["ANALYTICS_CLIENT"].send(event)
142+
except AnalyticsError:
143143
pass # cli analytics should fail silently

0 commit comments

Comments
 (0)