3 from PLC.Faults import *
4 from PLC.Method import Method
5 from PLC.Parameter import Parameter, Mixed
6 from PLC.Sites import Site, Sites
7 from PLC.Persons import Person, Persons
8 from PLC.Nodes import Node, Nodes
9 from PLC.PCUs import PCU, PCUs
10 from PLC.Auth import Auth
11 from PLC.SFA import SFA
13 class DeleteSite(Method):
15 Mark an existing site as deleted. The accounts of people who are
16 not members of at least one other non-deleted site will also be
17 marked as deleted. Nodes, PCUs, and slices associated with the
20 Returns 1 if successful, faults otherwise.
27 Mixed(Site.fields['site_id'],
28 Site.fields['login_base'])
31 returns = Parameter(int, '1 if successful')
33 def call(self, auth, site_id_or_login_base):
34 # Get account information
35 sites = Sites(self.api, [site_id_or_login_base])
37 raise PLCInvalidArgument, "No such site"
40 if site['peer_id'] is not None:
41 raise PLCInvalidArgument, "Not a local site"
46 self.event_objects = {'Site': [site['site_id']]}
47 self.message = 'Site %d deleted' % site['site_id']
50 sfa.delete_record(site, 'site')