def save_active_servers(self, active_servers, path): try: with open(paths.ACTIVE_SERVERS, 'wb') as fp: pickle.dump(active_servers, fp) utils.chown_path_to_user(paths.ACTIVE_SERVERS) except Exception as ex: self.logger.error(ex)
def create_directories(self): if not os.path.exists(paths.ROOT): os.mkdir(paths.ROOT) utils.chown_path_to_user(paths.ROOT) if not os.path.exists(paths.OVPN_CONFIGS): os.mkdir(paths.OVPN_CONFIGS) utils.chown_path_to_user(paths.OVPN_CONFIGS)
def create_directories(self): if not os.path.exists(paths.DIR_ROOT): os.mkdir(paths.DIR_ROOT) utils.chown_path_to_user(paths.DIR_ROOT) if not os.path.exists(paths.DIR_OVPN): os.mkdir(paths.DIR_OVPN) utils.chown_path_to_user(paths.DIR_OVPN)
def ensure_config_dirs(self): try: os.mkdir(paths.ROOT) utils.chown_path_to_user(paths.ROOT) os.mkdir(paths.OVPN_CONFIGS) utils.chown_path_to_user(paths.OVPN_CONFIGS) except FileExistsError: pass
def save(self): try: with open(self.path, 'w') as settings_file: self.settings.write(settings_file) utils.chown_path_to_user(self.path) self.logger.info("Settings saved successfully.") return True except Exception as ex: self.logger.error(ex) return False
def save(self): try: with open(self.path, 'w') as config_file: self.config.write(config_file) utils.chown_path_to_user(self.path) return True except Exception as ex: self.logger.error(ex) return False
def active_servers(self, value): with open(paths.ACTIVE_SERVERS, 'wb') as fp: pickle.dump(value, fp) utils.chown_path_to_user(paths.ACTIVE_SERVERS)