Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Commit

Permalink
fix online test
Browse files Browse the repository at this point in the history
  • Loading branch information
gijzelaerr committed Jul 26, 2018
1 parent 90be28f commit 539a046
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions eduvpn/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# SPDX-License-Identifier: GPL-3.0+

import json
from os import path, listdir
import os
import logging

from eduvpn.config import others_path, providers_path
Expand All @@ -14,7 +14,7 @@

logger = logging.getLogger(__name__)

distibuted_tokens_path = path.join(others_path, 'distributed.json')
distibuted_tokens_path = os.path.join(others_path, 'distributed.json')


def get_distributed_tokens():
Expand Down Expand Up @@ -51,7 +51,7 @@ def __init__(self):

@staticmethod
def from_uuid(uuid, display_name=None):
metadata_path = path.join(providers_path, uuid + '.json')
metadata_path = os.path.join(providers_path, uuid + '.json')
metadata = Metadata()
try:
with open(metadata_path, 'r') as f:
Expand All @@ -76,7 +76,7 @@ def write(self):
return
fields = [f for f in dir(self) if not f.startswith('_') and not callable(getattr(self, f))]
d = {field: getattr(self, field) for field in fields}
p = path.join(providers_path, self.uuid + '.json')
p = os.path.join(providers_path, self.uuid + '.json')
logger.info("storing metadata in {}".format(p))
serialized = json.dumps(d)
mkdir_p(providers_path)
Expand Down Expand Up @@ -115,7 +115,9 @@ def refresh_token(self):


def get_all_metadata():
metadatas = [Metadata.from_uuid(i[:-5]) for i in listdir(providers_path) if i.endswith('.json')]
if not os.access(providers_path, os.X_OK):
return []
metadatas = [Metadata.from_uuid(i[:-5]) for i in os.listdir(providers_path) if i.endswith('.json')]
return metadatas


Expand Down

0 comments on commit 539a046

Please sign in to comment.