update cli scripts to use REST API
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 2s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 2s
This commit is contained in:
+10
-8
@@ -16,6 +16,7 @@ parser = ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter)
|
||||
parser.add_argument("--verbose", "-v", action="count", default=0)
|
||||
parser.add_argument("--config", "-c", default="kontor-api")
|
||||
parser.add_argument("--dry-run", "-m", action="store_true")
|
||||
parser.add_argument("--to-file", "-f", action="store_true")
|
||||
parser.add_argument("--server", "-s")
|
||||
parser.add_argument("--cleanup", "-d", action="store_true")
|
||||
args = parser.parse_args()
|
||||
@@ -43,13 +44,14 @@ if __name__ == "__main__":
|
||||
logger.info("%s: %s exported", table, len(data))
|
||||
except EndPointNotAvailableException:
|
||||
logger.info("Endpoint not implemented")
|
||||
try:
|
||||
json_dump = json.dumps(export_data[server.name], indent=4)
|
||||
file_name = f"{server.name}-data.json"
|
||||
with open(file_name, "w") as dump_file:
|
||||
dump_file.write(json_dump)
|
||||
except TypeError as error:
|
||||
logger.info(f"{error}")
|
||||
if args.to_file:
|
||||
try:
|
||||
json_dump = json.dumps(export_data[server.name], indent=4)
|
||||
file_name = f"{server.name}-data.json"
|
||||
with open(file_name, "w") as dump_file:
|
||||
dump_file.write(json_dump)
|
||||
except TypeError as error:
|
||||
logger.info(f"{error}")
|
||||
for server in server_list:
|
||||
logger.info(f"{server.name}: {len(export_data[server.name])} tables exported")
|
||||
if len(server_list) > 1:
|
||||
@@ -61,5 +63,5 @@ if __name__ == "__main__":
|
||||
if item != item_data:
|
||||
logger.debug("diff: %s\n%s", item, item_data)
|
||||
else:
|
||||
logger.info("no changes for: %s(%s)", table, item["id"])
|
||||
logger.debug("no changes for: %s(%s)", table, item["id"])
|
||||
logger.info("kontor.sync finished")
|
||||
|
||||
Reference in New Issue
Block a user