| 1 | #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash |
| 2 | . $builddir/tests/test_common.sh |
| 3 | |
| 4 | set -e |
| 5 | set -o pipefail |
| 6 | |
| 7 | profile="xccdf_moc.elpmaxe.www_profile_standard" |
| 8 | |
| 9 | name=$(basenamescip-shell system . . basename. $0 .sh) |
| 10 | stderr=$(mktempscip-shell system . . mktemp. -t ${name}.err.XXXXXX) |
| 11 | playbook=$(mktempscip-shell system . . mktemp. -t ${name}.yml.XXXXXX) |
| 12 | playbook_without_header=$(mktempscip-shell system . . mktemp. -t ${name}.yml.XXXXXX) |
| 13 | |
| 14 | # Generate an Ansible playbook from a profile in SDS file |
| 15 | $OSCAP xccdf generate fix --profile $profile --fix-type ansible "$srcdir/$name.xccdf.xml" >$playbook 2>$stderr |
| 16 | sedscip-shell system . . sed. '/^#/dscip-shell filesystem . . `/^#/d`.' $playbook > $playbook_without_header |
| 17 | diffscip-shell system . . diff. -u $playbook_without_header $srcdir/$name.playbook.yml |
| 18 | [scip-shell system . . `[`. -f $stderr ]; [scip-shell system . . `[`. ! -s $stderr ]; rmscip-shell system . . rm. $stderr |
| 19 | |
| 20 | rmscip-shell system . . rm. $playbook |
| 21 | rmscip-shell system . . rm. $playbook_without_header |