← Back to team overview

maas-devel team mailing list archive

[Merge] lp:~jtv/maas/single-cluster into lp:maas

 

Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/single-cluster into lp:maas.

Requested reviews:
  MaaS Developers (maas-devel)

For more details, see:
https://code.launchpad.net/~jtv/maas/single-cluster/+merge/88739

Allocate just a single local database cluster per branch, and make sure the "make" targets that need it will start it up.  Also, rename maasdb.sh to maasdb and add a simple command set so it's easier to use.

Finally, update settings.py with the applicable changes we've made in development.py.
-- 
https://code.launchpad.net/~jtv/maas/single-cluster/+merge/88739
Your team MaaS Developers is requested to review the proposed merge of lp:~jtv/maas/single-cluster into lp:maas.
=== modified file '.bzrignore'
--- .bzrignore	2012-01-16 16:30:23 +0000
+++ .bzrignore	2012-01-16 17:17:23 +0000
@@ -2,6 +2,7 @@
 bin/django
 bin/test
 build
+db
 develop-eggs
 download-cache
 eggs

=== modified file 'Makefile'
--- Makefile	2012-01-16 15:53:24 +0000
+++ Makefile	2012-01-16 17:17:23 +0000
@@ -2,6 +2,7 @@
 PYTHON = python
 
 build: bin/buildout
+	bin/maasdb start ./db/ disposable
 
 bin/buildout: buildout.cfg setup.py
 	$(PYTHON) bootstrap.py
@@ -20,10 +21,11 @@
 
 clean:
 	find . -type f -name '*.py[co]' -exec rm -f {} \;
-	#rm -f bin/buildout
+	rm -f bin/buildout
 	#bzr clean-tree --unknown --force
 
-realclean: clean
+distclean: clean
+	bin/maasdb delete-cluster ./db/
 	rm -rf download-cache
 	rm -rf eggs
 	rm -rf develop-eggs
@@ -31,12 +33,13 @@
 tags:
 	bin/tags
 
-run:
+run: build
 	bin/django runserver 8000
 
 harness:
-	. bin/maasdb.sh ; maasdb_init_db db/development disposable
+	bin/maasdb start ./db/ disposable
 	bin/django shell
 
 syncdb:
+	bin/maasdb start ./db/ disposable
 	bin/django syncdb

=== renamed file 'bin/maasdb.sh' => 'bin/maasdb' (properties changed: -x to +x)
--- bin/maasdb.sh	2012-01-16 14:49:10 +0000
+++ bin/maasdb	2012-01-16 17:17:23 +0000
@@ -8,8 +8,7 @@
 #
 #  * Everything is PostgreSQL on Ubuntu.
 #  * POSIX shell.  Test your changes in dash, not just in bash.
-#  * Each branch gets its own cluster(s).  Kill & delete when done.
-#  * One database per cluster.  May change this later if it's a problem.
+#  * Each branch gets its own cluster.  Kill & delete when done.
 #  * Databases run under the system user that creates them.  No root required.
 #  * No global configuration apart from a basic PostgreSQL install.
 #  * Connections use Unix sockets.  No TCP port hogging.
@@ -131,3 +130,22 @@
         rm -rf -- "$DATADIR"
     fi
 }
+
+
+main() {
+    COMMAND="$1"
+    shift
+    case $COMMAND in
+        start) maasdb_init_db $* ;;
+        stop) maasdb_stop_cluster $* ;;
+        query) maasdb_query $* ;;
+        shell) maasdb_shell $* ;;
+        delete-cluster) maasdb_delete_cluster $* ;;
+    esac
+}
+
+
+if test -n "$*"
+then
+    main $*
+fi

=== modified file 'src/maas/development.py'
--- src/maas/development.py	2012-01-16 16:24:00 +0000
+++ src/maas/development.py	2012-01-16 17:17:23 +0000
@@ -24,7 +24,7 @@
         'NAME': 'maas',
         # For PostgreSQL, a "hostname" starting with a slash indicates a
         # Unix socket directory.
-        'HOST': '%s/db/development' % os.getcwd(),
+        'HOST': '%s/db' % os.getcwd(),
     }
 }
 

=== modified file 'src/maas/settings.py'
--- src/maas/settings.py	2012-01-16 16:15:44 +0000
+++ src/maas/settings.py	2012-01-16 17:17:23 +0000
@@ -17,12 +17,15 @@
 
 DATABASES = {
     'default': {
-        'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
-        'NAME': '',                      # Or path to database file if using sqlite3.
-        'USER': '',                      # Not used with sqlite3.
-        'PASSWORD': '',                  # Not used with sqlite3.
-        'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
-        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
+        # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' etc.
+        'ENGINE': 'django.db.backends.postgresql_psycopg2',
+        'NAME': 'maas',
+        'USER': '',
+        'PASSWORD': '',
+        # For PostgreSQL, a "hostname" starting with a slash indicates a
+        # Unix socket directory.
+        'HOST': '',
+        'PORT': '',
     }
 }
 
@@ -33,7 +36,7 @@
 # timezone as the operating system.
 # If running in a Windows environment this must be set to the same as your
 # system time zone.
-TIME_ZONE = 'America/Chicago'
+TIME_ZONE = None
 
 # Language code for this installation. All choices can be found here:
 # http://www.i18nguy.com/unicode/language-identifiers.html


Follow ups