Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(356)

Issue 12022044: Refactor for easier builtin server integration.

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 9 months ago by teknico
Modified:
10 years, 9 months ago
Reviewers:
bac, mp+177364, gary.poster
Visibility:
Public.

Description

Refactor for easier builtin server integration. Refactor the charm code to ease integration of the builtin server. Detail of the changes, per file: hooks/backend.py: - order the mixins code as they are called, to ease readability; - merge InstallMixin into GuiMixin; - rename UpstartMixin to HaproxyApacheMixin; - reimplement GuiMixin.install using the new functions from the split of hooks/utils.py#fetch_gui (see below); - reimplement GuiMixin.start using the new functions from the split of hooks/utils.py#start_gui (see below); - move here the chain and merge functions from hooks/utils.py, renaming them to be less generic; - further simplify the backend constructor code. hooks/utils.py: - rename JUJU_GUI_SITE and JUJU_GUI_PORTS to APACHE_SITE and APACHE_PORTS respectively; - split the start_gui function into compute_build_dir, write_gui_config and write_haproxy_config; - split the fetch_gui function into fetch_gui_from_branch and fetch_gui_release; - move the chain and merge functions to hooks/backend.py. tests/test_backends.py: - rename, add mocks and reorder to make tests pass again. tests/test_utils.py: - rename TestStartStop to TestStartImprovAgentGui; - split the start_gui function tests in TestStartImprovAgentGui into tests for compute_build_dir, write_gui_config, write_haproxy_config and write_apache_config; Sorry for the big diff. It was even bigger, but I moved some of the changes to a future branch. https://code.launchpad.net/~teknico/charms/precise/juju-gui/refactor-gui-startup/+merge/177364 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 11

Patch Set 2 : Refactor for easier builtin server integration. #

Patch Set 3 : Refactor for easier builtin server integration. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+333 lines, -299 lines) Patch
A [revision details] View 1 1 chunk +2 lines, -0 lines 0 comments Download
M hooks/backend.py View 1 6 chunks +141 lines, -105 lines 0 comments Download
M hooks/utils.py View 12 chunks +71 lines, -108 lines 0 comments Download
M tests/test_backends.py View 9 chunks +49 lines, -22 lines 0 comments Download
M tests/test_utils.py View 5 chunks +70 lines, -64 lines 0 comments Download

Messages

Total messages: 7
teknico
Please take a look.
10 years, 9 months ago (2013-07-29 11:12:06 UTC) #1
bac
LGTM Nicola. Thanks for the nice reorganization. https://codereview.appspot.com/12022044/diff/1/hooks/backend.py File hooks/backend.py (right): https://codereview.appspot.com/12022044/diff/1/hooks/backend.py#newcode67 hooks/backend.py:67: def install(self, ...
10 years, 9 months ago (2013-07-29 13:53:58 UTC) #2
teknico
Thanks for the review, see replies below. https://codereview.appspot.com/12022044/diff/1/hooks/backend.py File hooks/backend.py (right): https://codereview.appspot.com/12022044/diff/1/hooks/backend.py#newcode67 hooks/backend.py:67: def install(self, ...
10 years, 9 months ago (2013-07-29 14:09:10 UTC) #3
gary.poster
LGTM. Very nice changes, Nicola. I have a few small comments, one of which might ...
10 years, 9 months ago (2013-07-29 14:26:51 UTC) #4
teknico
gary.poster wrote: > In your cover letter, you mentioned "reorder to make tests pass again." ...
10 years, 9 months ago (2013-07-29 14:55:41 UTC) #5
teknico
Please take a look.
10 years, 9 months ago (2013-07-29 15:03:36 UTC) #6
teknico
10 years, 9 months ago (2013-07-30 10:15:06 UTC) #7
*** Submitted:

Refactor for easier builtin server integration.

Refactor the charm code to ease integration of the builtin server.
Detail of the changes, per file:

hooks/backend.py:

- order the mixins code as they are called, to ease readability;
- merge InstallMixin into GuiMixin;
- rename UpstartMixin to HaproxyApacheMixin;
- reimplement GuiMixin.install using the new functions from the split of
  hooks/utils.py#fetch_gui (see below);
- reimplement GuiMixin.start using the new functions from the split of
  hooks/utils.py#start_gui (see below);
- move here the chain and merge functions from hooks/utils.py, renaming
  them to be less generic;
- further simplify the backend constructor code.

hooks/utils.py:

- rename JUJU_GUI_SITE and JUJU_GUI_PORTS to APACHE_SITE and
  APACHE_PORTS respectively;
- split the start_gui function into compute_build_dir, write_gui_config
  and write_haproxy_config;
- split the fetch_gui function into fetch_gui_from_branch and
  fetch_gui_release;
- move the chain and merge functions to hooks/backend.py.

tests/test_backends.py:

- rename, add mocks and reorder to make tests pass again.

tests/test_utils.py:

- rename TestStartStop to TestStartImprovAgentGui;
- split the start_gui function tests in TestStartImprovAgentGui into
  tests for compute_build_dir, write_gui_config, write_haproxy_config
  and write_apache_config;

Sorry for the big diff. It was even bigger, but I moved some of the
changes to a future branch.

R=bac, gary.poster
CC=
https://codereview.appspot.com/12022044
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b