koan 3.2.0__tar.gz → 3.2.1__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 (92) hide show
  1. {koan-3.2.0 → koan-3.2.1}/.github/workflows/codeql-analysis.yml +1 -1
  2. {koan-3.2.0 → koan-3.2.1}/.github/workflows/lint.yml +4 -4
  3. {koan-3.2.0 → koan-3.2.1}/.github/workflows/packaging.yml +6 -6
  4. {koan-3.2.0 → koan-3.2.1}/.github/workflows/pypi.yml +1 -1
  5. {koan-3.2.0 → koan-3.2.1}/.github/workflows/release.yml +2 -2
  6. {koan-3.2.0 → koan-3.2.1}/.github/workflows/testing.yml +1 -1
  7. {koan-3.2.0 → koan-3.2.1}/AGENTS.md +33 -16
  8. {koan-3.2.0 → koan-3.2.1}/CLAUDE.md +33 -16
  9. {koan-3.2.0 → koan-3.2.1}/PKG-INFO +1 -1
  10. koan-3.2.1/koan/__init__.py +11 -0
  11. koan-3.2.1/koan/_version.py +5 -0
  12. {koan-3.2.0 → koan-3.2.1}/koan/app.py +17 -17
  13. {koan-3.2.0 → koan-3.2.1}/koan/cli.py +4 -6
  14. {koan-3.2.0 → koan-3.2.1}/koan/configurator.py +1 -1
  15. {koan-3.2.0 → koan-3.2.1}/koan/register.py +2 -2
  16. {koan-3.2.0 → koan-3.2.1}/koan/utils.py +1 -1
  17. koan-3.2.1/koan/virt/__init__.py +6 -0
  18. koan-3.2.0/koan/imagecreate.py → koan-3.2.1/koan/virt/image.py +1 -1
  19. koan-3.2.0/koan/openvzcreate.py → koan-3.2.1/koan/virt/openvz.py +1 -1
  20. koan-3.2.0/koan/vmwcreate.py → koan-3.2.1/koan/virt/vmw.py +1 -1
  21. koan-3.2.0/koan/xencreate.py → koan-3.2.1/koan/virt/xen.py +1 -1
  22. {koan-3.2.0 → koan-3.2.1}/koan/virtinstall.py +3 -3
  23. {koan-3.2.0 → koan-3.2.1}/koan.egg-info/PKG-INFO +1 -1
  24. {koan-3.2.0 → koan-3.2.1}/koan.egg-info/SOURCES.txt +7 -5
  25. {koan-3.2.0 → koan-3.2.1}/koan.egg-info/scm_file_list.json +7 -5
  26. {koan-3.2.0 → koan-3.2.1}/koan.egg-info/scm_version.json +2 -2
  27. {koan-3.2.0 → koan-3.2.1}/koan.spec +0 -13
  28. {koan-3.2.0 → koan-3.2.1}/setup.py +1 -1
  29. koan-3.2.1/tests/test_app.py +26 -0
  30. koan-3.2.0/koan/__init__.py +0 -8
  31. koan-3.2.0/koan/_version.py +0 -5
  32. {koan-3.2.0 → koan-3.2.1}/.dockerignore +0 -0
  33. {koan-3.2.0 → koan-3.2.1}/.github/FUNDING.yml +0 -0
  34. {koan-3.2.0 → koan-3.2.1}/.github/ISSUE_TEMPLATE/01_bug_report.md +0 -0
  35. {koan-3.2.0 → koan-3.2.1}/.github/ISSUE_TEMPLATE/02_feature_request.md +0 -0
  36. {koan-3.2.0 → koan-3.2.1}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  37. {koan-3.2.0 → koan-3.2.1}/.github/dependabot.yml +0 -0
  38. {koan-3.2.0 → koan-3.2.1}/.github/pull_request_template.md +0 -0
  39. {koan-3.2.0 → koan-3.2.1}/.gitignore +0 -0
  40. {koan-3.2.0 → koan-3.2.1}/.pre-commit-config.yaml +0 -0
  41. {koan-3.2.0 → koan-3.2.1}/.readthedocs.yml +0 -0
  42. {koan-3.2.0 → koan-3.2.1}/.releaserc.json +0 -0
  43. {koan-3.2.0 → koan-3.2.1}/AUTHORS.in +0 -0
  44. {koan-3.2.0 → koan-3.2.1}/CONTRIBUTING.md +0 -0
  45. {koan-3.2.0 → koan-3.2.1}/COPYING +0 -0
  46. {koan-3.2.0 → koan-3.2.1}/MANIFEST.in +0 -0
  47. {koan-3.2.0 → koan-3.2.1}/Makefile +0 -0
  48. {koan-3.2.0 → koan-3.2.1}/README.md +0 -0
  49. {koan-3.2.0 → koan-3.2.1}/bin/ovz-install +0 -0
  50. {koan-3.2.0 → koan-3.2.1}/commitlint.config.js +0 -0
  51. {koan-3.2.0 → koan-3.2.1}/debian/changelog +0 -0
  52. {koan-3.2.0 → koan-3.2.1}/debian/compat +0 -0
  53. {koan-3.2.0 → koan-3.2.1}/debian/control +0 -0
  54. {koan-3.2.0 → koan-3.2.1}/debian/copyright +0 -0
  55. {koan-3.2.0 → koan-3.2.1}/debian/koan.docs +0 -0
  56. {koan-3.2.0 → koan-3.2.1}/debian/rules +0 -0
  57. {koan-3.2.0 → koan-3.2.1}/debian/source/format +0 -0
  58. {koan-3.2.0 → koan-3.2.1}/docker/debs/build-and-install-debs.sh +0 -0
  59. {koan-3.2.0 → koan-3.2.1}/docker/debs/debian/Debian13.dockerfile +0 -0
  60. {koan-3.2.0 → koan-3.2.1}/docker/debs/install-debs.sh +0 -0
  61. {koan-3.2.0 → koan-3.2.1}/docker/rpms/Fedora/Fedora.dockerfile +0 -0
  62. {koan-3.2.0 → koan-3.2.1}/docker/rpms/RockyLinux10/RockyLinux10.dockerfile +0 -0
  63. {koan-3.2.0 → koan-3.2.1}/docker/rpms/build-and-install-rpms.sh +0 -0
  64. {koan-3.2.0 → koan-3.2.1}/docker/rpms/install-rpms.sh +0 -0
  65. {koan-3.2.0 → koan-3.2.1}/docker/rpms/openSUSE_Leap/openSUSE_Leap.dockerfile +0 -0
  66. {koan-3.2.0 → koan-3.2.1}/docker/rpms/openSUSE_Tumbleweed/openSUSE_TW.dockerfile +0 -0
  67. {koan-3.2.0 → koan-3.2.1}/docs/Makefile +0 -0
  68. {koan-3.2.0 → koan-3.2.1}/docs/cobbler-register.rst +0 -0
  69. {koan-3.2.0 → koan-3.2.1}/docs/conf.py +0 -0
  70. {koan-3.2.0 → koan-3.2.1}/docs/index.rst +0 -0
  71. {koan-3.2.0 → koan-3.2.1}/docs/installing-virtual-guests.rst +0 -0
  72. {koan-3.2.0 → koan-3.2.1}/docs/koan-on-openvz.rst +0 -0
  73. {koan-3.2.0 → koan-3.2.1}/docs/koan-with-isos.rst +0 -0
  74. {koan-3.2.0 → koan-3.2.1}/docs/koan.rst +0 -0
  75. {koan-3.2.0 → koan-3.2.1}/docs/reinstallation.rst +0 -0
  76. {koan-3.2.0 → koan-3.2.1}/docs/release-notes.rst +0 -0
  77. {koan-3.2.0 → koan-3.2.1}/docs/virtual-networking-setup.rst +0 -0
  78. {koan-3.2.0 → koan-3.2.1}/docs/vmware.rst +0 -0
  79. {koan-3.2.0 → koan-3.2.1}/koan/cexceptions.py +0 -0
  80. /koan-3.2.0/koan/qcreate.py → /koan-3.2.1/koan/virt/qemu.py +0 -0
  81. {koan-3.2.0 → koan-3.2.1}/koan.egg-info/dependency_links.txt +0 -0
  82. {koan-3.2.0 → koan-3.2.1}/koan.egg-info/entry_points.txt +0 -0
  83. {koan-3.2.0 → koan-3.2.1}/koan.egg-info/requires.txt +0 -0
  84. {koan-3.2.0 → koan-3.2.1}/koan.egg-info/top_level.txt +0 -0
  85. {koan-3.2.0 → koan-3.2.1}/package-lock.json +0 -0
  86. {koan-3.2.0 → koan-3.2.1}/package.json +0 -0
  87. {koan-3.2.0 → koan-3.2.1}/pyproject.toml +0 -0
  88. {koan-3.2.0 → koan-3.2.1}/setup.cfg +0 -0
  89. {koan-3.2.0 → koan-3.2.1}/tests/__init__.py +0 -0
  90. {koan-3.2.0 → koan-3.2.1}/tests/conftest.py +0 -0
  91. {koan-3.2.0 → koan-3.2.1}/tests/test_utils.py +0 -0
  92. {koan-3.2.0 → koan-3.2.1}/tests/virtinstall.py +0 -0
