Repository: cobbler/cobbler

Issue:
`cobbler validate-autoinstalls`: Crashes with "Unhashable type Profile"
### Describe the bug

`cobbler validate-autoinstalls` is crashing even though with a single profile or distro added to Cobbler.

### Steps to reproduce

1. Install Cobbler
2. Import single distro/profile
3. Execute `cobbler validate-autoinstalls`
4. See error

### Expected behavior

<!--- A clear and concise description of what you expected to happen. -->

### Cobbler version

<!--- Paste output from `cobbler version` -->
````paste below
3.3.3 + release33 commits
````

### Operating system

openSUSE Tumbleweed 20240209

### Cobbler log

<!--- Paste (partial) output from `/var/log/cobbler/cobbler.log` -->
````paste below
[2024-02-11_122905_validate_autoinstall_files] 2024-02-11T12:29:06 - INFO | Exception Info:
  File "/usr/lib/python3.11/site-packages/cobbler/remote.py", line 103, in run
    rc = self._run(self)
         ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/cobbler/remote.py", line 264, in runner
    return self.remote.api.validate_autoinstall_files()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/cobbler/api.py", line 1525, in validate_autoinstall_files
    autoinstall_mgr.validate_autoinstall_files()
  File "/usr/lib/python3.11/site-packages/cobbler/autoinstall_manager.py", line 328, in validate_autoinstall_files
    (success, errors_type, errors) = self.validate_autoinstall_file(x, True)
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/cobbler/autoinstall_manager.py", line 308, in validate_autoinstall_file
    self.generate_autoinstall(profile=obj)
  File "/usr/lib/python3.11/site-packages/cobbler/autoinstall_manager.py", line 267, in generate_autoinstall
    return self.autoinstallgen.generate_autoinstall_for_profile(profile)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/cobbler/autoinstallgen.py", line 342, in generate_autoinstall_for_profile
    g = self.api.find_profile(name=g)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/cobbler/api.py", line 1081, in find_profile
    return self._collection_mgr.profiles().find(name=name, return_list=return_list, no_errors=no_errors, **kargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/cobbler/cobbler_collections/collection.py", line 127, in find
    return self.listing.get(kargs["name"], None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
````

### Screenshots

None

### Additional information

None



Discussion:

Resolving patch:
diff --git a/cobbler/autoinstall_manager.py b/cobbler/autoinstall_manager.py
--- a/cobbler/autoinstall_manager.py
+++ b/cobbler/autoinstall_manager.py
@@ -305,9 +305,9 @@ def validate_autoinstall_file(self, obj, is_profile: bool) -> list:
         self.logger.info("----------------------------")
         self.logger.debug("osversion: %s", os_version)
         if is_profile:
-            self.generate_autoinstall(profile=obj)
+            self.generate_autoinstall(profile=obj.name)
         else:
-            self.generate_autoinstall(system=obj)
+            self.generate_autoinstall(system=obj.name)
         last_errors = self.autoinstallgen.get_last_errors()
         if len(last_errors) > 0:
             return [False, TEMPLATING_ERROR, last_errors]


Test patch: