Skip to content

Commit eefb55d

Browse files
committed
add doc for module config
1 parent c42b693 commit eefb55d

File tree

4 files changed

+44
-2
lines changed

4 files changed

+44
-2
lines changed

docs/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ Particularly, some `appliances (Proxmox, XCP-ng and KVM) are prepared <https://d
3232

3333
python/shares.rst
3434
python/computer.rst
35+
python/config.rst

docs/python/computer.rst

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Module: computer
2+
****************
3+
4+
This module is used to deal with all things related to the computer.
5+
6+
Members
7+
=======
8+
.. automodule:: linuxmusterLinuxclient7.computer
9+
:members:

docs/python/config.rst

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Module: config
2+
**************
3+
4+
This module is used to deal with all config files:
5+
6+
* `/etc/linuxmusterLinuxclient7/network.conf`
7+
8+
Members
9+
=======
10+
.. automodule:: linuxmusterLinuxclient7.config
11+
:members:

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

+23-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,18 @@
22
from linuxmusterLinuxclient7 import logging, constants
33

44
def network():
5+
"""
6+
Get the network configuration in `/etc/linuxmusterLinuxclient7/network.conf`
7+
8+
:return: Tuple (success, dict of keys)
9+
:rtype: tuple
10+
"""
511
rc, rawNetworkConfig = _readNetworkConfig()
612
if not rc:
7-
return False
13+
return False, None
814

915
if not _checkNetworkConfigVersion(rawNetworkConfig)[0]:
10-
return False
16+
return False, None
1117

1218
networkConfig = {}
1319

@@ -23,6 +29,14 @@ def network():
2329
return True, networkConfig
2430

2531
def writeNetworkConfig(newNetworkConfig):
32+
"""
33+
Write the network configuration in `/etc/linuxmusterLinuxclient7/network.conf`
34+
35+
:param newNetworkConfig: The new config
36+
:type newNetworkConfig: dict
37+
:return: True or False
38+
:rtype: bool
39+
"""
2640
networkConfig = configparser.ConfigParser(interpolation=None)
2741

2842
try:
@@ -49,6 +63,13 @@ def writeNetworkConfig(newNetworkConfig):
4963
return True
5064

5165
def upgrade():
66+
"""
67+
Upgrade the format of the network configuration in `/etc/linuxmusterLinuxclient7/network.conf`
68+
This is done automatically on package upgrades.
69+
70+
:return: True or False
71+
:rtype: bool
72+
"""
5273
return _upgradeNetworkConfig()
5374

5475
# --------------------

0 commit comments

Comments
 (0)