+ def sfa_install_all (self):
+ "yum install sfa sfa-plc sfa-sfatables sfa-client"
+ return self.yum_install ("sfa sfa-plc sfa-sfatables sfa-client")
+
+ def sfa_install_core(self):
+ "yum install sfa"
+ return self.yum_install ("sfa")
+
+ def sfa_install_plc(self):
+ "yum install sfa-plc"
+ return self.yum_install("sfa-plc")
+
+ def sfa_install_sfatables(self):
+ "yum install sfa-sfatables"
+ return self.yum_install ("sfa-sfatables")
+
+ # for some very odd reason, this sometimes fails with the following symptom
+ # # yum install sfa-client
+ # Setting up Install Process
+ # ...
+ # Downloading Packages:
+ # Running rpm_check_debug
+ # Running Transaction Test
+ # Transaction Test Succeeded
+ # Running Transaction
+ # Transaction couldn't start:
+ # installing package sfa-client-2.1-7.onelab.2012.05.23.i686 needs 68KB on the / filesystem
+ # [('installing package sfa-client-2.1-7.onelab.2012.05.23.i686 needs 68KB on the / filesystem', (9, '/', 69632L))]
+ # even though in the same context I have
+ # [2012.05.23--f14-32-sfastd1-1-vplc07] / # df -h
+ # Filesystem Size Used Avail Use% Mounted on
+ # /dev/hdv1 806G 264G 501G 35% /
+ # none 16M 36K 16M 1% /tmp
+ #
+ # so as a workaround, we first try yum install, and then invoke rpm on the cached rpm...
+ def sfa_install_client(self):
+ "yum install sfa-client"
+ first_try=self.yum_install("sfa-client")
+ if first_try: return True
+ utils.header ("********** Regular yum failed - special workaround in place, 2nd chance")
+ (code,cached_rpm_path)=utils.output_of(self.actual_command_in_guest('find /var/cache/yum -name sfa-client\*.rpm'))
+ utils.header("rpm_path=<<%s>>"%rpm_path)
+ # just for checking
+ self.run_in_guest("rpm -i %s"%cached_rpm_path)
+ return self.yum_check_installed ("sfa-client")
+
+ def sfa_dbclean(self):
+ "thoroughly wipes off the SFA database"
+ return self.run_in_guest("sfaadmin reg nuke")==0 or \
+ self.run_in_guest("sfa-nuke.py")==0 or \
+ self.run_in_guest("sfa-nuke-plc.py")==0
+
+ def sfa_fsclean(self):
+ "cleanup /etc/sfa/trusted_roots and /var/lib/sfa"
+ self.run_in_guest("rm -rf /etc/sfa/trusted_roots /var/lib/sfa/authorities")
+ return True
+
+ def sfa_plcclean(self):
+ "cleans the PLC entries that were created as a side effect of running the script"
+ # ignore result
+ sfa_spec=self.plc_spec['sfa']
+
+ for auth_sfa_spec in sfa_spec['auth_sfa_specs']:
+ login_base=auth_sfa_spec['login_base']
+ try: self.apiserver.DeleteSite (self.auth_root(),login_base)
+ except: print "Site %s already absent from PLC db"%login_base
+
+ for spec_name in ['pi_spec','user_spec']:
+ user_spec=auth_sfa_spec[spec_name]
+ username=user_spec['email']
+ try: self.apiserver.DeletePerson(self.auth_root(),username)
+ except:
+ # this in fact is expected as sites delete their members
+ #print "User %s already absent from PLC db"%username
+ pass
+
+ print "REMEMBER TO RUN sfa_import AGAIN"
+ return True