diff --git a/lib/foreman_maintain/utils/backup.rb b/lib/foreman_maintain/utils/backup.rb index aa2d9ade5..a6351c43a 100644 --- a/lib/foreman_maintain/utils/backup.rb +++ b/lib/foreman_maintain/utils/backup.rb @@ -183,24 +183,7 @@ def dumps_for_hybrid_db_setup(dbs_hash) def validate_hostname? # make sure that the system hostname is the same as the backup - hostname_from_metadata = metadata.fetch('hostname', nil) - if hostname_from_metadata - hostname_from_metadata == hostname - else - config_tarball = file_map[:config_files][:path] - tar_cmd = "tar zxf #{config_tarball} etc/httpd/conf/httpd.conf --to-stdout --occurrence=1" - status, httpd_config = execute_with_status(tar_cmd) - - # Incremental backups sometimes don't include httpd.conf. Since a "base" backup - # is restored before an incremental, we can assume that the hostname is checked - # during the base backup restore - if status == 0 - match = httpd_config.match(/\s*ServerName\s+"*([^ "]+)"*\s*$/) - match ? match[1] == hostname : false - else - true - end - end + metadata.fetch('hostname', nil) == hostname end def validate_interfaces diff --git a/test/files/backups/katello_standard_pulpcore_database/metadata.yml b/test/files/backups/katello_standard_pulpcore_database/metadata.yml new file mode 100644 index 000000000..8b6b86367 --- /dev/null +++ b/test/files/backups/katello_standard_pulpcore_database/metadata.yml @@ -0,0 +1,22 @@ +--- +os_version: CentOS Stream 8 +plugin_list: +- foreman-tasks-9.1.1 +- foreman_puppet-6.3.0 +- foreman_remote_execution-13.1.0 +- katello-4.13.0.pre.master +proxy_features: +- dynflow +- logs +- pulpcore +- puppet +- puppetca +- script +incremental: false +online: false +hostname: sat-6.example.com +proxy_config: + dhcp: false + dhcp_interface: eth0 + dns: false + dns_interface: eth0