Merge lp:~jamesbeedy/charm-haproxy/options_newline into lp:charm-haproxy

Proposed by james beedy
Status: Rejected
Rejected by: Haw Loeung
Proposed branch: lp:~jamesbeedy/charm-haproxy/options_newline
Merge into: lp:charm-haproxy
Diff against target: 22 lines (+4/-6)
1 file modified
hooks/hooks.py (+4/-6)
To merge this branch: bzr merge lp:~jamesbeedy/charm-haproxy/options_newline
Reviewer Review Type Date Requested Status
Cory Johns (community) Needs Fixing
Tom Haddon Pending
haproxy-team Pending
Review via email: mp+345463@code.launchpad.net

Commit message

Add backend options on new line.

Fixes: https://bugs.launchpad.net/charm-haproxy/+bug/1770866

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Cory Johns (johnsca) wrote :

I didn't realize I was still associated with this charm at all, much less requested on this review. I have to admit, I haven't done any work on this charm and was only associated with it because I changed the owner during a promulgation request. Apologies for missing the review request for so long.

From what I was able to gather from reading up on haproxy's configuration, this MR doesn't actually seem correct. Specifically, I think that it will break server-line settings[1] that do in fact need to go on the same line.

Really, it seems that the way the haproxy charm handles server_options[2] conflates server-line settings with options that need to be on their own line, making it basically impossible to handle both in a reasonable way.

Perhaps an "easy" fix would be to extend the list of known options[3] to include the ones that are failing, but I really think that create_listen_stanza should be refactored to avoid this sort of issue going forward.

That said, I'm really not very familiar with the charm, so I could be completely off base, so I've added the haproxy-team and specifically Tom Haddon to the review requests, as they will be much more knowledgeable about the correct solution for this.

[1]: https://cbonte.github.io/haproxy-dconv/1.7/configuration.html#5.2
[2]: https://bazaar.launchpad.net/~haproxy-team/charm-haproxy/trunk/view/head:/hooks/hooks.py#L350
[3]: https://bazaar.launchpad.net/~haproxy-team/charm-haproxy/trunk/view/head:/hooks/hooks.py#L58

review: Needs Fixing
Revision history for this message
james beedy (jamesbeedy) wrote :

@johnsca I'll give this a second review/revise per your notes here. Thanks for the bump

Unmerged revisions

114. By james beedy

Make sure backend 'options' get a new line.

Fixes: #1770866

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/hooks.py'
2--- hooks/hooks.py 2016-11-22 11:15:13 +0000
3+++ hooks/hooks.py 2018-05-12 16:21:32 +0000
4@@ -419,14 +419,12 @@
5 server_options) in enumerate(server_entries):
6 server_line = " server %s %s:%s" % \
7 (server_name, server_ip, server_port)
8+ server_line = server_line.format(i=i)
9+ service_config.append(server_line)
10 if server_options is not None:
11 if isinstance(server_options, basestring):
12- server_line += " " + server_options
13- else:
14- server_line += " " + " ".join(server_options)
15- server_line = server_line.format(i=i)
16- service_config.append(server_line)
17-
18+ service_config.append(" {}".format(server_options))
19+
20
21 # -----------------------------------------------------------------------------
22 # create_monitoring_stanza: Function to create the haproxy monitoring section

Subscribers

People subscribed via source and target branches

to all changes: