| @@ 8-60 (lines=53) @@ | ||
| 5 | import os |
|
| 6 | ||
| 7 | ||
| 8 | def parse_args(): |
|
| 9 | p = argparse.ArgumentParser() |
|
| 10 | p.add_argument( |
|
| 11 | "--input-dir", |
|
| 12 | help="Input directory that contains all Ansible remediations " |
|
| 13 | "snippets for the product we are building. " |
|
| 14 | "e.g. ~/scap-security-guide/build/fedora/fixes/ansible. " |
|
| 15 | "If --input-dir is not specified, it is derived from --ssg-root." |
|
| 16 | ) |
|
| 17 | p.add_argument( |
|
| 18 | "--output-dir", |
|
| 19 | help="Output directory to which the rule-based Ansible playbooks " |
|
| 20 | "will be generated. " |
|
| 21 | "e.g. ~/scap-security-guide/build/fedora/playbooks. " |
|
| 22 | "If --output-dir is not specified, it is derived from --ssg-root." |
|
| 23 | ) |
|
| 24 | p.add_argument( |
|
| 25 | "--resolved-rules-dir", |
|
| 26 | help="Directory that contains preprocessed rules in YAML format " |
|
| 27 | "eg. ~/scap-security-guide/build/fedora/rules. " |
|
| 28 | "If --resolved-rules-dir is not specified, it is derived from " |
|
| 29 | "--ssg-root." |
|
| 30 | ) |
|
| 31 | p.add_argument( |
|
| 32 | "--resolved-profiles-dir", |
|
| 33 | help="Directory that contains preprocessed profiles in YAML format " |
|
| 34 | "eg. ~/scap-security-guide/build/fedora/profiles. " |
|
| 35 | "If --resolved-profiles-dir is not specified, it is derived from " |
|
| 36 | "--ssg-root." |
|
| 37 | ) |
|
| 38 | p.add_argument( |
|
| 39 | "--ssg-root", required=True, |
|
| 40 | help="Directory containing the source tree. " |
|
| 41 | "e.g. ~/scap-security-guide/" |
|
| 42 | ) |
|
| 43 | p.add_argument( |
|
| 44 | "--product", required=True, |
|
| 45 | help="ID of the product for which we are building Playbooks. " |
|
| 46 | "e.g.: 'fedora'" |
|
| 47 | ) |
|
| 48 | p.add_argument( |
|
| 49 | "--profile", |
|
| 50 | help="Generate Playbooks only for given Profile ID. Accepts profile " |
|
| 51 | "ID in the short form, eg. 'ospp'. If not specified, Playbooks are " |
|
| 52 | "built for all available profiles." |
|
| 53 | ) |
|
| 54 | p.add_argument( |
|
| 55 | "--rule", |
|
| 56 | help="Generate Ansible Playbooks only for given rule specified by " |
|
| 57 | "a shortened Rule ID, eg. 'package_sendmail_removed'. " |
|
| 58 | "If not specified, Playbooks are built for every rule." |
|
| 59 | ) |
|
| 60 | return p.parse_args() |
|
| 61 | ||
| 62 | ||
| 63 | def main(): |
|
| @@ 12-45 (lines=34) @@ | ||
| 9 | import ssg.templates |
|
| 10 | ||
| 11 | ||
| 12 | def parse_args(): |
|
| 13 | p = argparse.ArgumentParser() |
|
| 14 | p.add_argument( |
|
| 15 | "--build-config-yaml", required=True, |
|
| 16 | help="YAML file with information about the build configuration. " |
|
| 17 | "e.g.: ~/scap-security-guide/build/build_config.yml" |
|
| 18 | ) |
|
| 19 | p.add_argument( |
|
| 20 | "--product-yaml", required=True, |
|
| 21 | help="YAML file with information about the product we are building. " |
|
| 22 | "e.g.: ~/scap-security-guide/rhel7/product.yml" |
|
| 23 | ) |
|
| 24 | p.add_argument( |
|
| 25 | "--resolved-rules-dir", required=True, |
|
| 26 | help="Directory with <rule-id>.yml resolved rule YAMLs. " |
|
| 27 | "e.g.: ~/scap-security-guide/build/rhel7/rules" |
|
| 28 | ) |
|
| 29 | p.add_argument( |
|
| 30 | "--templates-dir", required=True, |
|
| 31 | help="Path to directory which contains content templates. " |
|
| 32 | "e.g.: ~/scap-security-guide/shared/templates" |
|
| 33 | ) |
|
| 34 | p.add_argument( |
|
| 35 | "--checks-dir", required=True, |
|
| 36 | help="Path to which OVAL checks will be generated. " |
|
| 37 | "e.g.: ~/scap-security-guide/build/rhel7/checks" |
|
| 38 | ) |
|
| 39 | p.add_argument( |
|
| 40 | "--remediations-dir", required=True, |
|
| 41 | help="Path to which remediations will be generated. " |
|
| 42 | "e.g.: ~/scap-security-guide/build/rhel7/fixes_from_templates" |
|
| 43 | ) |
|
| 44 | args = p.parse_args() |
|
| 45 | return args |
|
| 46 | ||
| 47 | ||
| 48 | if __name__ == "__main__": |
|