Merge branch 'feature/subscriber-portal'

# Conflicts:
#	xos/core/xoslib/methods/loginview.py
diff --git a/containers/xos/Dockerfile b/containers/xos/Dockerfile
index 0fd7565..f65eb37 100644
--- a/containers/xos/Dockerfile
+++ b/containers/xos/Dockerfile
@@ -1,4 +1,4 @@
-FROM       python:2.7.11
+FROM       ubuntu:14.04.3
 
 # XXX Workaround for docker bug:
 # https://github.com/docker/docker/issues/6345
@@ -70,7 +70,7 @@
     google_api_python_client \
     httplib2.ca_certs_locater
 
-ADD http://code.jquery.com/jquery-1.9.1.min.js /usr/local/lib/python2.7/site-packages/suit/static/suit/js/
+ADD http://code.jquery.com/jquery-1.9.1.min.js /usr/local/lib/python2.7/dist-packages/suit/static/suit/js/
 
 # Install XOS
 RUN git clone git://github.com/open-cloud/xos.git /tmp/xos && \
@@ -86,10 +86,9 @@
 
 # Set environment variables.
 ENV HOME /root
-ENV PYTHONPATH /usr/local/lib/python2.7/site-packages:/usr/lib/python2.7/dist-packages
 
 # Define working directory.
 WORKDIR /opt/xos
 
 # Define default command.
-CMD update-ca-certificates && python manage.py runserver 0.0.0.0:8000 --insecure
+CMD update-ca-certificates && python /opt/xos/manage.py runserver 0.0.0.0:8000 --insecure --makemigrations
diff --git a/containers/xos/Dockerfile.devel b/containers/xos/Dockerfile.devel
index 93f5025..a8a9710 100644
--- a/containers/xos/Dockerfile.devel
+++ b/containers/xos/Dockerfile.devel
@@ -1,4 +1,4 @@
-FROM       python:2.7.11
+FROM       ubuntu:14.04.3
 
 # XXX Workaround for docker bug:
 # https://github.com/docker/docker/issues/6345
@@ -70,7 +70,7 @@
     google_api_python_client \
     httplib2.ca_certs_locater
 
-ADD http://code.jquery.com/jquery-1.9.1.min.js /usr/local/lib/python2.7/site-packages/suit/static/suit/js/
+ADD http://code.jquery.com/jquery-1.9.1.min.js /usr/local/lib/python2.7/dist-packages/suit/static/suit/js/
 
 # Install XOS
 ADD xos /opt/xos
@@ -85,10 +85,9 @@
 
 # Set environment variables.
 ENV HOME /root
-ENV PYTHONPATH /usr/local/lib/python2.7/site-packages:/usr/lib/python2.7/dist-packages
 
 # Define working directory.
 WORKDIR /opt/xos
 
 # Define default command.
-CMD update-ca-certificates && python manage.py runserver 0.0.0.0:8000 --insecure
+CMD update-ca-certificates && python /opt/xos/manage.py runserver 0.0.0.0:8000 --insecure --makemigrations
diff --git a/containers/xos/Dockerfile.templ b/containers/xos/Dockerfile.templ
index 828c16b..25270a6 100644
--- a/containers/xos/Dockerfile.templ
+++ b/containers/xos/Dockerfile.templ
@@ -65,7 +65,7 @@
     pyyaml \
     requests
 
-ADD http://code.jquery.com/jquery-1.9.1.min.js /usr/local/lib/python2.7/site-packages/suit/static/suit/js/
+ADD http://code.jquery.com/jquery-1.9.1.min.js /usr/local/lib/python2.7/dist-packages/suit/static/suit/js/
 
 # Install XOS
 RUN git clone XOS_GIT_REPO -b XOS_GIT_BRANCH /tmp/xos && \
@@ -80,10 +80,9 @@
 
 # Set environment variables.
 ENV HOME /root
-ENV PYTHONPATH /usr/local/lib/python2.7/site-packages:/usr/lib/python2.7/dist-packages
 
 # Define working directory.
 WORKDIR /root
 
 # Define default command.
