python-linstor 1.27.1__tar.gz → 1.28.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. {python_linstor-1.27.1 → python_linstor-1.28.2}/MANIFEST.in +0 -1
  2. {python_linstor-1.27.1 → python_linstor-1.28.2}/Makefile +5 -33
  3. {python_linstor-1.27.1/python_linstor.egg-info → python_linstor-1.28.2}/PKG-INFO +20 -5
  4. {python_linstor-1.27.1 → python_linstor-1.28.2}/README.md +17 -0
  5. {python_linstor-1.27.1 → python_linstor-1.28.2}/linstor/config.py +30 -4
  6. {python_linstor-1.27.1 → python_linstor-1.28.2}/linstor/linstorapi.py +236 -49
  7. {python_linstor-1.27.1 → python_linstor-1.28.2}/linstor/properties.py +1246 -552
  8. {python_linstor-1.27.1 → python_linstor-1.28.2}/linstor/responses.py +133 -18
  9. {python_linstor-1.27.1 → python_linstor-1.28.2}/linstor/sharedconsts.py +72 -1
  10. python_linstor-1.28.2/linstor/version.py +1 -0
  11. {python_linstor-1.27.1 → python_linstor-1.28.2}/linstor-common/consts.json +265 -0
  12. {python_linstor-1.27.1 → python_linstor-1.28.2}/linstor-common/drbdoptions.json +394 -301
  13. {python_linstor-1.27.1 → python_linstor-1.28.2}/linstor-common/drbdsetup.xml +166 -127
  14. {python_linstor-1.27.1 → python_linstor-1.28.2}/linstor-common/gendrbdoptions.py +31 -13
  15. {python_linstor-1.27.1 → python_linstor-1.28.2}/linstor-common/properties.json +321 -10
  16. python_linstor-1.28.2/linstor_tests/test_responses.py +86 -0
  17. {python_linstor-1.27.1 → python_linstor-1.28.2}/pyproject.toml +4 -6
  18. {python_linstor-1.27.1 → python_linstor-1.28.2/python_linstor.egg-info}/PKG-INFO +20 -5
  19. {python_linstor-1.27.1 → python_linstor-1.28.2}/python_linstor.egg-info/SOURCES.txt +0 -1
  20. {python_linstor-1.27.1 → python_linstor-1.28.2}/setup.cfg +1 -1
  21. {python_linstor-1.27.1 → python_linstor-1.28.2}/setup.py +2 -4
  22. python_linstor-1.27.1/linstor/version.py +0 -1
  23. python_linstor-1.27.1/linstor_tests/test_responses.py +0 -30
  24. python_linstor-1.27.1/setup.cfg.py2 +0 -10
  25. {python_linstor-1.27.1 → python_linstor-1.28.2}/COPYING +0 -0
  26. {python_linstor-1.27.1 → python_linstor-1.28.2}/linstor/__init__.py +0 -0
  27. {python_linstor-1.27.1 → python_linstor-1.28.2}/linstor/errors.py +0 -0
  28. {python_linstor-1.27.1 → python_linstor-1.28.2}/linstor/kv.py +0 -0
  29. {python_linstor-1.27.1 → python_linstor-1.28.2}/linstor/resource.py +0 -0
  30. {python_linstor-1.27.1 → python_linstor-1.28.2}/linstor/resourcegroup.py +0 -0
  31. {python_linstor-1.27.1 → python_linstor-1.28.2}/linstor/size_calc.py +0 -0
  32. {python_linstor-1.27.1 → python_linstor-1.28.2}/linstor-common/Makefile +0 -0
  33. {python_linstor-1.27.1 → python_linstor-1.28.2}/linstor-common/genconsts.py +0 -0
  34. {python_linstor-1.27.1 → python_linstor-1.28.2}/linstor-common/genproperties.py +0 -0
  35. {python_linstor-1.27.1 → python_linstor-1.28.2}/linstor_tests/__init__.py +0 -0
  36. {python_linstor-1.27.1 → python_linstor-1.28.2}/linstor_tests/test_linstorapi.py +0 -0
  37. {python_linstor-1.27.1 → python_linstor-1.28.2}/linstor_tests/test_utils.py +0 -0
  38. {python_linstor-1.27.1 → python_linstor-1.28.2}/python_linstor.egg-info/dependency_links.txt +0 -0
  39. {python_linstor-1.27.1 → python_linstor-1.28.2}/python_linstor.egg-info/top_level.txt +0 -0
@@ -7,4 +7,3 @@ include MANIFEST.in
7
7
  include COPYING
8
8
  include README.md
9
9
  include Makefile
10
- include setup.cfg.py2
@@ -1,34 +1,23 @@
1
- GIT = git
2
1
  INSTALLFILES=.installfiles
