Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions definitions/features/puppet_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ class Features::PuppetServer < ForemanMaintain::Feature
label :puppet_server

confine do
find_package('puppet-server') || find_package('puppetserver') || find_package('puppet')
find_package('puppet-server') ||
find_package('openvox-server') ||
find_package('puppetserver') ||
find_package('puppet')
end
end

Expand All @@ -23,7 +26,13 @@ def services
# We only check puppetserver and not puppet-server, as puppet-server
# is a part of httpd and relies on httpd service to restart, therefore
# not requiring a separate service to restart
find_package('puppetserver') ? [system_service('puppetserver', 30)] : []
return [system_service('puppetserver', 30)] if find_package('puppetserver') ||
find_package('openvox-server')
[]
end

def openvox?
find_package('openvox-server')
end
Comment on lines +34 to 36
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this used for?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To find out if openvox is used. I think this is used for a downstream check. Hopefully it does not bother.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

downstream in orcharino? that's fine! I was just a bit confused as I didn't see it used anywhere in this PR.


def find_empty_cacert_request_files
Expand Down
1 change: 1 addition & 0 deletions definitions/procedures/restore/required_packages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def run
backup = ForemanMaintain::Utils::Backup.new(@backup_dir)
required_packages = []
required_packages << 'puppetserver' if backup.with_puppetserver?
required_packages << 'openvox-server' if backup.with_openvoxserver?
if required_packages.any?
with_spinner('Installing required packages') do
ForemanMaintain.package_manager.install(required_packages, assumeyes: true)
Expand Down
4 changes: 4 additions & 0 deletions lib/foreman_maintain/utils/backup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ def with_puppetserver?
installed_rpms.any? { |rpm| rpm.start_with?('puppetserver-') }
end

def with_openvoxserver?
installed_rpms.any? { |rpm| rpm.start_with?('openvox-server-') }
end

def source_os_version
metadata.fetch('os_version', 'unknown')
end
Expand Down
16 changes: 16 additions & 0 deletions test/definitions/procedures/restore/required_packages_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,22 @@
Procedures::Restore::RequiredPackages.new(:backup_dir => '.')
end

it 'installs openvox-server if it was in the backup' do
ForemanMaintain::Utils::Backup.any_instance.stubs(:with_openvoxserver?).returns(true)
ForemanMaintain.package_manager.expects(:install).
with(['openvox-server'], assumeyes: true).once
result = run_procedure(subject)
assert result.success?, 'the procedure was expected to succeed'
end

it 'doesnt install openvox-server if it wasnt in the backup' do
ForemanMaintain::Utils::Backup.any_instance.stubs(:with_openvoxserver?).returns(false)
ForemanMaintain.package_manager.expects(:install).
with(['openvox-server'], assumeyes: true).never
result = run_procedure(subject)
assert result.success?, 'the procedure was expected to succeed'
end

it 'installs puppetserver if it was in the backup' do
ForemanMaintain::Utils::Backup.any_instance.stubs(:with_puppetserver?).returns(true)
ForemanMaintain.package_manager.expects(:install).
Expand Down