def chshell(name, shell):
 pre_info = info(name)
 if (not pre_info):
  raise CommandExecutionError("User '{0}' does not exist".format(name))
 if (shell == pre_info['shell']):
  return True
 cmd = ['pw', 'usermod', '-s', shell, '-n', name]
 __salt__['cmd.run'](cmd, python_shell=False)
 return (info(name).get('shell') == shell)

def chshell ( name , shell ) : pre_info = info ( name ) if ( not pre_info ) : raise CommandExecutionError ( "User '{0}' does not exist" . format ( name ) ) if ( shell == pre_info [ 'shell' ] ) : return True cmd = [ 'pw' , 'usermod' , '-s' , shell , '-n' , name ] __salt__ [ 'cmd.run' ] ( cmd , python_shell = False ) return ( info ( name ) . get ( 'shell' ) == shell )
change the default shell of the user cli example: .