diff options
author | Christian Heimes <cheimes@redhat.com> | 2016-11-18 15:42:23 +0100 |
---|---|---|
committer | Martin Basti <mbasti@redhat.com> | 2016-11-24 16:30:32 +0100 |
commit | 6409abf1a60f3548203e6607a2b157ff72af2c89 (patch) | |
tree | 2d1c06b3fc85d91f9d4bea67162a1ab9dcdca07e /ipaclient | |
parent | 2cbaf156045769b54150e4d4c3c1071f164a16fb (diff) | |
download | freeipa-6409abf1a60f3548203e6607a2b157ff72af2c89.tar.gz freeipa-6409abf1a60f3548203e6607a2b157ff72af2c89.tar.xz freeipa-6409abf1a60f3548203e6607a2b157ff72af2c89.zip |
Break ipaplatform / ipalib import cycle of hell
Here is an attempt to break the import cycle of hell between ipaplatform
and ipalib. All services now pass an ipalib.api object to
services.service(). RedHatServices.__init__() still needs to do a local
import because it initializes its wellknown service dict with service
instances.
Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Martin Basti <mbasti@redhat.com>
Diffstat (limited to 'ipaclient')
-rw-r--r-- | ipaclient/install/client.py | 8 | ||||
-rw-r--r-- | ipaclient/ntpconf.py | 11 |
2 files changed, 10 insertions, 9 deletions
diff --git a/ipaclient/install/client.py b/ipaclient/install/client.py index b24a98916..d18d8bb1f 100644 --- a/ipaclient/install/client.py +++ b/ipaclient/install/client.py @@ -2822,7 +2822,7 @@ def _install(options): root_logger.info("%s enabled", "SSSD" if options.sssd else "LDAP") if options.sssd: - sssd = services.service('sssd') + sssd = services.service('sssd', api) try: sssd.restart() except CalledProcessError: @@ -3139,7 +3139,7 @@ def uninstall(options): root_logger.info( "IPA domain removed from current one, restarting SSSD service") - sssd = services.service('sssd') + sssd = services.service('sssd', api) try: sssd.restart() except CalledProcessError: @@ -3153,7 +3153,7 @@ def uninstall(options): "Other domains than IPA domain found, IPA domain was removed " "from /etc/sssd/sssd.conf.") - sssd = services.service('sssd') + sssd = services.service('sssd', api) try: sssd.restart() except CalledProcessError: @@ -3172,7 +3172,7 @@ def uninstall(options): "Redundant SSSD configuration file " "/etc/sssd/sssd.conf was moved to /etc/sssd/sssd.conf.deleted") - sssd = services.service('sssd') + sssd = services.service('sssd', api) try: sssd.stop() except CalledProcessError: diff --git a/ipaclient/ntpconf.py b/ipaclient/ntpconf.py index 9a7db6544..c78f80749 100644 --- a/ipaclient/ntpconf.py +++ b/ipaclient/ntpconf.py @@ -16,11 +16,12 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # +import os +import shutil +from ipalib import api from ipapython import ipautil from ipapython.ipa_log_manager import root_logger -import shutil -import os from ipaplatform.tasks import tasks from ipaplatform import services from ipaplatform.paths import paths @@ -189,7 +190,7 @@ def check_timedate_services(): if service == 'ntpd': continue # Make sure that the service is not enabled - instance = services.service(service) + instance = services.service(service, api) if instance.is_enabled() or instance.is_running(): raise NTPConflictingService(conflicting_service=instance.service_name) @@ -201,7 +202,7 @@ def force_ntpd(statestore): for service in services.timedate_services: if service == 'ntpd': continue - instance = services.service(service) + instance = services.service(service, api) enabled = instance.is_enabled() running = instance.is_running() @@ -224,7 +225,7 @@ def restore_forced_ntpd(statestore): if service == 'ntpd': continue if statestore.has_state(service): - instance = services.service(service) + instance = services.service(service, api) enabled = statestore.restore_state(instance.service_name, 'enabled') running = statestore.restore_state(instance.service_name, 'running') if enabled: |