Beispiel #1
0
 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)
Beispiel #2
0
    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)
Beispiel #3
0
    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)
Beispiel #4
0
 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
Beispiel #6
0
    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
Beispiel #7
0
 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)