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

Fix Bad formed prometheus.service issue #306 #307

Closed
wants to merge 1 commit into from

Conversation

dubcl
Copy link

@dubcl dubcl commented Mar 25, 2019

Pull Request (PR) description

Hi, this fix the "prometheus.systemd.erb" and "config.pp" to generate a correct "prometheus.systemd" file and avoid "prometheus: error: unexpected ExecReload=/bin/kill"

This Pull Request (PR) fixes the following issues

Fixes #306

@bastelfreak
Copy link
Member

@dubcl can you take a look at the failing tests? Can you add a test for your usecase?

@@ -7,7 +7,7 @@ After=basic.target network.target
User=<%= scope.lookupvar('prometheus::server::user') %>
Group=<%= scope.lookupvar('prometheus::server::group') %>
ExecStart=<%= scope.lookupvar('prometheus::server::bin_dir') %>/prometheus \
<%= @daemon_flags.join(" \\\n ") %> \
<%= @daemon_flags.join("\n ") %>
<%= scope.lookupvar('prometheus::server::extra_options') %>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If extra_options is used (ie not an empty string), this will be broken?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

I'm using this fix:

- $daemon_flags = $daemon_flags_basic + "--web.external-url=${prometheus::server::external_url}"
+ $daemon_flags = "--web.external-url=${prometheus::server::external_url} \\" + $daemon_flags_basic

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, yes, the fix proposal by @matejzero works

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at it again, I think this still won't fix every usecase. Right not, it works if we are using external_url, but it will fail if we use extra_options, since there is no trailing \ at the end of daemon_flags.

In the pre-PR code, it failed if extra_options were empty string, since there was a trailing \ at the end.

I have a fix, should I open another PR or should I post the solution here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you propose another PR?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do. I did some work yesterday, but it looks like it's gonna take some time to cover all init providers, not only systemd.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about merging extra_options and daemon_flags in the puppet code?

@bastelfreak
Copy link
Member

Hi,
I took the code in this PR and updated it in #318. Thanks for the contribuion!

bastelfreak pushed a commit that referenced this pull request May 20, 2019
Our init scripts sometimes contain a trailing `\` after the last
argument. Some might lead to wrong parsing.

Fixes #306
Replaces #307
cegeka-jenkins pushed a commit to cegeka/puppet-prometheus that referenced this pull request Aug 28, 2019
Our init scripts sometimes contain a trailing `\` after the last
argument. Some might lead to wrong parsing.

Fixes voxpupuli#306
Replaces voxpupuli#307
Rovanion pushed a commit to Rovanion/puppet-prometheus that referenced this pull request May 5, 2021
Our init scripts sometimes contain a trailing `\` after the last
argument. Some might lead to wrong parsing.

Fixes voxpupuli#306
Replaces voxpupuli#307
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bad formed prometheus.service
4 participants