Last active
August 29, 2015 14:01
-
-
Save oc/db8a564fb6eb6789e952 to your computer and use it in GitHub Desktop.
Salt 2014.1.4 useradd.py bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root@mgmt:/srv/salt# salt-minion --versions-report | |
Salt: 2014.1.4 | |
Python: 2.7.3 (default, Mar 13 2014, 11:03:55) | |
Jinja2: 2.6 | |
M2Crypto: 0.21.1 | |
msgpack-python: 0.1.10 | |
msgpack-pure: Not Installed | |
pycrypto: 2.6 | |
PyYAML: 3.10 | |
PyZMQ: 13.1.0 | |
ZMQ: 3.2.3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/usr/lib/python2.7/dist-packages/salt/modules/useradd.py:476 | |
def list_groups(name): | |
''' | |
Return a list of groups the named user belongs to | |
CLI Example: | |
.. code-block:: bash | |
salt '*' user.list_groups foo | |
''' | |
return salt.utils.get_group_list(name) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
salt -v "foo*" saltutil.refresh_pillar && salt "foo*" state.highstate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Excerpt from statefile: | |
{% for site in pillar['nginx_sites'] %} | |
/etc/nginx/sites-available/{{ site.fqdn }}.conf: | |
file.managed: | |
- source: salt://nginx/etc/nginx/conf.d/site.conf.jinja | |
- template: jinja | |
- context: | |
{{ site }} | |
# misc options | |
- defaults: | |
aliases: [] | |
autoindex: False | |
basic_auth_file: False | |
client_max_body_size: 10m | |
default: False | |
error_404: False | |
expressionengine: False | |
facebook_rewrite: False | |
production: True | |
/etc/nginx/sites-enabled/{{ site.fqdn }}.conf: | |
file.symlink: | |
- target: /etc/nginx/sites-available/{{ site.fqdn }}.conf | |
- require: | |
- file: /etc/nginx/sites-available/{{ site.fqdn }}.conf | |
{%- endfor %} | |
### | |
# | |
# Output: | |
# | |
---------- | |
ID: /etc/nginx/sites-available/foo.bar.conf | |
Function: file.managed | |
Result: True | |
Comment: File /etc/nginx/sites-available/foo.bar.conf is in the correct state | |
Changes: | |
---------- | |
ID: /etc/nginx/sites-enabled/foo.bar.conf | |
Function: file.symlink | |
Result: False | |
Comment: An exception occurred in this state: Traceback (most recent call last): | |
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1371, in call | |
else: | |
File "/usr/lib/python2.7/dist-packages/salt/states/file.py", line 764, in symlink | |
__salt__['user.info'](user).get('gid', 0) | |
File "/usr/lib/python2.7/dist-packages/salt/modules/useradd.py", line 450, in info | |
return _format_info(data) | |
File "/usr/lib/python2.7/dist-packages/salt/modules/useradd.py", line 464, in _format_info | |
'groups': list_groups(data.pw_name), | |
File "/usr/lib/python2.7/dist-packages/salt/modules/useradd.py", line 486, in list_groups | |
return salt.utils.get_group_list(name) | |
AttributeError: 'module' object has no attribute 'get_group_list' | |
Changes: | |
-- | |
### | |
# Same error when creating users: | |
# | |
# Excerpt from statefile: | |
oc: | |
user.present: | |
- fullname: Ole Christian Rynning | |
- shell: /bin/bash | |
- home: /home/oc | |
- password: $5$salted-and-redacted-password-goes-here | |
- uid: 1337 | |
- gid: staff | |
- groups: | |
- staff | |
- users | |
- ssh | |
file.directory: | |
- name: /home/oc | |
- user: oc | |
- group: staff | |
- mode: 750 | |
- makedirs: True | |
- require: | |
- user: oc | |
ssh_auth: | |
- present | |
- user: oc | |
- source: salt://ssh-keys/oc.id_rsa.pub | |
### | |
# | |
# Output: | |
# | |
---------- | |
ID: oc | |
Function: ssh_auth.present | |
Result: False | |
Comment: An exception occurred in this state: Traceback (most recent call last): | |
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1371, in call | |
else: | |
File "/usr/lib/python2.7/dist-packages/salt/states/ssh_auth.py", line 179, in present | |
saltenv=__env__) | |
File "/usr/lib/python2.7/dist-packages/salt/modules/ssh.py", line 432, in set_auth_key_from_file | |
config | |
File "/usr/lib/python2.7/dist-packages/salt/modules/ssh.py", line 471, in set_auth_key | |
uinfo = __salt__['user.info'](user) | |
File "/usr/lib/python2.7/dist-packages/salt/modules/useradd.py", line 450, in info | |
return _format_info(data) | |
File "/usr/lib/python2.7/dist-packages/salt/modules/useradd.py", line 464, in _format_info | |
'groups': list_groups(data.pw_name), | |
File "/usr/lib/python2.7/dist-packages/salt/modules/useradd.py", line 486, in list_groups | |
return salt.utils.get_group_list(name) | |
AttributeError: 'module' object has no attribute 'get_group_list' | |
Changes: | |
---------- | |
ID: oc | |
Function: user.present | |
Result: False | |
Comment: An exception occurred in this state: Traceback (most recent call last): | |
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1371, in call | |
else: | |
File "/usr/lib/python2.7/dist-packages/salt/states/user.py", line 280, in present | |
homephone) | |
File "/usr/lib/python2.7/dist-packages/salt/states/user.py", line 69, in _changes | |
lusr = __salt__['user.info'](name) | |
File "/usr/lib/python2.7/dist-packages/salt/modules/useradd.py", line 450, in info | |
return _format_info(data) | |
File "/usr/lib/python2.7/dist-packages/salt/modules/useradd.py", line 464, in _format_info | |
'groups': list_groups(data.pw_name), | |
File "/usr/lib/python2.7/dist-packages/salt/modules/useradd.py", line 486, in list_groups | |
return salt.utils.get_group_list(name) | |
AttributeError: 'module' object has no attribute 'get_group_list' | |
Changes: | |
---------- | |
ID: oc | |
Function: file.directory | |
Name: /home/oc | |
Result: False | |
Comment: One or more requisite failed | |
Changes: | |
---------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I ran into this also.. it went away when i disabled ldap