Skip to content

Commit

Permalink
reformatted client calls to keep within maxiumum line length
Browse files Browse the repository at this point in the history
  • Loading branch information
peters-david committed May 2, 2024
1 parent 50532d5 commit 046d860
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/harbor.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,12 @@ async def main() -> None:

# Sync retention policies
print('SYNCING RETENTION POLICIES')
retention_policies_config = json.load(open(config_folder_path + "/retention-policies.json"))
await sync_retention_policies(retention_policies=retention_policies_config)
retention_policies_config = json.load(
open(config_folder_path + "/retention-policies.json")
)
await sync_retention_policies(
retention_policies=retention_policies_config
)


async def sync_retention_policies(retention_policies: [RetentionPolicy]):
Expand All @@ -119,15 +123,20 @@ async def sync_retention_policies(retention_policies: [RetentionPolicy]):
for retention_policy in retention_policies:
retention_id = retention_policy.id
try:
current_retention_policy = await client.get_retention_policy(retention_id)
current_retention_policy = await client.get_retention_policy(
retention_id
)
if retention_policy != current_retention_policy:
retention_policies_to_update.append(retention_policy)
except NotFound e:
retention_policies_to_create.append(retention_policy)
# Update retention policies
for retention_policy_to_update in retention_policies_to_update:
retention_id = retention_policy_to_update.id
await client.update_retention_policy(retention_id, retention_policies_to_update)
await client.update_retention_policy(
retention_id,
retention_policies_to_update
)
# Create retention policies
for retention_policy_to_create in retention_policies_to_create:
await client.update_retention_policy(retention_policies_to_update)
Expand Down

0 comments on commit 046d860

Please sign in to comment.