Skip to content

Commit

Permalink
Merge pull request #12454 from teacup-on-rockingchair/fix_control_pro…
Browse files Browse the repository at this point in the history
…duct_ambiguity_on_load

Fix issue with ambiguity of control product
  • Loading branch information
jan-cerny authored Oct 30, 2024
2 parents 26bb026 + adf59e6 commit 6f123a7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/manual/developer/03_creating_content.md
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,7 @@ original_title: used as a reference for policies not yet available in English
source: a link to the original policy, eg. a URL of a PDF document
controls_dir: a directory containing files representing controls that will be imported into this policy
reference_type: Reference type represented by control IDs in this policy.
product: product ID, set if the policy is specific to a single product.
product: list of product IDs, set if the policy is specific to a single or number of products.
levels: a list of levels, the first one is default
- id: level ID (required key)
inherits_from: a list of IDs of levels inheriting from
Expand Down
6 changes: 5 additions & 1 deletion ssg/controls.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,11 @@ def load(self):
self.title = ssg.utils.required_key(yaml_contents, "title")
self.source = yaml_contents.get("source", "")
self.reference_type = yaml_contents.get("reference_type", None)
self.product = yaml_contents.get("product", None)
yaml_product = yaml_contents.get("product", None)
if isinstance(yaml_product, list):
self.product = yaml_product
elif yaml_product is not None:
self.product = [yaml_product]

default_level_dict = {"id": "default"}
level_list = yaml_contents.get("levels", [default_level_dict])
Expand Down

0 comments on commit 6f123a7

Please sign in to comment.