maqet 0.0.1.3__py3-none-any.whl → 0.0.1.4__py3-none-any.whl

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.
maqet/core.py CHANGED
@@ -260,6 +260,8 @@ class Maqet:
260
260
  self.Machine = Machine # For comfortable stage building
261
261
  self._config = benedict(kwargs)
262
262
 
263
+ self._validate_config()
264
+
263
265
  self._stages = dict()
264
266
  self.storage: dict[str, Drive] = dict()
265
267
 
@@ -276,6 +278,18 @@ class Maqet:
276
278
  else:
277
279
  LOG.warning(f"Stage {stage} not found. Skipping")
278
280
 
281
+ def _validate_config(self):
282
+ default_config_fields = {
283
+ 'binary': 'qemu-system-x86_64',
284
+ 'arguments': [],
285
+ 'user_arguments': [],
286
+ 'storage': {}
287
+ }
288
+
289
+ for k, v in default_config_fields.items():
290
+ if k not in self._config:
291
+ self._config[k] = v
292
+
279
293
  @property
280
294
  def command(self) -> str:
281
295
  """
@@ -298,9 +312,11 @@ class Maqet:
298
312
  @config.setter
299
313
  def set_config(self, new_config: dict):
300
314
  self._config = benedict(new_config)
315
+ self._validate_config()
301
316
 
302
317
  def merge_config(self, new_config: dict):
303
318
  self._config.merge(new_config)
319
+ self._validate_config()
304
320
 
305
321
  def add_argument(self, argument: str) -> None:
306
322
  """
@@ -0,0 +1,6 @@
1
+ Metadata-Version: 2.1
2
+ Name: maqet
3
+ Version: 0.0.1.4
4
+ Requires-Python: >=3.12
5
+ Requires-Dist: python-benedict >=0.33.2
6
+
@@ -1,5 +1,5 @@
1
1
  maqet/__init__.py,sha256=hH-7x9aitvZKK46YFjdGLvHRSGMl67QLWwYlzikeoRw,96
2
- maqet/core.py,sha256=7SjZaVNWsZG7Sp2lw_UcrMKInWHMsprpq9nnnyiEi8s,11841
2
+ maqet/core.py,sha256=lq1sQU3lGSiADiD_nYMKXv4zYvhSrJaVPfSDzv03wiw,12274
3
3
  maqet/functions.py,sha256=gZRIeCZpalnK6T9ktDzGHIT8LzniXaEMdzFNVTccXOo,2856
4
4
  maqet/logger.py,sha256=3N9TnInogdYVZ7DrT6Cg6lL8Q-c6AufBDspy9RmLWhk,1821
5
5
  maqet/storage.py,sha256=09atk3-eMf2xH-CGdwrr9D-zHMPXkaLXT1AIjZ6WMxI,6273
@@ -27,7 +27,7 @@ qemu/utils/qemu_ga_client.py,sha256=ycQ6lOh7Q0DEwvNq_LyE0Y4DRZfimq8kjhNlyn3K0Zk,
27
27
  qemu/utils/qom.py,sha256=sC2wXMZ_dH4E5HnYinjCMpagx_I-9NJ5oJi0rEiqqQQ,7564
28
28
  qemu/utils/qom_common.py,sha256=UQitmqLNGYfd3DoMaLNxRprgJeaEs6hX-8mrhGQ2mkc,4991
29
29
  qemu/utils/qom_fuse.py,sha256=uDbTKVWWej1Ey1Jsnw2p9sjmuLC_2vBBtBZpPG40I-k,5966
