def get_selinux_context(path):
 out = __salt__['cmd.run'](['ls', '-Z', path], python_shell=False)
 try:
  ret = re.search('\\w+:\\w+:\\w+:\\w+', out).group(0)
 except AttributeError:
  ret = 'No selinux context information is available for {0}'.format(path)
 return ret

def get_selinux_context ( path ) : out = __salt__ [ 'cmd.run' ] ( [ 'ls' , '-Z' , path ] , python_shell = False ) try : ret = re . search ( '\\w+:\\w+:\\w+:\\w+' , out ) . group ( 0 ) except AttributeError : ret = 'No selinux context information is available for {0}' . format ( path ) return ret
get an selinux context from a given path cli example: .