lp:~frankban/juju-quickstart/env-creation-proto

Created by Francesco Banconi and last modified
Get this branch:
bzr branch lp:~frankban/juju-quickstart/env-creation-proto
Only Francesco Banconi can upload to this branch. If you are Francesco Banconi please log in for upload directions.

Branch merges

Related bugs

Related blueprints

Branch information

Owner:
Francesco Banconi
Project:
juju-quickstart
Status:
Development

Recent revisions

24. By Francesco Banconi

Checkpoint.

23. By Gary Poster

Add autologin support for quickstart

To qa, please do the following.

Story 1: quickstart works without autologin support for charm.

Simply run `.venv/bin/python juju-quickstart`. This will bring up the existing charm, which does not have support for autologin. It should work fine, with password.

Story 2: quickstart works with autologin when available.

Run `.venv/bin/python juju-quickstart --gui-charm-url cs:~juju-gui/precise/juju-gui-134`.

This should bring up the GUI with autologin.

Thank you!

R=matthew.scott
CC=
https://codereview.appspot.com/34420043

22. By Francesco Banconi

Install missing packages for add-apt-repository.

Also use absolute paths to commands executed
with sudo privileges.

Tests: `make check`

QA:

1) Create a saucy LXC sharing your home directory,
    e.g. `sudo lxc-create -t ubuntu -n quickstart -f <MY-TEMPLATE> \
          -- -r saucy -a amd64 -b $USER`
    where "quickstart" is the name of the container,
    "-r" is used to specify the release to use,
    "-b" binds the home directory of the specified user,
    and <MY-TEMPLATE> is a file with the following contents:
        lxc.network.type=veth
        lxc.network.link=lxcbr0
        lxc.network.flags=up
    I assume you already have:
      - a juju home containing the environments.yaml file
        configured with an "ec2" ec2 environment;
      - your ssh keys properly set up;
      - run the tests with `make check` as described above.
    So at this point the container does not have juju
    installed, but the juju home and ssh keys are
    available, and so the branch with a configured testing
    virtualenv. We already have cards for environment
    creation and ssh keys handling.
2) Start the LXC instance (`sudo lxc-start -n quickstart`).
3) Open a console inside the LXC with
    `sudo lxc-console -n quickstart`, log in using your user
    credentials, and cd into the directory where you checked
    out this branch.
4) Run `.venv/bin/python juju-quickstart -e ec2 --no-browser`.
    You should be asked the sudo password in order to add
    the missing PPA and install juju-core and lxc.
    Note that installing the packages can take some minutes.
    The process will then proceed as usual.
5) Run `.venv/bin/python juju-quickstart -e ec2 --no-browser`
    again: this time no packages installation should be required,
    and quickstart just reuses the existing environment.
6) From the host, stop and destroy the LXC container:
    `sudo lxc-stop -n quickstart` and `sudo lxc-destroy -n quickstart`.
7) Destroy your ec2 environment.

Thank you!

R=bac, rharding
CC=
https://codereview.appspot.com/32760043

21. By Francesco Banconi

Improve charm URL handling.

Validate the user provided GUI charm URL.
Also add a missing test for complete coverage
(obsessive-compulsive mode on).

Tests: `make check`.

QA:

1)
Provide invalid charm URLs, the program
should immediately stop the execution
and exit with an error, e.g.:

.venv/bin/python juju-quickstart --gui-charm-url invalid

.venv/bin/python juju-quickstart --gui-charm-url local:precise/juju-gui-80

.venv/bin/python juju-quickstart --gui-charm-url http:~juju-gui/precise/juju-gui-80

.venv/bin/python juju-quickstart --gui-charm-url cs:precise/juju-gui-1 bundle:~jorge/mediawiki-simple/4/mediawiki-simple

.venv/bin/python juju-quickstart --gui-charm-url cs:saucy/juju-gui-80

2)
Run the program passing a customized charm URL, e.g.:

.venv/bin/python juju-quickstart --gui-charm-url cs:~juju-gui/precise/juju-gui-128

You should see the "using a customized juju-gui charm" warning
printed during the service deployment step.

Re-execute the command above: quickstart should reuse the
service in the environment and the warning is printed again.

Destroy the environment.

3)
Now manually deploy an outdated version of the GUI charm:

(sudo) juju bootstrap
juju deploy cs:precise/juju-gui-79

Run quickstart:
.venv/bin/python juju-quickstart

You should see the "charm is outdated" warning, then quickstart
waits for the outdated GUI to be deployed and ready.

Destroy the environment.

4)
Run quickstart normally:
.venv/bin/python juju-quickstart
The last official GUI charm (cs:precise/juju-gui-80)
is installed and no warnings are logged.

Destroy the environment.
Done, thank you!

R=rharding, bac
CC=
https://codereview.appspot.com/30760043

20. By Francesco Banconi

Re-enable watcher requests/responses logging.

Tests: `make check`.

QA:
Run `.venv/bin/python juju-quickstart --debug` and
check that all the "AllWatcher" requests/responses
are properly logged.

R=bac
CC=
https://codereview.appspot.com/30810043

19. By Brad Crittenden

Ensure juju and lxc are installed

To test: make check

To QA:
- Create an lxc or vm without juju installed
- Clone this branch
- Run `make sysdeps`
- Run `make run`

It should install juju, lxc, and dependencies, then prompt you to run again
after initializing your juju environments.

R=
CC=
https://codereview.appspot.com/29770045

18. By Francesco Banconi

Add support for local providers.

Bootstrap the environment with "sudo" if
the environment is configured to use the
local provider.

Also improved debugging documentation.

Tests: make check

To QA this, just run `.venv/bin/python juju-quickstart`
as you are used to, but with the local provider:
try to deploy a bundle, try to re-run quickstart again
with the environment already bootstrapped.
In general the application should ask for sudo password
and then proceed as usual.

R=rharding
CC=
https://codereview.appspot.com/29540044

17. By Brad Crittenden

Pass the bundle id when deploying.

If bundle: URL is used, pass the bundle id when deploying so Charmworld can
increment the counter.

R=matthew.scott, frankban
CC=
https://codereview.appspot.com/28520044

16. By Francesco Banconi

Document bundle debugging and releasing.

R=matthew.scott
CC=
https://codereview.appspot.com/28490043

15. By Francesco Banconi

Make quickstart idempotent.

- do not bootstrap an environment if already bootstrapped;
- do not deploy the GUI if already there.

Sorry, the diff is long, but there are a lot of tests.

Tests: make check

QA:
- .venv/bin/python juju-quickstart -e ec2
  and ensure the GUI is correctly deployed;

- .venv/bin/python juju-quickstart -e ec2
  again, to check it recognizes that env is
  already bootstrapped and the
  GUI unit is already there;

In the following steps, sometimes the browser
can get confused about certs, wss conections
etc. If the GUI is not loading correctly,
try harder, use incognito mode, change the
browser.

- juju destroy-service -e ec2 juju-gui;
- .venv/bin/python juju-quickstart -e ec2
  again, to check the service and the unit
  are correctly re-deployed;

Incidentally the step above, in the case it
succeeds, also demonstrates that the GUI can
safely be redeployed in the same machine: I
wasn't sure about this and this means we are
cleaning up things correctly in our charm, yay!

- juju unexpose -e ec2 juju-gui;
- .venv/bin/python juju-quickstart -e ec2
  again, to check that the service is
  properly re-exposed;

- juju destroy-unit -e ec2 juju-gui/0;
- .venv/bin/python juju-quickstart -e ec2
  again, to check that the unit is
  re-added on the existing service
  (this time it should be named juju-gui/1);

- juju destroy-service -e ec2 juju-gui;
- juju deploy -e ec2 juju-gui (if juju exits with a
  "service already exists" error, retry after a while);
- .venv/bin/python juju-quickstart -e ec2 \
    bundle:~jorge/mediawiki-simple/4/mediawiki-simple;
The last command, executed right after juju-deploy should
also demonstrates that incidentally quickstart
can also be used to watch an already running
deployment, and that a bundle can still be deployed;

Final check:
- .venv/bin/python juju-quickstart -e ec2;
just to ensure quickstart is not surprised
that the unit is not in the bootstrap node
(i.e. you should see "juju-gui/0 is ready on machine 1").

Thanks a lot for testing all of this.
I added a card to automate the QA above with
a collection of functional tests.

Remember to destroy your ec2 environment.

R=gary.poster, rharding
CC=
https://codereview.appspot.com/28250044

Branch metadata

Branch format:
Branch format 7
Repository format:
Bazaar repository format 2a (needs bzr 1.16 or later)
Stacked on:
lp:juju-quickstart
This branch contains Public information 
Everyone can see this information.