def register_change(self): self.backup_set._build_file_selection() self.backup_set._build_regex_exclusions() if set(self.orig) != set(self.data): self._changes[self.name] = show_change(self.orig, self.data) elif self.name in self._changes: del self._changes[self.name]
def unlock_destination(self, destination_guid): """Unlocks an in-use destination, allowing the device owner to remove this destination from their backup. Raises a :class:`Py42Error` if the supplied destination guid is not in use on this backup set, or not available to the parent device/org. """ destination_guid = str(destination_guid) self._raise_if_invalid_destination(destination_guid) if destination_guid not in self.destinations: raise destination_not_added_error else: for d in self.data[u"destinations"]: if d[u"@id"] == destination_guid: del d[u"@locked"] self._changes[u"destinations"] = show_change( self._orig_destinations, self.destinations)
def remove_destination(self, destination_guid): """Removes a destination from use by this backup set. Args: destination_guid (str, int): The globally unique identifier of the destination to be removed. """ destination_guid = str(destination_guid) self._raise_if_invalid_destination(destination_guid) if destination_guid in self.destinations: for d in self.data[u"destinations"]: if d[u"@id"] == destination_guid: self.data[u"destinations"].remove(d) self._changes[u"destinations"] = show_change( self._orig_destinations, self.destinations)
def add_destination(self, destination_guid): """Adds a destination to be used by this backup set. Raises a :class:`Py42Error` if the supplied destination guid is not available to the parent device/org. Args: destination_guid (str, int): The globally unique identifier of the destination to be added. """ destination_guid = str(destination_guid) if destination_guid in self._manager.available_destinations: if destination_guid not in self.destinations: self.data[u"destinations"].append({u"@id": destination_guid}) self._changes[u"destinations"] = show_change( self._orig_destinations, self.destinations) else: raise invalid_destination_error
def lock_destination(self, destination_guid): """Locks an in-use destination, disallowing the device owner from removing this destination from their backup. Raises a :class:`Py42Error` if the supplied destination guid is not in use on this backup set, or not available to the parent device/org. """ destination_guid = str(destination_guid) if destination_guid in self._manager.available_destinations: if destination_guid not in self.destinations: raise destination_not_added_error else: for d in self.data[u"destinations"]: if d[u"@id"] == destination_guid: d[u"@locked"] = u"true" self._changes[u"destinations"] = show_change( self._orig_destinations, self.destinations) else: raise invalid_destination_error