Skip to content

default aptly user creation fails #61

@ipantovic

Description

@ipantovic

...with the following error:

----------
          ID: aptly_user
    Function: user.present
        Name: aptly
      Result: False
     Comment: Failed to create new user aptly
     Started: 13:14:41.167389
    Duration: 24.448 ms
     Changes:

in the logs state is rendered as below:

aptly_user:
  group.present:
    - name: aptly

  user.present:
    - name: aptly
    - shell: /bin/bash
    - home: /var/lib/aptly

    - require:
      - pkg: aptly_packages

command fails with:

[INFO    ] Running state [aptly] at time 13:14:41.167389
[INFO    ] Executing state user.present for [aptly]
[DEBUG   ] LazyLoaded shadow.info
[DEBUG   ] LazyLoaded user.info
[INFO    ] Executing command useradd in directory '/root'
[ERROR   ] Command 'useradd' failed with return code: 9
[ERROR   ] stderr: useradd: group aptly exists - if you want to add this user to that group, use -g.
[ERROR   ] retcode: 9
[ERROR   ] Failed to create new user aptly
[INFO    ] Completed state [aptly] at time 13:14:41.191837 (duration_in_ms=24.448)

here:

{% if aptly.user.uid %}
- uid: {{ aptly.user.uid }}
{% endif %}
{% if aptly.user.gid %}
- gid: {{ aptly.user.gid }}
- gid_from_name: True
{% endif %}

otherwise salt.user.present complains as we already created a group.

to fix it just add else:

    {% if aptly.user.gid %}
    - gid: {{ aptly.user.gid }}
    - gid_from_name: True
    {% else %}
    - gid: {{ aptly.groupname }}
    {% endif %}

let me know if I misunderstood something.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions