Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes & improvements for servers:yaml rake task #1056

Merged
merged 4 commits into from
Apr 5, 2024

Conversation

Ithanil
Copy link
Contributor

@Ithanil Ithanil commented Apr 5, 2024

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 #1057
Fixes #1024

Other notes

Has a trivial conflict with #1049

…uch that YAML.safe_load consumes it correctly (with default arguments), and for better human write-/readability
@Ithanil Ithanil marked this pull request as draft April 5, 2024 10:01
@Ithanil Ithanil marked this pull request as ready for review April 5, 2024 14:52
@farhatahmad farhatahmad merged commit e93f3f7 into blindsidenetworks:master Apr 5, 2024
1 check passed
@Ithanil Ithanil deleted the fix_yaml-sync branch April 5, 2024 16:20
farhatahmad pushed a commit that referenced this pull request Jun 27, 2024
* use string keys over symbols in hash produced by servers:yaml task, such that YAML.safe_load consumes it correctly (with default arguments), and for better human write-/readability

* fix 'enabled' value in servers:yaml output

* fix server.enabled? in servers:yaml[verbose]

* fix logic mistake which prevented state 'cordoned' to be outputted in output of servers:yaml[verbose]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants