Skip to content

Commit c42b693

Browse files
committed
add doc for module computer
1 parent cc540d6 commit c42b693

File tree

3 files changed

+37
-4
lines changed

3 files changed

+37
-4
lines changed

docs/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Linuxmuster-linuxclient7 is a part of the `linuxmuster.net <https://www.linuxmus
1717

1818
You can find the whole description of the install process on the `official documentation page <https://docs.linuxmuster.net/de/latest/>`_ of the project.
1919

20-
In particularly, some `appliances (Proxmox, XCP-ng and KVM) are prepared <https://docs.linuxmuster.net/de/latest/getting-started/installoptions/index.html>`_ in order to permit a fast deployment for test use.
20+
Particularly, some `appliances (Proxmox, XCP-ng and KVM) are prepared <https://docs.linuxmuster.net/de/latest/getting-started/installoptions/index.html>`_ in order to permit a fast deployment for test use.
2121

2222
.. toctree::
2323
:maxdepth: 1
@@ -31,3 +31,4 @@ In particularly, some `appliances (Proxmox, XCP-ng and KVM) are prepared <https:
3131
:hidden:
3232

3333
python/shares.rst
34+
python/computer.rst

docs/python/shares.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Module: shares
22
**************
33

4-
This is used to deal with mounting and unmounting samba shares.
4+
This module is used to deal with mounting and unmounting samba shares.
55

6-
Shares API
7-
============
6+
Members
7+
=======
88
.. automodule:: linuxmusterLinuxclient7.shares
99
:members:

usr/lib/python3/dist-packages/linuxmusterLinuxclient7/computer.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,54 @@
22
from linuxmusterLinuxclient7 import logging, ldapHelper, realm, localUserHelper
33

44
def hostname():
5+
"""
6+
Get the hostname of the computer
7+
8+
:return: The hostname
9+
:rtype: str
10+
"""
511
return socket.gethostname().split('.', 1)[0]
612

713
def krbHostName():
14+
"""
15+
Get the krb hostname, eg. `COMPUTER01$`
16+
17+
:return: The krb hostname
18+
:rtype: str
19+
"""
820
return hostname().upper() + "$"
921

1022
def readAttributes():
23+
"""
24+
Read all ldap attributes of the cumputer
25+
26+
:return: Tuple (success, dict of attributes)
27+
:rtype: tuple
28+
"""
1129
return ldapHelper.searchOne("(sAMAccountName={}$)".format(hostname()))
1230

1331
def isInGroup(groupName):
32+
"""
33+
Check if the computer is part of an ldap group
34+
35+
:param groupName: The name of the group to check
36+
:type grouName: str
37+
:return: True or False
38+
:rtype: bool
39+
"""
1440
rc, groups = localUserHelper.getGroupsOfLocalUser(krbHostName())
1541
if not rc:
1642
return False
1743

1844
return groupName in groups
1945

2046
def isInAD():
47+
"""
48+
Check if the computer is joined to an AD
49+
50+
:return: True or False
51+
:rtype: bool
52+
"""
2153
rc, groups = localUserHelper.getGroupsOfLocalUser(krbHostName())
2254
if not rc:
2355
return False

0 commit comments

Comments
 (0)