Skip to content

Commit

Permalink
Merge pull request #618 from grycap/eu_node
Browse files Browse the repository at this point in the history
Add EU Node Containers
  • Loading branch information
micafer authored Jan 24, 2025
2 parents 4b6f813 + 9f9fc2c commit 6c95f6d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/cred.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def validate_cred(self, userid, new_cred):
if isequal:
return 1, "Credentials already available."

if new_cred["type"] == "EUNode":
if new_cred["type"] in ["EUNode", "EUNodeCont"]:
if new_cred["node"] == cred["node"]:
return 2, ("This site has already a Credential with the same EU Node site." +
" This may cause problems authenticating with the site." +
Expand Down
Binary file added app/static/images/EUNodeContRow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions app/templates/modal_creds.html
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,19 @@
</select>
</div>
</div>
{% elif cred_type == "EUNodeCont" %}
<div class="row form-group">
<div class="col">
<input placeholder="Token" name="token" class="col-sm-12 form-control my-1" type="text" id="token" value="{{ creds['token'] if creds else '' }}" required/>
</div>
<div class="col">
<select class="js-example-basic-single js-states form-control" id="node" name="node" required>
<option name="node" value="">-- Set EU Node Provider --</option>
<option name="node" value="eu-1" {{ "selected" if creds and creds['node'] == "eu-1" else '' }}>eu-1</option>
<option name="node" value="eu-2" {{ "selected" if creds and creds['node'] == "eu-2" else '' }}>eu-2</option>
</select>
</div>
</div>
{% else %}


Expand Down
6 changes: 5 additions & 1 deletion app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,11 @@ def getUserAuthData(access_token, cred, userid, cred_id=None, full=False, add_ex
for cred in creds:
if cred['enabled'] and (cred_id is None or cred_id == cred['id'] or cred['id'] in extra_auth_ids):
res += "\\nid = %s" % cred['id']
if cred['type'] == "EUNode":
if cred['type'] == "EUNodeCont":
# Add the EUNode provider as Kubernetes
res += "; type = Kubernetes; token = '%s';" % cred['token']
res += " host = https://api.%s.paas.open-science-cloud.ec.europa.eu:6443" % cred['node']
elif cred['type'] == "EUNode":
# Add the EUNode provider as OpenStack
res += "; type = OpenStack; auth_version = 3.x_appcred;"
res += " host = https://api.%s.iaas.open-science-cloud.ec.europa.eu:5000" % cred['node']
Expand Down

0 comments on commit 6c95f6d

Please sign in to comment.