ipactl: pass api as argument to services

Commit 6409abf1 removes hard dependency of ipalib in ipalatform to avoid
cyclic dependenies, this commit updates ipactl accordingly

Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
This commit is contained in:
Martin Basti 2016-12-09 11:05:03 +01:00
parent ca4e6c1fdf
commit 15351ab6e7

View File

@ -244,7 +244,7 @@ def get_config_from_file():
def stop_services(svc_list):
for svc in svc_list:
svc_off = services.service(svc)
svc_off = services.service(svc, api=api)
try:
svc_off.stop(capture_output=False)
except Exception:
@ -303,7 +303,7 @@ def ipa_start(options):
svc_list = deduplicate(svc_list)
for svc in svc_list:
svchandle = services.service(svc)
svchandle = services.service(svc, api=api)
try:
print("Starting %s Service" % svc)
svchandle.start(capture_output=get_capture_output(svc, options.debug))
@ -343,7 +343,7 @@ def ipa_stop(options):
svc_list = deduplicate(svc_list)
for svc in reversed(svc_list):
svchandle = services.service(svc)
svchandle = services.service(svc, api=api)
try:
print("Stopping %s Service" % svc)
svchandle.stop(capture_output=False)
@ -421,7 +421,7 @@ def ipa_restart(options):
# we need to definitely stop some services
old_svc_list = deduplicate(old_svc_list)
for svc in reversed(old_svc_list):
svchandle = services.service(svc)
svchandle = services.service(svc, api=api)
try:
print("Stopping %s Service" % svc)
svchandle.stop(capture_output=False)
@ -446,7 +446,7 @@ def ipa_restart(options):
# there are services to restart
svc_list = deduplicate(svc_list)
for svc in svc_list:
svchandle = services.service(svc)
svchandle = services.service(svc, api=api)
try:
print("Restarting %s Service" % svc)
svchandle.restart(capture_output=get_capture_output(svc, options.debug))
@ -469,7 +469,7 @@ def ipa_restart(options):
# we still need to start some services
new_svc_list = deduplicate(new_svc_list)
for svc in new_svc_list:
svchandle = services.service(svc)
svchandle = services.service(svc, api=api)
try:
print("Starting %s Service" % svc)
svchandle.start(capture_output=get_capture_output(svc, options.debug))
@ -521,7 +521,7 @@ def ipa_status(options):
svc_list = deduplicate(svc_list)
for svc in svc_list:
svchandle = services.service(svc)
svchandle = services.service(svc, api=api)
try:
if svchandle.is_running():
print("%s Service: RUNNING" % svc)