Example #1
0
    def __init__(self, api_client, **kwargs):
        super(Machine, self).__init__(api_client, **kwargs)

        # Replace generic dicts with interface collection model
        if getattr(self, 'resource_id', None):
            self.interfaces = maas_interface.Interfaces(
                api_client, system_id=self.resource_id)
            self.interfaces.refresh()
            try:
                self.block_devices = maas_blockdev.BlockDevices(
                    api_client, system_id=self.resource_id)
                self.block_devices.refresh()
            except Exception:
                self.logger.warning("Failed loading node %s block devices." %
                                    (self.resource_id))
            try:
                self.volume_groups = maas_vg.VolumeGroups(
                    api_client, system_id=self.resource_id)
                self.volume_groups.refresh()
            except Exception:
                self.logger.warning("Failed load node %s volume groups." %
                                    (self.resource_id))
        else:
            self.interfaces = None
            self.block_devices = None
            self.volume_groups = None
Example #2
0
    def __init__(self, api_client, **kwargs):
        super(Machine, self).__init__(api_client, **kwargs)

        # Replace generic dicts with interface collection model
        if getattr(self, 'resource_id', None) is not None:
            self.interfaces = maas_interface.Interfaces(
                api_client, system_id=self.resource_id)
            self.interfaces.refresh()