-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* introduce pythonjsonlogger * correct library name and make json conditional * update prints to use logger * correct library name in code * change import of pythonjsonlogger * cast json logging env var as cannot be unmarshaled to boolean * add logger instead of prints * replace remaining prints with logger and fix linter issues * add missing positional argument * move positional argument * change log level and rename function * robot warning as info with details * bump harborapi version
- Loading branch information
1 parent
06c71d5
commit 8558afb
Showing
13 changed files
with
166 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
harborapi | ||
python-json-logger | ||
chevron |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
harborapi==0.25.3 | ||
harborapi==0.26.1 | ||
python-json-logger==2.0.7 | ||
chevron==0.14.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
import json | ||
|
||
|
||
async def sync_garbage_collection_schedule(client, path): | ||
async def sync_garbage_collection_schedule(client, path, logger): | ||
"""Synchronize the garbage collection and its schedule | ||
The garbage collection and its schedule from the garbage collection | ||
schedule file, if existent, will be updated and applied to harbor. | ||
""" | ||
|
||
print("SYNCING GARBAGE COLLECTION SCHEDULE") | ||
logger.info("Syncing garbage collection schedule") | ||
garbage_collection_schedule = json.load(open(path)) | ||
try: | ||
await client.get_gc_schedule() | ||
print("Updating garbage collection schedule") | ||
logger.info("Updating garbage collection schedule") | ||
await client.update_gc_schedule(garbage_collection_schedule) | ||
except Exception as e: | ||
print("Creating garbage collection schedule") | ||
logger.info("Creating garbage collection schedule") | ||
await client.create_gc_schedule(garbage_collection_schedule) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
import json | ||
|
||
|
||
async def sync_purge_job_schedule(client, path): | ||
async def sync_purge_job_schedule(client, path, logger): | ||
"""Synchronize the purge job and its schedule | ||
The purge job and its schedule from the purge job schedule file, | ||
if existent, will be updated and applied to harbor. | ||
""" | ||
|
||
print("SYNCING PURGE JOB SCHEDULE") | ||
logger.info("Syncing purge job schedule") | ||
purge_job_schedule = json.load(open(path)) | ||
try: | ||
await client.get_purge_job_schedule() | ||
print("Updating purge job schedule") | ||
logger.info("Updating purge job schedule") | ||
await client.update_purge_job_schedule(purge_job_schedule) | ||
except Exception as e: | ||
print("Creating purge job schedule") | ||
logger.info("Creating purge job schedule") | ||
await client.create_purge_job_schedule(purge_job_schedule) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.