Fix history list sub command when not using the default log dir

The 'history list' sub command is always getting the log files from the
default directory ('~/validations') even if the user decided to write
them in one other directory.

$ validation run --validation 512e \
             --validation-log-dir /var/log/validations  \
             --inventory /etc/ansible/hosts

$ validation -vvv --debug history list \
             --validation-log-dir /var/log/validations
...
FileNotFoundError: [Errno 2] No such file or directory: '/home/validations/validations'

This patch fixes this wrong behavior by passing the
--validation-log-dir argument value to the show_history actions.

Moreover, the ValidationActions class is taken validation_path and group
as parameters. Passing --validation-log-dir argument value is wrong and useless.

Change-Id: I9962d449ee507ee64d0c884199d02cd9ce786c9b
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
This commit is contained in:
Gael Chamoulaud (Strider) 2021-07-06 15:03:09 +02:00
parent 85947ee8e0
commit bf95674c5f
No known key found for this signature in database
GPG Key ID: 4119D0305C651D66
1 changed files with 2 additions and 1 deletions

View File

@ -62,10 +62,11 @@ class ListHistory(BaseLister):
"{} last validations.").format(
parsed_args.history_limit))
actions = ValidationActions(parsed_args.validation_log_dir)
actions = ValidationActions()
return actions.show_history(
validation_ids=parsed_args.validation,
log_path=parsed_args.validation_log_dir,
history_limit=parsed_args.history_limit)