Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1540225

Summary: 2_ovirt_logger.py can't filter vars passed on the command line
Product: [oVirt] ovirt-hosted-engine-setup Reporter: Yedidyah Bar David <didi>
Component: GeneralAssignee: Simone Tiraboschi <stirabos>
Status: CLOSED WONTFIX QA Contact: Lukas Svaty <lsvaty>
Severity: low Docs Contact:
Priority: unspecified    
Version: 2.2.1CC: bugs, lsvaty, ylavi
Target Milestone: ---Keywords: CodeChange
Target Release: ---Flags: sbonazzo: ovirt-4.3-
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-06-25 07:54:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Integration RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Yedidyah Bar David 2018-01-30 14:01:19 UTC
Description of problem:

Current version of [1] allows setting he_filtered_tokens_vars in the playbook to a list and adding to it variables that we want to filter out their content in the generated log. But if we want to allow passing such a variable on the command line, this does not work:

OTOPI_CALLBACK_OF=logs/otopi-$(date +%s).log ANSIBLE_STDOUT_CALLBACK=2_ovirt_logger HE_ANSIBLE_LOG_PATH=logs/ans$(date +%s).log ansible-playbook --module-path=/usr/share/ovirt-hosted-engine-setup/ansible --inventory=./inventory -e somevar=somevalue -e secret_var_cli1=secret_data_1 -e '{"he_filtered_tokens_vars":["secret_var_cli1"]}' test_filtering.yml

This is because if he_filtered_tokens_vars it has a higher precedence than set_fact, so the following code will not be able to change it.

Not sure it's important to fix. A possible solution is probably to have a different way to pass such things in the command line, such as a new environment variable or a different ansible variable.

[1] https://gerrit.ovirt.org/86238

Comment 1 Yedidyah Bar David 2018-02-01 14:42:39 UTC
87016 is not fixing this bug, it only mentions it. Our bot is too greedy...

Comment 2 Yedidyah Bar David 2018-02-05 09:09:08 UTC
The linked patch do not fix current bug, it only mentions it. Some hook is too greedy and linked it.

I discussed with Simone how to handle current bug but didn't try anything yet. For now, we simply add all filtered keys by passing on the command line, so should be safe. The drawback is that we can't _also_ add keys in the middle (inside the playbook), due to the way ansible vars work. But this isn't a problem for now.

Comment 3 Sandro Bonazzola 2018-02-20 17:37:15 UTC
(In reply to Yedidyah Bar David from comment #2)
> The linked patch do not fix current bug, it only mentions it. Some hook is
> too greedy and linked it.
> 
> I discussed with Simone how to handle current bug but didn't try anything
> yet. For now, we simply add all filtered keys by passing on the command
> line, so should be safe. The drawback is that we can't _also_ add keys in
> the middle (inside the playbook), due to the way ansible vars work. But this
> isn't a problem for now.

re targeting to 4.3 accordingly

Comment 4 Yaniv Lavi 2018-06-25 07:54:29 UTC
Closing old bugs.
Please reopen if still relevant.
Patches are welcomed.