would work, but this just finds all registration Token no matter the validity date.
What am I doing wrong, the Token-janitor seems to not include the "–tokeninfo-value-before ‘$(date)’ " part in the query because I get Token that cleary dont match those values
As you can see in the Screenshot a token with a future date in validity_period_end is found, I even set no validity_period_start value to exclude it from the potential error sources
Hi, thanks for the advice, but this results in the following error
Traceback (most recent call last):und
File “/usr/bin/privacyidea-token-janitor”, line 8, in
sys.exit(cli())
File “/opt/privacyidea/lib/python3.10/site-packages/click/core.py”, line 829, in call
return self.main(*args, **kwargs)
File “/opt/privacyidea/lib/python3.10/site-packages/flask/cli.py”, line 586, in main
return super(FlaskGroup, self).main(*args, **kwargs)
File “/opt/privacyidea/lib/python3.10/site-packages/click/core.py”, line 782, in main
rv = self.invoke(ctx)
File “/opt/privacyidea/lib/python3.10/site-packages/click/core.py”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/opt/privacyidea/lib/python3.10/site-packages/click/core.py”, line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/opt/privacyidea/lib/python3.10/site-packages/click/core.py”, line 610, in invoke
return callback(*args, **kwargs)
File “/opt/privacyidea/lib/python3.10/site-packages/click/decorators.py”, line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File “/opt/privacyidea/lib/python3.10/site-packages/flask/cli.py”, line 426, in decorator
return __ctx.invoke(f, *args, **kwargs)
File “/opt/privacyidea/lib/python3.10/site-packages/click/core.py”, line 610, in invoke
return callback(*args, **kwargs)
File “/opt/privacyidea/lib/python3.10/site-packages/privacyidea/cli/privacyideatokenjanitor/findtokens.py”, line 506, in findtokens
for tlist in generator:
File “/opt/privacyidea/lib/python3.10/site-packages/privacyidea/cli/privacyideatokenjanitor/findtokens.py”, line 306, in _get_tokenlist
if not all(comparator(value) for comparator in tokeninfo_value_filter):
File “/opt/privacyidea/lib/python3.10/site-packages/privacyidea/cli/privacyideatokenjanitor/findtokens.py”, line 306, in
if not all(comparator(value) for comparator in tokeninfo_value_filter):
File “/opt/privacyidea/lib/python3.10/site-packages/privacyidea/cli/privacyideatokenjanitor/findtokens.py”, line 197, in comparator
return _parse_datetime(key, value) < given_value_string
TypeError: ‘<’ not supported between instances of ‘datetime.datetime’ and ‘str’
You can use the privacyidea-token-janitor parameters tokeninfo-value-after and tokeinfo-value-before if you have correctly formatted dates in the tokeninfo.