Bug 1743165

Summary: The `--foreman-loggers` option does not work
Product: Red Hat Satellite Reporter: Sergei Petrosian <spetrosi>
Component: InstallationAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED WONTFIX QA Contact: Devendra Singh <desingh>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.6.0CC: ehelms, ekohlvan, lzap, swadeley, zhunting
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
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: 2021-01-19 21:34:26 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Sergei Petrosian 2019-08-19 09:01:24 UTC
Description of problem:
When trying to set loggers with the installer, the command that the full-help proposes does not work


Version-Release number of selected component (if applicable):
6.6


How reproducible:
Always

Steps to Reproduce:
1. Enter the following command to find how to set loggers with satellite-installer:
~~~~~
[root@sat65 ~]# satellite-installer --full-help | grep loggers
    --foreman-loggers             Enable or disable specific loggers, e.g. {"sql" => true} (current: {})
    --reset-foreman-loggers       Reset loggers to the default value ({})
~~~~~

2. Try the command the installer suggests and observe error at the output:
~~~~~
[root@sat65 ~]# satellite-installer --foreman-loggers "{"sql" => true}"
Resetting puppet server version param...
Parameter foreman-loggers invalid: Hash value elements are invalid: nil is Error during configuration, exiting
~~~~~

3. Try to escape quotes and observe error at the output again:
~~~~~
[root@sat65 ~]# satellite-installer --foreman-loggers "{\"sql\" => true}"
Resetting puppet server version param...
Parameter foreman-loggers invalid: Hash value elements are invalid: nil is Error during configuration, exiting
~~~~~

4. Try to use JSON format and observe error at the output again:
~~~~~
[root@sat65 ~]# satellite-installer --foreman-loggers "{\"sql\": true}"
Resetting puppet server version param...
Parameter foreman-loggers invalid: Hash value elements are invalid: " true}Error during configuration, exiting
~~~~~

Actual results:
Errors

Expected results:
The loggers are set correctly and persistently in the `/etc/foreman/settings.yaml` file.


Additional info:
Faced this while working on BZ#1738850.

Comment 5 Ewoud Kohl van Wijngaarden 2019-08-22 08:28:32 UTC
This was discussed a while ago and it's a bit complex. The suggested syntax is Puppet's but on the command line that doesn't work.

https://github.com/theforeman/kafo#hash-arguments has an example:

> bin/foreman-installer --puppet-server-git-branch-map=master:some --puppet-server-git-branch-map=development:another

When we tested this, it turns out it doesn't actually work well and the = needs to be dropped. That means the correct way is:

  satellite-installer --foreman-loggers sql:true

Comment 6 Lukas Zapletal 2019-08-22 10:45:01 UTC
Thanks, I wonder how you write multiple entries. Is that:

satellite-installer --foreman-loggers sql:true,audit:true

or

satellite-installer --foreman-loggers sql:true --foreman-loggers audit:true

?

Comment 7 Ewoud Kohl van Wijngaarden 2019-08-22 11:11:00 UTC
From the kafo example I suggests the latter. This is also how we treat arrays: you specify it multiple times. Haven't tried it myself.

Comment 8 Ewoud Kohl van Wijngaarden 2019-08-22 16:21:08 UTC
Moving forward I think we should remove the example since it doesn't really add a lot. This is also considered an advanced parameter so I'm wondering how much more we need to invest into inline documentation. What would be considered sufficient to close this bug?

Comment 9 Sergei Petrosian 2019-08-23 08:07:30 UTC
Hi Ewoud,

In BZ#1738850, I have added the command to enable a logger you shared to the 12.2. Enabling Individual Loggers [1] section. Still, it will be great if users can find the same information directly from the out[ut of `hammer --full-help`.
I suggest changing the current output, which is the following:
>    --foreman-loggers             Enable or disable specific loggers, e.g. {"sql" => true} (current: {})

To something not misleading, for example:
>    --foreman-loggers             Enable or disable specific loggers, e.g. {sql:true} (current: {})

Also, I like Lukas's suggestion to add a possibility to specify multiple entries with this command.

Thank you

[1] https://access.redhat.com/documentation/en-us/red_hat_satellite/6.6-beta/html/administering_red_hat_satellite/chap-red_hat_satellite-administering_red_hat_satellite-logging_and_reporting_problems#enabling_individual_loggers

Comment 10 Ewoud Kohl van Wijngaarden 2019-08-23 10:00:16 UTC
(In reply to Sergei Petrosian from comment #9)
> In BZ#1738850, I have added the command to enable a logger you shared to the
> 12.2. Enabling Individual Loggers [1] section. Still, it will be great if
> users can find the same information directly from the out[ut of `hammer
> --full-help`.
> I suggest changing the current output, which is the following:
> >    --foreman-loggers             Enable or disable specific loggers, e.g. {"sql" => true} (current: {})
> 
> To something not misleading, for example:
> >    --foreman-loggers             Enable or disable specific loggers, e.g. {sql:true} (current: {})

I prefer a more specific logging document (as you linked), but I'll see what I can do to remove the confusing instructions from the help text.

> Also, I like Lukas's suggestion to add a possibility to specify multiple
> entries with this command.

This should already be possible. If you encounter issues with it, it's a bug we need to resolve.

> [1]
> https://access.redhat.com/documentation/en-us/red_hat_satellite/6.6-beta/
> html/administering_red_hat_satellite/chap-red_hat_satellite-
> administering_red_hat_satellite-
> logging_and_reporting_problems#enabling_individual_loggers

Comment 11 Sergei Petrosian 2019-08-23 12:27:40 UTC
Thank you, Ewoud.

(In reply to Ewoud Kohl van Wijngaarden from comment #10)
> This should already be possible. If you encounter issues with it, it's a bug
> we need to resolve.
Sorry for the confusionm, I understood comment#6 incorrectly. The following command works fine: 
[root@sat65 ~]# satellite-installer --foreman-loggers sql:true --foreman-loggers ldap:true

Just for the record, others do not. This is not a bug definitely.
````
[root@sat65 ~]# satellite-installer --foreman-loggers sql:true ldap:true
ERROR: too many arguments

[root@sat65 ~]# satellite-installer --foreman-loggers sql:true,ldap:true
Resetting puppet server version param...
Parameter foreman-loggers invalid: Hash value elements are invalid: "true,ldap:true" is not a valid boolean
Error during configuration, exiting
````

Comment 15 Mike McCune 2020-12-09 22:17:59 UTC
Upon review of our valid but aging backlog the Satellite Team has concluded that this Bugzilla does not meet the criteria for a resolution in the near term, and are planning to close in approximately a month. If you have any concerns about this, please contact your Red Hat Account team.  Thank you.

Comment 16 Mike McCune 2021-01-19 21:27:18 UTC
Thank you for your interest in Satellite 6. We have evaluated this request, and while we recognize that it is a valid request, we do not expect this to be implemented in the product in the foreseeable future. This is due to other priorities for the product, and not a reflection on the request itself. We are therefore closing this out as WONTFIX. If you have any concerns about this, please do not reopen. Instead, feel free to contact your Red Hat Account Team. Thank you.