~chad.smith/landscape-charm/add-apt-repository-retries

« back to all changes in this revision

Viewing changes to lib/upgradecharm.py

Merge dont-upgrade-pacakges-in-upgrade-hook [f=] [r=danilo,bjornt,landscape-builder] [a=Chris Glass]
This branch removes the upgrade-charm hook since it was breaking the current workflow (we use a special "upgrade" action instead).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
import subprocess
2
 
 
3
 
from charmhelpers import fetch
4
 
from charmhelpers.core import hookenv
5
 
 
6
 
from lib.hook import Hook
7
 
from lib.apt import Apt
8
 
 
9
 
 
10
 
class UpgradeCharmHook(Hook):
11
 
    """Execute upgrade-charm hook logic."""
12
 
 
13
 
    def __init__(self, hookenv=hookenv, fetch=fetch, subprocess=subprocess):
14
 
        super(UpgradeCharmHook, self).__init__(hookenv=hookenv)
15
 
        self._fetch = fetch
16
 
        self._subprocess = subprocess
17
 
 
18
 
    def _run(self):
19
 
        # Set APT sources and install Landscape packages
20
 
        apt = Apt(
21
 
            hookenv=self._hookenv, fetch=self._fetch,
22
 
            subprocess=self._subprocess)
23
 
        apt.set_sources()
24
 
        apt.install_packages()