3
2
  PYTHON ?= python3
4
- override GITHEAD := $(shell test -e .git && $(GIT) rev-parse HEAD)
5
3
 
6
- U := $(shell $(PYTHON) ./setup.py versionup2date >/dev/null 2>&1; echo $$?;)
7
4
  TESTS = $(wildcard unit-tests/*_test.py)
8
5
 
9
6
  all:
10
7
  $(PYTHON) setup.py build
11
8
 
12
- install: gensrc linstor/consts_githash.py
9
+ install: gensrc
13
10
  $(PYTHON) setup.py install --record $(INSTALLFILES)
14
11
 
15
12
  uninstall:
16
13
  test -f $(INSTALLFILES) && cat $(INSTALLFILES) | xargs rm -rf || true
17
14
  rm -f $(INSTALLFILES)
18
15
 
19
- ifneq ($(U),0)
20
- up2date:
21
- $(error "Update your Version strings/Changelogs")
22
- else
23
- up2date: linstor/consts_githash.py
24
- $(info "Version strings/Changelogs up to date")
25
- endif
26
-
27
16
  .PHONY: linstor/drbdsetup_options.py
28
17
  linstor/drbdsetup_options.py:
29
18
  linstor-common/gendrbdoptions.py python $@
30
19
 
31
- release: up2date clean
20
+ release: clean
32
21
  $(PYTHON) setup.py sdist
33
22
  @echo && echo "Did you run distclean?"
34
23
  @echo && echo "Did you generate and commit the latest drbdsetup options?"
@@ -45,29 +34,16 @@ gensrc:
45
34
  make -C linstor-common python
46
35
 
47
36
  # no gensrc here, that is in debian/rules
48
- deb: up2date
37
+ deb:
49
38
  [ -d ./debian ] || (echo "Your checkout/tarball does not contain a debian directory" && false)
50
39
  debuild -i -us -uc -b
51
40
 
52
41
  # it is up to you (or the buildenv) to provide a distri specific setup.cfg
53
- rpm: gensrc up2date
42
+ rpm: gensrc
54
43
  $(PYTHON) setup.py bdist_rpm
55
44
 
56
- .PHONY: linstor/consts_githash.py
57
- ifdef GITHEAD
58
- override GITDIFF := $(shell $(GIT) diff --name-only HEAD 2>/dev/null | \
59
- grep -vxF "MANIFEST.in" | \
60
- tr -s '\t\n' ' ' | \
61
- sed -e 's/^/ /;s/ *$$//')
62
- linstor/consts_githash.py:
63
- @echo "GITHASH = 'GIT-hash: $(GITHEAD)$(GITDIFF)'" > $@
64
- else
65
- linstor/consts_githash.py:
66
- @echo >&2 "Need a git checkout to regenerate $@"; test -s $@
67
- endif
68
-
69
45
  md5sums:
70
- CURDATE=$$(date +%s); for i in $$(${GIT} ls-files | sort); do md5sum $$i >> md5sums.$${CURDATE}; done
46
+ CURDATE=$$(date +%s); for i in $$(git ls-files | sort); do md5sum $$i >> md5sums.$${CURDATE}; done
71
47
 
72
48
  clean:
73
49
  $(PYTHON) setup.py clean
@@ -75,10 +51,6 @@ clean:
75
51
  distclean: clean
76
52
  git clean -d -f || true
77
53
 
78
- check:
79
- # currently none
80
- # $(PYTHON) $(TESTS)
81
-
82
54
  .PHONY: doc upload-doc
83
55
  doc: gensrc
84
56
  make -C doc html
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-linstor
3
- Version: 1.27.1
3
+ Version: 1.28.2
4
4
  Summary: Linstor python api
5
5
  Home-page: https://www.linbit.com
6
6
  Author-email: Rene Peinthor <rene.peinthor@linbit.com>, Roland Kammerer <roland.kammerer@linbit.com>, Gabor Hernadi <gabor.hernadi@linbit.com>, Moritz Wanzenboeck <moritz.wanzenboeck@linbit.com>
7
7
  Maintainer-email: Rene Peinthor <rene.peinthor@linbit.com>
8
- License-Expression: LGPL-3.0-or-later
8
+ License: LGPL-3.0-or-later
9
9
  Project-URL: Homepage, https://github.com/LINBIT/linstor-api-py
10
10
  Project-URL: Documentation, https://linbit.github.io/linstor-api-py/
11
11
  Project-URL: Repository, https://github.com/LINBIT/linstor-api-py.git
@@ -13,8 +13,6 @@ Project-URL: Issues, https://github.com/LINBIT/linstor-api-py/issues
13
13
  Project-URL: Changelog, https://github.com/LINBIT/linstor-api-py/blob/master/CHANGELOG.md
14
14
  Classifier: Development Status :: 5 - Production/Stable
15
15
  Classifier: Intended Audience :: Developers
16
- Classifier: Programming Language :: Python :: 2.7
17
- Classifier: Programming Language :: Python :: 3.5
18
16
  Classifier: Programming Language :: Python :: 3.6
19
17
  Classifier: Programming Language :: Python :: 3.7
20
18
  Classifier: Programming Language :: Python :: 3.8
@@ -22,7 +20,7 @@ Classifier: Programming Language :: Python :: 3.9
22
20
  Classifier: Programming Language :: Python :: 3.10
23
21
  Classifier: Programming Language :: Python :: 3.11
24
22
  Classifier: Programming Language :: Python :: 3.12
25
- Requires-Python: >=3.5
23
+ Requires-Python: >=3.6
26
24
  Description-Content-Type: text/markdown
27
25
  License-File: COPYING
28
26
  Dynamic: home-page
@@ -37,6 +35,23 @@ LVM/ZFS volumes across a group of machines. It maintains DRBD configuration on t
37
35
  creates/deletes the backing LVM/ZFS volumes. It automatically places the backing LVM/ZFS volumes among the
38
36
  participating machines.
39
37
 
38
+ # Building
39
+
40
+ To build the package, install the `build` module and run it from the project root:
41
+
42
+ ```bash
43
+ pip install build
44
+ python -m build
45
+ ```
46
+
47
+ This will create both source distribution (`.tar.gz`) and wheel (`.whl`) files in the `dist/` directory.
48
+
49
+ To install the package locally for development:
50
+
51
+ ```bash
52
+ pip install -e .
53
+ ```
54
+
40
55
  # Online API documentation
41
56
  A rendered html documentation for the LINSTOR Python API can be found [here](https://linbit.github.io/linstor-api-py/).
42
57
 
@@ -7,6 +7,23 @@ LVM/ZFS volumes across a group of machines. It maintains DRBD configuration on t
7
7
  creates/deletes the backing LVM/ZFS volumes. It automatically places the backing LVM/ZFS volumes among the
8
8
  participating machines.
9
9
 
10
+ # Building
11
+
12
+ To build the package, install the `build` module and run it from the project root:
13
+
14
+ ```bash
15
+ pip install build
16
+ python -m build
17
+ ```
18
+
19
+ This will create both source distribution (`.tar.gz`) and wheel (`.whl`) files in the `dist/` directory.
20
+
21
+ To install the package locally for development:
22
+
23
+ ```bash
24
+ pip install -e .
25
+ ```
26
+
10
27
  # Online API documentation
11
28
  A rendered html documentation for the LINSTOR Python API can be found [here](https://linbit.github.io/linstor-api-py/).
12
29
 
@@ -1,11 +1,23 @@
1
1
  import os
2
+ from enum import Enum
3
+ from configparser import ConfigParser
2
4
 
3
5
  from linstor.linstorapi import MultiLinstor
4
6
 
5
- try:
6
- from configparser import ConfigParser
7
- except ImportError:
8
- from ConfigParser import SafeConfigParser as ConfigParser
7
+
8
+ class ConfigFileLevel(Enum):
9
+ USER = 1
10
+ SYS = 2
11
+
12
+ def to_config_path(self):
13
+ config_file = "linstor-client.conf"
14
+ if self.value == 1:
15
+ home_dir = os.path.expanduser("~")
16
+ return os.path.join(home_dir, ".config", "linstor", config_file)
17
+ elif self.value == 2:
18
+ return os.path.join('/etc', 'linstor', config_file)
19
+ else:
20
+ return None
9
21
 
10
22
 
11
23
  class Config(object):
@@ -47,6 +59,20 @@ class Config(object):
47
59
  entries = Config.CONFIG.get(section, []) if Config.CONFIG else []
48
60
  return {k: v for k, v in entries}
49
61
 
62
+ @staticmethod
63
+ def set_value(section: str, key: str, value: str, level: ConfigFileLevel = ConfigFileLevel.USER):
64
+ config_path = level.to_config_path()
65
+ cp = ConfigParser()
66
+ cp.read(config_path)
67
+ if section not in cp.sections():
68
+ cp.add_section(section)
69
+ cp.set(section, key, value)
70
+ config_dir = os.path.dirname(config_path)
71
+ if config_dir:
72
+ os.makedirs(config_dir, exist_ok=True)
73
+ with open(config_path, 'w') as f:
74
+ cp.write(f)
75
+
50
76
  @staticmethod
51
77
  def get_controllers(section='global', config_file_name=None, fallback='linstor://localhost'):
52
78
  """