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

Keepalived config not merged since you are specifying the json in the puppet hash variable #313

Merged
merged 1 commit into from
Apr 10, 2015

Conversation

victorgp
Copy link
Contributor

I think the config json shouldn't be merged, but just applied as it is because you are defining the actual hash in the puppet variable. Why?
Because i've been having this issue:

This was my client config file

{
  "client": {
    "name": "myhost",
    "address": "123.123.123.123",
    "bind": "127.0.0.1",
    "keepalive": {
      "extra_useless_parameter": 100,
      "thresholds": {
        "warning": 300,
        "critical": 600
      },
      "handlers": [
        "default",
        "mailer"
      ],
      "occurrences": 5,
      "refresh": 2702
    },
  }
}

I wanted to remove that "extra_useless_parameter", so i removed it in puppet. This sensu-puppet module is aware that the config file values changed, so it notifies the sensu service and provokes a restart.
So far, so good, the problem is that the "sensu_client_config" resource that you created, is not removing that "extra_useless_value" because is doing a json merge between the old config file and the new values, therefore the state of the config file is exactly the same as the previous one. This is causing that everytime puppet runs, it notifies the sensu service and restart it forever and ever.

@ghost
Copy link

ghost commented Apr 2, 2015

Could someone take a look at this?

@jamtur01
Copy link
Contributor

jamtur01 commented Apr 2, 2015

I'll try to take a look at this on the weekend.

@jamtur01
Copy link
Contributor

jamtur01 commented Apr 5, 2015

So I think this will create other problems - you're ignoring the fact this is a hash.

@ghost
Copy link

ghost commented Apr 6, 2015

Thank you for looking into this.

@victorgp what do you think?

@victorgp
Copy link
Contributor Author

victorgp commented Apr 7, 2015

@jamtur01 what do you mean with "the fact this is a hash"? in puppet you set the hash, and then the ruby code is merging the old one with the new one, if the old one is wrong (having a wrong hash key) and you want to remove that wrong key, if you do the merge, you can't remove it.

@jamtur01
Copy link
Contributor

jamtur01 commented Apr 7, 2015

@victorgp Why not handle it like the existing custom method?

@victorgp
Copy link
Contributor Author

victorgp commented Apr 7, 2015

Because if there is already a keepalived parameter, i think i should use that parameter if i want to set the keepalived options, i don't see why i should use the custom method for that.

@jamtur01
Copy link
Contributor

jamtur01 commented Apr 7, 2015

@ghost
Copy link

ghost commented Apr 7, 2015

I don't see why this would cause a problem and why anything would have to merged; shouldn't all of the needed data be passed into the keepalive function?

Do you agree that there is a bug the way it is? What sort of problems would happen with this change exactly as it is?

We've been running this on a fairly large scale for at least a month with no ill-effects that we can tell.

@jamtur01
Copy link
Contributor

jamtur01 commented Apr 7, 2015

My suggestion is that it's the same issue the logic the custom method is designed to address - why not use a consistent approach?

@ghost
Copy link

ghost commented Apr 7, 2015

Wouldn't direct assignment be much faster than a merge and a delete? Maybe both methods could be changed to just assignment.

@jamtur01
Copy link
Contributor

jamtur01 commented Apr 7, 2015

They are set this way because of sort order (this from memory - @rodjek @jlambert121 or @johnf might remember more). If you change the order of your JSON but not the content and directly assign then Sensu sees that as a change and restarts.

@jamtur01
Copy link
Contributor

Okay - I can't replicate the prior issue. I'm going to merge this. Folks are welcome to ping me if this breaks stuff.

jamtur01 added a commit that referenced this pull request Apr 10, 2015
Keepalived config not merged since you are specifying the json in the puppet hash variable
@jamtur01 jamtur01 merged commit 1c9faca into sensu:master Apr 10, 2015
@victorgp
Copy link
Contributor Author

Great, thank you @jamtur01

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.

2 participants