"Field 'tags' doesn't have a default value" when trying to process reports
I'm trying the latest code in the main branch (sorry, but it looks like it has cool CVE features!) and am getting the following when trying to process reports:
I cloned patchman to /srv/patchman and have 'installed' it and it's dependencies with python3.12 setup.py install in that directory.
[usr@patchman patchman]# patchman -a
/usr/local/bin/patchman:4: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
__import__('pkg_resources').run_script('patchman==3.0.19', 'patchman')
Cleaning Reports for all Hosts
Processing Reports for all Hosts
(1364, "Field 'tags' doesn't have a default value")
Traceback (most recent call last):
File "/usr/local/bin/patchman", line 4, in <module>
__import__('pkg_resources').run_script('patchman==3.0.19', 'patchman')
File "/usr/lib/python3.12/site-packages/pkg_resources/__init__.py", line 722, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python3.12/site-packages/pkg_resources/__init__.py", line 1561, in run_script
exec(code, namespace, namespace)
File "/usr/local/lib/python3.12/site-packages/patchman-3.0.19-py3.12.egg/EGG-INFO/scripts/patchman", line 550, in <module>
main()
File "/usr/local/lib/python3.12/site-packages/patchman-3.0.19-py3.12.egg/EGG-INFO/scripts/patchman", line 544, in main
showhelp = process_args(args)
^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/patchman-3.0.19-py3.12.egg/EGG-INFO/scripts/patchman", line 504, in process_args
process_reports(args.host, args.force)
File "/usr/local/lib/python3.12/site-packages/patchman-3.0.19-py3.12.egg/EGG-INFO/scripts/patchman", line 352, in process_reports
report.process(find_updates=False)
File "/srv/patchman/reports/models.py", line 111, in process
host = get_or_create_host(self, arch, osvariant, domain)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/patchman/hosts/utils.py", line 73, in get_or_create_host
if host:
^^^^
UnboundLocalError: cannot access local variable 'host' where it is not associated with a value
Is this something you've seen before? I can't see any more DB migrations to do.
Oh, I actually think that this is the issue:
(1364, "Field 'tags' doesn't have a default value")
An example of report.tags from one of my reports would be a b c (three tags, space separated).
Well I sort of fixed this... by resetting the DB and starting from scratch - although that wouldn't help anyone that does want to migrate their data of course.
I switched from django-tagging to django-taggit as the former is unmaintained: https://github.com/Fantomas42/django-tagging/pull/23
I spent some time trying to migrate tags but it was quite involved. I reasoned that machines would just re-send their tags anyway so the tags would get repopulated that way.
I did see this error when migrating during development but I thought it was fixed by https://github.com/furlongm/patchman/commit/850b53c93fa4b1e495a80570fa43ae8c5189dd1b
I'm curious if migrations were applied before running the above patchman command?
All migrations were applied as far as I could tell, makemigrations and migrate returned nothing.
Some fixes for tagging were applied to the main branch, can you see if they resolve your issue?