~ubuntu-branches/ubuntu/raring/maas/raring-updates

« back to all changes in this revision

Viewing changes to src/maasserver/preseed.py

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez, Raphaël Badin, Julian Edwards, Jeroen Vermeulen, Gavin Panella, Andres Rodriguez
  • Date: 2013-03-04 11:49:44 UTC
  • mfrom: (1.2.5)
  • Revision ID: package-import@ubuntu.com-20130304114944-81my0hho8arxa3ix
Tags: 1.3+bzr1452+dfsg-0ubuntu1
* New upstream release.
  - MAAS file storage mechanism is shifting from a single shared
    namespace to a per-user namespace. Operators of the majority
    of MAAS systems will not notice any change. However, operators
    of the most complex installations may find that a new
    "shared-environment" user is created, and that some resources
    are reassigned to it, such as API credentials and SSH public
    keys. This provides a transitional environment that mimics the
    behaviour of a shared namespace.

[ Raphaël Badin ]
* debian/control: maas-region-controller depends on bind9utils.
  (LP: #1103195)
* debian/maas-dns.postinst: Call write_dns_config.
  (LP: #1085865).
* debian/maas-cluster-controller.postinst: Fix the name of the config
  file (/etc/maas/pserv.yaml and not /etc/maas/pserv.conf)
  (LP: #1083542).
* debian/extras/99-maas-sudoers: Add 'SETENV:' to sudo rule
  to allow preserving the environment when running
  /usr/sbin/maas-import-pxe-files via sudo.
* debian/maas-dns.postinst: fix permissions and group ownership of
  file /etc/bind/maas/named.conf.rndc.maas. (LP: #1066935)
* debian/control: Remove the dependency of maas-cluster-controller
  on rabbitmq-server. (LP: #1072744)
* debian/extras/99-maas-sudoers: Add sudo rule for script
  /usr/sbin/maas-import-pxe-files.
* debian/maas-cluster-controller.install: Removed commissioning-user-data
  script.

[ Julian Edwards ]
* debian/maas-region-controller.install: Remove installation of maas-gc; it
  is no longer required as upstream no longer stores files in the filesystem.
  (LP: #1069734)
* debian/maas-cluster-controller.postinst: Ensure that /etc/maas/pserv.yaml
  is updated when reconfiguring. (LP: #1081212)

[ Jeroen Vermeulen ]
* debian/maas-cluster-controller.install: Install import scripts.
* debian/maas-cluster-controller.postinst: Configure tgt (the iSCSI server)
  so the import script can install files to it.
* debian/maas-cluster-controller.postrm: Clean up tgt config.
* debian/maas-region-controller.install: Move import scripts out to the
  cluster controller, and drop the maas-import-isos compatibility script.
* debian/maas-region-controller.postinst: Remove tgt config.
* debian/maas-region-controller.postrm: Remove tgt config cleanup.
* Bump code revision to include latest user_data.template fixes.

[ Gavin Panella ]
* debian/extras/99-maas: squashfs image download is no longer needed.
* debian/maas-cluster-controller.install: maas-import-squashfs and its
  configuration file are no longer part of upstream.
* debian/maas-cluster-controller.install: The maas-import-pxe-files cron
  task is no longer used.
* debian/maas-cluster-controller.postinst: Remove leading comment
  markers from the 'generator' line in pserv.yaml.

[ Andres Rodriguez ]
* debian/control:
  - maas-cluster-controller Conflicts with tftpd-hpa (LP: #1076028)
  - maas-dns: Conflicts with dnsmasq
  - maas-cluster-controller Conflicts/Replaces maas-region-controller as
    import scripts are no longer shipped in the region.
  - debian/control: Depends on distro-info for maas-cluster-controller
    instead of maas-region-controller (LP: #1103194)
* debian/maas-cluster-controller.config: If URL has been detected,
  add /MAAS if it doesn't contain it. This helps upgrades from versions
  where DEFAULT_MAAS_URL didn't use /MAAS.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
    'compose_preseed_url',
16
16
    'get_enlist_preseed',
17
17
    'get_preseed',
 
18
    'get_preseed_context',
18
19
    ]
19
20
 
20
21
from collections import namedtuple
21
22
from os.path import join
22
23
from pipes import quote
23
24
from urllib import urlencode
 
25
from urlparse import urlparse
24
26
 
25
27
from django.conf import settings
26
28
from maasserver.compose_preseed import compose_preseed
204
206
    return get_template(prefix, None, default=True)
205
207
 
206
208
 
 
209
def get_hostname_and_path(url):
 
210
    """Return a tuple of the hostname and the hierarchical path from a url."""
 
211
    parsed_url = urlparse(url)
 
212
    return parsed_url.hostname, parsed_url.path
 
213
 
 
214
 
207
215
def get_preseed_context(release='', nodegroup=None):
208
216
    """Return the node-independent context dictionary to be used to render
209
217
    preseed templates.
214
222
    :rtype: dict.
215
223
    """
216
224
    server_host = get_maas_facing_server_host(nodegroup=nodegroup)
 
225
    main_archive_hostname, main_archive_directory = get_hostname_and_path(
 
226
        Config.objects.get_config('main_archive'))
 
227
    ports_archive_hostname, ports_archive_directory = get_hostname_and_path(
 
228
        Config.objects.get_config('ports_archive'))
217
229
    base_url = nodegroup.maas_url if nodegroup is not None else None
218
230
    return {
 
231
        'main_archive_hostname': main_archive_hostname,
 
232
        'main_archive_directory': main_archive_directory,
 
233
        'ports_archive_hostname': ports_archive_hostname,
 
234
        'ports_archive_directory': ports_archive_directory,
219
235
        'release': release,
220
236
        'server_host': server_host,
221
237
        'server_url': absolute_reverse('nodes_handler', base_url=base_url),
222
238
        'metadata_enlist_url': absolute_reverse('enlist', base_url=base_url),
 
239
        'http_proxy': Config.objects.get_config('http_proxy'),
223
240
        }
224
241
 
225
242