make helper function private

This commit is contained in:
Erik Johnson 2017-02-01 08:54:06 -06:00
parent cdf045662f
commit 08fb24f947

View File

@ -345,7 +345,7 @@ def _context_string_to_dict(context):
return ret return ret
def filetype_id_to_string(filetype='a'): def _filetype_id_to_string(filetype='a'):
''' '''
Translates SELinux filetype single-letter representation Translates SELinux filetype single-letter representation
to a more human-readable version (which is also used in `semanage fcontext -l`). to a more human-readable version (which is also used in `semanage fcontext -l`).
@ -386,7 +386,7 @@ def fcontext_get_policy(name, filetype=None, sel_type=None, sel_user=None, sel_l
'sel_role': '[^:]+', # se_role for file context is always object_r 'sel_role': '[^:]+', # se_role for file context is always object_r
'sel_type': sel_type or '[^:]+', 'sel_type': sel_type or '[^:]+',
'sel_level': sel_level or '[^:]+'} 'sel_level': sel_level or '[^:]+'}
cmd_kwargs['filetype'] = '[[:alpha:] ]+' if filetype is None else filetype_id_to_string(filetype) cmd_kwargs['filetype'] = '[[:alpha:] ]+' if filetype is None else _filetype_id_to_string(filetype)
cmd = 'semanage fcontext -l | egrep ' + \ cmd = 'semanage fcontext -l | egrep ' + \
"'^{filespec}{spacer}{filetype}{spacer}{sel_user}:{sel_role}:{sel_type}:{sel_level}$'".format(**cmd_kwargs) "'^{filespec}{spacer}{filetype}{spacer}{sel_user}:{sel_role}:{sel_type}:{sel_level}$'".format(**cmd_kwargs)
current_entry_text = __salt__['cmd.shell'](cmd) current_entry_text = __salt__['cmd.shell'](cmd)