Skip to content

Commit

Permalink
Use a dictionary as the env_yaml argument
Browse files Browse the repository at this point in the history
Formerly, the product_yaml contents were used,
which broke after it ceased to be a dictionary.
  • Loading branch information
matejak committed May 5, 2023
1 parent eca16af commit 1016902
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 2 additions & 3 deletions utils/fix_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,11 @@ def find_rules_generator(args, func):
product = rule_obj['products'][0]

if product not in product_yamls:
product_path = os.path.join(args.root, "products", product, 'product.yml')
product_path = ssg.products.product_yaml_path(args.root, product)
product_yaml = ssg.products.load_product_yaml(product_path)
product_yaml['cmake_build_type'] = 'Debug'
product_yamls[product] = product_yaml

local_env_yaml = dict()
local_env_yaml = dict(cmake_build_type='Debug')
local_env_yaml.update(product_yamls[product])
local_env_yaml['rule_id'] = rule_id

Expand Down
9 changes: 6 additions & 3 deletions utils/rule_dir_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,10 @@ def handle_rule_yaml(product_list, product_yamls, rule_id, rule_dir, guide_dir):
rule_file = ssg.rules.get_rule_dir_yaml(rule_dir)

prod_type = product_list[0]
product_yaml = product_yamls[prod_type]
env_yaml = dict()
env_yaml.update(product_yamls[prod_type])

rule_yaml = ssg.build_yaml.Rule.from_yaml(rule_file, product_yaml)
rule_yaml = ssg.build_yaml.Rule.from_yaml(rule_file, env_yaml)
rule_products = set()
for product in product_list:
if ssg.utils.is_applicable(rule_yaml.prodtype, product):
Expand Down Expand Up @@ -155,8 +156,10 @@ def handle_remediations(product_list, product_yamls, rule_obj):
prod_type = r_product
product_yaml = product_yamls[prod_type]

env_yaml = dict()
env_yaml.update(product_yaml)
_, config = ssg.build_remediations.parse_from_file_with_jinja(
r_path, product_yaml
r_path, env_yaml
)
platforms = config['platform']
if not platforms:
Expand Down

0 comments on commit 1016902

Please sign in to comment.