Skip to content

Commit dc57d76

Browse files
if alias is read-only, and either READ_TYPE or CMO_READ_TYPE is read-only, treat the alias as correct (#1226)
1 parent ed4884b commit dc57d76

File tree

1 file changed

+25
-10
lines changed
  • integration-tests/alias-test/verify/src/test/python/aliastest/verify

1 file changed

+25
-10
lines changed

integration-tests/alias-test/verify/src/test/python/aliastest/verify/verifier.py

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
ONLINE_REFERENCE_ONLY = 'reference_only'
3131
READ_ONLY = 'readonly'
3232
READ_TYPE = 'read_type'
33+
READ_WRITE = 'readwrite'
3334
RECHECK = 'recheck'
3435
RESTART = 'restart_required'
3536
RESTART_NO_CHECK = 'none'
@@ -486,12 +487,13 @@ def _check_attribute_exists(self, location, generated_attribute, generated_attri
486487
alias_get_required_attribute_list)
487488
if read_only is not None:
488489
if not read_only and not _is_clear_text_password(generated_attribute):
489-
message = None
490490
if CMO_READ_TYPE in generated_attribute_info and \
491491
generated_attribute_info[CMO_READ_TYPE] == READ_ONLY:
492-
message = 'LSA has READ_WRITE and CMO has READ_ONLY'
493-
self._add_error(location, ERROR_ATTRIBUTE_NOT_READONLY_VERSION,
494-
message=message, attribute=generated_attribute)
492+
# if CMO_READ_TYPE is read only, no error...
493+
pass
494+
else:
495+
self._add_error(location, ERROR_ATTRIBUTE_NOT_READONLY_VERSION,
496+
attribute=generated_attribute)
495497
else:
496498
if self._is_generated_attribute_readonly(location, generated_attribute, generated_attribute_info,
497499
alias_get_required_attribute_list):
@@ -557,6 +559,8 @@ def _is_generated_attribute_readonly(self, location, generated_attribute, genera
557559
:return: True if the generated attribute is defined as readonly
558560
"""
559561
_method_name = '_is_generated_attribute_readonly'
562+
_logger.entering(location.get_folder_path(), generated_attribute, str(generated_attribute_info),
563+
str(alias_get_required_attribute_list), class_name=CLASS_NAME, method_name=_method_name)
560564

561565
if READ_TYPE not in generated_attribute_info and CMO_READ_TYPE not in generated_attribute_info:
562566
self._add_error(location, ERROR_FAILURE_ATTRIBUTE_UNEXPECTED,
@@ -568,17 +572,28 @@ def _is_generated_attribute_readonly(self, location, generated_attribute, genera
568572
read_type = generated_attribute_info[CMO_READ_TYPE]
569573
_logger.finer('Using CMO read type {0} for attribute {1} which is in GET required list',
570574
read_type, generated_attribute, class_name=CLASS_NAME, method_name=_method_name)
575+
# elif READ_TYPE in generated_attribute_info and CMO_READ_TYPE in generated_attribute_info:
576+
# if generated_attribute_info[READ_TYPE] == READ_ONLY or generated_attribute_info[CMO_READ_TYPE] == READ_ONLY:
577+
# read_type = READ_ONLY
578+
# else:
579+
# read_type = READ_WRITE
580+
# _logger.finer('Using both LSA read type {0} and CMO read type {1} for attribute {2}',
581+
# read_type, generated_attribute_info[CMO_READ_TYPE], generated_attribute,
582+
# class_name=CLASS_NAME, method_name=_method_name)
571583
elif READ_TYPE in generated_attribute_info:
572584
read_type = generated_attribute_info[READ_TYPE]
573-
else:
574-
_logger.finer('No LSA read type found, using the CMO read type for attribute {0} at location {1}',
575-
generated_attribute, location.get_folder_path(),
585+
_logger.finer('Using both LSA read type {0} for attribute {1}', read_type, generated_attribute,
576586
class_name=CLASS_NAME, method_name=_method_name)
587+
else:
577588
read_type = generated_attribute_info[CMO_READ_TYPE]
589+
_logger.finer('No LSA read type found, using the CMO read type {0} for attribute {1} at location {2}',
590+
read_type, generated_attribute, location.get_folder_path(),
591+
class_name=CLASS_NAME, method_name=_method_name)
578592

579-
_logger.fine('The attribute {0} read type is {1}', generated_attribute, read_type,
580-
class_name=CLASS_NAME, method_name=_method_name)
581-
return read_type == READ_ONLY
593+
result = read_type == READ_ONLY
594+
595+
_logger.exiting(class_name=CLASS_NAME, method_name=_method_name, result=result)
596+
return result
582597

583598
def _is_valid_attribute_type_and_value(self, location, generated_attribute, generated_attribute_info,
584599
model_attribute_name, alias_get_required_attribute_list):

0 commit comments

Comments
 (0)