Skip to content

Commit

Permalink
allow mutiple catalogs
Browse files Browse the repository at this point in the history
  • Loading branch information
iakov-aws committed Nov 5, 2023
1 parent b5759b0 commit a830b45
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions cid/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ def __init__(self, **kwargs) -> None:
self.verbose = kwargs.get('verbose')
set_parameters(kwargs, self.all_yes)
self._logger = None
self.catalog_url = 'https://raw.githubusercontent.com/aws-samples/aws-cudos-framework-deployment/dashboards/catalog.yaml'
self.catalog_urls = [
'https://raw.githubusercontent.com/aws-samples/aws-cudos-framework-deployment/dashboards/catalog.yaml',
]

def aws_login(self):
params = {
Expand Down Expand Up @@ -290,7 +292,10 @@ def get_page(self, source):
def load_resources(self):
''' load additional resources from command line parameters
'''
self.load_catalog()
if get_parameters().get('catalog'):
self.catalog_urls = get_parameters().get('catalog').split(',')
for catalog_url in self.catalog_urls:
self.load_catalog(catalog_url)
if get_parameters().get('resources'):
source = get_parameters().get('resources')
self.load_resource_file(source)
Expand All @@ -312,10 +317,9 @@ def load_resource_file(self, source):
return
self.resources = always_merger.merge(self.resources, resources)

def load_catalog(self, catalog_url=None):
def load_catalog(self, catalog_url):
''' load additional resources from catalog
'''
catalog_url = get_parameters().get('catalog') or self.catalog_url
try:
catalog = yaml.safe_load(self.get_page(catalog_url).text)
except requests.exceptions.HTTPError as exc:
Expand Down

0 comments on commit a830b45

Please sign in to comment.