+ def sfa_get_expires (self, options):
+ filename = "{}.json".format(self.hrn())
+ # /root/sfi/pg/<>
+ inplc_filename = os.path.join(self.sfi_path(),filename)
+ # /vservers/<>/root/sfi/... - cannot use os.path
+ inbox_filename = "{}{}".format(self.test_plc.vm_root_in_host(), inplc_filename)
+ sfi_command = ""
+ sfi_command += "-R {} --rawformat json".format(inplc_filename)
+ sfi_command += " status"
+ sfi_command += " {}".format(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 open(filename) as f:
+ status = json.loads(f.read())
+ value = status['value']
+ sliver = value['geni_slivers'][0]
+ expires = sliver['geni_expires']
+ print(" * expiration for {} (first sliver) -> {}".format(self.hrn(), expires))
+ return expires
+ except:
+ traceback.print_exc()
+