Skip to content
This repository has been archived by the owner. It is now read-only.

Commit 5f8402f

Browse files
committed
Remove verbose and show_profile options from audit modules
1 parent afc409b commit 5f8402f

20 files changed

+42
-99
lines changed

_modules/hubble.py

+3-13
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,7 @@ def audit(configs=None,
135135
configs = [os.path.join(os.path.sep, os.path.join(*(con.split('.yaml')[0]).split('.')))
136136
for con in configs]
137137

138-
ret = _run_audit(
139-
configs,
140-
tags,
141-
verbose=verbose,
142-
debug=debug,
143-
show_profile=show_profile
144-
)
138+
ret = _run_audit(configs, tags, debug=debug)
145139

146140
terse_results = {}
147141
verbose_results = {}
@@ -228,7 +222,7 @@ def audit(configs=None,
228222

229223
return results
230224

231-
def _run_audit(configs, tags, verbose, debug, show_profile):
225+
def _run_audit(configs, tags, debug):
232226

233227
results = {}
234228

@@ -269,11 +263,7 @@ def _run_audit(configs, tags, verbose, debug, show_profile):
269263
# We can revisit if this ever becomes a big bottleneck
270264
for key, func in __nova__._dict.iteritems():
271265
try:
272-
ret = func(data_list,
273-
tags,
274-
verbose=verbose,
275-
show_profile=show_profile,
276-
debug=debug)
266+
ret = func(data_list, tags, debug=debug)
277267
except Exception as exc:
278268
log.error('Exception occurred in nova module:')
279269
log.error(traceback.format_exc())

hubblestack_nova/command.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,13 @@ def __virtual__():
8787
return True
8888

8989

90-
def audit(data_list, tags, verbose=False, show_profile=False, debug=False):
90+
def audit(data_list, tags, debug=False):
9191
'''
9292
Run the command audits contained in the data_list
9393
'''
9494
__data__ = {}
9595
for profile, data in data_list:
96-
if show_profile:
97-
_merge_yaml(__data__, data, profile)
98-
else:
99-
_merge_yaml(__data__, data)
96+
_merge_yaml(__data__, data, profile)
10097
__tags__ = _get_tags(__data__)
10198

10299
if debug:

hubblestack_nova/cve_scan.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def __virtual__():
2121
return False, 'This module requires Linux and the oscap binary'
2222

2323

24-
def audit(data_list, tags, verbose=False, show_profile=False, debug=False):
24+
def audit(data_list, tags, debug=False):
2525
'''
2626
Run the network.netstat command
2727
'''

hubblestack_nova/cve_scan_v2.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def __virtual__():
9292
return not salt.utils.is_windows()
9393

9494

95-
def audit(data_list, tags, verbose=False, show_profile=False, debug=False):
95+
def audit(data_list, tags, debug=False):
9696
'''
9797
Main audit function. See module docstring for more information on usage.
9898
'''
@@ -224,9 +224,9 @@ def audit(data_list, tags, verbose=False, show_profile=False, debug=False):
224224
vulnerable = affected_obj
225225
if vulnerable:
226226
if vulnerable.score < min_score:
227-
ret['Controlled'].append(vulnerable.get_report(verbose, show_profile, profile))
227+
ret['Controlled'].append(vulnerable.get_report(profile))
228228
else:
229-
ret['Failure'].append(vulnerable.get_report(verbose, show_profile, profile))
229+
ret['Failure'].append(vulnerable.get_report(profile))
230230

231231
if tags != '*':
232232
log.debug("tags: %s", tags)
@@ -379,7 +379,7 @@ def __init__(self, title, pkg, pkg_version, score, operator, reporter, href, cve
379379
self.oudated_version = None
380380

381381

382-
def get_report(self, verbose, show_profile, profile):
382+
def get_report(self, profile):
383383
'''
384384
Return the dictionary of what should be reported in failures, based on verbose.
385385
'''

hubblestack_nova/firewall.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,10 @@ def __virtual__():
9999
return True
100100

101101

102-
def audit(data_list, tags, verbose=False, show_profile=False, debug=False):
102+
def audit(data_list, tags, debug=False):
103103
__data__ = {}
104104
for profile, data in data_list:
105-
if show_profile:
106-
_merge_yaml(__data__, data, profile)
107-
else:
108-
_merge_yaml(__data__, data)
105+
_merge_yaml(__data__, data, profile)
109106
__tags__ = _get_tags(__data__)
110107

111108
if debug:

hubblestack_nova/grep.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,13 @@ def __virtual__():
7373
return True
7474

7575

76-
def audit(data_list, tags, verbose=False, show_profile=False, debug=False):
76+
def audit(data_list, tags, debug=False):
7777
'''
7878
Run the grep audits contained in the YAML files processed by __virtual__
7979
'''
8080
__data__ = {}
8181
for profile, data in data_list:
82-
if show_profile:
83-
_merge_yaml(__data__, data, profile)
84-
else:
85-
_merge_yaml(__data__, data)
82+
_merge_yaml(__data__, data, profile)
8683
__tags__ = _get_tags(__data__)
8784

8885
if debug:

hubblestack_nova/misc.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,13 @@ def __virtual__():
5959
return True
6060

6161

62-
def audit(data_list, tags, verbose=False, show_profile=False, debug=False):
62+
def audit(data_list, tags, debug=False):
6363
'''
6464
Run the misc audits contained in the data_list
6565
'''
6666
__data__ = {}
6767
for profile, data in data_list:
68-
if show_profile:
69-
_merge_yaml(__data__, data, profile)
70-
else:
71-
_merge_yaml(__data__, data)
68+
_merge_yaml(__data__, data, profile)
7269
__tags__ = _get_tags(__data__)
7370

7471
if debug:

hubblestack_nova/netstat.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def __virtual__():
3636
return False, 'No network.netstat function found'
3737

3838

39-
def audit(data_list, tags, verbose=False, show_profile=False, debug=True):
39+
def audit(data_list, tags, debug=True):
4040
'''
4141
Run the network.netstat command
4242
'''
@@ -49,8 +49,7 @@ def audit(data_list, tags, verbose=False, show_profile=False, debug=True):
4949
if 'address' in check_args:
5050
tag_args = copy.deepcopy(check_args)
5151
tag_args['id'] = check
52-
if show_profile:
53-
tag_args['nova_profile'] = profile
52+
tag_args['nova_profile'] = profile
5453
if isinstance(check_args['address'], list):
5554
for address in check_args['address']:
5655
__tags__[address] = tag_args

hubblestack_nova/openssl.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,10 @@ def __virtual__():
9999
return True
100100

101101

102-
def audit(data_list, tags, verbose=False, show_profile=False, debug=True):
102+
def audit(data_list, tags, debug=True):
103103
__data__ = {}
104104
for profile, data in data_list:
105-
if show_profile:
106-
_merge_yaml(__data__, data, profile)
107-
else:
108-
_merge_yaml(__data__, data)
105+
_merge_yaml(__data__, data, profile)
109106
__tags__ = _get_tags(__data__)
110107

111108
if debug:

hubblestack_nova/pkg.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,13 @@ def __virtual__():
7979
return True
8080

8181

82-
def audit(data_list, tags, verbose=False, show_profile=False, debug=False):
82+
def audit(data_list, tags, debug=False):
8383
'''
8484
Run the pkg audits contained in the YAML files processed by __virtual__
8585
'''
8686
__data__ = {}
8787
for profile, data in data_list:
88-
if show_profile:
89-
_merge_yaml(__data__, data, profile)
90-
else:
91-
_merge_yaml(__data__, data)
88+
_merge_yaml(__data__, data, profile)
9289
__tags__ = _get_tags(__data__)
9390

9491
if debug:

hubblestack_nova/pkgng_audit.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def __virtual__():
2020
return True
2121

2222

23-
def audit(data_list, tags, verbose=False, show_profile=False, debug=False):
23+
def audit(data_list, tags, debug=False):
2424
'''
2525
Run the pkg.audit command
2626
'''
@@ -42,8 +42,7 @@ def audit(data_list, tags, verbose=False, show_profile=False, debug=False):
4242

4343
salt_ret = __salt__['pkg.audit']()
4444
results = {'pkgng_audit': {'result': salt_ret}}
45-
if show_profile:
46-
results['pkng_audit']['nova_profile'] = profile
45+
results['pkng_audit']['nova_profile'] = profile
4746
if not verbose:
4847
results = salt_ret
4948
if '0 problem(s)' not in salt_ret:

hubblestack_nova/service.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,13 @@ def __virtual__():
7272
return True
7373

7474

75-
def audit(data_list, tags, verbose=False, show_profile=False, debug=False):
75+
def audit(data_list, tags, debug=False):
7676
'''
7777
Run the service audits contained in the YAML files processed by __virtual__
7878
'''
7979
__data__ = {}
8080
for profile, data in data_list:
81-
if show_profile:
82-
_merge_yaml(__data__, data, profile)
83-
else:
84-
_merge_yaml(__data__, data)
81+
_merge_yaml(__data__, data, profile)
8582
__tags__ = _get_tags(__data__)
8683

8784
if debug:

hubblestack_nova/stat.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,13 @@ def __virtual__():
5757
return True
5858

5959

60-
def audit(data_list, tags, verbose=False, show_profile=False, debug=False):
60+
def audit(data_list, tags, debug=False):
6161
'''
6262
Run the stat audits contained in the YAML files processed by __virtual__
6363
'''
6464
__data__ = {}
6565
for profile, data in data_list:
66-
if show_profile:
67-
_merge_yaml(__data__, data, profile)
68-
else:
69-
_merge_yaml(__data__, data)
66+
_merge_yaml(__data__, data, profile)
7067
__tags__ = _get_tags(__data__)
7168

7269
if debug:

hubblestack_nova/sysctl.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,13 @@ def __virtual__():
4949
return True
5050

5151

52-
def audit(data_list, tags, verbose=False, show_profile=False, debug=False):
52+
def audit(data_list, tags, debug=False):
5353
'''
5454
Run the sysctl audits contained in the YAML files processed by __virtual__
5555
'''
5656
__data__ = {}
5757
for profile, data in data_list:
58-
if show_profile:
59-
_merge_yaml(__data__, data, profile)
60-
else:
61-
_merge_yaml(__data__, data)
58+
_merge_yaml(__data__, data, profile)
6259
__tags__ = _get_tags(__data__)
6360

6461
if debug:

hubblestack_nova/win_auditpol.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,15 @@ def __virtual__():
2525
return True
2626

2727

28-
def audit(data_list, tags, verbose=False, show_profile=False, debug=False):
28+
def audit(data_list, tags, debug=False):
2929
'''
3030
Runs auditpol on the local machine and audits the return data
3131
with the CIS yaml processed by __virtual__
3232
'''
3333
__data__ = {}
3434
__auditdata__ = _auditpol_import()
3535
for profile, data in data_list:
36-
if show_profile:
37-
_merge_yaml(__data__, data, profile)
38-
else:
39-
_merge_yaml(__data__, data)
36+
_merge_yaml(__data__, data, profile)
4037
__tags__ = _get_tags(__data__)
4138
if debug:
4239
log.debug('auditpol audit __data__:')

hubblestack_nova/win_firewall.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,15 @@ def __virtual__():
2525
return True
2626

2727

28-
def audit(data_list, tags, verbose=False, show_profile=False, debug=False):
28+
def audit(data_list, tags, debug=False):
2929
'''
3030
Runs auditpol on the local machine and audits the return data
3131
with the CIS yaml processed by __virtual__
3232
'''
3333
__data__ = {}
3434
__firewalldata__ = _import_firewall()
3535
for profile, data in data_list:
36-
if show_profile:
37-
_merge_yaml(__data__, data, profile)
38-
else:
39-
_merge_yaml(__data__, data)
36+
_merge_yaml(__data__, data, profile)
4037
__tags__ = _get_tags(__data__)
4138
if debug:
4239
log.debug('firewall audit __data__:')

hubblestack_nova/win_gp.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,15 @@ def __virtual__():
2525
return True
2626

2727

28-
def audit(data_list, tags, verbose=False, show_profile=False, debug=False):
28+
def audit(data_list, tags, debug=False):
2929
'''
3030
Runs auditpol on the local machine and audits the return data
3131
with the CIS yaml processed by __virtual__
3232
'''
3333
__data__ = {}
3434
__gpdata__ = _get_gp_templates()
3535
for profile, data in data_list:
36-
if show_profile:
37-
_merge_yaml(__data__, data, profile)
38-
else:
39-
_merge_yaml(__data__, data)
36+
_merge_yaml(__data__, data, profile)
4037
__tags__ = _get_tags(__data__)
4138
if debug:
4239
log.debug('firewall audit __data__:')

hubblestack_nova/win_pkg.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __virtual__():
2525
return True
2626

2727

28-
def audit(data_list, tags, verbose=False, show_profile=False, debug=False):
28+
def audit(data_list, tags, debug=False):
2929
'''
3030
Runs auditpol on the local machine and audits the return data
3131
with the CIS yaml processed by __virtual__
@@ -37,10 +37,7 @@ def audit(data_list, tags, verbose=False, show_profile=False, debug=False):
3737
__salt__['pkg.refresh_db']()
3838
__pkgdata__ = __salt__['pkg.list_pkgs']()
3939
for profile, data in data_list:
40-
if show_profile:
41-
_merge_yaml(__data__, data, profile)
42-
else:
43-
_merge_yaml(__data__, data)
40+
_merge_yaml(__data__, data, profile)
4441
__tags__ = _get_tags(__data__)
4542
if debug:
4643
log.debug('package audit __data__:')

hubblestack_nova/win_reg.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,14 @@ def __virtual__():
2424
return True
2525

2626

27-
def audit(data_list, tags, verbose=False, show_profile=False, debug=False):
27+
def audit(data_list, tags, debug=False):
2828
'''
2929
Runs auditpol on the local machine and audits the return data
3030
with the CIS yaml processed by __virtual__
3131
'''
3232
__data__ = {}
3333
for profile, data in data_list:
34-
if show_profile:
35-
_merge_yaml(__data__, data, profile)
36-
else:
37-
_merge_yaml(__data__, data)
34+
_merge_yaml(__data__, data, profile)
3835
__tags__ = _get_tags(__data__)
3936
if debug:
4037
log.debug('registry audit __data__:')

0 commit comments

Comments
 (0)