@@ -83,8 +83,10 @@ def __init__(self, config_dictionary):
83
83
"""
84
84
if config_dictionary is None :
85
85
self .config_dictionary = {}
86
+ self .is_targeted = False # no target was declared, methods are still usable
86
87
else :
87
88
self .config_dictionary = config_dictionary
89
+ self .is_targeted = True
88
90
89
91
def get_credentials_method (self ):
90
92
"""
@@ -96,10 +98,11 @@ def get_credentials_method(self):
96
98
def get_results_output_method (self ):
97
99
"""
98
100
Returns the method for generating results output.
99
- :return: "default" (script and additional files) or "json" (single results file)
101
+ :return: "default" (script and additional files) or "json" (single results file), or None if not
102
+ using a targeted configuration
100
103
"""
101
104
result = dictionary_utils .get_element (self .config_dictionary , RESULTS_OUTPUT_METHOD )
102
- if result is None :
105
+ if not result and self . is_targeted :
103
106
result = DEFAULT_RESULTS_OUTPUT_METHOD
104
107
return result
105
108
@@ -219,15 +222,26 @@ def uses_wdt_model(self):
219
222
:return: True if a model is included, False otherwise
220
223
"""
221
224
source_type = self ._get_domain_home_source_type ()
222
- return source_type == MODEL_IN_IMAGE_SOURCE_TYPE
225
+ return source_type in [None , MODEL_IN_IMAGE_SOURCE_TYPE ]
226
+
227
+ def uses_opss_secrets (self ):
228
+ """
229
+ Determine if OPSS secrets are applicable to this target configuration.
230
+ They are applicable for non-targeted scenarios.
231
+ :return: True if a model is included, False otherwise
232
+ """
233
+ source_type = self ._get_domain_home_source_type ()
234
+ return source_type not in [MODEL_IN_IMAGE_SOURCE_TYPE , PERSISTENT_VOLUME_SOURCE_TYPE ]
223
235
224
236
def get_domain_home_source_name (self ):
225
237
"""
226
238
Return the name associated with the domain home source type key.
227
239
:return: the domain home source name
228
240
"""
229
241
source_type = self ._get_domain_home_source_type ()
230
- return SOURCE_TYPE_NAMES [source_type ]
242
+ if source_type :
243
+ return SOURCE_TYPE_NAMES [source_type ]
244
+ return None
231
245
232
246
def sets_cluster_replicas (self ):
233
247
"""
@@ -272,11 +286,11 @@ def validate_configuration(self, exit_code, target_configuration_file):
272
286
self ._validate_enumerated_field (PRODUCT_VERSION , product_version , valid_product_versions , exit_code ,
273
287
target_configuration_file )
274
288
275
- source_type = self . _get_domain_home_source_type ( )
289
+ source_type = dictionary_utils . get_element ( self . config_dictionary , DOMAIN_HOME_SOURCE_TYPE )
276
290
self ._validate_enumerated_field (DOMAIN_HOME_SOURCE_TYPE , source_type , SOURCE_TYPE_NAMES .keys (), exit_code ,
277
291
target_configuration_file )
278
292
279
- output_method = self . get_results_output_method ( )
293
+ output_method = dictionary_utils . get_element ( self . config_dictionary , RESULTS_OUTPUT_METHOD )
280
294
self ._validate_enumerated_field (RESULTS_OUTPUT_METHOD , output_method , RESULTS_OUTPUT_METHODS , exit_code ,
281
295
target_configuration_file )
282
296
@@ -287,10 +301,13 @@ def validate_configuration(self, exit_code, target_configuration_file):
287
301
def _get_domain_home_source_type (self ):
288
302
"""
289
303
Get the domain home source type (private method).
290
- :return: the domain home source type key, or the default MODEL_IN_IMAGE_SOURCE_TYPE
304
+ :return: the configured domain home source type key, or MODEL_IN_IMAGE_SOURCE_TYPE. If not using a
305
+ targeted configuration, None is returned.
291
306
"""
292
307
source_type = dictionary_utils .get_element (self .config_dictionary , DOMAIN_HOME_SOURCE_TYPE )
293
- return source_type or MODEL_IN_IMAGE_SOURCE_TYPE
308
+ if not source_type and self .is_targeted :
309
+ source_type = MODEL_IN_IMAGE_SOURCE_TYPE
310
+ return source_type
294
311
295
312
def _validate_enumerated_field (self , key , value , valid_values , exit_code , target_configuration_file ):
296
313
method_name = '_validate_enumerated_field'
0 commit comments