#NEWLINE# def add( name , uid = None , gid = None , groups = None , home = None , shell = None , unique = True , fullname = '' , roomnumber = '' , workphone = '' , homephone = '' , createhome = True , **kwargs ) : #NEWLINE# #INDENT# "\n    Add a user to the minion\n\n    CLI Example:\n\n    .. code-block:: bash\n\n        salt '*' user.add name <uid> <gid> <groups> <home> <shell>\n    " #NEWLINE# if salt . utils . is_true ( kwargs . pop ( 'system' , False ) ) : #NEWLINE# #INDENT# log . warning ( "solaris_user module does not support the 'system' argument" ) #NEWLINE# #UNINDENT# if kwargs : #NEWLINE# #INDENT# log . warning ( 'Invalid kwargs passed to user.add' ) #NEWLINE# #UNINDENT# if isinstance ( groups , six . string_types ) : #NEWLINE# #INDENT# groups = groups . split ( ',' ) #NEWLINE# #UNINDENT# cmd = [ 'useradd' ] #NEWLINE# if shell : #NEWLINE# #INDENT# cmd . extend ( [ '-s' , shell ] ) #NEWLINE# #UNINDENT# if unique : #NEWLINE# #INDENT# cmd . extend ( [ '-u' , uid ] ) #NEWLINE# #UNINDENT# if gid : #NEWLINE# #INDENT# cmd . extend ( [ '-g' , gid ] ) #NEWLINE# #UNINDENT# if groups : #NEWLINE# #INDENT# cmd . extend ( [ '-G' , ',' . join ( groups ) ] ) #NEWLINE# #UNINDENT# if createhome : #NEWLINE# #INDENT# cmd . append ( '-m' ) #NEWLINE# #UNINDENT# if ( home is not None ) : #NEWLINE# #INDENT# cmd . extend ( [ '-d' , home ] ) #NEWLINE# #UNINDENT# if ( not unique ) : #NEWLINE# #INDENT# cmd . append ( '-o' ) #NEWLINE# #UNINDENT# cmd . append ( name ) #NEWLINE# if ( __salt__ [ 'cmd.retcode' ] ( cmd , python_shell = False ) != 0 ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if fullname : #NEWLINE# #INDENT# chfullname ( name , fullname ) #NEWLINE# #UNINDENT# if roomnumber : #NEWLINE# #INDENT# chroomnumber ( name , roomnumber ) #NEWLINE# #UNINDENT# if workphone : #NEWLINE# #INDENT# chworkphone ( name , workphone ) #NEWLINE# #UNINDENT# if homephone : #NEWLINE# #INDENT# chhomephone ( name , homephone ) #NEWLINE# #UNINDENT# return True