Merge lp:~thomir-deactivatedaccount/charm-haproxy/make-config-less-insane into lp:~ubuntuone-pqm-team/charm-haproxy/snap-store

Proposed by Thomi Richards
Status: Merged
Merged at revision: 111
Proposed branch: lp:~thomir-deactivatedaccount/charm-haproxy/make-config-less-insane
Merge into: lp:~ubuntuone-pqm-team/charm-haproxy/snap-store
Diff against target: 37 lines (+17/-9)
1 file modified
hooks/hooks.py (+17/-9)
To merge this branch: bzr merge lp:~thomir-deactivatedaccount/charm-haproxy/make-config-less-insane
Reviewer Review Type Date Requested Status
William Grant goodlord Approve
Review via email: mp+328004@code.launchpad.net

Commit message

Allow users to force particular option strings to the FE or BE sections.

Description of the change

Allow users to force particular option strings to the FE or BE sections, since the charm apparently has decided to tell me where my options must live :(

To post a comment you must log in.
112. By Thomi Richards

Fix service option filtering.

113. By Thomi Richards

Consolidate two loops.

114. By Thomi Richards

Code cleanups.

115. By Thomi Richards

Code cleanups.

116. By Thomi Richards

Code cleanups.

117. By Thomi Richards

Code cleanups.

Revision history for this message
William Grant (wgrant) wrote :

good riddance

review: Approve (code)
118. By Thomi Richards

Fixed failing test.

Revision history for this message
William Grant (wgrant) :
review: Approve (goodlord)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'hooks/hooks.py'
--- hooks/hooks.py 2017-03-02 16:10:43 +0000
+++ hooks/hooks.py 2017-07-25 07:09:10 +0000
@@ -347,16 +347,24 @@
347 if any(map(o.strip().startswith, service_options)):347 if any(map(o.strip().startswith, service_options)):
348 fe_options.append(o)348 fe_options.append(o)
349 be_options.append(o)349 be_options.append(o)
350
350 # Filter provided service options into frontend-only and backend-only.351 # Filter provided service options into frontend-only and backend-only.
351 results = izip(352 # XXX: The '{FE}' and '{BE}' feature is a local patch in this version
352 (fe_options, be_options),353 # of the charm, and is not present in the upstream charm.
353 (True, False),354 for option in service_options:
354 tee((o, any(map(o.strip().startswith,355 option = option.strip()
355 frontend_only_options)))356 if option.startswith('{FE}'):
356 for o in service_options))357 fe_options.append(option[4:].strip())
357 for out, cond, result in results:358 elif option.startswith('{BE}'):
358 out.extend(option for option, match in result359 be_options.append(option[4:].strip())
359 if match is cond and option not in out)360 else:
361 if any(map(option.startswith, frontend_only_options)):
362 if option not in fe_options:
363 fe_options.append(option)
364 else:
365 if option not in be_options:
366 be_options.append(option)
367
360 service_config = []368 service_config = []
361 unit_name = os.environ["JUJU_UNIT_NAME"].replace("/", "-")369 unit_name = os.environ["JUJU_UNIT_NAME"].replace("/", "-")
362 service_config.append("frontend %s-%s" % (unit_name, service_port))370 service_config.append("frontend %s-%s" % (unit_name, service_port))

Subscribers

People subscribed via source and target branches

to all changes: