clearlinux / mixer-tools

Software update mixer and related tools
Apache License 2.0
27 stars 37 forks source link

Fix setting of log location with custom config #776

Closed phmccarty closed 2 years ago

phmccarty commented 2 years ago

When mixer's -c/--config option was used, the referenced config was read too late to set a default log location. As a result, the log location was always set to the empty string (disabling logging), that is, unless --log VALUE was specified, or if mixer's current working directory contained a builder.conf with LOG defined.

The root cause of this bug is an order-of-operations issue with cobra integration; fix the issue by setting the log location in PersistentPreRunE() instead of init(), ensuring that the command line arguments have been processed, with configFile being set to the -c/--config value if specified.

phmccarty commented 2 years ago

Ugh, the commit description needs a slight revision. I'll push that shortly.

bryteise commented 2 years ago

Ah that's a tricky one. Thanks!