Closed duanyz1201 closed 3 years ago
I am confused. Is it Cobbler 3.2.2 or is it Cobbler 3.3.0?
Cobbler 3.3.0
signature reload error
root@cobbler-3.3.0 ~#cobbler signature update
task started: 2021-09-24_184952_sigupdate
task started (id=Updating Signatures, time=Fri Sep 24 18:49:52 2021)
running python triggers from /var/lib/cobbler/triggers/task/sigupdate/pre/*
running shell triggers from /var/lib/cobbler/triggers/task/sigupdate/pre/*
shell triggers finished successfully
Successfully got file from https://cobbler.github.io/signatures/3.0.x/latest.json
*** TASK COMPLETE ***
root@cobbler-3.3.0 ~#cobbler signature reload
There was an error loading the signature data in .
Please check the JSON file or run 'cobbler signature update'.
I got the same error importing Centos 7.9. Current signature for rhel7 is:
[root@localhost cobbler]# cobbler --version
Cobbler 3.3.0
source: ?, ?
build time: Sun Oct 10 15:26:12 2021
[root@localhost cobbler]# grep rhel7 /var/lib/cobbler/distro_signatures.json -A6
"rhel7": {
"signatures": [
"Packages"
],
"version_file": "(redhat|sl|slf|centos|oraclelinux|vzlinux)-release-(?!notes)([\\w]*-)*7(Server)*[\\.-]+(.*)\\.rpm",
"version_file_regex": null,
"kernel_arch": "kernel-(.*).rpm",
[root@localhost cobbler]# cat /var/lib/cobbler/distro_signatures.json|grep -E '"version_file_regex": (""|null)'|wc -l
61
--> it does not have the "version_file_regex". Same, with 61 signatures.
Double checking from the code "cobbler/modules/managers/import_signatures.py / “scan_signatures(self) -function:
if f_re.match(fname):
# if the version file regex exists, we use it to scan the contents of the target
# version file to ensure it's the right version
if sigdata["breeds"][breed][version]["version_file_regex"]:
vf_re = re.compile(sigdata["breeds"][breed][version]["version_file_regex"])
vf_lines = self.get_file_lines(os.path.join(root, fname))
for line in vf_lines:
if vf_re.match(line):
self.logger.debug("Found a matching signature: breed=%s, version=%s",
breed, version)
if not self.breed:
self.breed = breed
if not self.os_version:
self.os_version = version
if not self.autoinstall_file:
self.autoinstall_file = sigdata["breeds"][breed][version]["default_autoinstall"]
self.pkgdir = pkgdir
return sigdata["breeds"][breed][version]
break
return None
--> for "return sigdata", it always requires there need to be “version_file_regex”, and also regex-match need to be done.
I replaced the function from version 3.2.0, and was able to import Centos 7.9. Same part of the code:
if f_re.match(fname):
# if the version file regex exists, we use it
# to scan the contents of the target version file
# to ensure it's the right version
if sigdata["breeds"][breed][version]["version_file_regex"]:
vf_re = re.compile(sigdata["breeds"][breed][version]["version_file_regex"])
vf_lines = self.get_file_lines(os.path.join(root, fname))
for line in vf_lines:
if vf_re.match(line):
break
else:
continue
self.logger.debug(
"Found a matching signature: breed=%s, version=%s" % (breed, version))
if not self.breed:
self.breed = breed
if not self.os_version:
self.os_version = version
if not self.autoinstall_file:
self.autoinstall_file = sigdata["breeds"][breed][version]["default_autoinstall"]
self.pkgdir = pkgdir
return sigdata["breeds"][breed][version]
return None
--> only checks the version file regex-match, if "version_file_regex" exists.
I think the function was changed by #2767
@hveini Sorry, 2 bugs and both were introduced by me.
Describe the bug
Attempting to import locally mounted media fails with complaints about signature imports:
Expected behavior
TASK COMPLETE
Cobbler version
Operating system
root@cobbler3.2.2 ~#cat /etc/centos-release CentOS Linux release 8.4.2105
Cobbler log
Screenshots
Additional information