Issue #17811 has been updated by Charlie Sharpsteen.

Status changed from Accepted to In Topic Branch Pending Review
Assignee changed from eric sorenson to Charlie Sharpsteen
Branch set to https://github.com/puppetlabs/puppet/pull/1600

Patch written, tests created, pull request submitted.

----------------------------------------
Bug #17811: Creating user with named gid broken on Mac OS X
https://projects.puppetlabs.com/issues/17811#change-89241

* Author: Björn Albers
* Status: In Topic Branch Pending Review
* Priority: Normal
* Assignee: Charlie Sharpsteen
* Category: OSX
* Target version: 
* Affected Puppet version: 3.1.0
* Keywords: user, group, directoryservice
* Branch: https://github.com/puppetlabs/puppet/pull/1600
----------------------------------------
The [type 
reference](http://docs.puppetlabs.com/references/latest/type.html#user) states 
that both numerical and named gids are fine for the user type.                  
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
     
                                                                                
                                                                                
                                                                                
                                                                                
                                            
This seems to be broken, at least on Mac OS X 10.8.2 with Puppet 2.17.19        
                                                                                
                                                                                
                                                                                
                                            
and 2.7.20.                                                                     
                                                                                
                                                                                
                                                                                
                                            
                                                                                
                                                                                
                                                                                
                                                                                
                                            
When I specify a named gid, then the users primary group is set to              
                                                                                
                                                                                
                                                                                
                                            
wheel:                                                                          
                                                                                
                                                                                
                                                                                
                                            
       
                                                                                
                                                                                
                                                                                
                                                                                
                                     
    # Given no foo user / group and a nice manifest:                            
                                                                                
                                                                                
                                                                                
                                                
    $ sudo dscl . -list /Users | grep -i foo                                    
                                                                                
                                                                                
                                                                                
                                                
    $ sudo dscl . -list /Groups | grep -i foo                                   
                                                                                
                                                                                
                                                                                
                                                
    $ cat user_and_group_on_osx.pp                                              
                                                                                
                                                                                
                                                                                
                                                
    group { '_foo':                                                             
                                                                                
                                                                                
                                                                                
                                                
      ensure => present                                                         
                                                                                
                                                                                
                                                                                
                                                
    }                                                                           
                                                                                
                                                                                
                                                                                
                                                
    user { '_foo':                                                              
                                                                                
                                                                                
                                                                                
                                                
      ensure  => present,                                                       
                                                                                
                                                                                
                                                                                
                                                
      comment => 'Mr. Foo',                                                     
                                                                                
                                                                                
                                                                                
                                                
      home    => '/var/empty',                                                  
                                                                                
                                                                                
                                                                                
                                                
      shell   => '/usr/bin/false',                                              
                                                                                
                                                                                
                                                                                
                                                
      gid     => '_foo'                                                         
                                                                                
                                                                                
                                                                                
                                                
    }
                                                                                
                                                                                
                                                                                
                                                                                
                                           
    # When I apply it:                                                          
                                                                                
                                                                                
                                                                                
                                                
    $ sudo puppet apply --verbose --no-report user_and_group_on_osx.pp          
                                                                                
                                                                                
                                                                                
                                                
    info: Applying configuration version '1353935701'                           
                                                                                
                                                                                
                                                                                
                                                
    notice: /Stage[main]//Group[_foo]/ensure: created                           
                                                                                
                                                                                
                                                                                
                                                
    notice: /Stage[main]//User[_foo]/ensure: created                            
                                                                                
                                                                                
                                                                                
                                                
    notice: Finished catalog run in 6.99 seconds  
                                                                                
                                                                                
                                                                                
                                                                              
    # Then we have the defined user and group...
    $ sudo dscl . -list /Users | grep -i foo
    _foo                                                                        
                                                                                
                                                                                
                                                                                
                                               
    $ sudo dscl . -list /Groups | grep -i foo                                   
                                                                                
                                                                                
                                                                                
                                                
    _foo
                                                                                
                                                                                
                                                                                
                                                                                
                                        
    # But the PrimaryGroupID blew up:                                           
                                                                                
                                                                                
                                                                                
                                                
    $ sudo -u _foo id                                                           
                                                                                
                                                                                
                                                                                
                                                
    uid=29(_foo) gid=0(wheel) # :-(                                             
                                                                                
                                                                                
                                                                                
                                                       
    
groups=0(wheel),12(everyone),61(localaccounts),402(com.apple.sharepoint.group.1)
                                                                                
                                                                                
                                                                                
                                     
    $ sudo dscl . -read /Users/_foo | grep PrimaryGroupID                       
                                                                                
                                                                                
                                                                                
                                                
    PrimaryGroupID: _foo
                                                                                
                                                                                
                                                                                
                                                                                
                        
    # Fixing the stuff manually:                                                
                                                                                
                                                                                
                                                                                
                                                
    $ sudo dscl . -read /Groups/_foo                                            
                                                                                
                                                                                
                                                                                
                                                
    AppleMetaNodeLocation: /Local/Default                                       
                                                                                
                                                                                
                                                                                
                                                
    GeneratedUID: 394BE70D-66D4-404B-892E-22AEEC64AE84                          
                                                                                
                                                                                
                                                                                
                                                
    PrimaryGroupID: 23                                                          
                                                                                
                                                                                
                                                                                
                                                
    RecordName: _foo                                                            
                                                                                
                                                                                
                                                                                
                                                
    RecordType: dsRecTypeStandard:Groups                                        
                                                                                
                                                                                
                                                                                
                                                
    $ sudo dscl . -create /Users/_foo PrimaryGroupID                            
                                                                                
                                                                                
                                                                                
                                                
    23                                                                          
                                                                                
                                                                                
                                                                                
                                                
    $ sudo dscl . -read /Users/_foo | grep PrimaryGroupID                       
                                                                                
                                                                                
                                                                                
                                                
    PrimaryGroupID: 23                                                          
                                                                                
                                                                                
                                                                                
                                                
    $ sudo -u _foo id                                                           
                                                                                
                                                                                
                                                                                
                                                
    uid=29(_foo) gid=23(_foo) # :-)                                             
                                                                                
                                                                                
                                                                                
                                                       
    
groups=23(_foo),12(everyone),61(localaccounts),402(com.apple.sharepoint.group.1)


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to