-CMD python /opt/xos/manage.py runserver 0.0.0.0:8000 --insecure
+CMD update-ca-certificates && python /opt/xos/manage.py runserver 0.0.0.0:8000 --insecure --makemigrations
diff --git a/xos/configurations/opencloud/Makefile b/xos/configurations/opencloud/Makefile
new file mode 100644
index 0000000..aef4946
--- /dev/null
+++ b/xos/configurations/opencloud/Makefile
@@ -0,0 +1,35 @@
+xos:
+	sudo docker-compose up -d
+	bash ./wait_for_xos.sh
+	sudo docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/configurations/opencloud/opencloud.yaml
+
+containers:
+	cd ../../../containers/xos; make devel
+	cd ../../../containers/synchronizer; make
+
+stop:
+	sudo docker-compose stop
+
+showlogs:
+	sudo docker-compose logs
+
+rm: stop
+	sudo docker-compose rm
+
+ps:
+	sudo docker-compose ps
+
+enter-xos:
+	sudo docker exec -it devel_xos_1 bash
+
+enter-synchronizer:
+	sudo docker exec -it devel_xos_synchronizer_openstack_1 bash
+
+upgrade_pkgs:
+	sudo pip install httpie --upgrade
+
+rebuild_xos:
+	make -C ../../../containers/xos devel
+
+rebuild_synchronizer:
+	make -C ../../../containers/synchronizer
diff --git a/xos/configurations/opencloud/README.md b/xos/configurations/opencloud/README.md
new file mode 100644
index 0000000..97449ed
--- /dev/null
+++ b/xos/configurations/opencloud/README.md
@@ -0,0 +1,24 @@
+# XOS OpenCloud Portal
+
+This configuration can be used to bring up XOS on the OpenCloud portal.  It launches
+XOS in three Docker containers (development GUI, Synchronizer, database) and configures XOS
+with the `opencloud.yaml` TOSCA file in this directory.  *docker-compose* is used to manage
+the containers.
+
+## Docker Helpers
+
+Stop the containers: `make stop`
+
+Restart the containers: `make stop; make`
+
+Delete the containers and relaunch them: `make rm; make`
+
+Build the containers from scratch using the local XOS source tree: `make containers`
+
+View logs: `make showlogs`
+
+See what containers are running: `make ps`
+
+Open a shell on the XOS container: `make enter-xos`
+
+Open a shell on the Synchronizer container: `make enter-synchronizer`
diff --git a/xos/configurations/opencloud/docker-compose.yml b/xos/configurations/opencloud/docker-compose.yml
new file mode 100644
index 0000000..828175e
--- /dev/null
+++ b/xos/configurations/opencloud/docker-compose.yml
@@ -0,0 +1,34 @@
+xos_db:
+    image: xosproject/xos-postgres
+    expose:
+        - "5432"
+
+xos_synchronizer_openstack:
+    image: xosproject/xos-synchronizer-openstack
+    #command: bash -c "update-ca-certificates; sleep 120; python /opt/xos/synchronizers/openstack/xos-synchronizer.py"
+    command: sleep 86400
+    labels:
+        org.xosproject.kind: synchronizer
+        org.xosproject.target: openstack
+    links:
+        - xos_db
+    volumes:
+        - ../common/xos_common_config:/opt/xos/xos_configuration/xos_common_config:ro
+        - /usr/local/share/ca-certificates:/usr/local/share/ca-certificates:ro
+
+# FUTURE
+#xos_swarm_synchronizer:
+#    image: xosproject/xos-swarm-synchronizer
+#    labels:
+#        org.xosproject.kind: synchronizer
+#        org.xosproject.target: swarm
+
+xos:
+    image: xosproject/xos
+    command: python /opt/xos/manage.py runserver 0.0.0.0:8000 --insecure --makemigrations
+    ports:
+        - "80:8000"
+    links:
+        - xos_db
+    volumes:
+      - ../common/xos_common_config:/opt/xos/xos_configuration/xos_common_config:ro
diff --git a/xos/configurations/opencloud/wait_for_xos.sh b/xos/configurations/opencloud/wait_for_xos.sh
new file mode 100644
index 0000000..4f486af
--- /dev/null
+++ b/xos/configurations/opencloud/wait_for_xos.sh
@@ -0,0 +1,12 @@
+#! /bin/bash
+echo "Waiting for XOS to come up"
+until http 0.0.0.0:80 &> /dev/null
+do
+    sleep 1
+    RUNNING_CONTAINER=`sudo docker ps|grep "xos"|awk '{print $$NF}'`
+    if [[ $RUNNING_CONTAINER == "" ]]; then
+        echo Container may have failed. check with \"make showlogs\'
+        exit 1
+    fi
+done
+echo "XOS is ready"
diff --git a/xos/tosca/resources/user.py b/xos/tosca/resources/user.py
index 724bc3d..8587c89 100644
--- a/xos/tosca/resources/user.py
+++ b/xos/tosca/resources/user.py
@@ -76,6 +76,24 @@
 
         self.info("Created User '%s'" % (str(user), ))
 
+    def update(self, obj):
+        xos_args = self.get_xos_args()
+
+        password = None
+        if "password" in xos_args:
+            # password needs to be set with set_password function
+            password = xos_args["password"]
+            del xos_args["password"]
+
+        for (k,v) in xos_args.items():
+            setattr(obj, k, v)
+
+        if password:
+            obj.set_password(password)
+
+        self.postprocess(obj)
+        obj.save()
+
     def delete(self, obj):
         if obj.slices.exists():
             self.info("User %s has active slices; skipping delete" % obj.name)