RacksDB 0.2.0__tar.gz → 0.4.0__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 (64) hide show
  1. {RacksDB-0.2.0 → racksdb-0.4.0}/PKG-INFO +49 -16
  2. {RacksDB-0.2.0 → racksdb-0.4.0}/README.md +44 -14
  3. {RacksDB-0.2.0 → racksdb-0.4.0}/RacksDB.egg-info/PKG-INFO +49 -16
  4. {RacksDB-0.2.0 → racksdb-0.4.0}/RacksDB.egg-info/SOURCES.txt +12 -0
  5. {RacksDB-0.2.0 → racksdb-0.4.0}/RacksDB.egg-info/requires.txt +5 -1
  6. {RacksDB-0.2.0 → racksdb-0.4.0}/pyproject.toml +7 -3
  7. {RacksDB-0.2.0 → racksdb-0.4.0}/racksdb/__init__.py +16 -7
  8. {RacksDB-0.2.0 → racksdb-0.4.0}/racksdb/bases.py +50 -9
  9. racksdb-0.4.0/racksdb/drawers/base.py +161 -0
  10. racksdb-0.4.0/racksdb/drawers/coordinates/__init__.py +17 -0
  11. racksdb-0.4.0/racksdb/drawers/coordinates/base.py +10 -0
  12. racksdb-0.4.0/racksdb/drawers/coordinates/json.py +19 -0
  13. racksdb-0.4.0/racksdb/drawers/coordinates/yaml.py +19 -0
  14. racksdb-0.4.0/racksdb/drawers/dtypes/hexcolor.py +25 -0
  15. racksdb-0.4.0/racksdb/drawers/infrastructure.py +586 -0
  16. racksdb-0.4.0/racksdb/drawers/parameters.py +45 -0
  17. racksdb-0.4.0/racksdb/drawers/room.py +238 -0
  18. racksdb-0.4.0/racksdb/dtypes/bits.py +25 -0
  19. {RacksDB-0.2.0 → racksdb-0.4.0}/racksdb/dtypes/bytes.py +2 -8
  20. racksdb-0.4.0/racksdb/dtypes/watts.py +23 -0
  21. racksdb-0.4.0/racksdb/errors.py +20 -0
  22. {RacksDB-0.2.0 → racksdb-0.4.0}/racksdb/exec.py +59 -3
  23. {RacksDB-0.2.0 → racksdb-0.4.0}/racksdb/generic/db.py +98 -18
  24. {RacksDB-0.2.0 → racksdb-0.4.0}/racksdb/generic/dumpers/json.py +4 -18
  25. {RacksDB-0.2.0 → racksdb-0.4.0}/racksdb/generic/dumpers/yaml.py +14 -21
  26. {RacksDB-0.2.0 → racksdb-0.4.0}/racksdb/generic/errors.py +4 -0
  27. {RacksDB-0.2.0 → racksdb-0.4.0}/racksdb/generic/openapi.py +138 -32
  28. {RacksDB-0.2.0 → racksdb-0.4.0}/racksdb/generic/schema.py +40 -7
  29. {RacksDB-0.2.0 → racksdb-0.4.0}/racksdb/generic/views.py +71 -10
  30. racksdb-0.4.0/racksdb/tests/test_defined_type_hexcolor.py +25 -0
  31. racksdb-0.4.0/racksdb/tests/test_defined_type_watts.py +25 -0
  32. racksdb-0.4.0/racksdb/tests/test_drawer.py +154 -0
  33. {RacksDB-0.2.0 → racksdb-0.4.0}/racksdb/tests/tests_db_load.py +7 -8
  34. {RacksDB-0.2.0 → racksdb-0.4.0}/racksdb/views.py +61 -4
  35. racksdb-0.4.0/racksdb/web/__init__.py +0 -0
  36. racksdb-0.4.0/racksdb/web/app.py +336 -0
  37. RacksDB-0.2.0/racksdb/drawers/base.py +0 -42
  38. RacksDB-0.2.0/racksdb/drawers/infrastructure.py +0 -253
  39. RacksDB-0.2.0/racksdb/drawers/room.py +0 -160
  40. RacksDB-0.2.0/racksdb/errors.py +0 -9
  41. RacksDB-0.2.0/racksdb/web/app.py +0 -195
  42. {RacksDB-0.2.0 → racksdb-0.4.0}/LICENSE +0 -0
  43. {RacksDB-0.2.0 → racksdb-0.4.0}/RacksDB.egg-info/dependency_links.txt +0 -0
  44. {RacksDB-0.2.0 → racksdb-0.4.0}/RacksDB.egg-info/entry_points.txt +0 -0
  45. {RacksDB-0.2.0 → racksdb-0.4.0}/RacksDB.egg-info/top_level.txt +0 -0
  46. {RacksDB-0.2.0 → racksdb-0.4.0}/racksdb/drawers/__init__.py +0 -0
  47. {RacksDB-0.2.0/racksdb → racksdb-0.4.0/racksdb/drawers}/dtypes/__init__.py +0 -0
  48. {RacksDB-0.2.0/racksdb/generic → racksdb-0.4.0/racksdb/dtypes}/__init__.py +0 -0
  49. {RacksDB-0.2.0 → racksdb-0.4.0}/racksdb/dtypes/angle.py +0 -0
  50. {RacksDB-0.2.0 → racksdb-0.4.0}/racksdb/dtypes/dimension.py +0 -0
  51. {RacksDB-0.2.0 → racksdb-0.4.0}/racksdb/dtypes/netif_type.py +0 -0
  52. {RacksDB-0.2.0 → racksdb-0.4.0}/racksdb/dtypes/rack_height.py +0 -0
  53. {RacksDB-0.2.0 → racksdb-0.4.0}/racksdb/dtypes/rack_width.py +0 -0
  54. {RacksDB-0.2.0 → racksdb-0.4.0}/racksdb/dtypes/storage_type.py +0 -0
  55. {RacksDB-0.2.0/racksdb/tests → racksdb-0.4.0/racksdb/generic}/__init__.py +0 -0
  56. {RacksDB-0.2.0 → racksdb-0.4.0}/racksdb/generic/definedtype.py +0 -0
  57. {RacksDB-0.2.0 → racksdb-0.4.0}/racksdb/generic/dumpers/__init__.py +0 -0
  58. {RacksDB-0.2.0 → racksdb-0.4.0}/racksdb/generic/dumpers/_common.py +0 -0
  59. {RacksDB-0.2.0 → racksdb-0.4.0}/racksdb/generic/dumpers/console.py +0 -0
  60. {RacksDB-0.2.0/racksdb/web → racksdb-0.4.0/racksdb/tests}/__init__.py +0 -0
  61. {RacksDB-0.2.0 → racksdb-0.4.0}/racksdb/tests/test_schema.py +0 -0
  62. {RacksDB-0.2.0 → racksdb-0.4.0}/racksdb/tests/test_schema_defined_type_loader.py +0 -0
  63. {RacksDB-0.2.0 → racksdb-0.4.0}/racksdb/version.py +0 -0
  64. {RacksDB-0.2.0 → racksdb-0.4.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: RacksDB
3
- Version: 0.2.0
3
+ Version: 0.4.0
4
4
  Summary: Modelize your datacenters infrastructures in YAML database
5
5
  Author-email: Rémi Palancher <remi@rackslab.io>
6
6
  License: GPLv3+
@@ -20,12 +20,15 @@ License-File: LICENSE
20
20
  Requires-Dist: PyYAML
21
21
  Requires-Dist: ClusterShell
22
22
  Requires-Dist: pycairo
23
+ Requires-Dist: PyGObject
24
+ Provides-Extra: dev
25
+ Requires-Dist: Flask-Cors; extra == "dev"
23
26
  Provides-Extra: web
24
27
  Requires-Dist: Flask; extra == "web"
25
- Requires-Dist: Flask-Cors; extra == "web"
28
+ Requires-Dist: requests-toolbelt; extra == "web"
26
29
 
27
30
  <img
28
- src="docs/modules/overview/images/racksdb_logo.svg"
31
+ src="assets/bitmaps/logo_full_white_medium.png"
29
32
  alt="RacksDB Overview"
30
33
  align="right"
31
34
  width="200px"
@@ -53,9 +56,8 @@ source** for many purposes in IT management.
53
56
 
54
57
  <p align="center">
55
58
  <img
56
- src="docs/modules/overview/images/racksdb_overview.svg"
59
+ src="docs/modules/overview/images/racksdb_overview.png"
57
60
  alt="RacksDB Overview"
58
- width="600px"
59
61
  style="margin: 0 auto;">
60
62
  </p>
61
63
 
@@ -82,12 +84,21 @@ solutions are the following:
82
84
  extensions can be defined to store specific data.
83
85
 
84
86
  RacksDB provides multiple interfaces to request the database with its
85
- [CLI tool](https://docs.rackslab.io/racksdb/beta/usage/racksdb.html), a
86
- [Python library](https://docs.rackslab.io/racksdb/beta/usage/api.html) and a
87
- [REST API](https://docs.rackslab.io/racksdb/beta/usage/rest.html).
87
+ [CLI tool](https://docs.rackslab.io/racksdb/usage/racksdb.html), a
88
+ [Python library](https://docs.rackslab.io/racksdb/usage/lib.html), a
89
+ [REST API](https://docs.rackslab.io/racksdb/usage/rest.html) and a
90
+ [Web UI](https://docs.rackslab.io/racksdb/usage/ui.html).
91
+
92
+ <p align="center">
93
+ <img
94
+ src="assets/screenshots/assemblies/bitmaps/screenshots-small.webp"
95
+ alt="RacksDB web UI"
96
+ width="600px"
97
+ style="margin: 0 auto;">
98
+ <p>
88
99
 
89
100
  For more details, read the
90
- [full description](https://docs.rackslab.io/racksdb/beta/overview/overview.html)
101
+ [full description](https://docs.rackslab.io/racksdb/overview/overview.html)
91
102
  of RacksDB.
92
103
 
93
104
  ## Status
@@ -97,22 +108,31 @@ RacksDB is considered stable and ready for production.
97
108
  ## Quickstart
98
109
 
99
110
  To install and start using RacksDB in a few steps, follow the
100
- [quickstart guide](https://docs.rackslab.io/racksdb/beta/install/quickstart.html)!
111
+ [quickstart guide](https://docs.rackslab.io/racksdb/install/quickstart.html)!
101
112
 
102
113
  ## Documentation
103
114
 
104
- The [full documentation](https://docs.rackslab.io/racksdb/beta/)
115
+ The [full documentation](https://docs.rackslab.io/racksdb/)
105
116
  of RacksDB is available online with complete database definition reference
106
117
  documentation, how-tos (extensions, positioning), CLI manpage and library API
107
118
  documentation.
108
119
 
109
- ## Tests
120
+ ## Community
110
121
 
111
- To run the unit tests, launch this command:
122
+ Do you want to get in touch with developers and the community? Several channels
123
+ are available:
112
124
 
113
- ```
114
- $ python3 -m unittest discover -v .
115
- ```
125
+ * **Matrix Chat** [#racksdb:talk.rackslab.io](https://matrix.to/#/#racksdb:talk.rackslab.io):
126
+ instant messaging for quick feedback and help.
127
+
128
+ > [!NOTE]
129
+ > A [Matrix account](https://matrix.org/docs/chat_basics/matrix-for-im/#creating-a-matrix-account)
130
+ > is required to access the chat room. It can be created in few steps on any
131
+ > Matrix network public provider such as [matrix.org](https://matrix.org) or
132
+ > [gitter.im](https://gitter.im/#apps).
133
+
134
+ * [**GitHub Discussions**](https://github.com/rackslab/RacksDB/discussions):
135
+ send questions, ideas and suggestions.
116
136
 
117
137
  ## Authors
118
138
 
@@ -120,6 +140,19 @@ RacksDB is developed and maintained by [Rackslab](https://rackslab.io). Please
120
140
  [contact us](https://rackslab.io/en/contact/) for any questions or professionnal
121
141
  services.
122
142
 
143
+ The project has also received external contributions from great people:
144
+
145
+ * [@btravouillon](https://github.com/btravouillon)
146
+ ([Mila](https://mila.quebec/en/))
147
+
148
+ ## Tests
149
+
150
+ To run the unit tests, launch this command:
151
+
152
+ ```
153
+ $ python3 -m unittest discover -v .
154
+ ```
155
+
123
156
  ## License
124
157
 
125
158
  RacksDB is distributed under the terms of the GNU General Public License v3.0 or
@@ -1,5 +1,5 @@
1
1
  <img
2
- src="docs/modules/overview/images/racksdb_logo.svg"
2
+ src="assets/bitmaps/logo_full_white_medium.png"
3
3
  alt="RacksDB Overview"
4
4
  align="right"
5
5
  width="200px"
@@ -27,9 +27,8 @@ source** for many purposes in IT management.
27
27
 
28
28
  <p align="center">
29
29
  <img
30
- src="docs/modules/overview/images/racksdb_overview.svg"
30
+ src="docs/modules/overview/images/racksdb_overview.png"
31
31
  alt="RacksDB Overview"
32
- width="600px"
33
32
  style="margin: 0 auto;">
34
33
  </p>
35
34
 
@@ -56,12 +55,21 @@ solutions are the following:
56
55
  extensions can be defined to store specific data.
57
56
 
58
57
  RacksDB provides multiple interfaces to request the database with its
59
- [CLI tool](https://docs.rackslab.io/racksdb/beta/usage/racksdb.html), a
60
- [Python library](https://docs.rackslab.io/racksdb/beta/usage/api.html) and a
61
- [REST API](https://docs.rackslab.io/racksdb/beta/usage/rest.html).
58
+ [CLI tool](https://docs.rackslab.io/racksdb/usage/racksdb.html), a
59
+ [Python library](https://docs.rackslab.io/racksdb/usage/lib.html), a
60
+ [REST API](https://docs.rackslab.io/racksdb/usage/rest.html) and a
61
+ [Web UI](https://docs.rackslab.io/racksdb/usage/ui.html).
62
+
63
+ <p align="center">
64
+ <img
65
+ src="assets/screenshots/assemblies/bitmaps/screenshots-small.webp"
66
+ alt="RacksDB web UI"
67
+ width="600px"
68
+ style="margin: 0 auto;">
69
+ <p>
62
70
 
63
71
  For more details, read the
64
- [full description](https://docs.rackslab.io/racksdb/beta/overview/overview.html)
72
+ [full description](https://docs.rackslab.io/racksdb/overview/overview.html)
65
73
  of RacksDB.
66
74
 
67
75
  ## Status
@@ -71,22 +79,31 @@ RacksDB is considered stable and ready for production.
71
79
  ## Quickstart
72
80
 
73
81
  To install and start using RacksDB in a few steps, follow the
74
- [quickstart guide](https://docs.rackslab.io/racksdb/beta/install/quickstart.html)!
82
+ [quickstart guide](https://docs.rackslab.io/racksdb/install/quickstart.html)!
75
83
 
76
84
  ## Documentation
77
85
 
78
- The [full documentation](https://docs.rackslab.io/racksdb/beta/)
86
+ The [full documentation](https://docs.rackslab.io/racksdb/)
79
87
  of RacksDB is available online with complete database definition reference
80
88
  documentation, how-tos (extensions, positioning), CLI manpage and library API
81
89
  documentation.
82
90
 
83
- ## Tests
91
+ ## Community
84
92
 
85
- To run the unit tests, launch this command:
93
+ Do you want to get in touch with developers and the community? Several channels
94
+ are available:
86
95
 
87
- ```
88
- $ python3 -m unittest discover -v .
89
- ```
96
+ * **Matrix Chat** [#racksdb:talk.rackslab.io](https://matrix.to/#/#racksdb:talk.rackslab.io):
97
+ instant messaging for quick feedback and help.
98
+
99
+ > [!NOTE]
100
+ > A [Matrix account](https://matrix.org/docs/chat_basics/matrix-for-im/#creating-a-matrix-account)
101
+ > is required to access the chat room. It can be created in few steps on any
102
+ > Matrix network public provider such as [matrix.org](https://matrix.org) or
103
+ > [gitter.im](https://gitter.im/#apps).
104
+
105
+ * [**GitHub Discussions**](https://github.com/rackslab/RacksDB/discussions):
106
+ send questions, ideas and suggestions.
90
107
 
91
108
  ## Authors
92
109
 
@@ -94,6 +111,19 @@ RacksDB is developed and maintained by [Rackslab](https://rackslab.io). Please
94
111
  [contact us](https://rackslab.io/en/contact/) for any questions or professionnal
95
112
  services.
96
113
 
114
+ The project has also received external contributions from great people:
115
+
116
+ * [@btravouillon](https://github.com/btravouillon)
117
+ ([Mila](https://mila.quebec/en/))
118
+
119
+ ## Tests
120
+
121
+ To run the unit tests, launch this command:
122
+
123
+ ```
124
+ $ python3 -m unittest discover -v .
125
+ ```
126
+
97
127
  ## License
98
128
 
99
129
  RacksDB is distributed under the terms of the GNU General Public License v3.0 or
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: RacksDB
3
- Version: 0.2.0
3
+ Version: 0.4.0
4
4
  Summary: Modelize your datacenters infrastructures in YAML database
5
5
  Author-email: Rémi Palancher <remi@rackslab.io>
6
6
  License: GPLv3+
@@ -20,12 +20,15 @@ License-File: LICENSE
20
20
  Requires-Dist: PyYAML
21
21
  Requires-Dist: ClusterShell
22
22
  Requires-Dist: pycairo
23
+ Requires-Dist: PyGObject
24
+ Provides-Extra: dev
25
+ Requires-Dist: Flask-Cors; extra == "dev"
23
26
  Provides-Extra: web
24
27
  Requires-Dist: Flask; extra == "web"
25
- Requires-Dist: Flask-Cors; extra == "web"
28
+ Requires-Dist: requests-toolbelt; extra == "web"
26
29
 
27
30
  <img
28
- src="docs/modules/overview/images/racksdb_logo.svg"
31
+ src="assets/bitmaps/logo_full_white_medium.png"
29
32
  alt="RacksDB Overview"
30
33
  align="right"
31
34
  width="200px"
@@ -53,9 +56,8 @@ source** for many purposes in IT management.
53
56
 
54
57
  <p align="center">
55
58
  <img
56
- src="docs/modules/overview/images/racksdb_overview.svg"
59
+ src="docs/modules/overview/images/racksdb_overview.png"
57
60
  alt="RacksDB Overview"
58
- width="600px"
59
61
  style="margin: 0 auto;">
60
62
  </p>
61
63
 
@@ -82,12 +84,21 @@ solutions are the following:
82
84
  extensions can be defined to store specific data.
83
85
 
84
86
  RacksDB provides multiple interfaces to request the database with its
85
- [CLI tool](https://docs.rackslab.io/racksdb/beta/usage/racksdb.html), a
86
- [Python library](https://docs.rackslab.io/racksdb/beta/usage/api.html) and a
87
- [REST API](https://docs.rackslab.io/racksdb/beta/usage/rest.html).
87
+ [CLI tool](https://docs.rackslab.io/racksdb/usage/racksdb.html), a
88
+ [Python library](https://docs.rackslab.io/racksdb/usage/lib.html), a
89
+ [REST API](https://docs.rackslab.io/racksdb/usage/rest.html) and a
90
+ [Web UI](https://docs.rackslab.io/racksdb/usage/ui.html).
91
+
92
+ <p align="center">
93
+ <img
94
+ src="assets/screenshots/assemblies/bitmaps/screenshots-small.webp"
95
+ alt="RacksDB web UI"
96
+ width="600px"
97
+ style="margin: 0 auto;">
98
+ <p>
88
99
 
89
100
  For more details, read the
90
- [full description](https://docs.rackslab.io/racksdb/beta/overview/overview.html)
101
+ [full description](https://docs.rackslab.io/racksdb/overview/overview.html)
91
102
  of RacksDB.
92
103
 
93
104
  ## Status
@@ -97,22 +108,31 @@ RacksDB is considered stable and ready for production.
97
108
  ## Quickstart
98
109
 
99
110
  To install and start using RacksDB in a few steps, follow the
100
- [quickstart guide](https://docs.rackslab.io/racksdb/beta/install/quickstart.html)!
111
+ [quickstart guide](https://docs.rackslab.io/racksdb/install/quickstart.html)!
101
112
 
102
113
  ## Documentation
103
114
 
104
- The [full documentation](https://docs.rackslab.io/racksdb/beta/)
115
+ The [full documentation](https://docs.rackslab.io/racksdb/)
105
116
  of RacksDB is available online with complete database definition reference
106
117
  documentation, how-tos (extensions, positioning), CLI manpage and library API
107
118
  documentation.
108
119
 
109
- ## Tests
120
+ ## Community
110
121
 
111
- To run the unit tests, launch this command:
122
+ Do you want to get in touch with developers and the community? Several channels
123
+ are available:
112
124
 
113
- ```
114
- $ python3 -m unittest discover -v .
115
- ```
125
+ * **Matrix Chat** [#racksdb:talk.rackslab.io](https://matrix.to/#/#racksdb:talk.rackslab.io):
126
+ instant messaging for quick feedback and help.
127
+
128
+ > [!NOTE]
129
+ > A [Matrix account](https://matrix.org/docs/chat_basics/matrix-for-im/#creating-a-matrix-account)
130
+ > is required to access the chat room. It can be created in few steps on any
131
+ > Matrix network public provider such as [matrix.org](https://matrix.org) or
132
+ > [gitter.im](https://gitter.im/#apps).
133
+
134
+ * [**GitHub Discussions**](https://github.com/rackslab/RacksDB/discussions):
135
+ send questions, ideas and suggestions.
116
136
 
117
137
  ## Authors
118
138
 
@@ -120,6 +140,19 @@ RacksDB is developed and maintained by [Rackslab](https://rackslab.io). Please
120
140
  [contact us](https://rackslab.io/en/contact/) for any questions or professionnal
121
141
  services.
122
142
 
143
+ The project has also received external contributions from great people:
144
+
145
+ * [@btravouillon](https://github.com/btravouillon)
146
+ ([Mila](https://mila.quebec/en/))
147
+
148
+ ## Tests
149
+
150
+ To run the unit tests, launch this command:
151
+
152
+ ```
153
+ $ python3 -m unittest discover -v .
154
+ ```
155
+
123
156
  ## License
124
157
 
125
158
  RacksDB is distributed under the terms of the GNU General Public License v3.0 or
@@ -16,15 +16,24 @@ racksdb/views.py
16
16
  racksdb/drawers/__init__.py
17
17
  racksdb/drawers/base.py
18
18
  racksdb/drawers/infrastructure.py
19
+ racksdb/drawers/parameters.py
19
20
  racksdb/drawers/room.py
21
+ racksdb/drawers/coordinates/__init__.py
22
+ racksdb/drawers/coordinates/base.py
23
+ racksdb/drawers/coordinates/json.py
24
+ racksdb/drawers/coordinates/yaml.py
25
+ racksdb/drawers/dtypes/__init__.py
26
+ racksdb/drawers/dtypes/hexcolor.py
20
27
  racksdb/dtypes/__init__.py
21
28
  racksdb/dtypes/angle.py
29
+ racksdb/dtypes/bits.py
22
30
  racksdb/dtypes/bytes.py
23
31
  racksdb/dtypes/dimension.py
24
32
  racksdb/dtypes/netif_type.py
25
33
  racksdb/dtypes/rack_height.py
26
34
  racksdb/dtypes/rack_width.py
27
35
  racksdb/dtypes/storage_type.py
36
+ racksdb/dtypes/watts.py
28
37
  racksdb/generic/__init__.py
29
38
  racksdb/generic/db.py
30
39
  racksdb/generic/definedtype.py
@@ -38,6 +47,9 @@ racksdb/generic/dumpers/console.py
38
47
  racksdb/generic/dumpers/json.py
39
48
  racksdb/generic/dumpers/yaml.py
40
49
  racksdb/tests/__init__.py
50
+ racksdb/tests/test_defined_type_hexcolor.py
51
+ racksdb/tests/test_defined_type_watts.py
52
+ racksdb/tests/test_drawer.py
41
53
  racksdb/tests/test_schema.py
42
54
  racksdb/tests/test_schema_defined_type_loader.py
43
55
  racksdb/tests/tests_db_load.py
@@ -1,7 +1,11 @@
1
1
  PyYAML
2
2
  ClusterShell
3
3
  pycairo
4
+ PyGObject
5
+
6
+ [dev]
7
+ Flask-Cors
4
8
 
5
9
  [web]
6
10
  Flask
7
- Flask-Cors
11
+ requests-toolbelt
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "RacksDB"
7
- version = "0.2.0"
7
+ version = "0.4.0"
8
8
  description = "Modelize your datacenters infrastructures in YAML database"
9
9
  license = {text = "GPLv3+"}
10
10
  requires-python = ">=3.6"
@@ -16,6 +16,7 @@ dependencies = [
16
16
  "PyYAML",
17
17
  "ClusterShell",
18
18
  "pycairo",
19
+ "PyGObject",
19
20
  ]
20
21
  readme = "README.md"
21
22
  classifiers = [
@@ -29,9 +30,12 @@ classifiers = [
29
30
  ]
30
31
 
31
32
  [project.optional-dependencies]
33
+ dev = [
34
+ "Flask-Cors",
35
+ ]
32
36
  web = [
33
37
  "Flask",
34
- "Flask-Cors",
38
+ "requests-toolbelt",
35
39
  ]
36
40
 
37
41
  [project.scripts]
@@ -39,7 +43,7 @@ racksdb = "racksdb.exec:RacksDBExec.run"
39
43
  racksdb-web = "racksdb.web.app:RacksDBWebApp.run"
40
44
 
41
45
  [tool.setuptools.packages.find]
42
- include = ['racksdb*']
46
+ include = ["racksdb*"]
43
47
 
44
48
  [project.urls]
45
49
  "Homepage" = "https://github.com/rackslab/RacksDB"
@@ -9,14 +9,17 @@ from typing import Union
9
9
 
10
10
  from .generic.schema import Schema, SchemaFileLoader, SchemaDefinedTypeLoader
11
11
  from .generic.db import GenericDB, DBDict, DBList, DBSplittedFilesLoader
12
+ from .generic.errors import DBSchemaError, DBFormatError
13
+ from .errors import RacksDBFormatError, RacksDBSchemaError
12
14
  from . import bases
13
15
 
14
16
 
15
17
  class RacksDB(GenericDB):
16
18
 
17
19
  DEFAULT_DB = "/var/lib/racksdb"
18
- DEFAULT_SCHEMA = "/usr/share/racksdb/schema.yml"
20
+ DEFAULT_SCHEMA = "/usr/share/racksdb/schemas/racksdb.yml"
19
21
  DEFAULT_EXT = "/etc/racksdb/extensions.yml"
22
+ DEFAULT_UI = "/usr/share/racksdb/frontend"
20
23
  PREFIX = "RacksDB"
21
24
  DEFINED_TYPES_MODULE = "racksdb.dtypes"
22
25
 
@@ -65,10 +68,16 @@ class RacksDB(GenericDB):
65
68
  db = Path(cls.DEFAULT_DB)
66
69
  elif isinstance(db, str):
67
70
  db = Path(db)
68
- _schema = Schema(
69
- SchemaFileLoader(schema, ext),
70
- SchemaDefinedTypeLoader(cls.DEFINED_TYPES_MODULE),
71
- )
72
- _db = cls(_schema, DBSplittedFilesLoader(db))
73
- super(cls, _db).load(_db._loader)
71
+ try:
72
+ _schema = Schema(
73
+ SchemaFileLoader(schema, ext),
74
+ SchemaDefinedTypeLoader(cls.DEFINED_TYPES_MODULE),
75
+ )
76
+ except DBSchemaError as err:
77
+ raise RacksDBSchemaError(str(err)) from err
78
+ try:
79
+ _db = cls(_schema, DBSplittedFilesLoader(db))
80
+ super(cls, _db).load(_db._loader)
81
+ except DBFormatError as err:
82
+ raise RacksDBFormatError(str(err)) from err
74
83
  return _db
@@ -4,6 +4,20 @@
4
4
  #
5
5
  # SPDX-License-Identifier: GPL-3.0-or-later
6
6
 
7
+ import math
8
+
9
+ try:
10
+ from functools import cached_property
11
+ except ImportError:
12
+ # For Python 3.[6-7] compatibility. The dependency to cached_property
13
+ # external library is not declared in pyproject.toml, it is added
14
+ # explicitely in packages codes only for distributions stuck with these old
15
+ # versions of Python.
16
+ #
17
+ # This try/except block can be removed when support of Python < 3.8 is
18
+ # dropped in RacksDB.
19
+ from cached_property import cached_property
20
+
7
21
  from .generic.db import DBList, DBDict
8
22
 
9
23
 
@@ -43,18 +57,33 @@ class RacksDBInfrastructureBase:
43
57
  return True
44
58
 
45
59
 
46
- class RacksDBNodeBase:
60
+ class RacksDBGenericEquipment:
47
61
  @property
48
62
  def tags(self):
49
63
  result = DBList()
50
64
  for tag in getattr(self._parent, "tags", []):
51
65
  result.append(tag)
52
- # RacksDBNodeBase loaded tags are renamed with loaded prefix to avoid
53
- # conflict with this property.
66
+ # RacksDB{Node,StorageEquipment,NetworkEquipment,MiscEquipment} loaded tags are
67
+ # renamed with loaded prefix to avoid conflict with this property.
54
68
  for tag in getattr(self, f"{self.LOADED_PREFIX}tags", []):
55
- result.append(tag)
69
+ # Avoid duplicate tags that could be defined on both parent part and
70
+ # equipment.
71
+ if tag not in result:
72
+ result.append(tag)
56
73
  return result
57
74
 
75
+ @cached_property
76
+ def position(self):
77
+ obj = self._db.create_object_by_name("EquipmentPosition")
78
+ obj.height = (
79
+ self._first.slot
80
+ - self.rack.type.initial
81
+ + math.floor((self.slot - self._first.slot) * self.type.width)
82
+ * self.type.height
83
+ )
84
+ obj.width = (self.slot - self._first.slot) % int(1 / self.type.width)
85
+ return obj
86
+
58
87
  def _filter(self, infrastructure=None, name=None, tags=None):
59
88
  # filter by name
60
89
  if name is not None and name != self.name:
@@ -70,10 +99,23 @@ class RacksDBNodeBase:
70
99
  return True
71
100
 
72
101
 
73
- class RacksDBRackBase:
102
+ class RacksDBNodeBase(RacksDBGenericEquipment):
103
+ pass
104
+
105
+
106
+ class RacksDBStorageEquipmentBase(RacksDBGenericEquipment):
107
+ pass
108
+
74
109
 
75
- COMPUTED_PROPERTIES = ["nodes", "fillrate"]
110
+ class RacksDBNetworkEquipmentBase(RacksDBGenericEquipment):
111
+ pass
76
112
 
113
+
114
+ class RacksDBMiscEquipmentBase(RacksDBGenericEquipment):
115
+ pass
116
+
117
+
118
+ class RacksDBRackBase:
77
119
  def _filter(self, name=None):
78
120
  # filter by name
79
121
  if name is not None and name != self.name:
@@ -93,6 +135,8 @@ class RacksDBRackBase:
93
135
  occupied += equipment.type.height * equipment.type.width
94
136
  for equipment in part.network:
95
137
  occupied += equipment.type.height * equipment.type.width
138
+ for equipment in part.misc:
139
+ occupied += equipment.type.height * equipment.type.width
96
140
  return occupied / self.type.slots
97
141
 
98
142
  @property
@@ -108,9 +152,6 @@ class RacksDBRackBase:
108
152
 
109
153
 
110
154
  class RacksDBRacksRowBase:
111
-
112
- COMPUTED_PROPERTIES = ["nbracks"]
113
-
114
155
  @property
115
156
  def nbracks(self):
116
157
  """Return the number of racks in the row."""