eNMS-automation / eNMS

An enterprise-grade vendor-agnostic network automation platform.
https://www.enms.io/
GNU General Public License v3.0
810 stars 160 forks source link

AttributeError: 'Environment' object has no attribute 'vault_client' #370

Closed jsmith7735 closed 2 years ago

jsmith7735 commented 2 years ago

I performed a fresh install on an Ubuntu 20.04 machine in Azure and followed the instructions to get everything set up. I receive the error when attempting to use vault and add a device or credentials to the database.

Nov 09 02:25:48 eNMS-App gunicorn[81247]:   File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/orm/attributes.py", line 1082, in set
Nov 09 02:25:48 eNMS-App gunicorn[81247]:     value = self.fire_replace_event(
Nov 09 02:25:48 eNMS-App gunicorn[81247]:   File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/orm/attributes.py", line 1090, in fire_replace_event
Nov 09 02:25:48 eNMS-App gunicorn[81247]:     value = fn(
Nov 09 02:25:48 eNMS-App gunicorn[81247]:   File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/orm/events.py", line 2248, in wrap
Nov 09 02:25:48 eNMS-App gunicorn[81247]:     fn(target, *arg)
Nov 09 02:25:48 eNMS-App gunicorn[81247]:   File "/var/www/eNMS/eNMS/database.py", line 267, in vault_update
Nov 09 02:25:48 eNMS-App gunicorn[81247]:     data = env.vault_client.read(f"{path}/{old_name}/{property}")
Nov 09 02:25:48 eNMS-App gunicorn[81247]: AttributeError: 'Environment' object has no attribute 'vault_client'

I noticed that the environment.py file was updated about a month ago and the int_vault_client method was removed. I tried adding it back in but that did not resolve the problem. Is there something else I need to do to get this working again?

Adding these lines to environment.py did not fix the issue.

    def init_vault_client(self):
        url = getenv("VAULT_ADDR", "http://127.0.0.1:8200")
        self.vault_client = VaultClient(url=url, token=getenv("VAULT_TOKEN"))
        if self.vault_client.sys.is_sealed() and vs.settings["vault"]["unseal_vault"]:
            keys = [getenv(f"UNSEAL_VAULT_KEY{index}") for index in range(1, 6)]
            self.vault_client.sys.submit_unseal_keys(filter(None, keys))            
afourmy commented 2 years ago

discussed by mail