#
import re
-
from types import StringTypes
from PLC.Faults import *
from PLC.Filter import Filter
from PLC.Table import Row, Table
+from PLC.Nodes import Nodes,Node
+from PLC.Slices import Slices,Slice
+
class Peer (Row):
"""
Stores the list of peering PLCs in the peers table.
'peername' : Parameter (str, "Peer name"),
'peer_url' : Parameter (str, "Peer API url"),
'person_id' : Parameter (int, "Person_id of the account storing credentials - temporary"),
- 'node_ids' : Parameter ([int], "This peer's nodes ids")
+ 'node_ids' : Parameter ([int], "This peer's nodes ids"),
+ 'slice_ids' : Parameter ([int], "This peer's slices ids"),
}
def validate_peer_url (self, url):
assert 'peer_id' in self
+ # remove nodes depending on this peer
+ for foreign_node in Nodes (self.api, self['node_ids']):
+ foreign_node.delete(commit)
+
+ # remove the peer
self['deleted'] = True
self.sync(commit)