wolkenbrot 0.2.0__tar.gz → 0.4__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 (47) hide show
  1. wolkenbrot-0.4/.gitignore +106 -0
  2. wolkenbrot-0.4/AUTHORS +3 -0
  3. wolkenbrot-0.4/ChangeLog +101 -0
  4. {wolkenbrot-0.2.0 → wolkenbrot-0.4}/Makefile +25 -29
  5. wolkenbrot-0.4/PKG-INFO +242 -0
  6. wolkenbrot-0.4/Pipfile +15 -0
  7. wolkenbrot-0.4/Pipfile.lock +707 -0
  8. wolkenbrot-0.4/README.md +204 -0
  9. wolkenbrot-0.4/examples/libvirt.json +24 -0
  10. wolkenbrot-0.4/examples/openstack.json +21 -0
  11. {wolkenbrot-0.2.0 → wolkenbrot-0.4}/examples/short.json +3 -2
  12. wolkenbrot-0.4/examples/template/Makefile +7 -0
  13. wolkenbrot-0.4/examples/template/template.json +40 -0
  14. wolkenbrot-0.4/pyproject.toml +65 -0
  15. wolkenbrot-0.4/requirements.txt +38 -0
  16. wolkenbrot-0.4/setup.cfg +4 -0
  17. wolkenbrot-0.2.0/tests/test_wolkenbrot.py → wolkenbrot-0.4/tests/test_aws.py +24 -21
  18. wolkenbrot-0.4/wolkenbrot/__init__.py +18 -0
  19. wolkenbrot-0.2.0/wolkenbrot/__init__.py → wolkenbrot-0.4/wolkenbrot/aws.py +67 -217
  20. wolkenbrot-0.4/wolkenbrot/cli.py +89 -0
  21. wolkenbrot-0.4/wolkenbrot/common.py +77 -0
  22. wolkenbrot-0.4/wolkenbrot/libvirt.py +543 -0
  23. wolkenbrot-0.4/wolkenbrot/os.py +277 -0
  24. wolkenbrot-0.4/wolkenbrot/util.py +181 -0
  25. wolkenbrot-0.4/wolkenbrot.egg-info/PKG-INFO +242 -0
  26. {wolkenbrot-0.2.0 → wolkenbrot-0.4}/wolkenbrot.egg-info/SOURCES.txt +16 -6
  27. {wolkenbrot-0.2.0 → wolkenbrot-0.4}/wolkenbrot.egg-info/entry_points.txt +0 -1
  28. wolkenbrot-0.4/wolkenbrot.egg-info/requires.txt +16 -0
  29. wolkenbrot-0.4/wolkenbrot.spec +108 -0
  30. wolkenbrot-0.2.0/AUTHORS +0 -1
  31. wolkenbrot-0.2.0/ChangeLog +0 -19
  32. wolkenbrot-0.2.0/PKG-INFO +0 -117
  33. wolkenbrot-0.2.0/README.md +0 -99
  34. wolkenbrot-0.2.0/requirements-dev.txt +0 -4
  35. wolkenbrot-0.2.0/requirements.txt +0 -3
  36. wolkenbrot-0.2.0/setup.cfg +0 -38
  37. wolkenbrot-0.2.0/setup.py +0 -8
  38. wolkenbrot-0.2.0/wolkenbrot.egg-info/PKG-INFO +0 -117
  39. wolkenbrot-0.2.0/wolkenbrot.egg-info/not-zip-safe +0 -1
  40. wolkenbrot-0.2.0/wolkenbrot.egg-info/pbr.json +0 -1
  41. wolkenbrot-0.2.0/wolkenbrot.egg-info/requires.txt +0 -7
  42. {wolkenbrot-0.2.0 → wolkenbrot-0.4}/LICENSE +0 -0
  43. {wolkenbrot-0.2.0 → wolkenbrot-0.4}/docs/demo.gif +0 -0
  44. {wolkenbrot-0.2.0 → wolkenbrot-0.4}/examples/upload/bar.txt +0 -0
  45. {wolkenbrot-0.2.0 → wolkenbrot-0.4}/examples/upload/foo.txt +0 -0
  46. {wolkenbrot-0.2.0 → wolkenbrot-0.4}/wolkenbrot.egg-info/dependency_links.txt +0 -0
  47. {wolkenbrot-0.2.0 → wolkenbrot-0.4}/wolkenbrot.egg-info/top_level.txt +0 -0
