2025-03-02 20:13:32 +01:00
|
|
|
# import gnupg
|
2025-03-02 20:28:37 +01:00
|
|
|
import atexit
|
2025-03-02 20:13:32 +01:00
|
|
|
import json
|
|
|
|
import logging.config
|
|
|
|
import pathlib
|
|
|
|
|
|
|
|
logger = logging.getLogger("vm_management")
|
|
|
|
|
|
|
|
|
|
|
|
# Logging is https://www.youtube.com/watch?v=9L77QExPmI0
|
|
|
|
def setup_logging():
|
|
|
|
config_file = pathlib.Path("logging_configs/config.json")
|
|
|
|
with open(config_file, "r") as config_file:
|
|
|
|
config = json.load(config_file)
|
|
|
|
logging.config.dictConfig(config)
|
2025-03-02 20:28:37 +01:00
|
|
|
queue_handler = logging.getHandlerByName("queue_handler")
|
|
|
|
if queue_handler is not None:
|
|
|
|
queue_handler.listener.start()
|
|
|
|
atexit.register(queue_handler.listener.stop)
|
2025-03-02 20:13:32 +01:00
|
|
|
|
|
|
|
|
2025-02-28 00:11:09 +01:00
|
|
|
def main():
|
2025-03-02 20:13:32 +01:00
|
|
|
setup_logging()
|
|
|
|
logger.debug("Logging configured")
|
|
|
|
logger.info("Logging configured")
|
|
|
|
logger.warning("Logging configured")
|
|
|
|
logger.error("Logging configured")
|
|
|
|
logger.critical("Logging configured")
|
|
|
|
|
|
|
|
# รค gnupg = gnupg.GPG()
|
|
|
|
# logging.basicConfig(level=logging.INFO)
|
|
|
|
|
|
|
|
# gpg = gnupg.GPG(gnupghome="~/.gnupg", verbose=True)
|
|
|
|
# gpg.encoding="utf-8"
|
|
|
|
# with open("~/Downloads/hashicorp_vault_token.gpg", "r") as file:
|
|
|
|
# # secret = file.read()
|
2025-02-28 00:11:09 +01:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|