@@ -581,9 +581,8 @@ def default_audit_plist(baseline_name, build_path, baseline_yaml):
581
581
def generate_script (baseline_name , audit_name , build_path , baseline_yaml , reference , version_yaml ):
582
582
"""Generates the zsh script from the rules in the baseline YAML
583
583
"""
584
- version = version_yaml ["version" ]
585
- build = version_yaml ["build" ]
586
- mscp_version = f'{ version .split ()[- 1 ]} .{ build } '
584
+ version = version_yaml ['version' ]
585
+ mscp_version = version_yaml ["mscp_version" ]
587
586
compliance_script_file = open (f'{ build_path } /{ baseline_name } _compliance_v{ mscp_version } .sh' , 'w' )
588
587
589
588
check_function_string = ""
@@ -1346,7 +1345,7 @@ def get_rule_yaml(rule_file, baseline_yaml, custom=False,):
1346
1345
return resulting_yaml
1347
1346
1348
1347
1349
- def generate_xls (baseline_name , build_path , baseline_yaml ):
1348
+ def generate_xls (baseline_name , build_path , baseline_yaml , version_yaml ):
1350
1349
"""Using the baseline yaml file, create an XLS document containing the YAML fields
1351
1350
"""
1352
1351
@@ -1357,7 +1356,7 @@ def generate_xls(baseline_name, build_path, baseline_yaml):
1357
1356
parent_dir = os .path .dirname (file_dir )
1358
1357
1359
1358
# Output files
1360
- xls_output_file = f"{ build_path } /{ baseline_name } .xls"
1359
+ xls_output_file = f"{ build_path } /{ baseline_name } _v { version_yaml [ 'mscp_version' ] } .xls"
1361
1360
1362
1361
1363
1362
wb = Workbook ()
@@ -1745,9 +1744,6 @@ def main():
1745
1744
os .makedirs (build_path )
1746
1745
except OSError :
1747
1746
print (f"Creation of the directory { build_path } failed" )
1748
- adoc_output_file = open (f"{ build_path } /{ output_filename } .adoc" , 'w' )
1749
- print ('Profile YAML:' , args .baseline .name )
1750
- print ('Output path:' , adoc_output_file .name )
1751
1747
1752
1748
if args .hash :
1753
1749
signing = True
@@ -1771,6 +1767,15 @@ def main():
1771
1767
version_file = os .path .join (parent_dir , "VERSION.yaml" )
1772
1768
with open (version_file ) as r :
1773
1769
version_yaml = yaml .load (r , Loader = yaml .SafeLoader )
1770
+
1771
+ if version_yaml ["build" ] == 0 :
1772
+ version_yaml ["mscp_version" ] = f"{ version_yaml ['version' ].split ()[- 1 ]} "
1773
+ else :
1774
+ version_yaml ["mscp_version" ] = f"{ version_yaml ['version' ].split ()[- 1 ]} .{ version_yaml ['build' ]} "
1775
+
1776
+ adoc_output_file = open (f'{ build_path } /{ output_filename } _v{ version_yaml ["mscp_version" ]} .adoc' , 'w' )
1777
+ print ('Profile YAML:' , args .baseline .name )
1778
+ print ('Output path:' , adoc_output_file .name )
1774
1779
1775
1780
adoc_templates = [ "adoc_rule_ios" ,
1776
1781
"adoc_rule" ,
@@ -1886,7 +1891,11 @@ def main():
1886
1891
adoc_html_subtitle = baseline_yaml ['title' ].split (':' )[1 ]
1887
1892
adoc_document_subtitle2 = ':document-subtitle2:'
1888
1893
1889
- # Create header
1894
+ # Create header
1895
+ if version_yaml ['build' ] == 0 :
1896
+ header_version = version_yaml ['version' ]
1897
+ else :
1898
+ header_version = f'{ version_yaml ["version" ]} .{ version_yaml ["build" ]} '
1890
1899
header_adoc = adoc_header_template .substitute (
1891
1900
description = baseline_yaml ['description' ],
1892
1901
html_header_title = baseline_yaml ['title' ],
@@ -1901,7 +1910,7 @@ def main():
1901
1910
stig_attribute = adoc_STIG_show ,
1902
1911
cis_attribute = adoc_cis_show ,
1903
1912
cmmc_attribute = adoc_cmmc_show ,
1904
- version = version_yaml [ 'version' ] ,
1913
+ version = header_version ,
1905
1914
os_version = version_yaml ['os' ],
1906
1915
release_date = version_yaml ['date' ]
1907
1916
)
@@ -2214,7 +2223,7 @@ def main():
2214
2223
2215
2224
if args .xls :
2216
2225
print ('Generating excel document...' )
2217
- generate_xls (baseline_name , build_path , baseline_yaml )
2226
+ generate_xls (baseline_name , build_path , baseline_yaml , version_yaml )
2218
2227
2219
2228
asciidoctor_path = is_asciidoctor_installed ()
2220
2229
if asciidoctor_path != "" :
0 commit comments