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

Consul: Fix '_consul_lan_servers' variable to resolve 'hostvars[' ']' not defined' #440

Merged
merged 10 commits into from
Aug 18, 2023

Conversation

vitabaks
Copy link
Owner

@vitabaks vitabaks commented Aug 17, 2023

issue #437

In this PR, we addressed issues related to the formatting of the consul_servers and _consul_lan_servers variables.

The variable was previously formatted in a way that led to unnecessary line breaks and empty list elements. This caused errors when attempting to access mandatory variables from hostvars.

To fix this, we refactored the variable definition code to ensure that the list is properly formatted without extraneous whitespace, line breaks, or empty elements. This adjustment will enhance the reliability of the variable and prevent issues like the 'Mandatory variable 'hostvars[' ']' not defined' error.

The commit after which the variables were "broken": 51f17d6#diff-bfe4d1591b7e700567edc1a7cd12f30615d1bf0ec4e639b789c2e0a0fbcc7eb4

…iable 'hostvars[' ']' not defined' error

issue   #437
@vitabaks vitabaks self-assigned this Aug 17, 2023
@vitabaks vitabaks marked this pull request as draft August 17, 2023 22:49
@vitabaks vitabaks changed the title Consul: Fixing _consul_lan_servers variable to resolve 'hostvars[' ']' not defined' Consul: Fixi _consul_lan_servers variable to resolve 'hostvars[' ']' not defined' Aug 18, 2023
@vitabaks vitabaks changed the title Consul: Fixi _consul_lan_servers variable to resolve 'hostvars[' ']' not defined' Consul: Fix '_consul_lan_servers' variable to resolve 'hostvars[' ']' not defined' Aug 18, 2023
@vitabaks
Copy link
Owner Author

FYI @ThomasSanson

The commit after which the variables were "broken": 51f17d6#diff-bfe4d1591b7e700567edc1a7cd12f30615d1bf0ec4e639b789c2e0a0fbcc7eb4

this once again shows the need for tests for the Type C scheme

It will be necessary to allocate time and try again to add a scheme with consul to the molecule tests - #375

@vitabaks vitabaks marked this pull request as ready for review August 18, 2023 10:38
@vitabaks
Copy link
Owner Author

vitabaks commented Aug 18, 2023

Test result: passed

  TASK [deploy-finish : PostgreSQL Cluster health] *******************************
  ok: [10.172.0.20] => {
      "patronictl_result.stdout_lines": [
          "+ Cluster: postgres-cluster -------+-----------+----+-----------+",
          "| Member   | Host        | Role    | State     | TL | Lag in MB |",
          "+----------+-------------+---------+-----------+----+-----------+",
          "| pgnode01 | 10.172.0.20 | Leader  | running   |  2 |           |",
          "| pgnode02 | 10.172.0.21 | Replica | streaming |  2 |         0 |",
          "| pgnode03 | 10.172.0.22 | Replica | streaming |  2 |         0 |",
          "+----------+-------------+---------+-----------+----+-----------+"
      ]
  }
  
  TASK [deploy-finish : PostgreSQL Cluster connection info] **********************
  ok: [10.172.0.20] => {
      "msg": [
          "+------------------------------------------------+",
          "Client access point (DNS):",
          " master.postgres-cluster.service.consul ",
          " replica.postgres-cluster.service.consul ",
          "port 6432 (pgbouncer)",
          "+------------------------------------------------+"
      ]
  }

@vitabaks vitabaks merged commit edd1803 into master Aug 18, 2023
18 checks passed
@vitabaks vitabaks deleted the consul-hostvars branch September 13, 2023 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant