Dear Rob,

I'm using the python-freeipa library:

(client is initialised and logged in - tested and working with other calls such as user_show etc)

client.user_add(
      options.username,
      options.first_name,
      options.last_name,
      options.name,
      mail=options.mail,
      home_directory=options.home_directory,
      uidnumber=options.uid if options.uid else -1,
      gidnumber=options.primary_gid,
      user_password=options.password,
)

Regards,
Callum

--

Callum Smith
Research Computing Core
Wellcome Trust Centre for Human Genetics
University of Oxford
e. callum@well.ox.ac.uk

On 24 Oct 2018, at 13:32, Rob Crittenden <rcritten@redhat.com> wrote:

Callum Smith wrote:
Dear Rob,

Running v4.5.0 (CentOS 7.4 distribution)
API version 2.228

Setting it to -1 gives:
ValidationError: invalid 'uid': must be at least 1

Need more information on what exactly it is you are doing.

rob


Regards,
Callum

--

Callum Smith
Research Computing Core
Wellcome Trust Centre for Human Genetics
University of Oxford
e. callum@well.ox.ac.uk <mailto:callum@well.ox.ac.uk>

On 24 Oct 2018, at 12:47, Rob Crittenden <rcritten@redhat.com
<mailto:rcritten@redhat.com>> wrote:

Callum Smith via FreeIPA-users wrote:
Dear All,

When using the API to create an account, if I don't specify the
uidnumber I get this error:

missing attribute "uidNumber" required by object class "posixAccount"

I was expecting the uidNumber to function thus: "system will assign one
if not provided"

Am I missing something?

You need to set uidnumber to -1 to have DNA automatically assign a value
(pre v3.2 the magic number is 999).

rob