@@ -0,0 +1,106 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ .pytest_cache/
7
+
8
+ # vim
9
+ *.sw[o,p]
10
+
11
+ # C extensions
12
+ *.so
13
+
14
+ # Distribution / packaging
15
+ .Python
16
+ env/
17
+ build/
18
+ develop-eggs/
19
+ dist/
20
+ downloads/
21
+ eggs/
22
+ .eggs/
23
+ lib/
24
+ lib64/
25
+ parts/
26
+ sdist/
27
+ var/
28
+ wheels/
29
+ *.egg-info/
30
+ .installed.cfg
31
+ *.egg
32
+
33
+ # PyInstaller
34
+ # Usually these files are written by a python script from a template
35
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
36
+ *.manifest
37
+ *.spec
38
+
39
+ # Installer logs
40
+ pip-log.txt
41
+ pip-delete-this-directory.txt
42
+
43
+ # Unit test / coverage reports
44
+ htmlcov/
45
+ .tox/
46
+ .coverage
47
+ .coverage.*
48
+ .cache
49
+ nosetests.xml
50
+ coverage.xml
51
+ *.cover
52
+ .hypothesis/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+
62
+ # Flask stuff:
63
+ instance/
64
+ .webassets-cache
65
+
66
+ # Scrapy stuff:
67
+ .scrapy
68
+
69
+ # Sphinx documentation
70
+ docs/_build/
71
+
72
+ # PyBuilder
73
+ target/
74
+
75
+ # Jupyter Notebook
76
+ .ipynb_checkpoints
77
+
78
+ # pyenv
79
+ .python-version
80
+
81
+ # celery beat schedule file
82
+ celerybeat-schedule
83
+
84
+ # SageMath parsed files
85
+ *.sage.py
86
+
87
+ # dotenv
88
+ .env
89
+
90
+ # virtualenv
91
+ .venv
92
+ venv/
93
+ ENV/
94
+
95
+ # Spyder project settings
96
+ .spyderproject
97
+ .spyproject
98
+
99
+ # Rope project settings
100
+ .ropeproject
101
+
102
+ # mkdocs documentation
103
+ /site
104
+
105
+ # mypy
106
+ .mypy_cache/
wolkenbrot-0.4/AUTHORS ADDED
@@ -0,0 +1,3 @@
1
+ Oz N Tiram <oz.tiram@gmail.com>
2
+ Oz Tiram <oz.tiram@gmail.com>
3
+ dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@@ -0,0 +1,101 @@
1
+ CHANGES
2
+ =======
3
+
4
+ * feat: support uploading to a directory
5
+ * fix: multiple bug fixes for libvirtd
6
+ * chore: update dependencies
7
+ * feat: support uploading directories
8
+ * Add libvirt backend and cli
9
+ * chore: update requirements.txt
10
+ * chore: update dependencies
11
+
12
+ v0.3
13
+ ----
14
+
15
+ * Add tasks to build sdist and upload to pypi
16
+ * Add license header to all files
17
+ * AWS: Handle deletion of resources on exceptions
18
+ * Openstack: fix example
19
+ * Add spec for pyinstaller
20
+ * Continue working on executable creation
21
+ * Build executable with pyinstaller
22
+ * AWS: Fix all tests
23
+ * Makefile: py.test -> pytest
24
+ * Integrate mh in the makefile
25
+ * Add requirements.txt
26
+ * Openstack: Properly tag image
27
+ * Openstack: add tags to the image
28
+ * Openstack: clean volume when finished
29
+ * CLI: fix logic of OS vs. AWS
30
+ * Openstack: fix image delete
31
+ * Docs: show how to use templates
32
+ * AWS: Wait for SSH return if client obained
33
+ * CLI: fix undefined references
34
+ * AWS: fix tiny bugs introduced by refactoring
35
+ * AWS: Update example with updated AMI
36
+ * update openstack example
37
+ * Update ChangeLog
38
+ * Update README.md
39
+ * Update README.md
40
+ * Update README.md
41
+ * Handle deletion error
42
+ * Allow passing --openstack
43
+ * Openstack: successfully build image
44
+ * Openstack: Clean KeyPair after exit
45
+ * Create SSH client at wait for SSH
46
+ * Openstack delete security group when exiting
47
+ * Clean up builder machine at program exit
48
+ * Got SSH and following steps working on OS
49
+ * Add floating IP address if desired
50
+ * Fix: launching wait for SSH in openstack
51
+ * Simplify validate\_image\_function
52
+ * Fix launching of machine in openstack
53
+ * Fix logic of security groups creation
54
+ * Remove unused import
55
+ * Sort imports remove unused imports
56
+ * Update example config
57
+ * Add openstacksdk to the dependencies
58
+ * Tiny OS fixes
59
+ * Add bake functionality for openstack
60
+ * Enable openstack delete images
61
+ * Enable Openstack image details subcommand
62
+ * Isolate initialization of clients
63
+ * Refactor: continue work on Openstack support
64
+ * Bump urllib3 from 1.26.4 to 1.26.5
65
+ * WIP: continue work on openstack builder
66
+ * Add methods to create sec. group and ssh key on OS
67
+ * Add examples
68
+ * Fix missing imports in cli.py
69
+ * Refactor: move CLI logic to cli.py
70
+ * Update gitignore
71
+ * Update dependency declaration
72
+ * Update dependencies
73
+ * Bump cryptography from 3.2 to 3.3.2
74
+ * Bump cryptography from 2.7 to 3.2
75
+ * Update Pipenv.lock
76
+ * Update copyright in util.py
77
+ * Update requirements
78
+ * Refactor the code base as a start for adding another cloud
79
+ * Add pytest cache to ignored files
80
+ * Add Pipfiles
81
+
82
+ 0.2
83
+ ---
84
+
85
+ * Update Changelog
86
+ * add demo gif
87
+ * Add demo
88
+ * Add nice color output
89
+ * Don't start the build if the name already exists
90
+ * Output ssh exec in nearly real time
91
+ * Make the example work when debian wants input
92
+ * Update changelog
93
+ * Update the description
94
+
95
+ 0.1
96
+ ---
97
+
98
+ * Initial commit
99
+ * Add Changelog and Authors
100
+ * Add examples
101
+ * Initial commit of Wolkenbrot
@@ -1,32 +1,15 @@
1
1
  .PHONY: clean clean-test clean-pyc clean-build docs help
