Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed DFR3 service's out of index error #564

5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).


## [Unrelased]

### Fixed
- Out of index error in dfr3 service's property conversion when the rule is not found [#555](https://github.com/IN-CORE/pyincore/issues/555)

## [1.18.1] - 2024-04-30

### Changed
Expand Down
7 changes: 7 additions & 0 deletions pyincore/dfr3service.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,10 +395,17 @@ def _convert_properties_to_dict(rules, properties):
matched_properties = {}
# Handle legacy rules
if isinstance(rules, list):
# If the rules are empty, return the matched properties
if not rules:
return matched_properties
ywkim312 marked this conversation as resolved.
Show resolved Hide resolved
for i, and_rules in enumerate(rules):
for j, rule in enumerate(and_rules):
matched_properties.update(Dfr3Service._eval_property_from_inventory(rule, properties))
elif isinstance(rules, dict):
# If the rules are empty, return the matched properties
if not rules:
return matched_properties

# Handles new style of rules
boolean = list(rules.keys())[0] # AND or OR
criteria = rules[boolean]
Expand Down
Loading