Skip to content

Commit

Permalink
Add docstring + fix name
Browse files Browse the repository at this point in the history
  • Loading branch information
benoit74 committed Nov 16, 2023
1 parent 4fadd57 commit 3655418
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions dispatcher/backend/src/common/external.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

def update_workers_whitelist(session: so.Session):
"""update whitelist of workers on external services"""
ExternalIpUpdater.update_fn(build_workers_whitelist(session=session))
ExternalIpUpdater.update(build_workers_whitelist(session=session))


def build_workers_whitelist(session: so.Session) -> typing.List[str]:
Expand Down Expand Up @@ -150,7 +150,13 @@ def get_statement():


class ExternalIpUpdater:
update_fn = update_wasabi_whitelist
"""Class responsible to push IP updates to external system(s)
`update` is called with the new list of all workers IPs everytime
a change is detected.
By default, this class update our IPs whitelist in Wasabi"""

update = update_wasabi_whitelist


@dbsession
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def test_requested_task_worker_update_ip_whitelist(
# setup custom ip updater to intercept Wasabi operations
updater = IpUpdaterAndChecker(should_fail=external_update_fails)
assert TestWorkerRequestedTasks.new_ip_address not in updater.ip_addresses
ExternalIpUpdater.update_fn = updater.ip_update
ExternalIpUpdater.update = updater.ip_update
constants.USES_WORKERS_IPS_WHITELIST = external_update_enabled

# call it once to set next_ip
Expand Down

0 comments on commit 3655418

Please sign in to comment.