summaryrefslogtreecommitdiff
path: root/system/user.py
diff options
context:
space:
mode:
Diffstat (limited to 'system/user.py')
-rw-r--r--system/user.py35
1 files changed, 27 insertions, 8 deletions
diff --git a/system/user.py b/system/user.py
index c424beea..dd079b64 100644
--- a/system/user.py
+++ b/system/user.py
@@ -160,7 +160,7 @@ options:
default: rsa
version_added: "0.9"
description:
- - Optionally specify the type of SSH key to generate.
+ - Optionally specify the type of SSH key to generate.
Available SSH key types will depend on implementation
present on target host.
ssh_key_file:
@@ -201,19 +201,38 @@ options:
EXAMPLES = '''
# Add the user 'johnd' with a specific uid and a primary group of 'admin'
-- user: name=johnd comment="John Doe" uid=1040 group=admin
+- user:
+ name: johnd
+ comment: "John Doe"
+ uid: 1040
+ group: admin
# Add the user 'james' with a bash shell, appending the group 'admins' and 'developers' to the user's groups
-- user: name=james shell=/bin/bash groups=admins,developers append=yes
+- user:
+ name: james
+ shell: /bin/bash
+ groups: admins,developers
+ append: yes
# Remove the user 'johnd'
-- user: name=johnd state=absent remove=yes
+- user:
+ name: johnd
+ state: absent
+ remove: yes
# Create a 2048-bit SSH key for user jsmith in ~jsmith/.ssh/id_rsa
-- user: name=jsmith generate_ssh_key=yes ssh_key_bits=2048 ssh_key_file=.ssh/id_rsa
+- user:
+ name: jsmith
+ generate_ssh_key: yes
+ ssh_key_bits: 2048
+ ssh_key_file: .ssh/id_rsa
# added a consultant whose account you want to expire
-- user: name=james18 shell=/bin/zsh groups=developers expires=1422403387
+- user:
+ name: james18
+ shell: /bin/zsh
+ groups: developers
+ expires: 1422403387
'''
import os
@@ -1697,7 +1716,7 @@ class DarwinUser(User):
self.chown_homedir(int(self.uid), int(self.group), self.home)
for field in self.fields:
- if self.__dict__.has_key(field[0]) and self.__dict__[field[0]]:
+ if field[0] in self.__dict__ and self.__dict__[field[0]]:
cmd = self._get_dscl()
cmd += [ '-create', '/Users/%s' % self.name, field[1], self.__dict__[field[0]]]
@@ -1734,7 +1753,7 @@ class DarwinUser(User):
self._make_group_numerical()
for field in self.fields:
- if self.__dict__.has_key(field[0]) and self.__dict__[field[0]]:
+ if field[0] in self.__dict__ and self.__dict__[field[0]]:
current = self._get_user_property(field[1])
if current is None or current != self.__dict__[field[0]]:
cmd = self._get_dscl()