@@ -39,7 +39,7 @@ jobs:
39
39
  steps:
40
40
  - name: Checkout repository
41
41
  # https://github.com/actions/checkout
42
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
42
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
43
43
 
44
44
  # Initializes the CodeQL tools for scanning.
45
45
  - name: Initialize CodeQL
@@ -15,7 +15,7 @@ jobs:
15
15
  steps:
16
16
  - name: Checkout repository
17
17
  # https://github.com/actions/checkout
18
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
18
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
19
19
  - name: Install deps
20
20
  run: sudo apt-get install -y python3-pyflakes
21
21
  - name: Run pyflakes
@@ -26,7 +26,7 @@ jobs:
26
26
  steps:
27
27
  - name: Checkout repository
28
28
  # https://github.com/actions/checkout
29
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
29
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
30
30
  - name: Run black
31
31
  # https://github.com/psf/black
32
32
  uses: psf/black@87928e6d6761a4a6d22250e1fee5601b3998086e # 26.5.1
@@ -39,7 +39,7 @@ jobs:
39
39
  steps:
40
40
  - name: Checkout repository
41
41
  # https://github.com/actions/checkout
42
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
42
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
43
43
  - name: Run isort
44
44
  # https://github.com/isort/isort-action
45
45
  uses: isort/isort-action@24d8a7a51d33ca7f36c3f23598dafa33f7071326 # v1.1.1
@@ -51,7 +51,7 @@ jobs:
51
51
  steps:
52
52
  - name: Checkout repository
53
53
  # https://github.com/actions/checkout
54
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
54
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
55
55
  with:
56
56
  fetch-depth: 0
57
57
  - name: Lint commit messages
@@ -18,7 +18,7 @@ jobs:
18
18
  - name: Checkout repository
