fix bugs
diff --git a/plstackapi/importer/plclassic/importer.py b/plstackapi/importer/plclassic/importer.py
index 8315431..b113787 100644
--- a/plstackapi/importer/plclassic/importer.py
+++ b/plstackapi/importer/plclassic/importer.py
@@ -16,7 +16,7 @@
self.auth = auth
def __call__(self, *args, **kwds):
- a = [auth] + args
+ a = [self.auth] + list(args)
return self.callable(*a)
class API():
@@ -34,15 +34,15 @@
def __init__(self, username, password, url):
api = API(username, password, url)
self.sites = SiteImporter(api)
- self.slices = SliceImporter(api, remote_sites=self.sites.remote_sites, local_sites=self.sites.local_sites)
+ self.slices = SliceImporter(api)
self.users = UserImporter(api)
self.slivers = SliverImporter(api)
def run(self):
- self.roles.run()
self.sites.run()
self.users.run()
- self.slices.run()
+ self.slices.run(remote_sites=self.sites.remote_sites,
+ local_sites=self.sites.local_sites)
self.slivers.run()
@@ -67,5 +67,4 @@
print
sys.exit(0)
-
Importer(config.username, password, config.url).run()
diff --git a/plstackapi/importer/plclassic/site_importer.py b/plstackapi/importer/plclassic/site_importer.py
index 90ecf9b..1802f6f 100644
--- a/plstackapi/importer/plclassic/site_importer.py
+++ b/plstackapi/importer/plclassic/site_importer.py
@@ -11,8 +11,10 @@
db_sites = Site.objects.all()
for db_site in db_sites:
self.local_sites[db_site.login_base] = db_site
+ print "%s local sites" % len(db_sites)
sites = self.api.GetSites()
+ print "%s remote sites" %s len(sites))
count = 0
for site in sites:
self.remote_sites[site['site_id']] = site
diff --git a/plstackapi/importer/plclassic/slice_importer.py b/plstackapi/importer/plclassic/slice_importer.py
index 0db9136..98c37ec 100644
--- a/plstackapi/importer/plclassic/slice_importer.py
+++ b/plstackapi/importer/plclassic/slice_importer.py
@@ -12,6 +12,7 @@
sites = self.api.GetSites()
for site in sites:
remote_sites[site['site_id']] = site
+
if not local_sites:
from models import Site
@@ -22,8 +23,10 @@
db_slices = Slice.objects.all()
for db_slice in db_slices:
self.local_slices[db_slice.name] = db_slice
+ print "%s local slices" % len(db_slices)
slices = api.GetSlices()
+ print "%s remote sites" %s len(slices)
count = 0
for slice in slices:
self.remote_slice[slice['slice_id']] = slice