Skip to content

Commit

Permalink
Fix style
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer committed Jan 26, 2021
1 parent 972c6f3 commit a908c02
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions app/appdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,20 +131,21 @@ def get_images(site_id, vo):
va_data = appdb_call('/rest/1.0/va_providers/%s' % site_id)

images = []
if 'provider:image' in va_data['virtualization:provider'] and va_data['virtualization:provider']['provider:image']:
if ('provider:image' in va_data['virtualization:provider'] and
va_data['virtualization:provider']['provider:image']):
if isinstance(va_data['virtualization:provider']['provider:image'], list):
images = va_data['virtualization:provider']['provider:image']
else:
images = [va_data['virtualization:provider']['provider:image']]

for os_tpl in images:
try:
if '@voname' in os_tpl and vo in os_tpl['@voname'] and os_tpl['@archived'] == "false":
oss.append(os_tpl['@appcname'])
except Exception:
continue
except Exception:
pass
oss = []

return oss

Expand Down
2 changes: 1 addition & 1 deletion app/tests/test_appdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ def test_get_project_ids(self, appdb_call):
self.assertEquals(res, {"vo.access.egi.eu": "3a8e9d966e644405bf19b536adf7743d",
"covid-19.eosc-synergy.eu": "972298c557184a2192ebc861f3184da8"})


@patch('app.appdb.appdb_call')
def test_get_images(self, appdb_call):
images = """<virtualization:provider id="11548G0">
Expand All @@ -133,5 +132,6 @@ def test_get_images(self, appdb_call):
res = appdb.get_images('11548G0', 'vo.access.egi.eu')
self.assertEquals(res, ["scipioncloud.gpu"])


if __name__ == '__main__':
unittest.main()

0 comments on commit a908c02

Please sign in to comment.