~louis/+junk/nova-compute

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/fetch/__init__.py

  • Committer: Edward Hope-Morley
  • Date: 2014-03-26 18:08:46 UTC
  • mfrom: (55.1.1 nova-compute.lp1273067)
  • Revision ID: edward.hope-morley@canonical.com-20140326180846-o2mo693uow2urlpj
[hopem] Added support for ceph-client logging to syslog

Show diffs side-by-side

added added

removed removed

Lines of Context:
97
97
        subprocess.call(cmd, env=env)
98
98
 
99
99
 
 
100
def apt_upgrade(options=None, fatal=False, dist=False):
 
101
    """Upgrade all packages"""
 
102
    if options is None:
 
103
        options = ['--option=Dpkg::Options::=--force-confold']
 
104
 
 
105
    cmd = ['apt-get', '--assume-yes']
 
106
    cmd.extend(options)
 
107
    if dist:
 
108
        cmd.append('dist-upgrade')
 
109
    else:
 
110
        cmd.append('upgrade')
 
111
    log("Upgrading with options: {}".format(options))
 
112
 
 
113
    env = os.environ.copy()
 
114
    if 'DEBIAN_FRONTEND' not in env:
 
115
        env['DEBIAN_FRONTEND'] = 'noninteractive'
 
116
 
 
117
    if fatal:
 
118
        subprocess.check_call(cmd, env=env)
 
119
    else:
 
120
        subprocess.call(cmd, env=env)
 
121
 
 
122
 
100
123
def apt_update(fatal=False):
101
124
    """Update local apt cache"""
102
125
    cmd = ['apt-get', 'update']
135
158
 
136
159
 
137
160
def add_source(source, key=None):
 
161
    if source is None:
 
162
        log('Source is not present. Skipping')
 
163
        return
 
164
 
138
165
    if (source.startswith('ppa:') or
139
166
        source.startswith('http') or
140
167
        source.startswith('deb ') or