Ejemplo n.º 1
0
 def download_configs(self):
     log.info(
         f"Downloading latest NordVPN OpenVPN configuration files to '{paths.OVPN_CONFIGS}'."
     )
     try:
         zip_file, etag = nordapi.get_ovpn_configs()
     except ValueError:
         log.info("Configuration files already up-to-date.")
         return
     self.delete_configs()
     utils.extract_zip(zip_file, paths.OVPN_CONFIGS)
     self.config_info = etag
Ejemplo n.º 2
0
    def get_configs(self):
        self.logger.info(
            "Downloading latest NordVPN OpenVPN configuration files to '%s'." %
            paths.OVPN_CONFIGS)

        etag = self.get_config_info()
        config_data = nordapi.get_configs(etag)
        if config_data is False:
            self.logger.error(
                "Failed to retrieve configuration files from NordVPN")
            return False
        elif config_data:
            zip_file, etag = config_data
            if zip_file and etag:
                self.delete_configs()

                if not utils.extract_zip(zip_file, paths.OVPN_CONFIGS):
                    self.logger.error("Failed to extract configuration files")
                    return False

                if not self.set_config_info(etag):
                    return False
            else:
                self.logger.info("Configuration files already up-to-date.")

            return True
Ejemplo n.º 3
0
    def get_configs(self):
        self.logger.info(
            "Downloading latest NordVPN OpenVPN configuration files to '%s'." %
            paths.DIR_OVPN)

        configs = nordapi.get_configs()
        if configs:
            if not utils.extract_zip(configs, paths.DIR_OVPN):
                self.logger.error("Failed to extract configuration files")
        else:
            self.logger.error(
                "Failed to retrieve configuration files from NordVPN")