21
21
import nuvolaris .config as cfg
22
22
import nuvolaris .util as util
23
23
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 ):
25
25
""" Scans for the inner runtime list and add an entry into the containers for the default one if any
26
26
:param containers, the global containers array
27
27
: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):
30
30
for runtime in runtime_list :
31
31
if runtime ['default' ]:
32
32
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 )
38
40
39
- def parse_runtimes (runtimes_as_json ):
41
+ def parse_runtimes (runtimes_as_json , only_apache = True ):
40
42
""" parse an openwhisk runtimes json and returns a stuitable data structure to customize the preloader jon
41
43
:param runtimes_as_json a runtime json typically extracted from a config map
42
44
>>> import nuvolaris.testutil as tutil
43
45
>>> runtimes_as_json = tutil.load_sample_runtimes()
44
46
>>> data = parse_runtimes(runtimes_as_json)
45
- >>> len(data['containers']) == 8
47
+ >>> len(data['containers']) == 5
46
48
True
47
49
"""
48
50
data = {}
49
51
containers = list ()
50
52
51
53
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 )
53
55
54
56
data ['containers' ]= containers
55
57
return data
0 commit comments