def __init__(self, dev): """ Initialize the EdenOSManager object. :param dev: The device that the object will manage """ self.dev = dev self.fs = EdenFS(dev) self.client = EdenOSClient(dev)
class EdenOSManager: def __init__(self, dev): """ Initialize the EdenOSManager object. :param dev: The device that the object will manage """ self.dev = dev self.fs = EdenFS(dev) self.client = EdenOSClient(dev) def analyse(self): """ Analyse the device. :return: None """ eden_os = self.client.is_edenos() if not eden_os: print 'The device does not contain EdenOS, or the OS on it is outdated or corrupted.' self.client.install_edenos() eden_fs = self.fs.is_edenfs() if not eden_fs: print 'The device does not contain an EdenFS filesystem.' resp = raw_input('Would you like to choose a directory that will serve as root? (Y/N) ').upper() while resp != 'Y' and resp != 'N': resp = raw_input('Would you like to choose a directory that will serve as root? (Y/N) ').upper() if resp == 'Y': root_dir = raw_input("Please specify the path: ") while not os.path.exists(root_dir): root_dir = raw_input("Path does not exist. Please specify the path: ") else: root_dir = None self.fs.format_edenfs() if root_dir: self.fs.import_dir(root_dir, '/')