also expose is_bootstrapped

pull/36085/head
Trey Moen 5 days ago
parent ab25580a97
commit 3d39ef05e8
  1. 10
      system/athena/athenad.py
  2. 3
      system/hardware/base.py
  3. 10
      system/hardware/tici/esim.py

@ -561,8 +561,14 @@ def getNetworks():
@dispatcher.add_method
def getEsimProfiles():
return [asdict(p) for p in HARDWARE.get_sim_lpa().list_profiles()]
def getEsim():
lpa = HARDWARE.get_sim_lpa()
profiles = [asdict(p) for p in lpa.list_profiles()]
is_bootstrapped = lpa.is_bootstrapped()
return {
"profiles": profiles,
"is_bootstrapped": is_bootstrapped
}
@dispatcher.add_method

@ -65,6 +65,9 @@ class ThermalConfig:
class LPABase(ABC):
@abstractmethod
def bootstrap(self) -> None:
@abstractmethod
def is_bootstrapped(self) -> bool:
pass
@abstractmethod

@ -87,16 +87,16 @@ class TiciLPA(LPABase):
self._disable_profile(p.iccid)
self.delete_profile(p.iccid)
def is_bootstrapped(self) -> bool:
""" check if any comma provisioned profiles are on the eUICC """
return not any(self.is_comma_profile(iccid) for iccid in (p.iccid for p in self.list_profiles()))
def _disable_profile(self, iccid: str) -> None:
self._validate_successful(self._invoke('profile', 'disable', iccid))
self._process_notifications()
def _check_bootstrapped(self) -> None:
assert self._is_bootstrapped(), 'eUICC is not bootstrapped, please bootstrap before performing this operation'
def _is_bootstrapped(self) -> bool:
""" check if any comma provisioned profiles are on the eUICC """
return not any(self.is_comma_profile(iccid) for iccid in (p.iccid for p in self.list_profiles()))
assert self.is_bootstrapped(), 'eUICC is not bootstrapped, please bootstrap before performing this operation'
def _invoke(self, *cmd: str):
proc = subprocess.Popen(['sudo', '-E', 'lpac'] + list(cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=self.env)

Loading…
Cancel
Save