-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor satellite_upgrade_services to use SystemdServicesTasks
We used to just delete the symlinks in /etc/systemd, but with the new systemd actors this doesn't work anymore as they will restore the pre-delete state because they by default aim at having source and target systems match in terms of services. By using SystemdServicesTasks we can explicitly turn those services off and inform all interested parties about this.
- Loading branch information
1 parent
720bb13
commit bad2fb2
Showing
2 changed files
with
31 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...de/common/actors/satellite_upgrade_services/tests/unit_test_satellite_upgrade_services.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import glob | ||
|
||
from leapp.models import SatelliteFacts, SatellitePostgresqlFacts, SystemdServicesTasks | ||
|
||
|
||
def test_disable_httpd(monkeypatch, current_actor_context): | ||
def mock_glob(): | ||
orig_glob = glob.glob | ||
|
||
def mocked_glob(pathname): | ||
if pathname == '/etc/systemd/system/multi-user.target.wants/httpd.service': | ||
return [pathname] | ||
return orig_glob(pathname) | ||
|
||
return mocked_glob | ||
|
||
monkeypatch.setattr('glob.glob', mock_glob()) | ||
|
||
current_actor_context.feed(SatelliteFacts(has_foreman=True, | ||
postgresql=SatellitePostgresqlFacts(local_postgresql=False))) | ||
current_actor_context.run() | ||
|
||
message = current_actor_context.consume(SystemdServicesTasks)[0] | ||
assert 'httpd.service' in message.to_disable |