pub(crate) fn check_for_firewall_config(
        &mut self,
        registry_version: RegistryVersion,
    ) -> OrchestratorResult<()> {
        match self.registry.get_firewall_config(registry_version) {
            Ok(registry_fw_config) => {
                // Data found in registry!
                self.update_config_from_pb(registry_fw_config);
                self.source = DataSource::Registry;
            }
            Err(e) => {
                // No data was found in registry
                match self.source {
                    DataSource::Registry => warn!(
                        every_n_seconds => 300,
                        self.logger,
                        "Firewall configuration was not found in registry. Using previously fetched data. (Error from registry: {:?})",
                        e
                    ),
                    DataSource::Config => warn!(
                        every_n_seconds => 300,
                        self.logger,
                        "Firewall configuration was not found in registry. Using config file instead. (Error from registry: {:?})",
                        e
                    ),
                };
            }
        }

        let content = self.generate_firewall_file_content_full();

        let changed = content.ne(&self.compiled_config);
        if changed {
            // Firewall config is different - update it
            info!(
                self.logger,
                "New firewall configuration found (source: {:?}). Updating local firewall.",
                self.source
            );
        }

        if changed || self.must_write {
            if content.is_empty() {
                warn!(
                    self.logger,
                    "No firewall configuration found. Orchestrator will not write any config to a file."
                );
            } else {
                let f = &self.configuration.config_file;
                write_string_using_tmp_file(f, content.as_str())
                    .map_err(|e| OrchestratorError::file_write_error(f, e))?;
                self.compiled_config = content;
            }
            self.must_write = false;
        }

        Ok(())
    }
/// Checks for new firewall config, and if found, update local firewall
/// rules
Checks for new firewall config, and if found, update local firewall
rules
Checks for new firewall config and if found update local firewall rules
pub(crate) fn check_for_firewall_config(
        &mut self,
        registry_version: RegistryVersion,
    ) -> OrchestratorResult<()> {
        match self.registry.get_firewall_config(registry_version) {
            Ok(registry_fw_config) => {
                // Data found in registry!
                self.update_config_from_pb(registry_fw_config);
                self.source = DataSource::Registry;
            }
            Err(e) => {
                // No data was found in registry
                match self.source {
                    DataSource::Registry => warn!(
                        every_n_seconds => 300,
                        self.logger,
                        "Firewall configuration was not found in registry. Using previously fetched data. (Error from registry: {:?})",
                        e
                    ),
                    DataSource::Config => warn!(
                        every_n_seconds => 300,
                        self.logger,
                        "Firewall configuration was not found in registry. Using config file instead. (Error from registry: {:?})",
                        e
                    ),
                };
            }
        }
        let content = self.generate_firewall_file_content_full();
        let changed = content.ne(&self.compiled_config);
        if changed {
            // Firewall config is different - update it
            info!(
                self.logger,
                "New firewall configuration found (source: {:?}). Updating local firewall.",
                self.source
            );
        }
        if changed || self.must_write {
            if content.is_empty() {
                warn!(
                    self.logger,
                    "No firewall configuration found. Orchestrator will not write any config to a file."
                );
            } else {
                let f = &self.configuration.config_file;
                write_string_using_tmp_file(f, content.as_str())
                    .map_err(|e| OrchestratorError::file_write_error(f, e))?;
                self.compiled_config = content;
            }
            self.must_write = false;
        }
        Ok(())
    }
pub ( crate ) fn check_for_firewall_config ( & mut self , registry_version : RegistryVersion , ) -> OrchestratorResult < ( ) > { match self . registry . get_firewall_config ( registry_version ) { Ok ( registry_fw_config ) => { // Data found in registry! self . update_config_from_pb ( registry_fw_config ) ; self . source = DataSource :: Registry ; } Err ( e ) => { // No data was found in registry match self . source { DataSource :: Registry => warn ! ( every_n_seconds 300 self logger " " e ) , DataSource :: Config => warn ! ( every_n_seconds 300 self logger " " e ) , } ; } } let content = self . generate_firewall_file_content_full ( ) ; let changed = content . ne ( & self . compiled_config ) ; if changed { // Firewall config is different - update it info ! ( self logger " " self source ) ; } if changed || self . must_write { if content . is_empty ( ) { warn ! ( self logger " " ) ; } else { let f = & self . configuration . config_file ; write_string_using_tmp_file ( f , content . as_str ( ) ) . map_err ( | e | OrchestratorError :: file_write_error ( f , e ) ) ? ; self . compiled_config = content ; } self . must_write = false ; } Ok ( ( ) ) }
Checks for new firewall config, and if found, update local firewall
rules
Checks for new firewall config and if found update local firewall rules
&mut self
registry_version
RegistryVersion
&mut self
registry_version
RegistryVersion