Commit Graph

14 Commits

Author SHA1 Message Date
a-kenji
3088ce025b lib/introspection: Test skipping instrospection of oneOf
This builds on top of #5422.
And tests it's behavior.
2025-10-08 13:17:55 +02:00
a-kenji
8058a7c158 lib/instrospection: Skip either(oneOf)
For either(oneOf) types, we skip introspection as we cannot
determine which branch of the union was taken without more context
This *should* be safe, as it can currently mostly be triggered through
The `extraModules` setting of inventory modules.

Example:

```
importer.roles.default.extraModules = [
    ../../modules/nixos/common.nix
];
```

Error Message:

```
Traceback (most recent call last):
  File "/nix/store/zaz4r4fic03m4whgz46p5jjszzlkq694-clan-cli/lib/python3.13/site-packages/clan_lib/templates/handler.py", line 91, in machine_template
    yield dst_machine_dir
  File "/nix/store/zaz4r4fic03m4whgz46p5jjszzlkq694-clan-cli/lib/python3.13/site-packages/clan_cli/machines/create.py", line 95, in create_machine
    inventory_store.write(inventory, message=f"machine '{machine_name}'")
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/zaz4r4fic03m4whgz46p5jjszzlkq694-clan-cli/lib/python3.13/site-packages/clan_lib/persist/inventory_store.py", line 269, in write
    write_info = self._write_map()
  File "/nix/store/zaz4r4fic03m4whgz46p5jjszzlkq694-clan-cli/lib/python3.13/site-packages/clan_lib/persist/inventory_store.py", line 214, in _write_map
    current_priority = self._get_inventory_current_priority()
  File "/nix/store/zaz4r4fic03m4whgz46p5jjszzlkq694-clan-cli/lib/python3.13/site-packages/clan_lib/persist/inventory_store.py", line 206, in _get_inventory_current_priority
    return self._flake.select("clanInternals.inventoryClass.introspection")
           ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/zaz4r4fic03m4whgz46p5jjszzlkq694-clan-cli/lib/python3.13/site-packages/clan_lib/flake/flake.py", line 1129, in select
    self.get_from_nix([selector])
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/nix/store/zaz4r4fic03m4whgz46p5jjszzlkq694-clan-cli/lib/python3.13/site-packages/clan_lib/flake/flake.py", line 1054, in get_from_nix
    raise ClanSelectError(
    ...<3 lines>...
    ) from e
clan_lib.flake.flake.ClanSelectError: Error on: $ clan select 'clanInternals.inventoryClass.introspection'
  Reason: Yet Unsupported type: either
Removing left-over machine directory: /tmp/hyperconfig/machines/trooo
Error on: $ clan select 'clanInternals.inventoryClass.introspection'
  Reason: Yet Unsupported type: either

```

Closes: #5387
2025-10-07 22:58:51 +02:00
Johannes Kirschbauer
149e14e85d lib/introspection: backwards support older nixpkgs version with reduced features 2025-10-02 17:39:03 +02:00
Johannes Kirschbauer
6f5f182aef lib/introspect: fix list item meta 2025-10-02 16:40:29 +02:00
Johannes Kirschbauer
1a8131f17f lib/introspect: recurse for nested attrsOf 2025-10-01 16:56:53 +02:00
Johannes Kirschbauer
a8156d2fa6 lib/introspect: seperate headType from nullable 2025-10-01 09:51:34 +02:00
Johannes Kirschbauer
75121767d3 lib/introspect: use valueMeta to expose more information 2025-09-24 17:24:44 +02:00
Jörg Thalheim
b692f6fcfe put flake input overrides into a helper function 2025-07-07 15:59:09 +00:00
DavHau
73b298d0b2 checks: rename attributes for better discoverability
- all eval checks prefixed with `eval-`
- all service checks prefixed with `service-`
2025-06-30 19:04:21 +07:00
Johannes Kirschbauer
e17327bea8 Fix(introspection): 'lazyAttrsOf' needs to get the same handling as 'attrsOf' 2025-05-21 16:45:19 +02:00
Jörg Thalheim
a058e1a6cd lib.filter: allow to name inputs 2025-05-13 13:31:12 +02:00
Michael Hoang
ce85aebc17 tests: add --show-trace to nix-unit tests 2025-04-08 08:53:29 +02:00
Johannes Kirschbauer
8a1584b145 chore(lib/introspection): add comment about upstream PRs, that allows removing features 2025-04-02 12:38:28 +02:00
Johannes Kirschbauer
6e16d1345e chore(lib/treewide): cleanup directory struture of lib. See lib/readme.md for details 2025-04-02 11:11:21 +02:00