This function is used to parse acl. :param source: Source Dict :param target: Target Dict :param diff_dict: Difference Dict
(source, target, diff_dict)
| 790 | |
| 791 | |
| 792 | def parse_acl(source, target, diff_dict): |
| 793 | """ |
| 794 | This function is used to parse acl. |
| 795 | |
| 796 | :param source: Source Dict |
| 797 | :param target: Target Dict |
| 798 | :param diff_dict: Difference Dict |
| 799 | """ |
| 800 | acl_keys = ['datacl', 'relacl', 'typacl', 'pkgacl', 'fsrvacl'] |
| 801 | key = is_key_exists(acl_keys, source) |
| 802 | |
| 803 | # If key is not found in source then check the key is available |
| 804 | # in target. |
| 805 | key = _check_key_in_source_target(key, acl_keys, target, source) |
| 806 | |
| 807 | tmp_source = source[key] if\ |
| 808 | key in source and source[key] is not None else [] |
| 809 | tmp_target = copy.deepcopy(target[key]) if\ |
| 810 | key in target and target[key] is not None else [] |
| 811 | |
| 812 | diff = {'added': [], 'deleted': []} |
| 813 | for acl in tmp_source: |
| 814 | if acl in tmp_target: |
| 815 | tmp_target.remove(acl) |
| 816 | elif acl not in tmp_target: |
| 817 | diff['added'].append(acl) |
| 818 | diff['deleted'] = tmp_target |
| 819 | |
| 820 | # Update the key if there are some element in added or deleted |
| 821 | # else remove that key from diff dict |
| 822 | if len(diff['added']) > 0 or len(diff['deleted']) > 0: |
| 823 | diff_dict.update({key: diff}) |
| 824 | elif key in diff_dict: |
| 825 | diff_dict.pop(key) |
| 826 | |
| 827 | |
| 828 | def sort_list(source, target): |
no test coverage detected