Skip to content

Commit

Permalink
Merge branch 'master' into vmimage_by_name
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer authored Jan 10, 2023
2 parents d3f8275 + 9fa4bc2 commit 17ca7c6
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 507 deletions.
3 changes: 3 additions & 0 deletions IM/InfrastructureInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,9 @@ def update_radl(self, radl, deployed_vms, warn=True):

with self._lock:
original_radl = self.radl.clone()
# Add the description field
if radl.description:
self.radl.add(radl.description.clone(), "replace")
# Add new networks ad ansible_hosts only
for s in radl.networks + radl.ansible_hosts:
if not self.radl.add(s.clone(), "ignore") and warn:
Expand Down
36 changes: 36 additions & 0 deletions IM/InfrastructureManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

from IM.VMRC import VMRC
from IM.AppDBIS import AppDBIS
from IM.AppDB import AppDB
from IM.CloudInfo import CloudInfo
from IM.auth import Authentication
from IM.recipe import Recipe
Expand Down Expand Up @@ -1464,6 +1465,40 @@ def gen_auth_from_appdb(auth):
InfrastructureManager.logger.error("Error getting auth data from AppDBIS: %s" % sites)
return auth

@staticmethod
def translate_egi_to_ost(auth):
# Gen OST auth for all EGI auth sent
res = []
for auth_item in auth.auth_list:
if auth_item.get('type') == "EGI":
if 'host' in auth_item and 'vo' in auth_item and 'token' in auth_item:
ost_auth = {'id': auth_item['id'], 'type': 'OpenStack', 'username': 'egi.eu', 'tenant': 'openid',
'password': auth_item['token'], 'auth_version': '3.x_oidc_access_token',
'vo': auth_item['vo']}
site_id = AppDB.get_site_id(auth_item["host"], stype="openstack")
site_url = AppDB.get_site_url(site_id)
if not site_url:
InfrastructureManager.logger.error("Site name '%s' not found at AppDB." % auth_item['host'])
continue
ost_auth['host'] = site_url
projects = AppDB.get_project_ids(site_id)
# If the VO does not appear in the project IDs
if auth_item['vo'] in projects:
ost_auth['domain'] = projects[auth_item['vo']]
else:
# let's use the VO name directly
ost_auth['domain'] = auth_item['vo']

if 'api_version' in auth_item:
ost_auth['api_version'] = auth_item['api_version']

res.append(ost_auth)
else:
res.append(auth_item)

auth.auth_list = res
return auth

@staticmethod
def check_auth_data(auth):
# First check if it is configured to check the users from a list
Expand Down Expand Up @@ -1505,6 +1540,7 @@ def check_auth_data(auth):
# We have to check if TTS is needed for other auth item
auth = InfrastructureManager.get_auth_from_vault(auth)
auth = InfrastructureManager.gen_auth_from_appdb(auth)
auth = InfrastructureManager.translate_egi_to_ost(auth)
return auth

@staticmethod
Expand Down
209 changes: 0 additions & 209 deletions IM/connectors/EGI.py

This file was deleted.

11 changes: 9 additions & 2 deletions IM/connectors/OpenStack.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,13 @@ def concrete_system(self, radl_system, str_url, auth_data):
if not username:
res_system.setValue('disk.0.os.credentials.username', self.DEFAULT_USER)

auths = auth_data.getAuthInfo(self.type, self.cloud.server)
if auths:
auth = self.get_auth(auths)
if auth.get("vo"):
res_system.addFeature(Feature("provider.vo", "=", auth.get("vo")),
conflict="other", missing="other")

return res_system
else:
return None
Expand Down Expand Up @@ -2023,7 +2030,7 @@ def list_images(self, auth_data, filters=None):
return images

@staticmethod
def _get_tenant_id(driver, auth):
def _get_tenant_id(auth):
"""
Workaround function to get tenant id from tenant name
"""
Expand All @@ -2039,7 +2046,7 @@ def _get_tenant_id(driver, auth):

def get_quotas(self, auth_data):
driver = self.get_driver(auth_data)
tenant_id = self._get_tenant_id(driver, auth_data.getAuthInfo(self.type, self.cloud.server)[0])
tenant_id = self._get_tenant_id(auth_data.getAuthInfo(self.type, self.cloud.server)[0])
quotas = driver.ex_get_quota_set(tenant_id)
try:
net_quotas = driver.ex_get_network_quotas(tenant_id)
Expand Down
2 changes: 1 addition & 1 deletion IM/connectors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@


__all__ = ['CloudConnector', 'EC2', 'OCCI', 'OpenNebula', 'OpenStack', 'Docker', 'GCE', 'FogBow',
'Azure', 'DeployedNode', 'Kubernetes', 'Dummy', 'vSphere', 'CloudStack', 'Linode', 'Orange', 'EGI',
'Azure', 'DeployedNode', 'Kubernetes', 'Dummy', 'vSphere', 'CloudStack', 'Linode', 'Orange',
'OSCAR', 'Lambda']
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
[![Codacy Badge](https://app.codacy.com/project/badge/Coverage/582a0d6e763f44bdade11133e5191439)](https://www.codacy.com/gh/grycap/im/dashboard?utm_source=github.com&utm_medium=referral&utm_content=grycap/im&utm_campaign=Badge_Coverage)
[![License](https://img.shields.io/badge/license-GPL%20v3.0-brightgreen.svg)](LICENSE)
[![Docs](https://img.shields.io/badge/docs-latest-brightgreen.svg)](https://imdocs.readthedocs.io/en/latest/)
[![SQAaaS badge](https://img.shields.io/badge/sqaaas%20software-gold-yellow)](https://eu.badgr.com/public/assertions/rXQbYl_9SiCN7P-QCdu7Ig)

IM is a tool that deploys complex and customized virtual infrastructures on
IaaS Cloud deployments (such as AWS, OpenStack, etc.). It eases the access and
Expand All @@ -30,6 +31,14 @@ Miguel Caballer, Ignacio Blanquer, German Molto, and Carlos de Alfonso.
Journal of Grid Computing, Volume 13, Issue 1, Pages 53-70, 2015, ISSN
1570-7873, DOI: 10.1007/s10723-014-9296-5.

## Achievements

[![SQAaaS badge](https://github.com/EOSC-synergy/SQAaaS/raw/master/badges/badges_150x116/badge_software_gold.png)](https://eu.badgr.com/public/assertions/rXQbYl_9SiCN7P-QCdu7Ig "SQAaaS gold badge achieved")

This software has received a gold badge according to the
[Software Quality Baseline criteria](https://github.com/indigo-dc/sqa-baseline)
defined by the [EOSC-Synergy](https://www.eosc-synergy.eu) project.

## 1 DOCKER IMAGE (Recommended Option)

The recommended option to use the Infrastructure Manager service is using the
Expand Down
Loading

0 comments on commit 17ca7c6

Please sign in to comment.