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

« back to all changes in this revision

Viewing changes to src/maasserver/models/bootresourcefile.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:
20
20
    CharField,
21
21
    ForeignKey,
22
22
    )
 
23
from django.db.models.signals import post_delete
 
24
from django.dispatch import receiver
23
25
from maasserver import DefaultMeta
24
26
from maasserver.enum import (
25
27
    BOOT_RESOURCE_FILE_TYPE,
64
66
 
65
67
    filetype = CharField(
66
68
        max_length=20, choices=BOOT_RESOURCE_FILE_TYPE_CHOICES,
67
 
        default=BOOT_RESOURCE_FILE_TYPE.TGZ, editable=False)
 
69
        default=BOOT_RESOURCE_FILE_TYPE.ROOT_TGZ, editable=False)
68
70
 
69
71
    extra = JSONObjectField(blank=True, default="", editable=False)
70
72
 
71
73
    def __repr__(self):
72
74
        return "<BootResourceFile %s/%s>" % (self.filename, self.filetype)
 
75
 
 
76
 
 
77
@receiver(post_delete)
 
78
def delete_large_file(sender, instance, **kwargs):
 
79
    """Call delete on the LargeFile, now that the relation has been removed.
 
80
    If this was the only resource file referencing this LargeFile then it will
 
81
    be delete.
 
82
 
 
83
    This is done using the `post_delete` signal because only then has the
 
84
    relation been removed.
 
85
    """
 
86
    if sender == BootResourceFile:
 
87
        try:
 
88
            largefile = instance.largefile
 
89
        except LargeFile.DoesNotExist:
 
90
            largefile = None
 
91
        if largefile is not None:
 
92
            largefile.delete()