+ def sfa_get_expires (self, options):
+ filename="%s.json"%self.hrn()
+ # /root/sfi/pg/<>
+ inplc_filename=os.path.join(self.sfi_path(),filename)
+ # /vservers/<>/root/sfi/... - cannot use os.path
+ inbox_filename="%s%s"%(self.test_plc.vm_root_in_host(),inplc_filename)
+ sfi_command =""
+ sfi_command += "-R %s --rawformat json"%inplc_filename
+ sfi_command += " status"
+ sfi_command += " %s"%self.hrn()
+ # cannot find it if sfi status returns an error
+ if self.test_plc.run_in_guest (self.sfi_user(sfi_command)) !=0: return
+ if self.test_plc.test_ssh.fetch(inbox_filename,filename)!=0: return
+ try:
+ with file(filename) as f: status = json.loads(f.read())
+ value=status['value']
+ sliver=value['geni_slivers'][0]
+ expires=sliver['geni_expires']
+ print " * expiration for %s (first sliver) -> %s"%(self.hrn(),expires)
+ return expires
+ except:
+ traceback.print_exc()
+