Merge lp:~allenap/maas/rename-scripts-and-prepare-for-twistd-in-region into lp:~maas-committers/maas/trunk

Proposed by Gavin Panella
Status: Merged
Approved by: Gavin Panella
Approved revision: no longer in the source branch.
Merged at revision: 3442
Proposed branch: lp:~allenap/maas/rename-scripts-and-prepare-for-twistd-in-region
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 399 lines (+94/-100)
5 files modified
HACKING.txt (+2/-2)
Makefile (+42/-38)
buildout.cfg (+48/-58)
services/pserv/run (+1/-1)
src/apiclient/testing/django.py (+1/-1)
To merge this branch: bzr merge lp:~allenap/maas/rename-scripts-and-prepare-for-twistd-in-region
Reviewer Review Type Date Requested Status
Gavin Panella (community) Approve
Graham Binns (community) Approve
Review via email: mp+240429@code.launchpad.net

Commit message

Rename several scripts in the development build, and prepare for twistd in the region.

Description of the change

To post a comment you must log in.
Revision history for this message
Graham Binns (gmb) :
review: Approve
Revision history for this message
Julian Edwards (julian-edwards) wrote :

The commit message doesn't tell me at all what this change is for or why it's needed, can you explain please, especially since this will directly affect everyone's dev environment. Sorry Gavin, but your commit messages are nearly always terrible :(

Revision history for this message
Gavin Panella (allenap) wrote :

I will improve the commit message tomorrow. I can't get Apache to shut-down services in the region properly so I'm looking at turning it inside-out and running Django as a WSGI service within Twisted.

Revision history for this message
Julian Edwards (julian-edwards) wrote :

On Tuesday 04 November 2014 00:27:41 you wrote:
> I will improve the commit message tomorrow. I can't get Apache to shut-down
> services in the region properly so I'm looking at turning it inside-out and
> running Django as a WSGI service within Twisted.

Ooof, GLWT. :)

> Because different sub-projects of MAAS use, in theory, different
> libraries, and buildout is meant to create isolated environments for
> each. In practice this is of limited utility right now, but moving away
> from buildout improves this, and makes the dev environment and tests
> more reliable indicators of behaviour when packaged (this is something
> that I did with my nearly 1 year old repackaging branch).

How about an outer wrapper that examines its args and runs the right sub-
script?

>
> > Also, my fingers *only* just got used to typing test.maas, why the
> > rename?
>
> I'm thinking about your RSI.
>
> You know it's been >2 years we've been typing test.maas?

Yes, it takes me that long. I still get it wrong today! :)

> test.maas gives the impression that it's everything, but in fact it's
> just the region. I started fixing other things up and this stuck out
> like a sticky out thing.

Right, it does stick out.

But wouldn't it be lovely to
bin/maas <whatever>

:)

>
> > Also, paring down tests in test.pserv is completely different, it
> > uses: test.pserv provisioningserver.module.file
>
> This is, I think, because these sub-projects share a common root folder
> (src), so the test commands need to be concocted differently for the
> region to everything else, but my memory is vague on this.
>
> There's also a Django-assimilation thing going on with nose which I
> suspect of some involvement, but again I can't be sure.

Yeah, you have my sympathy dealing with this.

Revision history for this message
Gavin Panella (allenap) wrote :

Graham's been removed from the official team, so I'm rubber-stamping this to satisfy the lander.

review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :

Attempt to merge into lp:maas failed due to conflicts:

