Issue #4990 has been updated by Chuck Schweizer.

Would it acceptable if the change just used the next available UID / GID that 
the useradd and groupadd scripts would generate?

    -getent group puppet &>/dev/null || groupadd -r puppet -g 52 &>/dev/null 
    +getent group puppet &>/dev/null || groupadd -r puppet -g 52 &>/dev/null || 
groupadd -r puppet &>/dev/null
    -useradd -r -u 52 -g puppet -d %{_localstatedir}/lib/puppet -s 
/sbin/nologin \
    -    -c "Puppet" puppet &>/dev/null || :
    +useradd -r -u 52 -g puppet -d %{_localstatedir}/lib/puppet -s 
/sbin/nologin \
    +    -c "Puppet" puppet &>/dev/null || useradd -r -g puppet -d 
%{_localstatedir}/lib/puppet -s /sbin/nologin \
    +    -c "Puppet" puppet &>/dev/null || :


----------------------------------------
Feature #4990: Update RPM SPEC file to use new UID if current User ID is in use
https://projects.puppetlabs.com/issues/4990

Author: Chuck Schweizer
Status: Needs design decision
Priority: Low
Assignee: Todd Zullinger
Category: installation
Target version: 
Affected version: 
Keywords: 
Branch: 


The following is very rough code of what would work for my environment. I would 
like this because UID/GID may already be taken by another application and I 
want the puppet user to still be created.

    --- puppet.spec.old 2010-10-12 11:20:43.000000000 -0500
    +++ puppet.spec     2010-10-12 11:20:54.000000000 -0500
    @@ -182,9 +182,26 @@
     # Fixed uid/gid were assigned in bz 472073 (Fedora), 471918 (RHEL-5),
     # and 471919 (RHEL-4)
     %pre
    -getent group puppet &>/dev/null || groupadd -r puppet -g 52 &>/dev/null 
    +DEFAULT_PUPPETID=52
    +NEXT_ID=0
    +
    +if getent group $DEFAULT_PUPPETID &>/dev/null || getent passwd 
$DEFAULT_PUPPETID &>/dev/null;then
    +  ID_SCAN=$DEFAULT_PUPPETID
    +  while (( NEXT_ID == 0 )) ;do
    +    if getent group $ID_SCAN &>/dev/null || getent passwd $ID_SCAN 
&>/dev/null;then
    +      (( ID_SCAN = ID_SCAN + 1 ))
    +    else
    +      NEXT_ID=$ID_SCAN
    +      break
    +    fi
    +  done
    +else
    +  NEXT_ID=$DEFAULT_PUPPETID
    +fi
    +
    +getent group puppet &>/dev/null || groupadd -r puppet -g $NEXT_ID 
&>/dev/null 
    getent passwd puppet &>/dev/null || \
    -useradd -r -u 52 -g puppet -d %{_localstatedir}/lib/puppet -s 
/sbin/nologin \
    +useradd -r -u $NEXT_ID -g puppet -d %{_localstatedir}/lib/puppet -s 
/sbin/nologin \
         -c "Puppet" puppet &>/dev/null || :
     # ensure that old setups have the right puppet home dir
     if [ $1 -gt 1 ] ; then
    


-- 
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to