4 Commits

Author SHA1 Message Date
2e4638e448 Typo 2023-05-29 13:25:03 -07:00
916064c153 Bump python version and relock pipenv 2023-05-20 18:24:25 -07:00
ec894014c6 Uhm whoops 2023-03-27 20:27:35 -07:00
d66688eb3c Remove annoying log emissions 2023-03-27 20:17:45 -07:00
4 changed files with 25 additions and 20 deletions

View File

@ -1 +1 @@
3.10.10
3.11.2

11
Pipfile.lock generated
View File

@ -1,11 +1,11 @@
{
"_meta": {
"hash": {
"sha256": "cceb18d3baeb19edef3ba31b743720003102c4c3d9cddd6b595c664692a37384"
"sha256": "a06b0e056404fd78550c7c60ba63ed5eaf9a1ecb91a3baa8eca7fd4a56544ca5"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.10.5"
"python_version": "3.10.10"
},
"sources": [
{
@ -18,6 +18,7 @@
"default": {
"pyyaml": {
"hashes": [
"sha256:01b45c0191e6d66c470b6cf1b9531a771a83c1c4208272ead47a3ae4f2f603bf",
"sha256:0283c35a6a9fbf047493e3a0ce8d79ef5030852c51e9d911a27badfde0605293",
"sha256:055d937d65826939cb044fc8c9b08889e8c743fdc6a32b33e2390f66013e449b",
"sha256:07751360502caac1c067a8132d150cf3d61339af5691fe9e87803040dbc5db57",
@ -29,26 +30,32 @@
"sha256:277a0ef2981ca40581a47093e9e2d13b3f1fbbeffae064c1d21bfceba2030287",
"sha256:2cd5df3de48857ed0544b34e2d40e9fac445930039f3cfe4bcc592a1f836d513",
"sha256:40527857252b61eacd1d9af500c3337ba8deb8fc298940291486c465c8b46ec0",
"sha256:432557aa2c09802be39460360ddffd48156e30721f5e8d917f01d31694216782",
"sha256:473f9edb243cb1935ab5a084eb238d842fb8f404ed2193a915d1784b5a6b5fc0",
"sha256:48c346915c114f5fdb3ead70312bd042a953a8ce5c7106d5bfb1a5254e47da92",
"sha256:50602afada6d6cbfad699b0c7bb50d5ccffa7e46a3d738092afddc1f9758427f",
"sha256:68fb519c14306fec9720a2a5b45bc9f0c8d1b9c72adf45c37baedfcd949c35a2",
"sha256:77f396e6ef4c73fdc33a9157446466f1cff553d979bd00ecb64385760c6babdc",
"sha256:81957921f441d50af23654aa6c5e5eaf9b06aba7f0a19c18a538dc7ef291c5a1",
"sha256:819b3830a1543db06c4d4b865e70ded25be52a2e0631ccd2f6a47a2822f2fd7c",
"sha256:897b80890765f037df3403d22bab41627ca8811ae55e9a722fd0392850ec4d86",
"sha256:98c4d36e99714e55cfbaaee6dd5badbc9a1ec339ebfc3b1f52e293aee6bb71a4",
"sha256:9df7ed3b3d2e0ecfe09e14741b857df43adb5a3ddadc919a2d94fbdf78fea53c",
"sha256:9fa600030013c4de8165339db93d182b9431076eb98eb40ee068700c9c813e34",
"sha256:a80a78046a72361de73f8f395f1f1e49f956c6be882eed58505a15f3e430962b",
"sha256:afa17f5bc4d1b10afd4466fd3a44dc0e245382deca5b3c353d8b757f9e3ecb8d",
"sha256:b3d267842bf12586ba6c734f89d1f5b871df0273157918b0ccefa29deb05c21c",
"sha256:b5b9eccad747aabaaffbc6064800670f0c297e52c12754eb1d976c57e4f74dcb",
"sha256:bfaef573a63ba8923503d27530362590ff4f576c626d86a9fed95822a8255fd7",
"sha256:c5687b8d43cf58545ade1fe3e055f70eac7a5a1a0bf42824308d868289a95737",
"sha256:cba8c411ef271aa037d7357a2bc8f9ee8b58b9965831d9e51baf703280dc73d3",
"sha256:d15a181d1ecd0d4270dc32edb46f7cb7733c7c508857278d3d378d14d606db2d",
"sha256:d4b0ba9512519522b118090257be113b9468d804b19d63c71dbcf4a48fa32358",
"sha256:d4db7c7aef085872ef65a8fd7d6d09a14ae91f691dec3e87ee5ee0539d516f53",
"sha256:d4eccecf9adf6fbcc6861a38015c2a64f38b9d94838ac1810a9023a0609e1b78",
"sha256:d67d839ede4ed1b28a4e8909735fc992a923cdb84e618544973d7dfc71540803",
"sha256:daf496c58a8c52083df09b80c860005194014c3698698d1a57cbcfa182142a3a",
"sha256:dbad0e9d368bb989f4515da330b88a057617d16b6a8245084f1b05400f24609f",
"sha256:e61ceaab6f49fb8bdfaa0f92c4b57bcfbea54c09277b1b4f7ac376bfb7a7c174",
"sha256:f84fbc98b019fef2ee9a1cb3ce93e3187a6df0b2538a651bfb890254ba9f90b5"
],

View File

@ -54,7 +54,7 @@ class BackupRotator:
config = self.__configs[config_index]
#
self.info("Rotating for config " + str(config_index + 1) + " of " + str(len(self.__configs)), config["__path"])
self.info(f"Rotating for config {config_index + 1} of {len(self.__configs)} : {config['__path']}")
self._do_rotate(config)
@staticmethod
@ -76,9 +76,6 @@ class BackupRotator:
def _consume_configs(self, paths: list=None):
configs = self.__config_helper.gather_valid_configs(paths=paths)
print("Configs:")
print(configs)
return
for config in configs:
self._consume_config(path=config)
@ -97,7 +94,7 @@ class BackupRotator:
# Consume to internal
self.__configs.append(config)
self.info("Consumed config from path:", path)
self.info(f"Consumed config from path: {path}")
def _do_rotate(self, config):
@ -217,7 +214,7 @@ class BackupRotator:
self.info("[Not Old enough] {} ({})".format(
child_basename, age_formatted
))
if len(children_to_delete) > 0:
self.info("Removing old items ...")
for child_to_delete in children_to_delete:
@ -225,7 +222,7 @@ class BackupRotator:
self._remove_item(config, child_to_delete)
else:
self.info("No old items to remove")
@staticmethod
def _gather_rotation_candidates(config, path):
@ -348,11 +345,11 @@ class BackupRotator:
raise Exception("Tried to remove a file, but this path isn't a file: " + str(file_path))
if self.__dry_run:
self.info("Won't purge file during global-level dry run: ", file_path)
self.info(f"Won't purge file during global-level dry run: {file_path}")
elif "dry-run" in config.keys() and config["dry-run"] is True:
self.info("Won't purge file during config-level dry run: ", file_path)
self.info(f"Won't purge file during config-level dry run: {file_path}")
else:
self.info("Purging file:", file_path)
self.info(f"Purging file: {file_path}")
os.remove(file_path)
def _remove_directory(self, config, dir_path):
@ -361,11 +358,11 @@ class BackupRotator:
raise Exception("Tried to remove a directory, but this path isn't a directory: " + str(dir_path))
if self.__dry_run:
self.info("Won't purge directory during global-level dry run: ", dir_path)
self.info(f"Won't purge directory during global-level dry run: {dir_path}")
elif "dry-run" in config.keys() and config["dry-run"] is True:
self.info("Won't purge directory during config-level dry run: ", dir_path)
self.info(f"Won't purge directory during config-level dry run: {dir_path}")
else:
self.info("Purging directory:", dir_path)
self.info(f"Purging directory: {dir_path}")
shutil.rmtree(dir_path)

View File

@ -47,10 +47,11 @@ class Logger:
handler.setFormatter(formatter)
self.__logger.addHandler(handler)
self.debug("Test debug log")
self.info("Test info log")
self.warn("Test warn log")
self.error("Test error log")
# This is annoying inside cron
# self.debug("Test debug log")
# self.info("Test info log")
# self.warn("Test warn log")
# self.error("Test error log")
def debug(self, s):