text conflict in Makefile

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'HACKING.txt'
2--- HACKING.txt 2014-09-24 14:20:51 +0000
3+++ HACKING.txt 2015-01-09 13:11:18 +0000
4@@ -97,8 +97,8 @@
5
6 To run tests at a lower level of granularity::
7
8- $ ./bin/test.maas test src/maasserver/tests/test_api.py
9- $ ./bin/test.maas test src/maasserver/tests/test_api.py:AnonymousEnlistmentAPITest
10+ $ ./bin/test.region src/maasserver/tests/test_api.py
11+ $ ./bin/test.region src/maasserver/tests/test_api.py:AnonymousEnlistmentAPITest
12
13 The test runner is `nose`_, so you can pass in options like
14 ``--with-coverage`` and ``--nocapture`` (short option: ``-s``). The
15
16=== modified file 'Makefile'
17--- Makefile 2014-12-17 05:29:57 +0000
18+++ Makefile 2015-01-09 13:11:18 +0000
19@@ -22,8 +22,11 @@
20 # JavaScript enum module (not modules).
21 js_enums := src/maasserver/static/js/enums.js
22
23-# MAAS SASS Stylesheets
24-scss_inputs := $(wildcard src/maasserver/static/scss/*/*.scss)
25+# MAAS SASS stylesheets. The first input file (maas-styles.css) imports
26+# the others, so is treated specially in the target definitions.
27+scss_inputs := \
28+ src/maasserver/static/scss/maas-styles.scss \
29+ $(wildcard src/maasserver/static/scss/*/*.scss)
30 scss_output := src/maasserver/static/css/maas-styles.css
31
32 # Prefix commands with this when they need access to the database.
33@@ -41,15 +44,20 @@
34 build: \
35 bin/buildout \
36 bin/database \
37- bin/maas-region-admin bin/test.maas \
38- bin/maas bin/test.maascli \
39- bin/test.maastesting \
40- bin/twistd.pserv bin/test.pserv \
41+ bin/maas \
42+ bin/maas-probe-dhcp \
43+ bin/maas-provision \
44+ bin/maas-region-admin \
45+ bin/twistd.cluster \
46+ bin/twistd.region \
47+ bin/test.cli \
48+ bin/test.cluster \
49 bin/test.config \
50- bin/maas-probe-dhcp \
51+ bin/test.region \
52+ bin/test.testing \
53 bin/py bin/ipy \
54 $(js_enums) \
55- styles
56+ $(scss_output)
57
58 all: build doc
59
60@@ -75,45 +83,41 @@
61 $(buildout) install database
62 @touch --no-create $@
63
64-bin/maas-region-admin: \
65- bin/buildout buildout.cfg versions.cfg setup.py $(js_enums) styles
66- $(buildout) install maas
67+bin/maas-region-admin bin/twistd.region: \
68+ bin/buildout buildout.cfg versions.cfg setup.py $(js_enums) $(scss_output)
69+ $(buildout) install region
70 @touch --no-create $@
71
72-bin/test.maas: \
73- bin/buildout buildout.cfg versions.cfg setup.py $(js_enums) styles
74- $(buildout) install maas-test
75+bin/test.region: \
76+ bin/buildout buildout.cfg versions.cfg setup.py $(js_enums) $(scss_output)
77+ $(buildout) install region-test
78 @touch --no-create $@
79
80 bin/maas: bin/buildout buildout.cfg versions.cfg setup.py
81- $(buildout) install maascli
82- @touch --no-create $@
83-
84-bin/test.maascli: bin/buildout buildout.cfg versions.cfg setup.py
85- $(buildout) install maascli-test
86- @touch --no-create $@
87-
88-bin/test.maastesting: bin/buildout buildout.cfg versions.cfg setup.py
89- $(buildout) install maastesting-test
90- @touch --no-create $@
91-
92-bin/maas-provision bin/twistd.pserv: \
93+ $(buildout) install cli
94+ @touch --no-create $@
95+
96+bin/test.cli: bin/buildout buildout.cfg versions.cfg setup.py
97+ $(buildout) install cli-test
98+ @touch --no-create $@
99+
100+bin/test.testing: bin/buildout buildout.cfg versions.cfg setup.py
101+ $(buildout) install testing-test
102+ @touch --no-create $@
103+
104+bin/maas-probe-dhcp bin/maas-provision bin/twistd.cluster: \
105 bin/buildout buildout.cfg versions.cfg setup.py
106- $(buildout) install pserv
107+ $(buildout) install cluster
108 @touch --no-create $@
109
110-bin/test.pserv: bin/buildout buildout.cfg versions.cfg setup.py
111- $(buildout) install pserv-test
112+bin/test.cluster: bin/buildout buildout.cfg versions.cfg setup.py
113+ $(buildout) install cluster-test
114 @touch --no-create $@
115
116 bin/test.config: bin/buildout buildout.cfg versions.cfg setup.py
117 $(buildout) install config-test
118 @touch --no-create $@
119
120-bin/maas-probe-dhcp: bin/buildout buildout.cfg versions.cfg setup.py
121- $(buildout) install maas-probe-dhcp
122- @touch --no-create $@
123-
124 bin/flake8: bin/buildout buildout.cfg versions.cfg setup.py
125 $(buildout) install flake8
126 @touch --no-create $@
127@@ -189,10 +193,10 @@
128 $(js_enums): bin/py src/maasserver/utils/jsenums.py $(py_enums)
129 bin/py -m src/maasserver/utils/jsenums $(py_enums) > $@
130
131-styles: $(scss_inputs)
132- pyscss src/maasserver/static/scss/maas-styles.scss \
133- -o $(scss_output) \
134- --load-path=src/maasserver/static/scss
135+styles: $(scss_output)
136+
137+$(scss_output): $(scss_inputs)
138+ pyscss $< -o $@ --load-path=src/maasserver/static/scss
139
140 clean:
141 $(MAKE) -C acceptance $@
142@@ -349,7 +353,7 @@
143
144 services/database/@deps: bin/database
145
146-services/pserv/@deps: bin/twistd.pserv
147+services/pserv/@deps: bin/twistd.cluster
148
149 services/reloader/@deps:
150
151
152=== modified file 'buildout.cfg'
153--- buildout.cfg 2014-10-01 15:22:21 +0000
154+++ buildout.cfg 2015-01-09 13:11:18 +0000
155@@ -1,17 +1,16 @@
156 [buildout]
157 parts =
158- flake8
159- maas
160- maas-test
161- maascli
162- maascli-test
163- maas-probe-dhcp
164- maastesting-test
165- pserv
166- pserv-test
167+ cli
168+ cli-test
169+ cluster
170+ cluster-test
171 config-test
172+ flake8
173+ region
174+ region-test
175 repl
176 sphinx
177+ testing-test
178 extensions = buildout-versions
179 buildout_versions_file = versions.cfg
180 versions = versions
181@@ -59,7 +58,7 @@
182 entry-points = database=postgresfixture.main:main
183 scripts = database
184
185-[maas]
186+[region]
187 recipe = zc.recipe.egg
188 dev-eggs =
189 django-debug-toolbar
190@@ -67,30 +66,32 @@
191 ${common:test-eggs}
192 django-nose
193 eggs =
194- ${maas:dev-eggs}
195- ${maas:test-eggs}
196+ ${region:dev-eggs}
197+ ${region:test-eggs}
198 djorm-ext-pgarray
199 docutils
200 crochet
201 iscpy
202 entry-points =
203 maas-region-admin=django.core.management:execute_from_command_line
204+ twistd.region=twisted.scripts.twistd:run
205 initialization =
206 ${common:initialization}
207 environ.setdefault("DJANGO_SETTINGS_MODULE", "maas.development")
208 scripts =
209 maas-region-admin
210+ twistd.region
211 extra-paths =
212 ${common:extra-paths}
213
214-[maas-test]
215+[region-test]
216 recipe = zc.recipe.egg
217 eggs =
218- ${maas:eggs}
219+ ${region:eggs}
220 entry-points =
221- test.maas=django.core.management:execute_from_command_line
222+ test.region=django.core.management:execute_from_command_line
223 initialization =
224- ${maas:initialization}
225+ ${region:initialization}
226 sys.argv[1:1] = [
227 "test", "--noinput", "--exclude=provisioningserver",
228 "--exclude=maastesting", "--exclude=maascli",
229@@ -100,24 +101,11 @@
230 # requests at DEBUG level: we don't want this in the
231 # tests as it's too verbose.
232 ]
233-scripts = test.maas
234-extra-paths =
235- ${maas:extra-paths}
236-
237-[maas-probe-dhcp]
238-recipe = zc.recipe.egg
239-eggs =
240- ${maas:eggs}
241-entry-points =
242- maas-probe-dhcp=provisioningserver.dhcp.probe:main
243-scripts =
244- maas-probe-dhcp
245-extra-paths =
246- ${maas:extra-paths}
247-initialization =
248- ${common:initialization}
249-
250-[maascli]
251+scripts = test.region
252+extra-paths =
253+ ${region:extra-paths}
254+
255+[cli]
256 recipe = zc.recipe.egg
257 eggs =
258 entry-points =
259@@ -127,62 +115,64 @@
260 scripts =
261 maas
262
263-[maascli-test]
264+[cli-test]
265 recipe = zc.recipe.egg
266 eggs =
267- ${maascli:eggs}
268+ ${region:eggs}
269 ${common:test-eggs}
270 entry-points =
271- test.maascli=nose.core:TestProgram
272+ test.cli=nose.core:TestProgram
273 initialization =
274 sys.argv[1:1] = ["--where=src/maascli"]
275-extra-paths = ${maascli:extra-paths}
276+extra-paths = ${cli:extra-paths}
277 scripts =
278- test.maascli
279+ test.cli
280
281-[maastesting-test]
282+[testing-test]
283 recipe = zc.recipe.egg
284 eggs =
285 ${common:test-eggs}
286 entry-points =
287- test.maastesting=nose.core:TestProgram
288+ test.testing=nose.core:TestProgram
289 initialization =
290 sys.argv[1:1] = ["--where=src/maastesting"]
291 extra-paths = ${common:extra-paths}
292 scripts =
293- test.maastesting
294-scripts = test.maastesting
295+ test.testing
296+scripts = test.testing
297 extra-paths =
298- ${maas:extra-paths}
299+ ${region:extra-paths}
300
301-[pserv]
302+[cluster]
303 recipe = zc.recipe.egg
304 eggs =
305 crochet
306 entry-points =
307+ maas-probe-dhcp=provisioningserver.dhcp.probe:main
308 maas-provision=provisioningserver.__main__:main
309- twistd.pserv=twisted.scripts.twistd:run
310+ twistd.cluster=twisted.scripts.twistd:run
311 extra-paths =
312 ${common:extra-paths}
313 scripts =
314+ maas-probe-dhcp
315 maas-provision
316- twistd.pserv
317+ twistd.cluster
318 initialization =
319 ${common:initialization}
320
321-[pserv-test]
322+[cluster-test]
323 recipe = zc.recipe.egg
324 eggs =
325- ${pserv:eggs}
326+ ${cluster:eggs}
327 ${common:test-eggs}
328 entry-points =
329- test.pserv=nose.core:TestProgram
330+ test.cluster=nose.core:TestProgram
331 initialization =
332- ${pserv:initialization}
333+ ${cluster:initialization}
334 sys.argv[1:1] = ["--where=src/provisioningserver"]
335-extra-paths = ${pserv:extra-paths}
336+extra-paths = ${cluster:extra-paths}
337 scripts =
338- test.pserv
339+ test.cluster
340
341 [config-test]
342 recipe = zc.recipe.egg
343@@ -191,7 +181,7 @@
344 entry-points =
345 test.config=nose.core:TestProgram
346 initialization =
347- ${pserv:initialization}
348+ ${cluster:initialization}
349 sys.argv[1:1] = ["--where=etc/maas/templates/commissioning-user-data"]
350 extra-paths = ${common:extra-paths}
351 scripts =
352@@ -210,15 +200,15 @@
353 build = ${buildout:directory}/docs/_build
354 extra-paths = ${common:extra-paths}
355 eggs =
356- ${maas:eggs}
357- ${pserv:eggs}
358+ ${region:eggs}
359+ ${cluster:eggs}
360
361 # Convenient REPLs with all eggs available.
362 [repl]
363 recipe = z3c.recipe.scripts
364 eggs =
365- ${maas:eggs}
366- ${pserv:eggs}
367+ ${region:eggs}
368+ ${cluster:eggs}
369 ${common:test-eggs}
370 extra-paths = ${common:extra-paths}
371 interpreter = py
372
373=== modified file 'services/pserv/run'
374--- services/pserv/run 2014-02-12 22:11:46 +0000
375+++ services/pserv/run 2015-01-09 13:11:18 +0000
376@@ -15,7 +15,7 @@
377 [ -z "${logdir:-}" ] || exec &>> "${logdir}/current"
378
379 # Exec the Provisioning Server.
380-script="$(readlink -f bin/twistd.pserv)"
381+script="$(readlink -f bin/twistd.cluster)"
382 config="$(readlink -f etc/maas/pserv.yaml)"
383
384 # Obtain the development setting for CLUSTER_UUID.
385
386=== modified file 'src/apiclient/testing/django.py'
387--- src/apiclient/testing/django.py 2013-12-28 00:05:31 +0000
388+++ src/apiclient/testing/django.py 2015-01-09 13:11:18 +0000
389@@ -61,7 +61,7 @@
390 # type handlers with utils.translate_mime. So we must import it, even
391 # though we don't use it. However, piston loads Django's QuerySet code
392 # which fails if you don't have a settings.py available. Which we don't
393- # during 'test.pserv'. So we import this late.
394+ # during 'test.cluster'. So we import this late.
395 from piston import emitters
396 emitters # Imported for side-effects.
397 from piston.utils import translate_mime
398
399=== renamed file 'twisted/plugins/maasps.py' => 'twisted/plugins/maasclusterd.py'