diff options
author | Daniel Watkins <oddbloke@ubuntu.com> | 2020-08-13 11:27:47 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-13 11:27:47 -0400 |
commit | 6ac71fdf22db43269cf9b068517290b937ec31b5 (patch) | |
tree | 9c080b7083660f025299822a51d583351fdce72e | |
parent | 46950cc404da411269d751953bfbcead90ee6806 (diff) | |
download | vyos-cloud-init-6ac71fdf22db43269cf9b068517290b937ec31b5.tar.gz vyos-cloud-init-6ac71fdf22db43269cf9b068517290b937ec31b5.zip |
cloudinit.distros: update docstrings of add_user and create_user (#527)
This aligns their docstrings more closely with their actual behaviour.
-rwxr-xr-x | cloudinit/distros/__init__.py | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py index 2fc91bbc..c7163e1c 100755 --- a/cloudinit/distros/__init__.py +++ b/cloudinit/distros/__init__.py @@ -392,6 +392,9 @@ class Distro(metaclass=abc.ABCMeta): def add_user(self, name, **kwargs): """ Add a user to the system using standard GNU tools + + This should be overriden on distros where useradd is not desirable or + not available. """ # XXX need to make add_user idempotent somehow as we # still want to add groups or modify SSH keys on pre-existing @@ -520,9 +523,22 @@ class Distro(metaclass=abc.ABCMeta): def create_user(self, name, **kwargs): """ - Creates users for the system using the GNU passwd tools. This - will work on an GNU system. This should be overriden on - distros where useradd is not desirable or not available. + Creates or partially updates the ``name`` user in the system. + + This defers the actual user creation to ``self.add_user`` or + ``self.add_snap_user``, and most of the keys in ``kwargs`` will be + processed there if and only if the user does not already exist. + + Once the existence of the ``name`` user has been ensured, this method + then processes these keys (for both just-created and pre-existing + users): + + * ``plain_text_passwd`` + * ``hashed_passwd`` + * ``lock_passwd`` + * ``sudo`` + * ``ssh_authorized_keys`` + * ``ssh_redirect_user`` """ # Add a snap user, if requested |