Merge lp:~allenap/maas/remove-maas 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: 5587
Proposed branch: lp:~allenap/maas/remove-maas
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 397 lines (+81/-61)
17 files modified
HACKING.txt (+9/-5)
Makefile (+2/-1)
buildout.cfg (+2/-3)
docs/conf.py (+2/-1)
docs/troubleshooting.rst (+1/-1)
media/README (+4/-4)
services/reloader/run (+1/-1)
src/maascli/cli.py (+2/-2)
src/maasserver/__init__.py (+1/-1)
src/maasserver/djangosettings/demo.py (+1/-1)
src/maasserver/djangosettings/development.py (+1/-1)
src/maasserver/djangosettings/settings.py (+3/-3)
src/maasserver/djangosettings/tests/test_settings.py (+2/-2)
src/maasserver/management/commands/dbupgrade.py (+46/-3)
src/maasserver/management/commands/tests/test_dbupgrade.py (+4/-1)
utilities/check-imports (+0/-27)
utilities/remote-reinstall (+0/-4)
To merge this branch: bzr merge lp:~allenap/maas/remove-maas
Reviewer Review Type Date Requested Status
Blake Rouse (community) Approve
Andres Rodriguez (community) Needs Information
Review via email: mp+310634@code.launchpad.net

Commit message

Remove src/maas.

Description of the change

This fails in one test: http://paste.ubuntu.com/23460489/

I haven't been able to figure it out yet, but I wanted to put this up in case someone else <cough>Blake<cough> would have an idea.

To post a comment you must log in.
Revision history for this message
Blake Rouse (blake-rouse) wrote :

I will have to dig into this to see why its failing. It has to be something in the tarball that is used for upgrading pre 2.0.

Revision history for this message
Andres Rodriguez (andreserl) wrote :

Why are we removing src/maas ?

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

> Why are we removing src/maas ?

It's not needed as a standalone thing, and hasn't been for a long time now. It also gets in the way of using "maas" as a namespace package, a change Blake has kicked off with the client API.

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

> I will have to dig into this to see why its failing. It has to be something in
> the tarball that is used for upgrading pre 2.0.

Thanks. I did make one change to the tarball: I added maas19settings.py. You'll get this when pulling this branch, but it won't show up in the diff, so I've pasted it too: http://paste.ubuntu.com/23480843/

Revision history for this message
Andres Rodriguez (andreserl) wrote :

This would need a lot of changes on the installation. src/maas gets up installed in /usr/share/maas and would break all installations....

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

> This would need a lot of changes on the installation. src/maas gets up
> installed in /usr/share/maas and would break all installations....

A packaging change is needed, yes, but /usr/share/maas/maas can be removed. There's nothing in there that needs to be preserved so there isn't any migration needed; configuration has been in /etc/maas for a long time now. The only difficult bit is making it work with migrations from pre-2.0.

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

Okay, this is working now: I had missed out SOUTH_MIGRATION_MODULES from the maas19settings.py file that's in the South migrations tarball. I'll prep a packaging change.

Revision history for this message
Gavin Panella (allenap) wrote :
Revision history for this message
Blake Rouse (blake-rouse) wrote :

