def _is_valid_shell(shell):
 if salt.utils.is_windows():
  return True
 shells = '/etc/shells'
 available_shells = []
 if os.path.exists(shells):
  try:
   with salt.utils.fopen(shells, 'r') as shell_fp:
    lines = shell_fp.read().splitlines()
   for line in lines:
    if line.startswith('#'):
     continue
    else:
     available_shells.append(line)
  except OSError:
   return True
 else:
  return None
 if (shell in available_shells):
  return True
 else:
  return False

def _is_valid_shell ( shell ) : if salt . utils . is_windows ( ) : return True shells = '/etc/shells' available_shells = [ ] if os . path . exists ( shells ) : try : with salt . utils . fopen ( shells , 'r' ) as shell_fp : lines = shell_fp . read ( ) . splitlines ( ) for line in lines : if line . startswith ( '#' ) : continue else : available_shells . append ( line ) except OSError : return True else : return None if ( shell in available_shells ) : return True else : return False
attempts to search for valid shells on a system and see if a given shell is in the list .