Skip to content

Commit

Permalink
Fix #1367
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer committed Apr 6, 2022
1 parent 2e86bdd commit 6fd1574
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
11 changes: 11 additions & 0 deletions IM/connectors/EGI.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def concrete_system(self, radl_system, str_url, auth_data):
url = urlparse(str_url)
protocol = url[0]
src_host = url[1].split(':')[0]
vo = url[4]

if protocol in ["ost", "appdb"] and self.cloud.server and not self.cloud.protocol:
site_host = ""
Expand All @@ -130,6 +131,16 @@ def concrete_system(self, radl_system, str_url, auth_data):
(protocol == "appdb" and src_host == self.cloud.server)):
driver = self.get_driver(auth_data)

# In AppDB case also check the vo name, if set in the url
if protocol == "appdb" and vo:
auths = auth_data.getAuthInfo(self.type, self.cloud.server)
if not auths:
raise Exception("No auth data has been specified to EGI.")
else:
auth = self.get_egi_auth(auths)
if auth['vo'] != vo:
return None

res_system = radl_system.clone()
instance_type = self.get_instance_type(driver, res_system)
self.update_system_info_from_instance(res_system, instance_type)
Expand Down
10 changes: 10 additions & 0 deletions test/unit/connectors/EGI.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,16 @@ def test_10_concrete(self, appdb, get_driver):
self.assertEqual(concrete[0].getValue("instance_type"), "small")
self.assertNotIn("ERROR", self.log.getvalue(), msg="ERROR found in log: %s" % self.log.getvalue())

radl_system.setValue('disk.0.image.url', 'appdb://CESGA/image_apc_name?vo_name')
concrete = egi_cloud.concreteSystem(radl_system, auth)
self.assertEqual(len(concrete), 0)
self.assertNotIn("ERROR", self.log.getvalue(), msg="ERROR found in log: %s" % self.log.getvalue())

radl_system.setValue('disk.0.image.url', 'appdb://CESGA/image_apc_name?vo.access.egi.eu')
concrete = egi_cloud.concreteSystem(radl_system, auth)
self.assertEqual(len(concrete), 1)
self.assertNotIn("ERROR", self.log.getvalue(), msg="ERROR found in log: %s" % self.log.getvalue())

def create_node(self, **kwargs):
"""
Create VMs returning error only first time
Expand Down

0 comments on commit 6fd1574

Please sign in to comment.