-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move common Satellite Upgrade code to "common"
- Loading branch information
Showing
5 changed files
with
36 additions
and
14 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
repos/system_upgrade/common/actors/satellite_upgrade_services/actor.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,35 @@ | ||
import glob | ||
import os | ||
|
||
from leapp.actors import Actor | ||
from leapp.models import SatelliteFacts | ||
from leapp.tags import ApplicationsPhaseTag, IPUWorkflowTag | ||
|
||
SYSTEMD_WANTS_BASE = '/etc/systemd/system/multi-user.target.wants/' | ||
SERVICES_TO_DISABLE = ['dynflow-sidekiq@*', 'foreman', 'foreman-proxy', | ||
'httpd', 'postgresql', 'pulpcore-api', 'pulpcore-content', | ||
'pulpcore-worker@*', 'tomcat'] | ||
|
||
|
||
class SatelliteUpgradeServices(Actor): | ||
""" | ||
Reconfigure Satellite services | ||
""" | ||
|
||
name = 'satellite_upgrade_services' | ||
consumes = (SatelliteFacts,) | ||
produces = () | ||
tags = (IPUWorkflowTag, ApplicationsPhaseTag) | ||
|
||
def process(self): | ||
facts = next(self.consume(SatelliteFacts), None) | ||
if not facts or not facts.has_foreman: | ||
return | ||
|
||
# disable services, will be re-enabled by the installer | ||
for service_name in SERVICES_TO_DISABLE: | ||
for service in glob.glob(os.path.join(SYSTEMD_WANTS_BASE, '{}.service'.format(service_name))): | ||
try: | ||
os.unlink(service) | ||
except Exception as e: # pylint: disable=broad-except | ||
self.log.warning('Failed disabling service {}: {}'.format(service, e)) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
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