2121import nuvolaris .config as cfg
2222import nuvolaris .util as util
2323
24- def find_default_container (containers : list , container_name , runtime_list ):
24+ def find_default_container (containers : list , container_name , runtime_list , only_apache = True ):
2525 """ Scans for the inner runtime list and add an entry into the containers for the default one if any
2626 :param containers, the global containers array
2727 :param container_name, the name that will be assigned for the containers preloader
@@ -30,26 +30,28 @@ def find_default_container(containers: list, container_name, runtime_list):
3030 for runtime in runtime_list :
3131 if runtime ['default' ]:
3232 img = runtime ['image' ]
33- container = {
34- "name" : container_name ,
35- "image" : f"{ img ['prefix' ]} /{ img ['name' ]} :{ img ['tag' ]} "
36- }
37- containers .append (container )
33+ is_apache = img ['prefix' ] == 'apache'
34+ if not only_apache or is_apache :
35+ container = {
36+ "name" : container_name ,
37+ "image" : f"{ img ['prefix' ]} /{ img ['name' ]} :{ img ['tag' ]} "
38+ }
39+ containers .append (container )
3840
39- def parse_runtimes (runtimes_as_json ):
41+ def parse_runtimes (runtimes_as_json , only_apache = True ):
4042 """ parse an openwhisk runtimes json and returns a stuitable data structure to customize the preloader jon
4143 :param runtimes_as_json a runtime json typically extracted from a config map
4244 >>> import nuvolaris.testutil as tutil
4345 >>> runtimes_as_json = tutil.load_sample_runtimes()
4446 >>> data = parse_runtimes(runtimes_as_json)
45- >>> len(data['containers']) == 8
47+ >>> len(data['containers']) == 5
4648 True
4749 """
4850 data = {}
4951 containers = list ()
5052
5153 for name in runtimes_as_json ["runtimes" ]:
52- find_default_container (containers , name , runtimes_as_json ["runtimes" ][name ])
54+ find_default_container (containers , name , runtimes_as_json ["runtimes" ][name ], only_apache )
5355
5456 data ['containers' ]= containers
5557 return data
0 commit comments