certtools / intelmq

IntelMQ is a solution for IT security teams for collecting and processing security feeds using a message queuing protocol.
https://docs.intelmq.org/latest/
GNU Affero General Public License v3.0
975 stars 296 forks source link

remove deprecated parameter for YAML loader & dumper #2520

Open sebix opened 3 months ago

sebix commented 3 months ago

typ='unsafe' is deprecated

fixes https://github.com/certtools/intelmq/issues/2489

Please don't merge before 3.3.1 release is done.

sebix commented 2 months ago

This does not work for the state.json:

[   44s] Traceback (most recent call last):
[   44s]   File "/usr/bin/intelmqctl", line 33, in <module>
[   44s]     sys.exit(load_entry_point('intelmq==3.3.1', 'console_scripts', 'intelmqctl')())
[   44s]              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[   44s]   File "/usr/lib/python3.11/site-packages/intelmq/bin/intelmqctl.py", line 1302, in main
[   44s]     return x.run()
[   44s]            ^^^^^^^
[   44s]   File "/usr/lib/python3.11/site-packages/intelmq/bin/intelmqctl.py", line 430, in run
[   44s]     retval, results = args.func(**args_dict)
[   44s]                       ^^^^^^^^^^^^^^^^^^^^^^
[   44s]   File "/usr/lib/python3.11/site-packages/intelmq/bin/intelmqctl.py", line 1033, in upgrade_conf
[   44s]     state = utils.load_configuration(state_file)
[   44s]             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[   44s]   File "/usr/lib/python3.11/site-packages/intelmq/lib/utils.py", line 222, in load_configuration
[   44s]     config = YAML(pure=True).load(fpconfig)
[   44s]              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[   44s]   File "/usr/lib/python3.11/site-packages/ruamel/yaml/main.py", line 456, in load
[   44s]     return constructor.get_single_data()
[   44s]            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[   44s]   File "/usr/lib/python3.11/site-packages/ruamel/yaml/constructor.py", line 114, in get_single_data
[   44s]     node = self.composer.get_single_node()
[   44s]            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[   44s]   File "/usr/lib/python3.11/site-packages/ruamel/yaml/composer.py", line 72, in get_single_node
[   44s]     document = self.compose_document()
[   44s]                ^^^^^^^^^^^^^^^^^^^^^^^
[   44s]   File "/usr/lib/python3.11/site-packages/ruamel/yaml/composer.py", line 94, in compose_document
[   44s]     node = self.compose_node(None, None)
[   44s]            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[   44s]   File "/usr/lib/python3.11/site-packages/ruamel/yaml/composer.py", line 130, in compose_node
[   44s]     node = self.compose_mapping_node(anchor)
[   44s]            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[   44s]   File "/usr/lib/python3.11/site-packages/ruamel/yaml/composer.py", line 211, in compose_mapping_node
[   44s]     item_value = self.compose_node(node, item_key)
[   44s]                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[   44s]   File "/usr/lib/python3.11/site-packages/ruamel/yaml/composer.py", line 106, in compose_node
[   44s]     if self.parser.check_event(AliasEvent):
[   44s]        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[   44s]   File "/usr/lib/python3.11/site-packages/ruamel/yaml/parser.py", line 141, in check_event
[   44s]     self.current_event = self.state()
[   44s]                          ^^^^^^^^^^^^
[   44s]   File "/usr/lib/python3.11/site-packages/ruamel/yaml/parser.py", line 631, in parse_block_mapping_value
[   44s]     if self.scanner.check_token(ValueToken):
[   44s]        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[   44s]   File "/usr/lib/python3.11/site-packages/ruamel/yaml/scanner.py", line 1735, in check_token
[   44s]     self._gather_comments()
[   44s]   File "/usr/lib/python3.11/site-packages/ruamel/yaml/scanner.py", line 1775, in _gather_comments
[   44s]     self.fetch_more_tokens()
[   44s]   File "/usr/lib/python3.11/site-packages/ruamel/yaml/scanner.py", line 278, in fetch_more_tokens
[   44s]     return self.fetch_value()
[   44s]            ^^^^^^^^^^^^^^^^^^
[   44s]   File "/usr/lib/python3.11/site-packages/ruamel/yaml/scanner.py", line 628, in fetch_value
[   44s]     raise ScannerError(
[   44s] ruamel.yaml.scanner.ScannerError: mapping values are not allowed here
[   44s]   in "/var/lib/intelmq/state.json", line 1, column 29