~ubuntu-repository-cache-charmers/ubuntu-repository-cache/trunk

« back to all changes in this revision

Viewing changes to lib/ubuntu_repository_cache/service.py

  • Committer: Ryan Finnie
  • Date: 2018-11-27 18:21:10 UTC
  • Revision ID: ryan.finnie@canonical.com-20181127182110-m0ao7v2s4yvdj6d5
[r=rcj] Add expanded configuration options for archive types

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
def install():
56
56
    '''Perform service installation'''
57
57
 
 
58
    config = hookenv.config()
 
59
 
58
60
    # We can allow for pre-install scripts to alter the operating
59
61
    # environment, it doesn't mean we can support it.
60
62
    preinstall_files = glob.glob('exec.d/*/charm-pre-install')
88
90
    # the cloud where it is being deployed.  In that case the
89
91
    # URL for the repository in the cloud image will point to the
90
92
    # service provided by this charm and it could be unavailable.
91
 
    url = 'http://%s/ubuntu/' % hookenv.config()['sync-host']
92
 
    LOG('Changing apt source list url to %s' % url)
93
 
    util.change_aptsources_url(url)
 
93
    if config['update-unit-apt-sources']:
 
94
        url = 'http://{}/{}/'.format(config['sync-host'], config['path-base'])
 
95
        LOG('Changing apt source list url to %s' % url)
 
96
        util.change_aptsources_url(url)
 
97
 
94
98
    fetch.apt_update(fatal=True)
95
99
 
96
100
    storage.setup()
266
270
            config.save()
267
271
        cron_context['ApacheRoot'] = config['apache-root']
268
272
        cron_context['SyncHost'] = config['sync-host']
 
273
        cron_context['PathBase'] = config['path-base']
 
274
        cron_context['RsyncModule'] = config['rsync-module']
269
275
        cron_context['Minutes'] = config['rsync-minutes']
270
276
        cron_context['UnitId'] = hookenv.local_unit()
271
277
        cron_context['UnitPath'] = \