30
- maqet-0.0.1.3.dist-info/METADATA,sha256=lkT0rMHt-c6_DXT-HjQPZFULSEHIzceQqsBMSw24Oo4,3154
31
- maqet-0.0.1.3.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
32
- maqet-0.0.1.3.dist-info/top_level.txt,sha256=9J0eHJ7TIdifxVkOxhgWVSyxkKRQhuFcbqUzIjhmgWg,11
33
- maqet-0.0.1.3.dist-info/RECORD,,
30
+ maqet-0.0.1.4.dist-info/METADATA,sha256=sltSMjplayRAPOPAf5RV8rJ8s_xXdZufdEVPWp5OXGs,116
31
+ maqet-0.0.1.4.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
32
+ maqet-0.0.1.4.dist-info/top_level.txt,sha256=9J0eHJ7TIdifxVkOxhgWVSyxkKRQhuFcbqUzIjhmgWg,11
33
+ maqet-0.0.1.4.dist-info/RECORD,,
@@ -1,104 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: maqet
3
- Version: 0.0.1.3
4
- Project-URL: Repository, https://gitlab.com/m4x0n_24/maqet/-/tree/main
5
- Classifier: Programming Language :: Python :: 3.12
6
- Requires-Python: >=3.12
7
- Description-Content-Type: text/markdown
8
- Requires-Dist: python-benedict >=0.33.2
9
-
10
- # MAQET
11
-
12
- **Work in progress.** Documentation and code can be absolute mess.
13
-
14
- If you are willing to help - open issue, MR or do something else
15
- to attract maintainer's attention
16
-
17
- ## Description
18
-
19
- MAQET stands for M4x0n QEmu Tool.
20
- It's based on [QEMU](https://gitlab.com/qemu-project/qemu) python [tooling](https://gitlab.com/qemu-project/qemu/-/tree/master/python?ref_type=heads).
21
-
22
- Main goal of this project is to provide good way to run qemu virtual machine.
23
- Author (m4x0n) wants to create virtual environment for repeatable testing
24
- of Linux installation and configuration before messing around with real computer,
25
- so all features implemented are primarily pursuing this goal.
26
-
27
- ### Roadmap
28
-
29
- First usable version:
30
-
31
- - [x] YAML manifest for VM settings
32
- - [x] Storage (-drive) management:
33
- - [x] RAW and QCOW2 files
34
- - [x] Using backing images for QCOW2
35
- - [x] Internal snapshots for QCOW2
36
- - [x] Stages defined as python functions with decorator (Flask style)
37
- - [x] CLI to specify stage, additional arguments and options
38
- - [x] QMP commands
39
-
40
- Goals for near future (sorted by priority):
41
-
42
- - [ ] Unified naming of variables (what is config? What is manifest?)
43
- - [ ] Code cleanup, adding typing hints, docstrings etc.
44
- - [ ] Extensible system of kwargs handling in every class (see in dev notes)
45
- - [ ] Unit tests
46
- - [ ] Full translation of strings into QMP key inputs
47
-
48
- Advanced goals
49
-
50
- - [ ] Custom QMP command presets
51
- - [ ] Advanced storage management
52
- - [ ] Runtime snapshots via qmp
53
- - [ ] Remote storage types (iscsi)
54
-
55
- ## Usage guide
56
-
57
- See [example](https://gitlab.com/m4x0n_24/maqet/-/tree/main/example)
58
- Full documentation will be later
59
-
60
- ## Development notes
61
-
62
- ### Unification of **kwargs handling in extensible way
63
-
64
- Problem: classes have *args and **kwargs arguments. It gives flexibility,
65
- but also makes argument handling cumbersome (Ladder of if statements).
66
-
67
- Main class - Maqet, get it's kwargs and uses them as a config,
68
- parses and creates Machine class object
69
- with relevant arguments, also in form of kwargs.
70
-
71
- Idea is to make it extensible and unified. Like this:
72
-
73
- ```yaml
74
- binary: qemu-system-x86_64
75
- arguments:
76
- - foo
77
- - bar
78
- - baz
79
- storage:
80
- - hda:
81
- size: 5G
82
- type: qcow2
83
- options:
84
- id: sda
85
- ...
86
- some_custom_field:
87
- - memory: 8G
88
- - cpu: 4
89
- - print: I_LIKE_PONIES
90
- ```
91
-
92
- Binary is easy, just pass it into Machine
93
- What about arguments? Also pass into Machie, I made parser that turn them
94
- into cli arguments for qemu binary
95
- Storage? Call object Storage for every object in the list and pass contents inside
96
- Custom field? It will be ignored. If we want to use it?
97
- For example:
98
- We want to turn `memory: 8G, cpu: 4` into `-m 8G -smp 4`
99
- and run `print("I_LIKE_PONIES")` before VM starts.
100
- So we need somehow to extend Maqet class. How to do it? Still not sure.
101
-
102
- ### QEMU not in PyPI
103
-
104
- Now QEMU tooling for python is used as sparse-checkouted git submodule.