This is good work. Glad to see that folder in the code removed.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'HACKING.txt'
--- HACKING.txt 2016-03-28 13:54:47 +0000
+++ HACKING.txt 2016-12-02 09:29:56 +0000
@@ -138,8 +138,9 @@
138regiond.log. To enable logging of all exceptions even exceptions where MAAS138regiond.log. To enable logging of all exceptions even exceptions where MAAS
139will return the correct HTTP status code.::139will return the correct HTTP status code.::
140140
141 $ sudo sed -i 's/DEBUG = False/DEBUG = True/g' /usr/share/maas/maas/settings.py141 $ sudo sed -i 's/DEBUG = False/DEBUG = True/g' \
142 $ sudo service maas-regiond restart142 > /usr/lib/python3/dist-packages/maasserver/djangosettings/settings.py
143 $ sudo service maas-regiond restart
143144
144Run regiond in foreground145Run regiond in foreground
145^^^^^^^^^^^^^^^^^^^^^^^^^146^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -149,8 +150,10 @@
149placed a breakpoint into the code you want to inspect you can start the regiond150placed a breakpoint into the code you want to inspect you can start the regiond
150process in the foreground.::151process in the foreground.::
151152
152 $ sudo service maas-regiond stop153 $ sudo service maas-regiond stop
153 $ sudo -u maas -H DJANGO_SETTINGS_MODULE=maas.settings PYTHONPATH=/usr/share/maas twistd3 --nodaemon --pidfile= maas-regiond154 $ sudo -u maas -H \
155 > DJANGO_SETTINGS_MODULE=maasserver.djangosettings.settings \
156 > twistd3 --nodaemon --pidfile= maas-regiond
154157
155158
156.. Note::159.. Note::
@@ -175,7 +178,8 @@
175Development MAAS server setup178Development MAAS server setup
176=============================179=============================
177180
178Access to the database is configured in ``src/maas/development.py``.181Access to the database is configured in
182``src/maasserver/djangosettings/development.py``.
179183
180The ``Makefile`` or the test suite sets up a development database184The ``Makefile`` or the test suite sets up a development database
181cluster inside your branch. It lives in the ``db`` directory, which185cluster inside your branch. It lives in the ``db`` directory, which
182186
=== modified file 'Makefile'
--- Makefile 2016-10-17 06:38:56 +0000
+++ Makefile 2016-12-02 09:29:56 +0000
@@ -427,7 +427,8 @@
427 $(warning 'distclean' is deprecated; use 'clean')427 $(warning 'distclean' is deprecated; use 'clean')
428428
429harness: bin/maas-region bin/database429harness: bin/maas-region bin/database
430 $(dbrun) bin/maas-region shell --settings=maas.demo430 $(dbrun) bin/maas-region shell \
431 --settings=maasserver.djangosettings.demo
431432
432dbharness: bin/database433dbharness: bin/database
433 bin/database --preserve shell434 bin/database --preserve shell
434435
=== modified file 'buildout.cfg'
--- buildout.cfg 2016-10-12 15:26:17 +0000
+++ buildout.cfg 2016-12-02 09:29:56 +0000
@@ -104,7 +104,7 @@
104 twistd.region=twisted.scripts.twistd:run104 twistd.region=twisted.scripts.twistd:run
105initialization =105initialization =
106 ${common:initialization}106 ${common:initialization}
107 environ.setdefault("DJANGO_SETTINGS_MODULE", "maas.development")107 environ.setdefault("DJANGO_SETTINGS_MODULE", "maasserver.djangosettings.development")
108scripts =108scripts =
109 maas-region109 maas-region
110 twistd.region110 twistd.region
@@ -129,7 +129,6 @@
129 # "--with-resources",129 # "--with-resources",
130 "--with-scenarios",130 "--with-scenarios",
131 "--with-select",131 "--with-select",
132 "--select-dir=src/maas",
133 "--select-dir=src/maasserver",132 "--select-dir=src/maasserver",
134 "--select-dir=src/metadataserver",133 "--select-dir=src/metadataserver",
135 "--cover-package=maas,maasserver,metadataserver",134 "--cover-package=maas,maasserver,metadataserver",
@@ -294,7 +293,7 @@
294 from os import environ293 from os import environ
295 environ.setdefault("MAAS_RACK_DEVELOP", "TRUE")294 environ.setdefault("MAAS_RACK_DEVELOP", "TRUE")
296 environ.setdefault("MAAS_ROOT", "${buildout:directory}/run-e2e")295 environ.setdefault("MAAS_ROOT", "${buildout:directory}/run-e2e")
297 environ.setdefault("DJANGO_SETTINGS_MODULE", "maas.development")296 environ.setdefault("DJANGO_SETTINGS_MODULE", "maasserver.djangosettings.development")
298 environ.setdefault("DEV_DB_NAME", "test_maas_e2e")297 environ.setdefault("DEV_DB_NAME", "test_maas_e2e")
299 environ.setdefault("MAAS_PREVENT_MIGRATIONS", "1")298 environ.setdefault("MAAS_PREVENT_MIGRATIONS", "1")
300299
301300
=== modified file 'docs/conf.py'
--- docs/conf.py 2016-03-28 13:54:47 +0000
+++ docs/conf.py 2016-12-02 09:29:56 +0000
@@ -24,7 +24,8 @@
24from pytz import UTC24from pytz import UTC
2525
26# Configure MAAS's settings.26# Configure MAAS's settings.
27environ.setdefault("DJANGO_SETTINGS_MODULE", "maas.settings")27environ.setdefault(
28 "DJANGO_SETTINGS_MODULE", "maasserver.djangosettings.settings")
2829
29# If extensions (or modules to document with autodoc) are in another directory,30# If extensions (or modules to document with autodoc) are in another directory,
30# add these directories to sys.path here. If the directory is relative to the31# add these directories to sys.path here. If the directory is relative to the
3132
=== modified file 'docs/troubleshooting.rst'
--- docs/troubleshooting.rst 2014-09-10 16:20:31 +0000
+++ docs/troubleshooting.rst 2016-12-02 09:29:56 +0000
@@ -111,7 +111,7 @@
111 always point at the local server.111 always point at the local server.
112 #. If you are still getting "404 - Page not found" errors, check that the MAAS112 #. If you are still getting "404 - Page not found" errors, check that the MAAS
113 web interface has been installed in the right place. There should be a file113 web interface has been installed in the right place. There should be a file
114 present called /usr/share/maas/maas/urls.py114 called ``urls.py`` in ``/usr/lib/python3/dist-packages/maasserver/djangosettings/``.
115115
116Debugging ephemeral image116Debugging ephemeral image
117=========================117=========================
118118
=== modified file 'media/README'
--- media/README 2012-03-11 21:13:22 +0000
+++ media/README 2016-12-02 09:29:56 +0000
@@ -1,5 +1,5 @@
1This folder contains somewhat ephemeral things: subfolders serve as1This folder contains somewhat ephemeral things: subfolders serve as
2MEDIA_ROOT for maas.demo and maas.development environments. The2MEDIA_ROOT for maasserver.djangosettings.demo and .development
3media/demo directory should always exist and not be deleted, though3environments. The media/demo directory should always exist and not be
4its contents can be. The media/development directory should be created4deleted, though its contents can be. The media/development directory
5and destroyed by tests, as needed.5should be created and destroyed by tests, as needed.
66
=== modified file 'services/reloader/run'
--- services/reloader/run 2016-05-11 19:01:48 +0000
+++ services/reloader/run 2016-12-02 09:29:56 +0000
@@ -128,7 +128,7 @@
128 exclude_filter=lambda path: (128 exclude_filter=lambda path: (
129 "/test/" in path or "/testing/" in path or "/." in path))129 "/test/" in path or "/testing/" in path or "/." in path))
130 wm.add_watch(130 wm.add_watch(
131 ["src/maas*", "src/meta*"], TRIGGER_EVENTS,131 ["src/maasserver", "src/metadataserver"], TRIGGER_EVENTS,
132 proc_fun=handle_maas_change, rec=True, auto_add=True, do_glob=True)132 proc_fun=handle_maas_change, rec=True, auto_add=True, do_glob=True)
133 wm.add_watch(133 wm.add_watch(
134 ["src/prov*"], TRIGGER_EVENTS, proc_fun=handle_pserv_change,134 ["src/prov*"], TRIGGER_EVENTS, proc_fun=handle_pserv_change,
135135
=== modified file 'src/maascli/cli.py'
--- src/maascli/cli.py 2016-07-30 01:17:54 +0000
+++ src/maascli/cli.py 2016-12-02 09:29:56 +0000
@@ -189,8 +189,8 @@
189 # Setup and the allowed django commands into the maascli.189 # Setup and the allowed django commands into the maascli.
190 management = get_django_management()190 management = get_django_management()
191 if management is not None and is_maasserver_available():191 if management is not None and is_maasserver_available():
192 os.environ.setdefault("DJANGO_SETTINGS_MODULE", "maas.settings")192 os.environ.setdefault(
193 sys.path.append('/usr/share/maas')193 "DJANGO_SETTINGS_MODULE", "maasserver.djangosettings.settings")
194 load_regiond_commands(management, parser)194 load_regiond_commands(management, parser)
195195
196196
197197
=== modified file 'src/maasserver/__init__.py'
--- src/maasserver/__init__.py 2016-10-20 14:45:06 +0000
+++ src/maasserver/__init__.py 2016-12-02 09:29:56 +0000
@@ -8,7 +8,7 @@
8 'DefaultViewMeta',8 'DefaultViewMeta',
9 'is_master_process',9 'is_master_process',
10 'logger',10 'logger',
11 ]11]
1212
13import logging13import logging
14from os import environ14from os import environ
1515
=== renamed directory 'src/maas' => 'src/maasserver/djangosettings'
=== modified file 'src/maasserver/djangosettings/demo.py'
--- src/maas/demo.py 2016-06-07 19:59:49 +0000
+++ src/maasserver/djangosettings/demo.py 2016-12-02 09:29:56 +0000
@@ -5,7 +5,7 @@
55
6from os.path import abspath6from os.path import abspath
77
8from maas import (8from maasserver.djangosettings import (
9 development,9 development,
10 import_settings,10 import_settings,
11 settings,11 settings,
1212
=== modified file 'src/maasserver/djangosettings/development.py'
--- src/maas/development.py 2016-10-18 11:21:26 +0000
+++ src/maasserver/djangosettings/development.py 2016-12-02 09:29:56 +0000
@@ -7,7 +7,7 @@
7from os.path import abspath7from os.path import abspath
88
9from formencode.validators import StringBool9from formencode.validators import StringBool
10from maas import (10from maasserver.djangosettings import (
11 fix_up_databases,11 fix_up_databases,
12 import_settings,12 import_settings,
13 settings,13 settings,
1414
=== modified file 'src/maasserver/djangosettings/settings.py'
--- src/maas/settings.py 2016-11-17 11:46:08 +0000
+++ src/maasserver/djangosettings/settings.py 2016-12-02 09:29:56 +0000
@@ -6,9 +6,9 @@
6import os6import os
77
8import django.template.base8import django.template.base
9from maas import fix_up_databases
10from maas.monkey import patch_get_script_prefix
11from maasserver.config import RegionConfiguration9from maasserver.config import RegionConfiguration
10from maasserver.djangosettings import fix_up_databases
11from maasserver.djangosettings.monkey import patch_get_script_prefix
1212
1313
14def _read_timezone(tzfilename='/etc/timezone'):14def _read_timezone(tzfilename='/etc/timezone'):
@@ -265,7 +265,7 @@
265265
266)266)
267267
268ROOT_URLCONF = 'maas.urls'268ROOT_URLCONF = 'maasserver.djangosettings.urls'
269269
270TEMPLATE_DIRS = (270TEMPLATE_DIRS = (
271 # Put strings here, like "/home/html/django_templates"271 # Put strings here, like "/home/html/django_templates"
272272
=== renamed file 'src/maas/tests/test_maas.py' => 'src/maasserver/djangosettings/tests/test_settings.py'
--- src/maas/tests/test_maas.py 2016-06-21 10:29:11 +0000
+++ src/maasserver/djangosettings/tests/test_settings.py 2016-12-02 09:29:56 +0000
@@ -10,11 +10,11 @@
1010
11from django.conf import settings11from django.conf import settings
12from django.db import connections12from django.db import connections
13from maas import (13from maasserver.djangosettings import (
14 find_settings,14 find_settings,
15 import_settings,15 import_settings,
16)16)
17from maas.settings import (17from maasserver.djangosettings.settings import (
18 _get_local_timezone,18 _get_local_timezone,
19 _read_timezone,19 _read_timezone,
20)20)
2121
=== modified file 'src/maasserver/management/commands/dbupgrade.py'
--- src/maasserver/management/commands/dbupgrade.py 2016-09-04 19:57:50 +0000
+++ src/maasserver/management/commands/dbupgrade.py 2016-12-02 09:29:56 +0000
@@ -9,6 +9,7 @@
9__all__ = []9__all__ = []
1010
11from importlib import import_module11from importlib import import_module
12import json
12import optparse13import optparse
13import os14import os
14import shutil15import shutil
@@ -34,7 +35,7 @@
34# Script that performs the south migrations for MAAS under django 1.6 and35# Script that performs the south migrations for MAAS under django 1.6 and
35# python2.7.36# python2.7.
36MAAS_UPGRADE_SCRIPT = """\37MAAS_UPGRADE_SCRIPT = """\
37# Copyright 2015 Canonical Ltd. This software is licensed under the38# Copyright 2015-2016 Canonical Ltd. This software is licensed under the
38# GNU Affero General Public License version 3 (see the file LICENSE).39# GNU Affero General Public License version 3 (see the file LICENSE).
3940
40from __future__ import (41from __future__ import (
@@ -46,12 +47,49 @@
46str = None47str = None
4748
48__metaclass__ = type49__metaclass__ = type
49__all__ = [50__all__ = []
50 ]
5151
52import os52import os
53import sys53import sys
5454
55import django.conf
56
57
58class LazySettings(django.conf.LazySettings):
59 '''Prevent Django from mangling warnings settings.
60
61 At present, Django adds a single filter that surfaces all deprecation
62 warnings, but MAAS handles them differently. Django doesn't appear to give
63 a way to prevent it from doing its thing, so we must undo its changes.
64
65 Deprecation warnings in production environments are not desirable as they
66 are a developer tool, and not something an end user can reasonably do
67 something about. This brings control of warnings back into MAAS's control.
68 '''
69
70 def _configure_logging(self):
71 # This is a copy of *half* of Django's `_configure_logging`, omitting
72 # the problematic bits.
73 if self.LOGGING_CONFIG:
74 from django.utils.log import DEFAULT_LOGGING
75 from django.utils.module_loading import import_by_path
76 # First find the logging configuration function ...
77 logging_config_func = import_by_path(self.LOGGING_CONFIG)
78 logging_config_func(DEFAULT_LOGGING)
79 # ... then invoke it with the logging settings
80 if self.LOGGING:
81 logging_config_func(self.LOGGING)
82
83
84# Install our `LazySettings` as the Django-global settings class. First,
85# ensure that Django hasn't yet loaded its settings.
86assert not django.conf.settings.configured
87# This is needed because Django's `LazySettings` overrides `__setattr__`.
88object.__setattr__(django.conf.settings, "__class__", LazySettings)
89
90# Force Django configuration.
91os.environ["DJANGO_SETTINGS_MODULE"] = "maas19settings"
92
55# Inject the sys.path from the parent process so that the python path is93# Inject the sys.path from the parent process so that the python path is
56# is similar, except that the directory that this script is running from is94# is similar, except that the directory that this script is running from is
57# already the first path in sys.path.95# already the first path in sys.path.
@@ -132,6 +170,11 @@
132 tempdir = tempfile.mkdtemp(prefix='maas-upgrade-')170 tempdir = tempfile.mkdtemp(prefix='maas-upgrade-')
133 subprocess.check_call([171 subprocess.check_call([
134 "tar", "zxf", path_to_tarball, "-C", tempdir])172 "tar", "zxf", path_to_tarball, "-C", tempdir])
173
174 settings_json = os.path.join(tempdir, "maas19settings.json")
175 with open(settings_json, "w", encoding="utf-8") as fd:
176 fd.write(json.dumps({"DATABASES": settings.DATABASES}))
177
135 script_path = os.path.join(tempdir, "migrate.py")178 script_path = os.path.join(tempdir, "migrate.py")
136 with open(script_path, "wb") as fp:179 with open(script_path, "wb") as fp:
137 fp.write(MAAS_UPGRADE_SCRIPT.encode("utf-8"))180 fp.write(MAAS_UPGRADE_SCRIPT.encode("utf-8"))
138181
=== modified file 'src/maasserver/management/commands/tests/test_dbupgrade.py'
--- src/maasserver/management/commands/tests/test_dbupgrade.py 2016-03-28 13:54:47 +0000
+++ src/maasserver/management/commands/tests/test_dbupgrade.py 2016-12-02 09:29:56 +0000
@@ -64,7 +64,10 @@
64 env = os.environ.copy()64 env = os.environ.copy()
65 env["MAAS_PREVENT_MIGRATIONS"] = "0"65 env["MAAS_PREVENT_MIGRATIONS"] = "0"
66 mra = os.path.join(root, "bin", "maas-region")66 mra = os.path.join(root, "bin", "maas-region")
67 cmd = [mra, "dbupgrade", "--settings", "maas.settings"]67 cmd = [
68 mra, "dbupgrade", "--settings",
69 "maasserver.djangosettings.settings",
70 ]
68 if always_south:71 if always_south:
69 cmd.append("--always-south")72 cmd.append("--always-south")
70 self.execute(cmd, env=env)73 self.execute(cmd, env=env)
7174
=== modified file 'src/maasserver/migrations/south/django16_south_maas19.tar.gz'
72Binary files src/maasserver/migrations/south/django16_south_maas19.tar.gz 2016-11-17 11:46:08 +0000 and src/maasserver/migrations/south/django16_south_maas19.tar.gz 2016-12-02 09:29:56 +0000 differ75Binary files src/maasserver/migrations/south/django16_south_maas19.tar.gz 2016-11-17 11:46:08 +0000 and src/maasserver/migrations/south/django16_south_maas19.tar.gz 2016-12-02 09:29:56 +0000 differ
=== modified file 'utilities/check-imports'
--- utilities/check-imports 2016-10-19 17:14:02 +0000
+++ utilities/check-imports 2016-12-02 09:29:56 +0000
@@ -263,19 +263,6 @@
263)263)
264264
265265
266RegionControllerConfig = files("src/maas/**/*.py")
267RegionControllerConfigRule = Rule(
268 Allow("django|django.**"),
269 Allow("formencode.validators.*"),
270 Allow("maasserver.config.*"),
271 Allow("maasserver.testing.testcase.*"),
272 Allow("maas|maas.**"),
273 Allow("provisioningserver|provisioningserver.**"),
274 Allow("psycopg2|psycopg2.**"),
275 Allow(StandardLibraries),
276)
277
278
279Tests = files(266Tests = files(
280 "src/**/test_*.py",267 "src/**/test_*.py",
281 "src/**/testing/**/*.py",268 "src/**/testing/**/*.py",
@@ -424,20 +411,6 @@
424 Allow(TestingLibraries),411 Allow(TestingLibraries),
425 ),412 ),
426 ),413 ),
427
428 #
429 # REGION CONTROLLER CONFIGURATION
430 #
431 (
432 RegionControllerConfig - Tests,
433 RegionControllerConfigRule,
434 ),
435 (
436 RegionControllerConfig & Tests,
437 RegionControllerConfigRule | Rule(
438 Allow(TestingLibraries),
439 ),
440 ),
441 #414 #
442 # TESTING HELPERS415 # TESTING HELPERS
443 #416 #
444417
=== modified file 'utilities/remote-reinstall'
--- utilities/remote-reinstall 2016-10-27 00:01:01 +0000
+++ utilities/remote-reinstall 2016-12-02 09:29:56 +0000
@@ -159,10 +159,6 @@
159 root@${hostname}:/etc/maas159 root@${hostname}:/etc/maas
160ssh_run "chown -R maas:maas /etc/maas"160ssh_run "chown -R maas:maas /etc/maas"
161161
162echo " - src/maas --> /usr/share/maas/maas"
163try rsync -${rsync_options} src/maas/ \
164 root@${hostname}:/usr/share/maas/maas
165
166echo ""162echo ""
167echo "Synchronizing static web content..."163echo "Synchronizing static web content..."
168echo " - Removing /usr/share/maas/web/static/*..."164echo " - Removing /usr/share/maas/web/static/*..."