~ubuntu-branches/ubuntu/utopic/maas/utopic

« back to all changes in this revision

Viewing changes to src/provisioningserver/import_images/download_resources.py

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez, Jeroen Vermeulen, Andres Rodriguez, Jason Hobbs, Raphaël Badin, Louis Bouchard, Gavin Panella
  • Date: 2014-08-21 19:36:30 UTC
  • mfrom: (1.3.1)
  • Revision ID: package-import@ubuntu.com-20140821193630-kertpu5hd8yyss8h
Tags: 1.7.0~beta7+bzr3266-0ubuntu1
* New Upstream Snapshot, Beta 7 bzr3266

[ Jeroen Vermeulen ]
* debian/extras/99-maas-sudoers
  debian/maas-dhcp.postinst
  debian/rules
  - Add second DHCP server instance for IPv6.
* debian/maas-region-controller-min.install
  debian/maas-region-controller-min.lintian-overrides
  - Install deployment user-data: maas_configure_interfaces.py script.
* debian/maas-cluster-controller.links
  debian/maas-cluster-controller.install
  debian/maas-cluster-controller.postinst
  - Reflect Celery removal changes made in trunk r3067.
  - Don't install celeryconfig_cluster.py any longer. 
  - Don't install maas_local_celeryconfig_cluster.py any longer.
  - Don't symlink maas_local_celeryconfig_cluster.py from /etc to /usr.
  - Don't insert UUID into maas_local_celeryconfig_cluster.py.

[ Andres Rodriguez ]
* debian/maas-region-controller-min.postrm: Cleanup lefover files.
* debian/maas-dhcp.postrm: Clean leftover configs.
* Provide new maas-proxy package that replaces the usage of
  squid-deb-proxy:
  - debian/control: New maas-proxy package that replaces the usage
    of squid-deb-proxy; Drop depends on squid-deb-proxy.
  - Add upstrart job.
  - Ensure squid3 is stopped as maas-proxy uses a caching proxy.
* Remove Celery references to cluster controller:
  - Rename upstart job from maas-pserv to maas-cluster; rename
    maas-cluster-celery to maas-cluster-register. Ensure services
    are stopped on upgrade.
  - debian/maintscript: Cleanup config files.
  - Remove all references to the MAAS celery daemon and config
    files as we don't use it like that anymore
* Move some entries in debian/maintscript to
  debian/maas-cluster-controller.maintscript
* Remove usage of txlongpoll and rabbitmq-server. Handle upgrades
  to ensure these are removed correctly.

[ Jason Hobbs ]
* debian/maas-region-controller-min.install: Install
  maas-generate-winrm-cert script.

[ Raphaël Badin ]
* debian/extras/maas-region-admin: Bypass django-admin as it prints
  spurious messages to stdout (LP: #1365130).

[Louis Bouchard]
* debian/maas-cluster-controller.postinst:
  - Exclude /var/log/maas/rsyslog when changing ownership
    (LP: #1346703)

[Gavin Panella]
* debian/maas-cluster-controller.maas-clusterd.upstart:
  - Don't start-up the cluster controller unless a shared-secret has
    been installed.
* debian/maas-cluster-controller.maas-cluster-register.upstart: Drop.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
import os.path
22
22
 
23
23
from provisioningserver.import_images.helpers import (
 
24
    get_os_from_product,
24
25
    get_signing_policy,
25
26
    maaslog,
26
27
    )
121
122
    return [(root_image_path, 'root-image'), (root_tgz_path, 'root-tgz')]
122
123
 
123
124
 
124
 
def link_resources(snapshot_path, links, arch, release, label, subarches):
 
125
def link_resources(snapshot_path, links, osystem, arch, release, label,
 
126
                   subarches):
125
127
    """Hardlink entries in the snapshot directory to resources in the cache.
126
128
 
127
129
    This creates file entries in the snapshot directory for boot resources
132
134
        the cache.  Each link is described as a tuple of (path, logical
133
135
        name).  The path points to a file in the cache directory.  The logical
134
136
        name will be link's filename, without path.
 
137
    :param osystem: Operating system with this boot image supports.
135
138
    :param arch: Architecture which this boot image supports.
136
139
    :param release: OS release of which this boot image is a part.
137
140
    :param label: OS release label of which this boot image is a part, e.g.
143
146
        for older Ubuntu releases.
144
147
    """
145
148
    for subarch in subarches:
146
 
        directory = os.path.join(snapshot_path, arch, subarch, release, label)
 
149
        directory = os.path.join(
 
150
            snapshot_path, osystem, arch, subarch, release, label)
147
151
        if not os.path.exists(directory):
148
152
            os.makedirs(directory)
149
153
        for cached_file, logical_name in links:
167
171
        self.root_path = root_path
168
172
        self.store = store
169
173
        self.product_mapping = product_mapping
170
 
        super(RepoWriter, self).__init__()
 
174
        super(RepoWriter, self).__init__(config={
 
175
            # Only download the latest version. Without this all versions
 
176
            # will be downloaded from simplestreams.
 
177
            'max_items': 1,
 
178
            })
171
179
 
172
180
    def load_products(self, path=None, content_id=None):
173
181
        """Overridable from `BasicMirrorWriter`."""
194
202
            links = insert_file(
195
203
                self.store, ftype, tag, checksums, size, contentsource)
196
204
 
 
205
        os = get_os_from_product(item)
197
206
        subarches = self.product_mapping.get(item)
198
207
        link_resources(
199
208
            snapshot_path=self.root_path, links=links,
200
 
            arch=item['arch'], release=item['release'], label=item['label'],
201
 
            subarches=subarches)
 
209
            osystem=os, arch=item['arch'], release=item['release'],
 
210
            label=item['label'], subarches=subarches)
202
211
 
203
212
 
204
213
def download_boot_resources(path, store, snapshot_path, product_mapping,
262
271
    """
263
272
    storage_path = os.path.abspath(storage_path)
264
273
    snapshot_path = compose_snapshot_path(storage_path)
265
 
    ubuntu_path = os.path.join(snapshot_path, 'ubuntu')
266
274
    # Use a FileStore as our ObjectStore implementation.  It will write to the
267
275
    # cache directory.
268
276
    if store is None:
273
281
 
274
282
    for source in sources:
275
283
        download_boot_resources(
276
 
            source['url'], store, ubuntu_path, product_mapping,
 
284
            source['url'], store, snapshot_path, product_mapping,
277
285
            keyring_file=source.get('keyring')),
278
286
 
279
287
    return snapshot_path