2
2
  .DEFAULT_GOAL := help
3
3
 
4
- define BROWSER_PYSCRIPT
5
- import os, webbrowser, sys
6
- try:
7
- from urllib import pathname2url
8
- except:
9
- from urllib.request import pathname2url
10
-
11
- webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1])))
12
- endef
13
- export BROWSER_PYSCRIPT
14
-
15
- define PRINT_HELP_PYSCRIPT
16
- import re, sys
17
-
18
- for line in sys.stdin:
19
- match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
20
- if match:
21
- target, help = match.groups()
22
- print("%-20s %s" % (target, help))
23
- endef
24
- export PRINT_HELP_PYSCRIPT
25
- BROWSER := python -c "$$BROWSER_PYSCRIPT"
4
+ PIP ?= pip3
5
+ PY ?= python3
26
6
 
27
7
  help:
28
- @python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
29
-
8
+ @mh -f $(MAKEFILE_LIST) $(target) || echo "Please install mh from github/oz123/mh"
9
+ ifndef target
10
+ @echo ""
11
+ @echo "Use \`make help target=foo\` to learn more about foo."
12
+ endif
30
13
 
31
14
  clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts
32
15
 
@@ -51,10 +34,10 @@ clean-test: ## remove test and coverage artifacts
51
34
 