19
19
  # setuptools_scm needs full history (incl. tags) to derive the version
20
20
  # https://github.com/actions/checkout
21
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
21
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
22
22
  with:
23
23
  fetch-depth: 0
24
24
  - name: Build a RockyLinux 10 Package
@@ -40,7 +40,7 @@ jobs:
40
40
  - name: Checkout repository
41
41
  # setuptools_scm needs full history (incl. tags) to derive the version
42
42
  # https://github.com/actions/checkout
43
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
43
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
44
44
  with:
45
45
  fetch-depth: 0
46
46
  - name: Build a Fedora Package
@@ -62,7 +62,7 @@ jobs:
62
62
  - name: Checkout repository
63
63
  # setuptools_scm needs full history (incl. tags) to derive the version
64
64
  # https://github.com/actions/checkout
65
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
65
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
66
66
  with:
67
67
  fetch-depth: 0
68
68
  - name: Install System dependencies
@@ -89,7 +89,7 @@ jobs:
89
89
  - name: Checkout repository
90
90
  # setuptools_scm needs full history (incl. tags) to derive the version
91
91
  # https://github.com/actions/checkout
92
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
92
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
93
93
  with:
94
94
  fetch-depth: 0
95
95
  - name: Install System dependencies
@@ -116,7 +116,7 @@ jobs:
116
116
  - name: Checkout repository
117
117
  # setuptools_scm needs full history (incl. tags) to derive the version
118
118
  # https://github.com/actions/checkout
119
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
119
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
120
120
  with:
121
121
  fetch-depth: 0
122
122
  - name: Build a Debian 13 Package
@@ -158,7 +158,7 @@ jobs:
158
158
  - name: Checkout repository
159
159
  # setuptools_scm needs full history (incl. tags) to derive the version
160
160
  # https://github.com/actions/checkout
161
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
161
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
162
162
  with:
163
163
  fetch-depth: 0
164
164
  - name: Mark directory as safe for Git
@@ -10,7 +10,7 @@ jobs:
10
10
  - name: Checkout repository
11
11
  # setuptools_scm needs full history (incl. tags) to derive the version
12
12
  # https://github.com/actions/checkout
13
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
13
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
14
14
  with:
15
15
  fetch-depth: 0
16
16
  - name: Install package deps
@@ -22,7 +22,7 @@ jobs:
22
22
  - name: Checkout repository
23
23
  # setuptools_scm needs full history (incl. tags) to derive the version
24
24
  # https://github.com/actions/checkout
25
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
25
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
26
26
  with:
27
27
  fetch-depth: 0
28
28
  - name: Set up Node.js
@@ -69,7 +69,7 @@ jobs:
69
69
  - name: Checkout repository
70
70
  # setuptools_scm needs full history (incl. tags) to derive the version
71
71
  # https://github.com/actions/checkout
72
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
72
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
73
73
  with:
74
74
  fetch-depth: 0
75
75
  - name: Set up Node.js
@@ -20,7 +20,7 @@ jobs:
20
20
  - name: Checkout repository
21
21
  # setuptools_scm needs full history (incl. tags) to derive the version
22
22
  # https://github.com/actions/checkout
23
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
23
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
24
24
  with:
25
25
  fetch-depth: 0
26
26
  - name: Install dependencies
@@ -7,8 +7,10 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
7
7
  Koan ("kickstart-over-a-network") is the client-side companion to
8
8
  [Cobbler](https://github.com/cobbler/cobbler). It runs on a target machine and talks to a Cobbler
9
9
  server to either provision new virtualized guests (Xen, KVM/qemu, VMware, OpenVZ) or re-provision
10
- (re-kickstart) an existing physical/virtual system. It ships two console scripts: `koan` (the big
11
- `Koan` CLI in `app.py`) and `cobbler-register` (the small `Register` CLI in `register.py`).
10
+ (re-kickstart) an existing physical/virtual system. It ships two console scripts, `koan` and
11
+ `cobbler-register`; both entrypoints (`main()` and `register_main()`) live in `koan/cli.py` and
12
+ use `argparse`, while the actual provisioning/registration logic lives in the `Koan` class
13
+ (`app.py`) and `Register` class (`register.py`) respectively — see Architecture below.
12
14
 
13
15
  ## Commands
14
16
 
@@ -71,17 +73,28 @@ SPDX comment block, then imports).
71
73
 
72
74
  ## Architecture
73
75
 
