Closed WadeBarnes closed 1 year ago
cc @shaangill025, @swcurran
This is running in OCP using the ghcr.io/hyperledger/aries-cloudagent-python:py3.9-indy-1.16.0-0.8.1-rc0
image.
Will this work, by updating the following here?
with open(os.path.abspath(path), "r") as stream:
What about just making it a JSON data structure in code, instead of a file? Same as version in version.py? Same effort to maintain, and minimum overhead to handle.
os.path.abspath
will build the path to the file based on the working directory. Example with working dir /acapy-mediator
, like it is on the container:
>>> import os
>>> os.path.abspath('./aries_cloudagent/commands/default_version_upgrade_config.yml')
'/acapy-mediator/aries_cloudagent/commands/default_version_upgrade_config.yml'
Still the wrong path.
How about this?
os.getcwd() should get us /home/indy/.local/lib/python3.9/site-packages/aries_cloudagent/commands
and then we add the file name to it which gets us the path
import os
file_name = "default_version_upgrade_config.yml"
work_dir_path = os.getcwd()
file_path = os.path.join(work_dir_path, file_name)
Seeing that it is upgrade.py
trying to access default_version_upgrade_config.yml
and they are both in the same folder, you'll likely want to use something like os.path.realpath(os.path.dirname(__file__))
to find the absolute directory of the upgrade.py
script and then build the path to default_version_upgrade_config.yml
from there.
How about this? os.getcwd() should get us
/home/indy/.local/lib/python3.9/site-packages/aries_cloudagent/commands
and then we add the file name to it which gets us the pathimport os file_name = "default_version_upgrade_config.yml" work_dir_path = os.getcwd() file_path = os.path.join(work_dir_path, file_name)
os.getcwd()
will return the working directory, that will change depending on the working directory at the time aca-py is started.
Example with the working directory as set before (to /acapy-mediator
):
>>> import os
>>> os.getcwd()
'/acapy-mediator'
The following error occurs on startup:
default_version_upgrade_config.yml
exists in the container, but it's located at/home/indy/.local/lib/python3.9/site-packages/aries_cloudagent/commands/default_version_upgrade_config.yml
. aca-py seems to be looking for the file relative to the working directory, rather than relative to the module trying to access it.