clean_all_sites performs deep cleaning - useful when used in conjunction with the...
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Thu, 29 May 2008 15:23:41 +0000 (15:23 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Thu, 29 May 2008 15:23:41 +0000 (15:23 +0000)
system/Makefile
system/TestApiserver.py
system/TestPlc.py

index 10f2063..06f2817 100644 (file)
@@ -1,16 +1,26 @@
 tags:
        find . '(' -name '*.py' -o -name 'qemu-*' ')' | grep -v '.svn/' | xargs etags
 
+.PHONY: tags
 
-LOCAL_RSYNC_EXCLUDES   := --exclude '*.pyc' --exclude 'arg*' 
+####################
+
+########## make sync PLCHOST=hostname VSERVER=vservername
+ifdef PLCHOST
+ifdef BUILDNAME
+PLCSSH:=root@$(PLCHOST):$(BUILDNAME)
+endif
+endif
+
+LOCAL_RSYNC_EXCLUDES   := --exclude '*.pyc' --exclude 'arg*'
 RSYNC_EXCLUDES         := --exclude .svn --exclude CVS --exclude '*~' --exclude TAGS $(LOCAL_RSYNC_EXCLUDES)
 RSYNC_COND_DRY_RUN     := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
 RSYNC                  := rsync -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
 
 sync:
-ifeq (,$(RSYNC_URL))
-       echo "sync: You must define target host as RSYNC_URL on the command line"
-       echo " e.g. make sync RSYNC_URL=root@testbox1:workdir" ; exit 1
+ifeq (,$(PLCSSH))
+       echo "sync: You must define PLCHOST and BUILDNAME on the command line"
+       echo " e.g. make sync PLCHOST=private.one-lab.org BUILDNAME=" ; exit 1
 else
-       +$(RSYNC) ./ $(RSYNC_URL)/
+       +$(RSYNC) ./ $(PLCSSH)
 endif
index 006c990..5d49a23 100644 (file)
@@ -37,6 +37,7 @@ server_methods = [ ('GetNodes' ,  []),
                    ('DeletePerson' , True),
                    ('AddPersonKey' , True),
                    ('GetPlcRelease', {'build': {'target-arch':'i386'}}),
+                   ('GetSites', []),
                    ]
 
 class TestApiserver:
index d1f2320..e7c9556 100644 (file)
@@ -72,7 +72,8 @@ class TestPlc:
                      'check_initscripts', 'check_tcp',SEP,
                      'force_gather_logs', 'force_kill_qemus', 'force_record_tracker','force_free_tracker' ]
     other_steps = [ 'stop_all_vservers','fresh_install', 'cache_rpm', 'stop', 'vs_start', SEP,
-                    'clean_initscripts', 'clean_sites', 'clean_nodes', 
+                    'clean_initscripts', 'clean_all_sites',
+                    'clean_sites', 'clean_nodes', 
                     'clean_slices', 'clean_keys', SEP,
                     'show_boxes', 'list_all_qemus', 'list_qemus', SEP,
                     'db_dump' , 'db_restore', ' cleanup_tracker',
@@ -390,6 +391,13 @@ class TestPlc:
                 test_site.create_users()
         return True
 
+    def clean_all_sites (self):
+        print 'auth_root',self.auth_root()
+        site_ids = [s['site_id'] for s in self.apiserver.GetSites(self.auth_root(), {}, ['site_id'])]
+        for site_id in site_ids:
+            print 'Deleting site_id',site_id
+            self.apiserver.DeleteSite(self.auth_root(),site_id)
+
     def nodes (self):
         return self.do_nodes()
     def clean_nodes (self):