Commit 11ebd697 authored by Jiahang Chen's avatar Jiahang Chen
Browse files

fix path problem

parent d5641de5
Pipeline #350518 passed with stage
in 11 seconds
{"thingId": "s3i:b6d1cc6d-896c-40fe-9403-b5b7682b1d03", "policyId": "s3i:b6d1cc6d-896c-40fe-9403-b5b7682b1d03", "attributes": {"class": "ml40::Thing", "name": "my_dt_harvester", "roles": [{"class": "fml40::Harvester"}], "features": [{"class": "fml40::ProvidesProductionData"}, {"class": "fml40::AcceptsFellingJobs"}, {"class": "ml40::Composite", "targets": [{"class": "ml40::Thing", "name": "my_engine", "roles": [{"class": "ml40::Engine"}], "features": [{"class": "ml40::RotationalSpeed", "rpm": 2001}]}, {"class": "ml40::Thing", "name": "my_bord_computer", "roles": [{"class": "ml40::MachineUI"}], "features": []}]}]}}
\ No newline at end of file
......@@ -13,7 +13,7 @@
from s3i import IdentityProvider
from ml.app_logger import APP_LOGGER
from ml.authentication import GRANT_TYPES
from path.path import PROJECT_ROOT
from path.path import get_root
IDENTITY_PROVIDER_URL = "https://idp.s3i.vswf.dev/"
......@@ -333,7 +333,7 @@ def make_thing_config(dt_id, name, roles, features=[]):
}
}
path = os.path.join(PROJECT_ROOT, "configs", "{}.json".format(name))
path = os.path.join(get_root(), "configs", "{}.json".format(name))
with open(path, 'wb') as file:
file.write(json.dumps(config_file).encode('utf-8'))
return "{}.json".format(name)
......@@ -345,7 +345,7 @@ def load_config(config_file_name):
:param config_filepath: Path to json formatted file.
"""
config_file_path = os.path.join(PROJECT_ROOT, "configs", config_file_name)
config_file_path = os.path.join(get_root(), "configs", config_file_name)
with open(config_file_path) as config_file:
config = json.load(config_file)
return config
......
......@@ -2,7 +2,7 @@
import sys
path = sys.modules[__name__].__file__ if __name__ == "__main__" else __file__
PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(path), os.path.pardir))
def get_root():
path = sys.modules[__name__].__file__ if __name__ == "__main__" else __file__
return os.path.abspath(os.path.join(os.path.dirname(path), os.path.pardir))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment