blob: 3a2113f92a7221a2b008f656b5c9b49cbb1e9fc9 [file] [log] [blame]
Tony Mackf593dba2013-03-24 13:17:43 -04001import xmlrpclib
2from importer.planetstack.role_importer import RoleImporter
3from importer.planetstack.site_importer import SiteImporter
4from importer.planetstack.user_importer import UserImporter
5from importer.planetstack.slice_importer import SliceImporter
6from importer.planetstack.sliver_importer import SliverImporter
7
8
9class Call:
10 def __init__(self, callable, auth):
11 self.callable = callable
12 self.auth = auth
13
14 def __call__(self, *args, **kwds):
15 a = [auth] + args
16 return self.callable(*a)
17
18class API():
19 def __init__(self):
Tony Mack8eeddf92013-03-26 13:42:59 -040020 self.auth = {'AuthMethod': 'password',
21 'Username': None,
22 'AuthString': None}
Tony Mackf593dba2013-03-24 13:17:43 -040023 self.server = xmlrpclib.ServerProxy("URL", allow_none=True)
24
25 def __getattr__(self, name):
26 return Call(getattr(self.server, name), self.auth)
27
28class Importer:
29
30 def __init__(self):
31 self.api = API()
32 self.roles = RoleImporter(self)
33 self.sites = SiteImporter(self)
34 self.users = UserImporter(self)
35 self.slices = SliceImporter(self)
36 self.slivers = SliverImporter(self)
37
38 def run(self):
39 self.roles.run()
40 self.sites.run()
41 self.users.run()
42 self.slices.run()
43 self.slivers.run()
44
45