Code review comment for lp:~bac/charms/oneiric/buildbot-slave/fix-apt-sources

Revision history for this message
Benji York (benji) wrote :

On Thu, Apr 5, 2012 at 1:18 PM, Brad Crittenden <email address hidden> wrote:
> Brad Crittenden has proposed merging lp:~bac/charms/oneiric/buildbot-slave/fix-apt-sources into lp:~yellow/charms/oneiric/buildbot-slave/trunk.

>  def install_packages():
> +    try:
> +        # Attempt exercising 'apt-get' to see if there are errors in the
> +        # repositories, as frequently seen on EC2.  If so, fix the apt sources
> +        # file.  This approach will work if the failure is seen initially but
> +        # will not succeed if it is intermittent.
> +        run('apt-get', 'update')
> +    except subprocess.CalledProcessError as e:
> +        log("Error running 'apt-get update':")
> +        log(str(e))
> +        log("Proceeding with re-written /etc/apt/sources.list")
> +        fix_apt_sources()
> +        run('apt-get', 'update')
>     install_extra_repository('ppa:yellow/ppa')
>     apt_get_install('python-shelltoolbox')

Since "apt-get update" returns a specific exit code (100) shouldn't we
only rewrite sources.list if it fails with that result?
--
Benji York

« Back to merge proposal