74
- Everything lives in the flat `koan/` package (no subpackages):
75
-
76
- - **`app.py`** — the real core of the program: the `Koan` class implements the entire `koan` CLI
77
- (~2100 lines). `main()` parses options with `optparse` and drives one `Koan` instance through a
78
- single top-level action (`--virt`, `--replace-self`, `--update-files`, `--update-config`,
79
- `--list`, etc. — see `Koan.run()`). Key method groups:
76
+ Everything lives in the `koan/` package, mostly flat aside from the `koan/virt/` subpackage:
77
+
78
+ - **`cli.py`** — `argparse`-based entrypoints for both console scripts. `main()` (koan) builds
79
+ the ~30 flags, copies the parsed `Namespace` onto a fresh `Koan()` instance's attributes 1:1,
80
+ and calls `k.run()`; `register_main()` (cobbler-register) does the same for `Register`. Both
81
+ wrap the call in a try/except that special-cases the `from_koan` marker (see `cexceptions.py`
82
+ below) to print a clean one-line message instead of a traceback. `main()` also defines
83
+ `--version` (reads `koan.__version__`, generated by `setuptools_scm`). Gotcha when adding new
84
+ `store_true` flags here: `argparse`'s `store_true` defaults to `False`, not `None` like the
85
+ `optparse` code this replaced — pass `default=None` explicitly for any flag whose absence needs
86
+ to be distinguishable from an explicit "off" (e.g. `-n/--nogfx`, checked via `is not None`
87
+ against `-g/--graphics`'s always-set default).
88
+ - **`app.py`** — the real core of the program: the `Koan` class implements almost all of the
89
+ `koan` CLI's behavior as a plain business-logic class with no argument parsing of its own —
90
+ `cli.py`'s `main()` populates its attributes and calls `Koan.run()`, which drives a single
91
+ top-level action (`--virt`, `--replace-self`, `--update-files`, `--update-config`, `--list`,
92
+ etc). Key method groups:
80
93
  - `net_install()` / `get_distro_files()` / `calc_kernel_args()` — fetch profile/system data
81
94
  from the Cobbler server and compute kernel/initrd/kernel-options for network installs and
82
95
  `--replace-self` (kexec) reinstalls.
83
96
  - `virt_net_install()` / `load_virt_modules()` / `virt_choose()` — dispatch to the
84
- per-hypervisor `*create.py` module based on `virt_type`.
97
+ per-hypervisor module in `koan/virt/` based on `virt_type`.
85
98
  - The many `calc_virt_*()` methods (`calc_virt_ram`, `calc_virt_disk`-adjacent
86
99
  `calc_virt_filesize*`, `calc_virt_mac`, `calc_virt_uuid`, `calc_virt_path*`, ...) resolve
87
100
  per-VM settings from Cobbler profile/system data plus command-line overrides plus defaults —
@@ -89,26 +102,30 @@ Everything lives in the flat `koan/` package (no subpackages):
89
102
  throughout and is the main thing to preserve when touching option handling.
90
103
  - `update_files()` / `update_config()` — pull config-management templates/packages/repos from
91
104
  Cobbler for an already-installed system and hand off to `configurator.KoanConfigure`.
105
+ - `get_install_tree_from_autoinst()` still uses `optparse.OptionParser` internally — that's
106
+ parsing `url=`/`nfs=` args embedded in a downloaded kickstart/autoinst file, unrelated to the
107
+ `koan` command line, so it wasn't touched by the `cli.py` extraction/argparse migration.
92
108
  - **`configurator.py`** — `KoanConfigure`: applies repo/package/file configuration pushed down
93
109
  from Cobbler's config-management data to the local system (currently only implements YUM repo
94
110
  configuration; `yum` import is optional/best-effort).
95
111
  - **`virtinstall.py`** — builds a `virt-install`/libvirt command line (disk/NIC sanitization,
96
112
  `build_commandline()`) for KVM/qemu and Xen-via-libvirt guests.
97
- - **`{xen,qcreate,openvz,vmw,image}create.py`** — one module per hypervisor/guest backend, each
113
+ - **`koan/virt/{xen,qemu,openvz,vmw,image}.py`** — one module per hypervisor/guest backend, each
98
114
  exposing a `start_install(*args, **kwargs)` entry point that `app.py` calls into via
99
- `virt_choose()`/`load_virt_modules()`. `vmwcreate.py` additionally has helpers to build VMX
115
+ `virt_choose()`/`load_virt_modules()`. `vmw.py` additionally has helpers to build VMX
100
116
  files and register/start guests through VMware. When adding a new virt backend, follow this
101
117
  same `start_install(**kwargs)` contract so it plugs into `app.py` unchanged.
102
118
  - **`utils.py`** — shared grab-bag: XML-RPC connection to the Cobbler server
103
119
  (`connect_to_server`), network/OS introspection (`get_network_info`, `os_release`,
104
120
  `is_uefi_system`), subprocess helpers, and misc file/MAC/UUID utilities used across the other
105
121
  modules.
