blindsidenetworks / scalelite

Scalable load balancer for BigBlueButton.
GNU Affero General Public License v3.0
470 stars 247 forks source link

Fixes & improvements for servers:yaml rake task #1056

Closed Ithanil closed 5 months ago

Ithanil commented 5 months ago

Fixes multiple issues with the rake servers:yaml task.

Description

The rake servers:yaml task had 3-4 bugs: 1) Output of rake servers:yaml is incompatible to servers:sync This could in principle be fixed by specifying certain options in the YAML.safe_load call, but in my opinion it makes more sense to use strings for the keys. It is more human write-/readable and YAML.safe_load will work "out of the box". This PR converts all the keys to strings. 2) The value of "enabled" was always empty, because servers.enabled does not exist. It must be servers.enabled?, which is fixed by the PR. 3) The same mistake of 2) was also present in the logic behind the "state" value in the verbose servers:yaml output. This is also fixed. 4) In the line referenced by 3) there was another error w.r.t. operator associativity, which ultimately prevented output of the state 'cordoned'.

Testing Steps

Tested multiple configurations by dumping the YAML and then syncing it (after changing some value in the YAML or in the setup).

Before/After

Before:

bash-5.1$ rake servers:yaml
---
:servers:
  bbb-xyz-1:
    :url: https://bbb-xyz-1/bigbluebutton/api
    :secret: xyz-1
    :load_multiplier: 1.0
    :enabled:
  bbb-xyz-2:
    :url: https://bbb-xyz-2/bigbluebutton/api
    :secret: xyz-2
    :load_multiplier: 1.0
    :enabled:

After:

bash-5.1$ rake servers:yaml
---
servers:
  bbb-xyz-1:
    url: https://bbb-xyz-1/bigbluebutton/api
    secret: xyz-1
    load_multiplier: 1.0
    enabled: true
  bbb-xyz-2:
    url: https://bbb-xyz-2/bigbluebutton/api
    secret: xyz-2
    load_multiplier: 1.0
    enabled: false

Fixed Issues

Fixes https://github.com/blindsidenetworks/scalelite/issues/1057 Fixes https://github.com/blindsidenetworks/scalelite/issues/1024

Other notes

Has a trivial conflict with https://github.com/blindsidenetworks/scalelite/pull/1049