ekohl
December 13, 2021, 5:16pm
3
I already opened a PR back in June to properly fail on errors:
theforeman:master
← ekohl:more-native-methods
opened 08:45AM - 24 Jun 21 UTC
This uses more built in validators. It also creates a setting for the public key… file and derives it if not specified.
The only downside is that the validate_readable doesn't print a helpful command to generate it if needed. Programmable settings can be used to generate it on the fly if the parent directory is readable. Another alternative is to introduce another custom validator.
It also still uses the Smart Proxy's LegacyModuleLoader due to the presence of after_activation.
Currently a draft since I can't test this locally (smart_proxy_dynflow is not Ruby 3 compatible). Consider it more of an RFC.
I’ve now updated it to reflect the MQTT work but I ran into a bug on the Smart Proxy:
theforeman:develop
← ekohl:fix-validators
opened 02:58PM - 13 Dec 21 UTC
In old Ruby versions a hash was pushed as the last argument but in modern Ruby t… here is first class support for this via kwargs. This worked if a single argument was provided but if they were combined it failed:
```ruby
validate_presence :setting, if: ->(settings) { true }
```
This then tried to create a validator of a hash.
It looks like this code currently has no coverage which is why this never showed up. I'm also not sure if this is used in any plugins. I'm taking a look at writing tests.
That makes me wonder how many more of these kind of bugs are hiding in the Smart Proxy. I posted Ruby 3 support - #3 by ekohl .
2 Likes
evgeni
December 13, 2021, 6:04pm
4
1 Like