juju/juju-gui — pull request #531 by frankban (2014-09-04 14:56:56+00:00)
Title: Disable containerization when not supported.

Implement an infrastructure to dynamically disable
containers support in the machine view based on the
environment's provider type.

A list of supported containers is defined at
environment level, and used to check containerization
support.

Avoid hard-coding the list of container types in the
create machine view.

Update the service unit token to accept a list of
available container types.
Also removed the env from the service usint token:
it doesn't appear to be used at all.

This branch also includes some drive-by fixes to
methods' docstrings and comments.

My apologies for the long diff, but the task was not
easy to subdivide, and lots of tests have been added.

QA:

In sandbox mode.

- `make devel`;
- open the GUI with the `/:flags:/mv/` flag;
- switch to machine view;
- ensure containers can be correctly created by:
- creating a machine and then a container;
- deploying a service and then placing the unit
in an existing top level machine;
- using the deploy menu option in the service unit token.
In all the cases, the container type options should
be LXC and KVM.
- commit the changes, ensure everything works as usual.

In a real environment (e.g. local LXC or EC2).

- `juju quickstart`;
- `juju set juju-gui juju-gui-source="https://github.com/frankban/juju-gui.git disable-containers"`;
- wait for the installation of the customized GUI to be completed;
- open the GUI with the `/:flags:/mv/` flag;
- switch to machine view;
- a message in the containers header should inform you
that sub-containers are not supported;
- there should be no way to create sub-containers: e.g.
the existing machines are no longer drop targets for
unplaced units;
- also, container types options should no longer be available
in the service unit token when "deploy" is clicked;
- you should still be able to place new units to
new machines: do that, and then commit the changes
and ensure everything works as usual;
- now refresh the machine view: it should load correctly
and you should still see the "Sub-containers not supported"
message. Note that the when refreshing the machine view unit
icons are not shown in the machine column, but they appears
if you switch to service view and then back to machine view.
This bug is present also in current trunk: is it already
known? If not, I'll file a bug.

Done, thank you.