52
35
  test: OPTS = --pdb
53
36
  test: ## run tests quickly with the default Python
54
- py.test $(OPTS) -x -vv
37
+ pytest $(OPTS) -x -vv
55
38
 
56
39
  coverage: ## check code coverage quickly with the default Python
57
- py.test -x -vv --cov --cov-report html --cov-config .coveragerc tests/
40
+ pytest -x -vv --cov --cov-report html --cov-config .coveragerc tests/
58
41
 
59
42
  #$(BROWSER) htmlcov/index.html
60
43
 
@@ -72,8 +55,21 @@ docs: ## generate Sphinx HTML documentation, including API docs
72
55
 
73
56
 
74
57
  dev: clean
75
- pip install -e .
76
-
58
+ $(PIP) install -e .[openstack,aws,libvirt]
77
59
 
78
60
  install: clean
79
- pip install .
61
+ $(PIP) install .[openstack,aws,libvirt]
62
+
63
+ build-exec: ## build a single file executable of wolkenbrot
64
+ $(PIP) install .
65
+ pyinstaller wolkenbrot.spec
66
+
67
+ build-exec-in-docker: ## build an executable with pyinstaller
68
+ docker run --rm -w /usr/src -v $(CURDIR):/usr/src/ docker.io/oz123/pyinstall-builder:latest bash -c "make install build-exec PY=$(PY)"
69
+ #docker run -it --rm -w /usr/src -v $(CURDIR):/usr/src/ docker.io/oz123/pyinstall-builder:latest bash
70
+
71
+ build-sdist: clean
72
+ $(PY) -m build -s
73
+
74
+ pypi-release:
75
+ twine upload sdist/wolkenbrot.tar.gz
@@ -0,0 +1,242 @@
1
+ Metadata-Version: 2.4
2
+ Name: wolkenbrot
3
+ Version: 0.4
4
+ Summary: Create and Manage AWS EC2 AMI cloud images
5
+ Author-email: Oz N Tiram <oz.tiram@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/oz123/wolkenbrot
8
+ Project-URL: Repository, https://github.com/oz123/wolkenbrot
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Programming Language :: Python
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Intended Audience :: System Administrators
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Topic :: Software Development
20
+ Requires-Python: >=3.9
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ License-File: AUTHORS
24
+ Requires-Dist: boto3
25
+ Requires-Dist: colorama
26
+ Requires-Dist: paramiko
27
+ Provides-Extra: dev
28
+ Requires-Dist: coverage; extra == "dev"
29
+ Requires-Dist: pytest; extra == "dev"
30
+ Requires-Dist: moto; extra == "dev"
31
+ Requires-Dist: pytest-cov; extra == "dev"
32
+ Provides-Extra: openstack
33
+ Requires-Dist: openstacksdk; extra == "openstack"
34
+ Provides-Extra: libvirt
35
+ Requires-Dist: libvirt-python; extra == "libvirt"
36
+ Requires-Dist: pycdlib; extra == "libvirt"
37
+ Dynamic: license-file
38
+
39
+ # Wolkenbrot
40
+
41
+ ## bakes and manages your cloud images (AWS, OpenStack, libvirt/KVM)
42
+ ![demo](https://github.com/oz123/wolkenbrot/blob/master/docs/demo.gif?raw=true)
43
+
44
+ wolkenbrot is named after a German children's title called Wolkenbrot by
45
+ the Korean authors Baek Hee Na Kim Hyang Soo. The translation to English is
46
+ cloud's bread.
47
+
48
+ Wolken brot is inspired by packer[1] and kujenga[2], removing fabric as a
49
+ dependency. It also aims to be more tested and documented.
50
+
51
+ In case you wonder, yes it's similar to packer by Hashicorp.
52
+ But here are some reasons that you might like it better than packer:
53
+
54
+ 1. It's written in Python.
55
+ 2. It's not written in Go.
56
+ 3. It can use private AMI as a starting point for your build.
57
+ 4. It's smaller and easier to hack on.
58
+ 5. It has a cooler name.
59
+ 6. It has a better license, MIT sounds way better then MPL-2. Especially because it means "with" in German.
60
+
61
+ ### how is it different from Packer or kujenga?
62
+
63
+ 1. It is Python3 only.
64
+ 2. It does not depend on fabric.
65
+ 3. It replaces boto with boto3
66
+ 4. It's name is not Swahili, but rather German.
67
+ 5. It adds the ability to list your images
68
+ 6. It adds the ability to get detailed information about an image from the CLI.
69
+ 7. It adds the ability to de-register images from the CLI.
70
+
71
+ [1]: https://github.com/macd/kujenga
72
+ [2]: https://www.packer.io/
73
+
74
+ ### AWS Usage (default)
75
+
76
+ You can run the following command to build an image:
77
+
78
+ ```
79
+ $ wolkenbrot bake <image.json>
80
+ ```
81
+
82
+ See the documentation for the JSON format.
83
+
84
+ You can run the following command to list your existing images:
85
+
86
+ ```
87
+ $ wolkenbrot list
88
+ ```
89
+
90
+ You can view the information about and image:
91
+
92
+ ```
93
+ $ wolkenbrot info ami-72192e
94
+ ```
95
+
96
+ You can remove the image with:
97
+
98
+ ```
99
+ $ wolkenbrot delete ami-72192e
100
+ ```
101
+
102
+ Wolkenbrot follows boto3 configuration principles, so if you wonder how to
103
+ pass AWS configuration parameters, take a look in [Boto3's own documentation][2]
104
+
105
+ [3]: http://boto3.readthedocs.io/en/latest/guide/configuration.html
106
+
107
+ ### OpenStack Usage
108
+
109
+ Use the `--openstack` flag or set `"provider": "openstack"` in your JSON config:
110
+
111
+ ```
112
+ $ wolkenbrot --openstack bake <image.json>
113
+ $ wolkenbrot --openstack list
114
+ $ wolkenbrot --openstack info <image-id>
115
+ $ wolkenbrot --openstack delete <image-id>
116
+ ```
117
+
118
+ ### Libvirt/KVM Usage
119
+
120
+ Use the `--libvirt` flag or set `"provider": "libvirt"` in your JSON config:
121
+
122
+ ```
123
+ $ wolkenbrot --libvirt bake <image.json>
124
+ $ wolkenbrot --libvirt list
125
+ $ wolkenbrot --libvirt info <image-name.qcow2>
126
+ $ wolkenbrot --libvirt delete <image-name.qcow2>
127
+ ```
128
+
129
+ #### Libvirt-specific options
130
+
131
+ - `--uri` - Libvirt connection URI (default: `qemu:///system`)
132
+ - `--image-dir` - Directory for libvirt images (default: `/var/lib/libvirt/images`)
133
+
134
+ Examples:
135
+
136
+ ```
137
+ # List images in a custom directory
138
+ $ wolkenbrot --libvirt --image-dir /custom/path list
139
+
140
+ # Connect to a remote libvirt host
141
+ $ wolkenbrot --libvirt --uri qemu+ssh://user@host/system list
142
+ ```
143
+
144
+ #### Libvirt JSON configuration
145
+
146
+ Example `libvirt.json`:
147
+
148
+ ```json
149
+ {
150
+ "provider": "libvirt",
151
+ "name": "my-image",
152
+ "description": "My custom image",
153
+ "base_image": {
154
+ "path": "/var/lib/libvirt/images/ubuntu-cloud.img"
155
+ },
156
+ "output_path": "./my-image.qcow2",
157
+ "user": "ubuntu",
158
+ "memory": 4096,
159
+ "vcpus": 2,
160
+ "disk_size": "20G",
161
+ "network": "default",
162
+ "uploads": {
163
+ "./local-file": "/remote/path"
164
+ },
165
+ "commands": [
166
+ "sudo apt-get update",
167
+ "sudo apt-get install -y nginx"
168
+ ]
169
+ }
170
+ ```
171
+
172
+ Libvirt-specific configuration options:
173
+ - `region` - Libvirt connection URI (default: `qemu:///system`)
174
+ - `base_image.path` - Path to the base cloud image (qcow2 format)
175
+ - `output_path` - Where to save the final image
176
+ - `instance_type` - Predefined instance type (see table below)
177
+ - `memory` - VM memory in MB (default: 2048, overrides instance_type)
178
+ - `vcpus` - Number of virtual CPUs (default: 2, overrides instance_type)
179
+ - `disk_size` - Disk size (default: "20G", overrides instance_type)
180
+ - `network` - Libvirt network name (default: "default")
181
+
182
+ #### Instance Types
183
+
184
+ | Type | vCPUs | Memory | Disk |
185
+ |--------|-------|--------|------|
186
+ | small | 1 | 1 GB | 10G |
187
+ | medium | 2 | 4 GB | 20G |
188
+ | large | 4 | 8 GB | 40G |
189
+ | xlarge | 8 | 16 GB | 80G |
190
+
191
+ You can use `instance_type` instead of specifying `memory`, `vcpus`, and `disk_size` individually:
192
+
193
+ ```json
194
+ {
195
+ "provider": "libvirt",
196
+ "name": "my-image",
197
+ "base_image": {"path": "/var/lib/libvirt/images/ubuntu.img"},
198
+ "instance_type": "medium"
199
+ }
200
+ ```
201
+
202
+ Individual settings (`memory`, `vcpus`, `disk_size`) override the instance type defaults if both are specified.
203
+
204
+ #### Remote Libvirt Hosts
205
+
206
+ Use `region` in the config (or `--uri` CLI option) to connect to remote libvirt hosts:
207
+
208
+ ```json
209
+ {
210
+ "provider": "libvirt",
211
+ "name": "my-image",
212
+ "region": "qemu+ssh://user@remote-host/system",
213
+ "base_image": {"path": "/var/lib/libvirt/images/ubuntu.img"},
214
+ "instance_type": "large"
215
+ }
216
+ ```
217
+
218
+ Common URI formats:
219
+ - `qemu:///system` - Local system (default, requires root or libvirt group)
220
+ - `qemu:///session` - Local user session (unprivileged)
221
+ - `qemu+ssh://user@host/system` - Remote host via SSH
222
+
223
+ ### FAQ
224
+
225
+ * Do you support Windows or Mac OS X?
226
+
227
+ The author of this software strongly despises working on Windows or
228
+ Mac OS X. Hence, this software is not tested for these platforms.
229
+ If you can run Python on your OS, it might run.
230
+
231
+ * Do you support provisioning machines with Saltstack\Chef\Puppet\Ansible\XYZ?
232
+
233
+ Yes, just install them via shell first, then call the right binary with the correct playbook\state\formula..
234
+
235
+ ### Testing and Installing the test requirements
236
+
237
+ Simply issue:
238
+
239
+ ```
240
+ $ pip install -e ".[dev]"
241
+ $ make test
242
+ ```
wolkenbrot-0.4/Pipfile ADDED
@@ -0,0 +1,15 @@
1
+ [[source]]
2
+ verify_ssl = true
3
+ url = "https://pypi.python.org/simple"
4
+ name = "pypi"
5
+
6
+ [dev-packages]
7
+
8
+ [packages]
9
+ "boto3" = "*"
10
+ paramiko = "*"
11
+ colorama = "*"
12
+ openstacksdk = ">=0.59"
13
+ cryptography = "39.0.1"
14
+ libvirt-python = "*"
15
+ pycdlib = "*"