@@ -83,8 +83,10 @@ def __init__(self, config_dictionary):
8383 """
8484 if config_dictionary is None :
8585 self .config_dictionary = {}
86+ self .is_targeted = False # no target was declared, methods are still usable
8687 else :
8788 self .config_dictionary = config_dictionary
89+ self .is_targeted = True
8890
8991 def get_credentials_method (self ):
9092 """
@@ -96,10 +98,11 @@ def get_credentials_method(self):
9698 def get_results_output_method (self ):
9799 """
98100 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
100103 """
101104 result = dictionary_utils .get_element (self .config_dictionary , RESULTS_OUTPUT_METHOD )
102- if result is None :
105+ if not result and self . is_targeted :
103106 result = DEFAULT_RESULTS_OUTPUT_METHOD
104107 return result
105108
@@ -219,15 +222,26 @@ def uses_wdt_model(self):
219222 :return: True if a model is included, False otherwise
220223 """
221224 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 ]
223235
224236 def get_domain_home_source_name (self ):
225237 """
226238 Return the name associated with the domain home source type key.
227239 :return: the domain home source name
228240 """
229241 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
231245
232246 def sets_cluster_replicas (self ):
233247 """
@@ -272,11 +286,11 @@ def validate_configuration(self, exit_code, target_configuration_file):
272286 self ._validate_enumerated_field (PRODUCT_VERSION , product_version , valid_product_versions , exit_code ,
273287 target_configuration_file )
274288
275- source_type = self . _get_domain_home_source_type ( )
289+ source_type = dictionary_utils . get_element ( self . config_dictionary , DOMAIN_HOME_SOURCE_TYPE )
276290 self ._validate_enumerated_field (DOMAIN_HOME_SOURCE_TYPE , source_type , SOURCE_TYPE_NAMES .keys (), exit_code ,
277291 target_configuration_file )
278292
279- output_method = self . get_results_output_method ( )
293+ output_method = dictionary_utils . get_element ( self . config_dictionary , RESULTS_OUTPUT_METHOD )
280294 self ._validate_enumerated_field (RESULTS_OUTPUT_METHOD , output_method , RESULTS_OUTPUT_METHODS , exit_code ,
281295 target_configuration_file )
282296
@@ -287,10 +301,13 @@ def validate_configuration(self, exit_code, target_configuration_file):
287301 def _get_domain_home_source_type (self ):
288302 """
289303 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.
291306 """
292307 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
294311
295312 def _validate_enumerated_field (self , key , value , valid_values , exit_code , target_configuration_file ):
296313 method_name = '_validate_enumerated_field'
0 commit comments