theforeman / smart_proxy_monitoring

Smart proxy plugin for monitoring system integration
GNU General Public License v3.0
7 stars 10 forks source link

Avoid changing hash during iteration #34

Open ekohl opened 2 months ago

ekohl commented 2 months ago

The old code failed with:

can't add a new key into hash during iteration

The new code uses transform_keys to change all keys and then iterates all values. While this means it iterates twice, it should at least be safe.

Reported at: https://community.theforeman.org/t/foreman-proxy-monitoring-down-upgrading-foreman-from-3-10-to-3-11/38579/2

timogoebel commented 2 months ago

Nice catch, should this return the hash after transformation?

ekohl commented 2 months ago

Right now it's modified in place and now used like that, but I suppose it could