File: compile_product.py

package info (click to toggle)
scap-security-guide 0.1.76-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 110,644 kB
  • sloc: xml: 241,883; sh: 73,777; python: 32,527; makefile: 27
file content (36 lines) | stat: -rw-r--r-- 974 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import argparse

import ssg.products


def create_parser():
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--product-yaml", required=True,
        help="YAML file with information about the product we are building. "
        "e.g.: ~/scap-security-guide/products/rhel9/product.yml "
        "needed for autodetection of profile root"
    )
    parser.add_argument(
        "--product-properties",
        help="The directory with additional product properties yamls."
    )
    parser.add_argument(
        "--compiled-product-yaml", required=True,
        help="Where to save the compiled product yaml."
    )
    return parser


def main():
    parser = create_parser()
    args = parser.parse_args()

    product = ssg.products.Product(args.product_yaml)
    if args.product_properties:
        product.read_properties_from_directory(args.product_properties)
    product.write(args.compiled_product_yaml)


if __name__ == "__main__":
    main()