def __init__(self, shell=None): if shell is None: shell = citizenshell.LocalShell() assert isinstance(shell, citizenshell.abstractshell.AbstractShell) self.shell = shell self._hw_info = None self._os_info = None
def _shell(self): if self.ip in (None, "127.0.0.1", "localhost"): return ptShell(citizenshell.LocalShell()) if self.ssh_user: return ptShell( citizenshell.SecureShell(hostname=self.ip, username=self.ssh_user, password=self.ssh_password)) return None
def __init__(self, shell=None): if shell is None: shell = citizenshell.LocalShell() assert isinstance(shell, citizenshell.LocalShell) or isinstance( shell, citizenshell.SecureShell) self.shell = shell self._hw_info = None self._os_info = None
def _coverage(): logging.basicConfig(level=logging.DEBUG) sh = ptShell(citizenshell.LocalShell()) print("os family: ", sh.os_info.family) print("os version: ", sh.os_info.version) print("hostname: ", sh.os_info.hostname) print("uuid: ", sh.hw_info.uuid) print("uuid: ", sh.hw_info.uuid) print("serial: ", sh.hw_info.serial) print("vendor: ", sh.hw_info.vendor) print("model: ", sh.hw_info.model) print("cpu_model: ", sh.hw_info.cpu_model) print("cpu_freq_ghz: ", sh.hw_info.cpu_freq_ghz) print("cpu_count: ", sh.hw_info.cpu_count) print("ram_kb: ", sh.hw_info.ram_kb)