106
- - **`register.py`** — a second, much smaller CLI (`Register` class) for the `cobbler-register`
107
- command, which just registers the current system with a Cobbler server (distinct from the main
108
- provisioning flow in `app.py`).
122
+ - **`register.py`** — a second, much smaller business-logic class (`Register`) backing the
123
+ `cobbler-register` command (its `argparse` entrypoint is `cli.py`'s `register_main()`), which
124
+ just registers the current system with a Cobbler server (distinct from the main provisioning
125
+ flow in `app.py`).
109
126
  - **`cexceptions.py`** — exception hierarchy. `KoanException`/`InfoException` set a
110
- `from_koan` marker so `main()` can print a clean one-line message instead of a traceback for
111
- expected/user-facing errors; anything else prints a full traceback.
127
+ `from_koan` marker so `cli.py`'s `main()`/`register_main()` can print a clean one-line message
128
+ instead of a traceback for expected/user-facing errors; anything else prints a full traceback.
112
129
 
113
130
  ## Tests
114
131
 
@@ -7,8 +7,10 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
7
7
  Koan ("kickstart-over-a-network") is the client-side companion to
8
8
  [Cobbler](https://github.com/cobbler/cobbler). It runs on a target machine and talks to a Cobbler
9
9
  server to either provision new virtualized guests (Xen, KVM/qemu, VMware, OpenVZ) or re-provision
10
- (re-kickstart) an existing physical/virtual system. It ships two console scripts: `koan` (the big
11
- `Koan` CLI in `app.py`) and `cobbler-register` (the small `Register` CLI in `register.py`).
10
+ (re-kickstart) an existing physical/virtual system. It ships two console scripts, `koan` and
11
+ `cobbler-register`; both entrypoints (`main()` and `register_main()`) live in `koan/cli.py` and
12
+ use `argparse`, while the actual provisioning/registration logic lives in the `Koan` class
13
+ (`app.py`) and `Register` class (`register.py`) respectively — see Architecture below.
12
14
 
13
15
  ## Commands
14
16
 
@@ -71,17 +73,28 @@ SPDX comment block, then imports).
71
73
 
72
74
  ## Architecture
73
75
 
74
- Everything lives in the flat `koan/` package (no subpackages):
75
-
76
- - **`app.py`** — the real core of the program: the `Koan` class implements the entire `koan` CLI
77
- (~2100 lines). `main()` parses options with `optparse` and drives one `Koan` instance through a
78
- single top-level action (`--virt`, `--replace-self`, `--update-files`, `--update-config`,
79
- `--list`, etc. — see `Koan.run()`). Key method groups:
76
+ Everything lives in the `koan/` package, mostly flat aside from the `koan/virt/` subpackage:
77
+
78
+ - **`cli.py`** — `argparse`-based entrypoints for both console scripts. `main()` (koan) builds
79
+ the ~30 flags, copies the parsed `Namespace` onto a fresh `Koan()` instance's attributes 1:1,
80
+ and calls `k.run()`; `register_main()` (cobbler-register) does the same for `Register`. Both
81
+ wrap the call in a try/except that special-cases the `from_koan` marker (see `cexceptions.py`
82
+ below) to print a clean one-line message instead of a traceback. `main()` also defines
83
+ `--version` (reads `koan.__version__`, generated by `setuptools_scm`). Gotcha when adding new
84
+ `store_true` flags here: `argparse`'s `store_true` defaults to `False`, not `None` like the
85
+ `optparse` code this replaced — pass `default=None` explicitly for any flag whose absence needs
86
+ to be distinguishable from an explicit "off" (e.g. `-n/--nogfx`, checked via `is not None`
87
+ against `-g/--graphics`'s always-set default).
88
+ - **`app.py`** — the real core of the program: the `Koan` class implements almost all of the
89
+ `koan` CLI's behavior as a plain business-logic class with no argument parsing of its own —
90
+ `cli.py`'s `main()` populates its attributes and calls `Koan.run()`, which drives a single
91
+ top-level action (`--virt`, `--replace-self`, `--update-files`, `--update-config`, `--list`,
92
+ etc). Key method groups:
80
93
  - `net_install()` / `get_distro_files()` / `calc_kernel_args()` — fetch profile/system data
81
94
  from the Cobbler server and compute kernel/initrd/kernel-options for network installs and
82
95
  `--replace-self` (kexec) reinstalls.
83
96
  - `virt_net_install()` / `load_virt_modules()` / `virt_choose()` — dispatch to the
84
- per-hypervisor `*create.py` module based on `virt_type`.
97
+ per-hypervisor module in `koan/virt/` based on `virt_type`.
85
98
  - The many `calc_virt_*()` methods (`calc_virt_ram`, `calc_virt_disk`-adjacent
86
99
  `calc_virt_filesize*`, `calc_virt_mac`, `calc_virt_uuid`, `calc_virt_path*`, ...) resolve
87
100
  per-VM settings from Cobbler profile/system data plus command-line overrides plus defaults —
@@ -89,26 +102,30 @@ Everything lives in the flat `koan/` package (no subpackages):
89
102
  throughout and is the main thing to preserve when touching option handling.
90
103
  - `update_files()` / `update_config()` — pull config-management templates/packages/repos from
91
104
  Cobbler for an already-installed system and hand off to `configurator.KoanConfigure`.
105
+ - `get_install_tree_from_autoinst()` still uses `optparse.OptionParser` internally — that's
106
+ parsing `url=`/`nfs=` args embedded in a downloaded kickstart/autoinst file, unrelated to the
107
+ `koan` command line, so it wasn't touched by the `cli.py` extraction/argparse migration.
92
108
  - **`configurator.py`** — `KoanConfigure`: applies repo/package/file configuration pushed down
93
109
  from Cobbler's config-management data to the local system (currently only implements YUM repo
94
110
  configuration; `yum` import is optional/best-effort).
95
111
  - **`virtinstall.py`** — builds a `virt-install`/libvirt command line (disk/NIC sanitization,
96
112
  `build_commandline()`) for KVM/qemu and Xen-via-libvirt guests.
97
- - **`{xen,qcreate,openvz,vmw,image}create.py`** — one module per hypervisor/guest backend, each
113
+ - **`koan/virt/{xen,qemu,openvz,vmw,image}.py`** — one module per hypervisor/guest backend, each
98
114
  exposing a `start_install(*args, **kwargs)` entry point that `app.py` calls into via
99
- `virt_choose()`/`load_virt_modules()`. `vmwcreate.py` additionally has helpers to build VMX
115
+ `virt_choose()`/`load_virt_modules()`. `vmw.py` additionally has helpers to build VMX
100
116
  files and register/start guests through VMware. When adding a new virt backend, follow this
101
117
  same `start_install(**kwargs)` contract so it plugs into `app.py` unchanged.
102
118
  - **`utils.py`** — shared grab-bag: XML-RPC connection to the Cobbler server
103
119
  (`connect_to_server`), network/OS introspection (`get_network_info`, `os_release`,
104
120
  `is_uefi_system`), subprocess helpers, and misc file/MAC/UUID utilities used across the other
105
121
  modules.
106
- - **`register.py`** — a second, much smaller CLI (`Register` class) for the `cobbler-register`
107
- command, which just registers the current system with a Cobbler server (distinct from the main
108
- provisioning flow in `app.py`).
122
+ - **`register.py`** — a second, much smaller business-logic class (`Register`) backing the
123
+ `cobbler-register` command (its `argparse` entrypoint is `cli.py`'s `register_main()`), which
124
+ just registers the current system with a Cobbler server (distinct from the main provisioning
125
+ flow in `app.py`).
109
126
  - **`cexceptions.py`** — exception hierarchy. `KoanException`/`InfoException` set a
110
- `from_koan` marker so `main()` can print a clean one-line message instead of a traceback for
111
- expected/user-facing errors; anything else prints a full traceback.
127
+ `from_koan` marker so `cli.py`'s `main()`/`register_main()` can print a clean one-line message
128
+ instead of a traceback for expected/user-facing errors; anything else prints a full traceback.
112
129
 
113
130
  ## Tests
114
131
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: koan
3
- Version: 3.2.0
3
+ Version: 3.2.1
4
4
  Summary: Kickstart over a Network Client for Cobbler
5
5
  Home-page: https://www.github.com/cobbler/koan
6
6
  Author: Team Cobbler
@@ -0,0 +1,11 @@
1
+ """
2
+ Koan ("kickstart-over-a-network"), the client-side companion to Cobbler.
3
+
4
+ Provisions new virtualized guests (Xen, KVM/qemu, VMware, OpenVZ) or re-provisions an existing physical/virtual system
5
+ by talking to a Cobbler server. Ships the ``koan`` and ``cobbler-register`` console scripts.
6
+ """
7
+
8
+ try:
9
+ from koan._version import __version__
10
+ except ImportError:
11
+ __version__ = None
@@ -0,0 +1,5 @@
1
+ # Auto-generated by setuptools_scm — do not edit
2
+ __version__ = "3.2.1"
3
+ __gitstamp__ = "gdaf3aa672b73c24c418966133db1703131e97eb4"
4
+ __gitdate__ = "2026-07-21"
5
+ __builddate__ = "2026-12-01 09:38:39.882140+00:00"
@@ -23,8 +23,8 @@ import time
23
23
  import traceback
24
24
  from optparse import OptionParser
25
25
 
26
- from . import configurator, utils
27
- from .cexceptions import InfoException
26
+ from koan import configurator, utils
27
+ from koan.cexceptions import InfoException
28
28
 
29
29
  COBBLER_REQUIRED = 1.300
30
30
  KOAN_CONF_DIR = "/var/lib/koan/config/"
@@ -484,7 +484,7 @@ class Koan:
484
484
  url_fmt = "http://%s/cblr/svc/op/ks/profile/%s"
485
485
  else:
486
486
  url_fmt = "http://%s/cblr/svc/op/ks/system/%s"
487
- url = url_fmt % (self.server, profile_data["name"])
487
+ url = url_fmt % (profile_data["http_server"], profile_data["name"])
488
488
  else:
489
489
  url = profile_data["autoinst"]
490
490
 
@@ -1412,11 +1412,11 @@ EOF
1412
1412
 
1413
1413
  def load_virt_modules(self):
1414
1414
  try:
1415
- from . import imagecreate, qcreate, xencreate
1415
+ from koan.virt import image, qemu, xen
1416
1416
 
1417
- assert xencreate
1418
- assert qcreate
1419
- assert imagecreate
1417
+ assert xen
1418
+ assert qemu
1419
+ assert image
1420
1420
  except:
1421
1421
  traceback.print_exc()
1422
1422
  raise InfoException("no virtualization support available,\
@@ -1428,39 +1428,39 @@ EOF
1428
1428
  if (self.image is not None) and (pd["image_type"] == "virt-clone"):
1429
1429
  fullvirt = True
1430
1430
  uuid = None
1431
- from . import imagecreate
1431
+ from koan.virt import image
1432
1432
 
1433
- creator = imagecreate.start_install
1433
+ creator = image.start_install
1434
1434
  elif self.virt_type in ["xenpv", "xenfv"]:
1435
1435
  uuid = self.get_uuid(self.calc_virt_uuid(pd))
1436
- from . import xencreate
1436
+ from koan.virt import xen
1437
1437
 
1438
- creator = xencreate.start_install
1438
+ creator = xen.start_install
1439
1439
  if self.virt_type == "xenfv":
1440
1440
  fullvirt = True
1441
1441
  can_poll = "xen"
1442
1442
  elif self.virt_type in ["qemu", "kvm"]:
1443
1443
  fullvirt = True
1444
1444
  uuid = None
1445
- from . import qcreate
1445
+ from koan.virt import qemu
1446
1446
 
1447
- creator = qcreate.start_install
1447
+ creator = qemu.start_install
1448
1448
  can_poll = "qemu"
1449
1449
  elif self.virt_type == "vmware":
1450
- from . import vmwcreate
1450
+ from koan.virt import vmw
1451
1451
 
1452
1452
  uuid = None
1453
- creator = vmwcreate.start_install
1453
+ creator = vmw.start_install
1454
1454
  elif self.virt_type == "vmwarew":
1455
1455
  import vmwwcreate
1456
1456
 
1457
1457
  uuid = None
1458
1458
  creator = vmwwcreate.start_install
1459
1459
  elif self.virt_type == "openvz":
1460
- from . import openvzcreate
1460
+ from koan.virt import openvz
1461
1461
 
1462
1462
  uuid = None
1463
- creator = openvzcreate.start_install
1463
+ creator = openvz.start_install
1464
1464
  else:
1465
1465
  raise InfoException("Unspecified virt type: %s" % self.virt_type)
1466
1466
  return (uuid, creator, fullvirt, can_poll)
@@ -11,12 +11,10 @@ import os
11
11
  import sys
12
12
  import traceback
13
13
 
14
- from koan import __version__
15
-
16
- from . import utils
17
- from .app import Koan
18
- from .cexceptions import InfoException
19
- from .register import Register
14
+ from koan import __version__, utils
15
+ from koan.app import Koan
16
+ from koan.cexceptions import InfoException
17
+ from koan.register import Register
20
18
 
21
19
 
22
20
  def main():
@@ -19,7 +19,7 @@ import sys
19
19
  import tempfile
20
20
  import time
21
21
 
22
- from . import utils
22
+ from koan import utils
23
23
 
24
24
  try:
25
25
  import yum
@@ -11,8 +11,8 @@ import socket
11
11
  import time
12
12
  import traceback
13
13
 
14
- from . import utils
15
- from .cexceptions import InfoException
14
+ from koan import utils
15
+ from koan.cexceptions import InfoException
16
16
 
17
17
  # usage: cobbler-register [--server=server] [--fqdn=hostname] --profile=foo
18
18
 
@@ -21,7 +21,7 @@ import xmlrpc.client
21
21
  import distro
22
22
  import netifaces
23
23
 
24
- from .cexceptions import InfoException
24
+ from koan.cexceptions import InfoException
25
25
 
26
26
  VIRT_STATE_NAME_MAP = {
27
27
  0: "running",
@@ -0,0 +1,6 @@
1
+ """
2
+ Per-hypervisor VM installer backends.
3
+ """
4
+
5
+ # SPDX-License-Identifier: GPL-2.0-or-later
6
+ # SPDX-FileCopyrightText: Copyright 2026 Enno Gotthold <enno.gotthold@suse.com>
@@ -8,7 +8,7 @@ Virtualization installation functions for image based deployment
8
8
  # SPDX-FileCopyrightText: Original version based on virt-image
9
9
  # SPDX-FileCopyrightText: David Lutterkort <dlutter@redhat.com>
10
10
 
11
- from . import utils, virtinstall
11
+ from koan import utils, virtinstall
12
12
 
13
13
 
14
14
  def start_install(*args, **kwargs):
@@ -7,7 +7,7 @@ OpenVZ container-type virtualization installation functions.
7
7
 
8
8
  import os
9
9
 
10
- from .cexceptions import OVZCreateException
10
+ from koan.cexceptions import OVZCreateException
11
11
 
12
12
 
13
13
  def start_install(*args, **kwargs):
@@ -8,7 +8,7 @@ Virtualization installation functions.
8
8
 
9
9
  import os
10
10
 
11
- from .cexceptions import InfoException, VirtCreateException
11
+ from koan.cexceptions import InfoException, VirtCreateException
12
12
 
13
13
  IMAGE_DIR = "/var/lib/vmware/images"
14
14
  VMX_DIR = "/var/lib/vmware/vmx"
@@ -11,7 +11,7 @@ Currently somewhat Xen/paravirt specific, will evolve later.
11
11
  # SPDX-FileCopyrightText: Option handling added by Andrew Puch <apuch@redhat.com>
12
12
  # SPDX-FileCopyrightText: Simplified for use as library by koan, Michael DeHaan <michael.dehaan AT gmail>
13
13
 
14
- from . import utils, virtinstall
14
+ from koan import utils, virtinstall
15
15
 
16
16
 
17
17
  def start_install(*args, **kwargs):
@@ -15,8 +15,8 @@ import os
15
15
  import re
16
16
  import shlex
17
17
 
18
- from . import utils
19
- from .cexceptions import InfoException
18
+ from koan import utils
19
+ from koan.cexceptions import InfoException
20
20
 
21
21
  # The virtinst module will no longer be availabe to import in some
22
22
  # distros. We need to get all the info we need from the virt-install
@@ -218,7 +218,7 @@ def build_commandline(
218
218
 
219
219
  is_import = uri.startswith("import")
220
220
  if is_import:
221
- # We use the special value 'import' for imagecreate.py. Since
221
+ # We use the special value 'import' for koan/virt/image.py. Since
222
222
  # it is connection agnostic, just let virt-install choose the
223
223
  # best hypervisor.
224
224
  uri = ""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: koan
3
- Version: 3.2.0
3
+ Version: 3.2.1
4
4
  Summary: Kickstart over a Network Client for Cobbler
5
5
  Home-page: https://www.github.com/cobbler/koan
6
6
  Author: Team Cobbler
@@ -65,14 +65,9 @@ koan/app.py
65
65
  koan/cexceptions.py
66
66
  koan/cli.py
67
67
  koan/configurator.py
68
- koan/imagecreate.py
69
- koan/openvzcreate.py
70
- koan/qcreate.py
71
68
  koan/register.py
72
69
  koan/utils.py
73
70
  koan/virtinstall.py
74
- koan/vmwcreate.py
75
- koan/xencreate.py
76
71
  koan.egg-info/PKG-INFO
77
72
  koan.egg-info/SOURCES.txt
78
73
  koan.egg-info/dependency_links.txt
@@ -81,7 +76,14 @@ koan.egg-info/requires.txt
81
76
  koan.egg-info/scm_file_list.json
82
77
  koan.egg-info/scm_version.json
83
78
  koan.egg-info/top_level.txt
79
+ koan/virt/__init__.py
80
+ koan/virt/image.py
81
+ koan/virt/openvz.py
82
+ koan/virt/qemu.py
83
+ koan/virt/vmw.py
84
+ koan/virt/xen.py
84
85
  tests/__init__.py
85
86
  tests/conftest.py
87
+ tests/test_app.py
86
88
  tests/test_utils.py
87
89
  tests/virtinstall.py
@@ -61,14 +61,15 @@
61
61
  "koan/cexceptions.py",
62
62
  "koan/cli.py",
63
63
  "koan/configurator.py",
64
- "koan/imagecreate.py",
65
- "koan/openvzcreate.py",
66
- "koan/qcreate.py",
67
64
  "koan/register.py",
68
65
  "koan/utils.py",
66
+ "koan/virt/__init__.py",
67
+ "koan/virt/image.py",
68
+ "koan/virt/openvz.py",
69
+ "koan/virt/qemu.py",
70
+ "koan/virt/vmw.py",
71
+ "koan/virt/xen.py",
69
72
  "koan/virtinstall.py",
70
- "koan/vmwcreate.py",
71
- "koan/xencreate.py",
72
73
  "package-lock.json",
73
74
  "package.json",
74
75
  "pyproject.toml",
@@ -76,6 +77,7 @@
76
77
  "setup.py",
77
78
  "tests/__init__.py",
78
79
  "tests/conftest.py",
80
+ "tests/test_app.py",
79
81
  "tests/test_utils.py",
80
82
  "tests/virtinstall.py"
81
83
  ]
@@ -1,7 +1,7 @@
1
1
  {
2
- "tag": "3.2.0",
2
+ "tag": "3.2.1",
3
3
  "distance": 0,
4
- "node": "g074d29913efe8d14d60fca9b0e22d4daa664b05f",
4
+ "node": "gdaf3aa672b73c24c418966133db1703131e97eb4",
5
5
  "dirty": false,
6
6
  "branch": "HEAD",
7
7
  "node_date": "2026-07-21"
@@ -75,23 +75,10 @@ system. For use with a boot-server configured with Cobbler.
75
75
  if [ -d "%{_sourcedir}/%{name}-%{version}/.git" ]; then
76
76
  cp -r %{_sourcedir}/%{name}-%{version}/.git %{_builddir}/%{name}-%{version}
77
77
  fi
78
- %if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
79
78
  %pyproject_wheel
80
- %else
81
- python3 -m pip wheel --verbose --progress-bar off --disable-pip-version-check --use-pep517 --no-build-isolation --no-deps --wheel-dir ./dist .
82
- %endif
83
79
 
84
80
  %install
85
- %if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
86
81
  %pyproject_install
87
- %else
88
- # Install the wheel %build already produced instead of rebuilding from source:
89
- # building from "." here would spin up pip's isolated build environment, which
90
- # then fails to fetch setuptools/wheel because of --no-index. DEB_PYTHON_INSTALL_LAYOUT=deb
91
- # is required too: Debian's pip ignores --prefix and defaults to the posix_local
92
- # scheme (/usr/local), which doesn't match what %files (under %{_prefix}) expects.
93
- DEB_PYTHON_INSTALL_LAYOUT=deb python3 -m pip install --verbose --progress-bar off --disable-pip-version-check --root %{buildroot} --no-compile --ignore-installed --no-deps --no-index ./dist/*.whl
94
- %endif
95
82
 
96
83
  %files
97
84
  %license COPYING
@@ -21,7 +21,7 @@ setup(
21
21
  "write_to_template": _version_template,
22
22
  "fallback_version": "3.0.2",
23
23
  },
24
- packages=["koan"],
24
+ packages=["koan", "koan.virt"],
25
25
  entry_points={
26
26
  "console_scripts": [
27
27
  "koan = koan.cli:main",
@@ -0,0 +1,26 @@
1
+ from koan.app import Koan
2
+
3
+
4
+ def test_get_install_tree_from_autoinst_uses_http_server_port(mocker):
5
+ # Arrange
6
+ # Cobbler bakes a non-default http_port into "http_server" (e.g. "host:10080"),
7
+ # while "server" is just the plain hostname/IP koan was invoked with.
8
+ k = Koan()
9
+ k.server = "192.168.10.112"
10
+ k.system = None
11
+ profile_data = {
12
+ "name": "centos7.4-x86_64",
13
+ "autoinst": "http://192.168.10.112:10080/cblr/svc/op/ks/profile/centos7.4-x86_64",
14
+ "http_server": "192.168.10.112:10080",
15
+ }
16
+ mock_urlread = mocker.patch("koan.utils.urlread", return_value=b"")
17
+
18
+ # Act
19
+ k.get_install_tree_from_autoinst(profile_data)
20
+
21
+ # Assert
22
+ requested_url = mock_urlread.call_args[0][0]
23
+ assert (
24
+ requested_url
25
+ == "http://192.168.10.112:10080/cblr/svc/op/ks/profile/centos7.4-x86_64"
26
+ )
@@ -1,8 +0,0 @@
1
- """
2
- Main Koan package
3
- """
4
-
5
- try:
6
- from koan._version import __version__
7
- except ImportError:
8
- __version__ = None
@@ -1,5 +0,0 @@
1
- # Auto-generated by setuptools_scm — do not edit
2
- __version__ = "3.2.0"
3
- __gitstamp__ = "g074d29913efe8d14d60fca9b0e22d4daa664b05f"
4
- __gitdate__ = "2026-07-21"
5
- __builddate__ = "2026-12-01 09:38:37.410999+00:00"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes