Code review comment for lp://staging/~frankban/charms/precise/juju-gui/trusty-defaults

Revision history for this message
Francesco Banconi (frankban) wrote :

Reviewers: mp+216695_code.launchpad.net,

Message:
Please take a look.

Description:
Use trusty as default target series.

Switched to lp:~juju-gui/charms/trusty/juju-gui/trunk
(I'll send an email after this branch is landed).

Change "make deploy" to install the trusty charm by default.

Also run "apt-get update" at the beginning of the install hook.

Tests: `make unittest`.

https://code.launchpad.net/~frankban/charms/precise/juju-gui/trusty-defaults/+merge/216695

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/90220043/

Affected files (+44, -26 lines):
   M .lbox
   M HACKING.md
   M Makefile
   M README.md
   A [revision details]
   M hooks/install
   M revision
   M tests/deploy.py
   M tests/example.py
   M tests/test_deploy.py

Index: .lbox
=== modified file '.lbox'
--- .lbox 2013-06-04 16:52:52 +0000
+++ .lbox 2014-04-22 09:27:01 +0000
@@ -1,1 +1,1 @@
-propose -cr -for lp:~juju-gui/charms/precise/juju-gui/trunk
+propose -cr -for lp:~juju-gui/charms/trusty/juju-gui/trunk

Index: HACKING.md
=== modified file 'HACKING.md'
--- HACKING.md 2014-04-15 14:17:12 +0000
+++ HACKING.md 2014-04-22 10:28:39 +0000
@@ -30,7 +30,7 @@
  The command above will run as root and install the required deb packages.

  Next, you need the bzr branch. We work from
-[lp:~juju-gui/charms/precise/juju-gui/trunk](https://code.launchpad.net/~juju-gui/charms/precise/juju-gui/trunk).
+[lp:~juju-gui/charms/trusty/juju-gui/trunk](https://code.launchpad.net/~juju-gui/charms/trusty/juju-gui/trunk).

  You could start hacking now, but there's a bit more to do to prepare for
  running and writing tests.
@@ -112,7 +112,7 @@

      make clean
      juju bootstrap
- juju deploy --repository=/path/to/charm/repo local:precise/juju-gui
+ juju deploy --repository=/path/to/charm/repo local:trusty/juju-gui
      juju expose juju-gui

  The second one is just running "make deploy":
@@ -127,10 +127,10 @@
  created, the testing virtualenv.

  The `make deploy` command also supports specifying the OS version used to
-deploy the local charm. By default a precise machine is created, but you
can
-run the following to deploy the charm on trusty:
+deploy the local charm. By default a trusty machine is created, but you can
+run the following to deploy the charm on precise:

- make deploy SERIES=trusty
+ make deploy SERIES=precise

  Now you are working with a test run, as described in
  <https://juju.ubuntu.com/docs/write-charm.html#test-run>. The
@@ -166,6 +166,17 @@
  All of this is described in more detail on the Juju site: this is an
  introduction to the process.

+## Making charm releases ##
+
+The same code base is used for both precise and trusty releases.
+Releasing the charm is done by pushing changes from the development branch
to
+the precise and trusty release branches.
+The branches live in the following locations:
+
+- development branch: `lp:~juju-gui/charms/trusty/juju-gui/trunk`
+- precise release: `lp:charms/juju-gui`
+- trusty release: `lp:charms/trusty/juju-gui`
+
  ## Upgrading the local releases repository ##

  The charm, in the default juju-gui-source configuration ("local"), deploys
the

Index: Makefile
=== modified file 'Makefile'
--- Makefile 2014-04-15 12:52:27 +0000
+++ Makefile 2014-04-22 09:27:01 +0000
@@ -84,7 +84,8 @@
   @echo ' expose the Juju GUI charm setting up a temporary Juju
repository.'
   @echo ' Wait for the service to be started. If JUJU_ENV is not passed,'
   @echo ' the charm will be deployed in the default Juju environment.'
- @echo ' If SERIES is not passed, "precise" is used.'
+ @echo ' If SERIES is not passed, "trusty" is used. Possible values are'
+ @echo ' "precise" and "trusty".'

  .PHONY: all clean deploy ensure-juju-env ensure-juju-test ftest help \
      jujutest lint setup sysdeps test unittest

Index: README.md
=== modified file 'README.md'
--- README.md 2014-04-15 14:17:12 +0000
+++ README.md 2014-04-22 09:27:01 +0000
@@ -83,7 +83,7 @@

      services:
        juju-gui:
- charm: cs:precise/juju-gui-7
+ charm: cs:trusty/juju-gui-42
          exposed: true
          relations: {}
          units:

Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision:
<email address hidden>
+New revision:
<email address hidden>

Index: revision
=== modified file 'revision'
--- revision 2014-04-17 09:17:07 +0000
+++ revision 2014-04-22 09:27:33 +0000
@@ -1,1 +1,1 @@
-112
+113

Index: hooks/install
=== modified file 'hooks/install'
--- hooks/install 2014-01-16 19:25:52 +0000
+++ hooks/install 2014-04-22 09:31:49 +0000
@@ -26,13 +26,17 @@
  )

-# Python dependencies must be installed here so that the charm can import
and
-# use required libraries.
  PYTHON_DEPENDENCIES = (
      'libapt-pkg-dev', 'python-apt', 'python-launchpadlib', 'python-tempita',
      'python-yaml'
  )

+
+# Update the list of dependencies to ensure sources are not stale.
+run('juju-log', '--', 'Updating APT sources.')
+run('apt-get', 'update')
+# Python dependencies must be installed here so that the charm can import
and
+# use required libraries.
  run('juju-log', '--', 'Installing base Python dependencies: {}.'.format(
      ', '.join(PYTHON_DEPENDENCIES)))
  apt_get_install(*PYTHON_DEPENDENCIES)

Index: tests/deploy.py
=== modified file 'tests/deploy.py'
--- tests/deploy.py 2014-04-14 17:00:09 +0000
+++ tests/deploy.py 2014-04-22 09:27:01 +0000
@@ -39,11 +39,12 @@
                  '--exclude', '/tests')

-def setup_repository(name, source, series='precise'):
+def setup_repository(name, source, series='trusty'):
      """Create a temporary Juju repository to use for charm deployment.

- Copy the charm files in source in the precise repository section,
using the
- provided charm name and excluding the virtualenv and Git directories.
+ Copy the charm files in source in the repository section corresponding
to
+ the given series, using the provided charm name and excluding the
+ virtualenv and Git directories.

      Return the repository path.
      """
@@ -67,7 +68,7 @@
      If force_machine is not None, create the unit in the specified machine.
      If charm_source is None, dynamically retrieve the charm source
directory.
      If series is None, the series specified in the SERIES environment
variable
- is used if found, defaulting to "precise".
+ is used if found, defaulting to "trusty".
      """
      # Note: this function is used by both the functional tests and
      # "make deploy": see the "if main" section below.
@@ -75,7 +76,7 @@
          # Dynamically retrieve the charm source based on the path of this
file.
          charm_source = os.path.join(os.path.dirname(__file__), '..')
      if series is None:
- series = os.getenv('SERIES', '').strip() or 'precise'
+ series = os.getenv('SERIES', '').strip() or 'trusty'
      logging.debug('setting up the charms repository')
      repo = setup_repository(charm_name, charm_source, series=series)
      args = ['deploy', '--repository', repo]

Index: tests/example.py
=== modified file 'tests/example.py'
--- tests/example.py 2013-11-27 14:37:06 +0000
+++ tests/example.py 2014-04-22 09:27:01 +0000
@@ -19,12 +19,11 @@

  BUNDLE1 = """
  bundle1:
- series: precise
+ series: trusty
    services:
      wordpress:
        charm: "cs:precise/wordpress-15"
- num_units: 1
- to: '0'
+ num_units: 2
        options:
          debug: "no"
          engine: nginx
@@ -35,8 +34,9 @@
          "gui-x": 313
          "gui-y": 51
      mysql:
- charm: "cs:precise/mysql-26"
- num_units: 2
+ charm: "cs:trusty/mysql-0"
+ num_units: 1
+ to: '0'
        options:
          "binlog-format": MIXED
          "block-size": "5"
@@ -63,7 +63,6 @@

  BUNDLE2 = """
  bundle2:
- series: precise
    services:
      mediawiki:
        charm: "cs:precise/mediawiki-9"

Index: tests/test_deploy.py
=== modified file 'tests/test_deploy.py'
--- tests/test_deploy.py 2014-01-16 19:25:52 +0000
+++ tests/test_deploy.py 2014-04-22 09:27:01 +0000
@@ -90,7 +90,7 @@
      def test_repository(self):
          # The charm repository is correctly created with the default
series.
          repo = setup_repository(self.name, self.source)
- self.check_repository(repo, 'precise')
+ self.check_repository(repo, 'trusty')

      def test_series(self):
          # The charm repository is created with the given series.
@@ -101,7 +101,7 @@
          # The charm files are correctly copied inside the repository,
excluding
          # unwanted directories.
          repo = setup_repository(self.name, self.source)
- charm_dir = os.path.join(repo, 'precise', self.name)
+ charm_dir = os.path.join(repo, 'trusty', self.name)
          expected = set([
              os.path.basename(self.root_file)
          ])
@@ -116,14 +116,14 @@

      unit_info = {'public-address': 'unit.example.com'}
      charm = 'test-charm'
- local_charm = 'local:precise/{}'.format(charm)
+ local_charm = 'local:trusty/{}'.format(charm)

      @mock.patch('deploy.juju')
      @mock.patch('deploy.wait_for_unit')
      def call_deploy(
              self, mock_wait_for_unit, mock_juju,
              service_name=None, options=None, force_machine=None,
- charm_source=None, series='precise'):
+ charm_source=None, series='trusty'):
          mock_wait_for_unit.return_value = self.unit_info
          if charm_source is None:
              expected_source = os.path.join(os.path.dirname(__file__), '..')

« Back to merge proposal