Skip to content

Commit ed647a5

Browse files
committed
Revert "Implements #283"
This reverts commit b067f0d.
1 parent 5a9dd76 commit ed647a5

7 files changed

Lines changed: 12 additions & 211 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Create the `config.json` file (see the [example](app/config-sample.json)) settin
5858
| ANALYTICS_TAG | Google Analytic Tag | N | "" |
5959
| STATIC_SITES | List of static sites added to the AppDB ones ([{"name": "static_site_name", "url": "static_site_url", "id": "static_id", "vos": {"vo": "stprojectid"}}]) | N | [] |
6060
| STATIC_SITES_URL | URL of a JSON file with the list of static sites added to the AppDB ones | N | "" |
61-
| SITES_CACHE_TIMEOUT | AppDB cache TTL | N | 3600 |
61+
| APPDB_CACHE_TIMEOUT | AppDB cache TTL | N | 3600 |
6262
| CHECK_TOSCA_CHANGES_TIME | Interval to look for changes in TOSCA templates | N | 120 |
6363
| VAULT_URL | Vault service URL to store Cloud credentials | N | None |
6464

app/__init__.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@
3636
from app.im import InfrastructureManager
3737
from app.ssh_key import SSHKey
3838
from app.ott import OneTimeTokenData
39-
from app import utils, db
40-
from app import appdb as sitesInfo
39+
from app import utils, appdb, db
4140
from app.vault_info import VaultInfo
4241
from oauthlib.oauth2.rfc6749.errors import InvalidTokenError, TokenExpiredError, InvalidGrantError
4342
from werkzeug.exceptions import Forbidden
@@ -778,8 +777,8 @@ def getsites(vo=None):
778777
for site_name, site in static_sites.items():
779778
res += '<option name="selectedSite" value=%s>%s</option>' % (site['url'], site_name)
780779

781-
sites = utils.getSiteInfoProvider().get_sites(vo)
782-
for site_name, site in sites.items():
780+
appdb_sites = appdb.get_sites(vo)
781+
for site_name, site in appdb_sites.items():
783782
# avoid site duplication
784783
if site_name not in static_sites:
785784
if site["state"]:
@@ -808,7 +807,7 @@ def getimages(cred_id=None):
808807

809808
else:
810809
site, _, vo = utils.get_site_info(cred_id, cred, get_cred_id())
811-
for image_name, image_id in utils.getSiteInfoProvider().get_images(site['id'], vo):
810+
for image_name, image_id in appdb.get_images(site['id'], vo):
812811
res += '<option name="selectedImage" value=%s>%s</option>' % (image_id, image_name)
813812
return res
814813

@@ -1540,7 +1539,7 @@ def handle_csrf_error(e):
15401539
# Reload internally the site cache
15411540
@scheduler.task('interval', id='reload_sites', seconds=5)
15421541
def reload_sites():
1543-
scheduler.modify_job('reload_sites', trigger='interval', seconds=settings.sites_cache_timeout - 30)
1542+
scheduler.modify_job('reload_sites', trigger='interval', seconds=settings.appdb_cache_timeout - 30)
15441543
with app.app_context():
15451544
app.logger.debug('Reload Site List.')
15461545
g.settings = settings

app/config-sample.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"MOTOMO_INFO": {"url": "", "siteid": ""},
1717
"STATIC_SITES": [{"name": "static_site_name", "url": "static_site_url", "id": "static_id", "vos": {"vo": "stprojectid"}, "api_version": "1.1"}],
1818
"STATIC_SITES_URL": "",
19-
"SITES_CACHE_TIMEOUT": 3600,
19+
"APPDB_CACHE_TIMEOUT": 3600,
2020
"CHECK_TOSCA_CHANGES_TIME": 120,
2121
"IM_TIMEOUT": 60,
2222
"VAULT_URL": "",

app/egi_catch_all.py

Lines changed: 0 additions & 84 deletions
This file was deleted.

app/settings.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def __init__(self, config):
4141
self.motomo_info = config.get('MOTOMO_INFO')
4242
self.static_sites = config.get('STATIC_SITES', [])
4343
self.static_sites_url = config.get('STATIC_SITES_URL', "")
44-
self.sites_cache_timeout = config.get('SITES_CACHE_TIMEOUT', 3600)
44+
self.appdb_cache_timeout = config.get('APPDB_CACHE_TIMEOUT', 3600)
4545
self.debug_oidc_token = config.get('DEBUG_OIDC_TOKEN', None)
4646
self.imTimeout = config.get('IM_TIMEOUT', 60)
4747
self.checkToscaChangesTime = config.get('CHECK_TOSCA_CHANGES_TIME', 120)
@@ -52,4 +52,3 @@ def __init__(self, config):
5252
self.vos_user_role = config.get('VOS_USER_ROLE')
5353
self.enable_external_vault = config.get('ENABLE_EXTERNAL_VAULT', False)
5454
self.hide_tosca_tags = config.get('HIDE_TOSCA_TAGS', [])
55-
self.site_info_provider = config.get('SITE_INFO_PROVIDER', 'AppDB')

app/tests/test_egi_catch_all.py

Lines changed: 0 additions & 103 deletions
This file was deleted.

app/utils.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
from requests.packages.urllib3.exceptions import InsecureRequestWarning
4040

4141
from app import appdb
42-
from app import egi_catch_all
4342

4443
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
4544
urllib3.disable_warnings(InsecureRequestWarning)
@@ -74,13 +73,6 @@ def _getStaticSitesInfo(force=False):
7473
return []
7574

7675

77-
def getSiteInfoProvider():
78-
if g.settings.site_info_provider == "AppDB":
79-
return appdb
80-
elif g.settings.site_info_provider == "EGI Catch All":
81-
return egi_catch_all
82-
83-
8476
def getCachedProjectIDs(site_id):
8577
res = {}
8678
for site in getCachedSiteList().values():
@@ -89,7 +81,7 @@ def getCachedProjectIDs(site_id):
8981
site["vos"] = {}
9082
if "vos_updated" not in site or not site["vos_updated"]:
9183
try:
92-
site["vos"].update(getSiteInfoProvider().get_project_ids(site_id))
84+
site["vos"].update(appdb.get_project_ids(site_id))
9385
site["vos_updated"] = True
9486
except Exception as ex:
9587
print("Error loading project IDs from AppDB: %s" % ex, file=sys.stderr)
@@ -105,8 +97,6 @@ def getStaticSites(vo=None, force=False):
10597
if vo is None or ("vos" in site and site["vos"] and vo in site["vos"]):
10698
res[site["name"]] = site
10799
site["state"] = ""
108-
if g.settings.site_info_provider == "EGI Catch All":
109-
site["id"] = site["name"]
110100

111101
return res
112102

@@ -148,11 +138,11 @@ def getCachedSiteList(force=False):
148138
global LAST_UPDATE
149139

150140
now = int(time.time())
151-
if force or not SITE_LIST or now - LAST_UPDATE > g.settings.sites_cache_timeout:
141+
if force or not SITE_LIST or now - LAST_UPDATE > g.settings.appdb_cache_timeout:
152142
try:
153-
sites = getSiteInfoProvider().get_sites()
143+
sites = appdb.get_sites()
154144
if sites:
155-
SITE_LIST = getSiteInfoProvider().get_sites()
145+
SITE_LIST = appdb.get_sites()
156146
# in case of error do not update time
157147
LAST_UPDATE = now
158148
except Exception as ex:

0 commit comments

Comments
 (0)