# HG changeset patch # User Bart Smaalders # Date 1239138139 25200 # Node ID e61c57c724c963dd1e1565116db663aa8e7c39ef # Parent 4cb0f058b175978a6a864ca2a69900cd4b21a7b4 7663 disable_fmri should be synchronous diff -r 4cb0f058b175 -r e61c57c724c9 src/modules/client/actuator.py --- a/src/modules/client/actuator.py Tue Apr 07 13:54:16 2009 -0700 +++ b/src/modules/client/actuator.py Tue Apr 07 14:02:19 2009 -0700 @@ -90,8 +90,6 @@ svcprop_path = "/usr/bin/svcprop" svcadm_path = "/usr/sbin/svcadm" - - class NonzeroExitException(Exception): def __init__(self, cmd, return_code, output): self.cmd = cmd @@ -166,14 +164,14 @@ self.suspend_fmris = suspend_fmris self.tmp_suspend_fmris = tmp_suspend_fmris - args = (svcadm_path, "disable", "-t") + args = (svcadm_path, "disable", "-st") params = tuple(suspend_fmris | tmp_suspend_fmris) if params: self.__call(args + params) - args = (svcadm_path, "disable") + args = (svcadm_path, "disable", "-s") params = tuple(disable_fmris) if params: diff -r 4cb0f058b175 -r e61c57c724c9 src/modules/client/api.py --- a/src/modules/client/api.py Tue Apr 07 13:54:16 2009 -0700 +++ b/src/modules/client/api.py Tue Apr 07 14:02:19 2009 -0700 @@ -35,6 +35,7 @@ import urllib import urllib2 +import pkg.client.actuator as actuator import pkg.client.api_errors as api_errors import pkg.client.bootenv as bootenv import pkg.client.history as history @@ -544,6 +545,14 @@ history.RESULT_FAILED_STORAGE self.img.cleanup_downloads() raise api_errors.MainDictParsingException(e) + except actuator.NonzeroExitException, e: + self.img.history.operation_result = \ + history.RESULT_FAILED_ACTUATOR + # won't happen during image-update + be.restore_install_uninstall() + self.img.cleanup_downloads() + raise api_errors.ActuatorException(e) + except Exception, e: self.img.history.operation_result = \ history.RESULT_FAILED_UNKNOWN diff -r 4cb0f058b175 -r e61c57c724c9 src/modules/client/api_errors.py --- a/src/modules/client/api_errors.py Tue Apr 07 13:54:16 2009 -0700 +++ b/src/modules/client/api_errors.py Tue Apr 07 14:02:19 2009 -0700 @@ -63,6 +63,14 @@ ApiException.__init__(self) self.plan_type = plan_type +class ActuatorException(ApiException): + def __init__(self, e): + ApiException.__init__(self) + self.exception = e + + def __str__(self): + return str(self.exception) + class PrematureExecutionException(ApiException): pass diff -r 4cb0f058b175 -r e61c57c724c9 src/modules/client/history.py --- a/src/modules/client/history.py Tue Apr 07 13:54:16 2009 -0700 +++ b/src/modules/client/history.py Tue Apr 07 14:02:19 2009 -0700 @@ -61,6 +61,8 @@ RESULT_FAILED_STORAGE = ["Failed", "Storage"] # Indicates that a transport error caused the operation to fail. RESULT_FAILED_TRANSPORT = ["Failed", "Transport"] +# Indicates that the operation failed due to an actuator problem +RESULT_FAILED_ACTUATOR = ["Failed", "Actuator"] # Indicates that the operation failed for an unknown reason. RESULT_FAILED_UNKNOWN = ["Failed", "Unknown"] diff -r 4cb0f058b175 -r e61c57c724c9 src/tests/cli/t_actuators.py --- a/src/tests/cli/t_actuators.py Tue Apr 07 13:54:16 2009 -0700 +++ b/src/tests/cli/t_actuators.py Tue Apr 07 14:02:19 2009 -0700 @@ -305,7 +305,7 @@ cmdstr = "--debug actuator_cmds_dir=%s" % self.testdata_dir self.pkg(cmdstr + " install basics@1.4") self.pkg("verify") - self.file_contains(svcadm_output, "svcadm disable -t svc:system/test_suspend_svc") + self.file_contains(svcadm_output, "svcadm disable -st svc:system/test_suspend_svc") self.file_contains(svcadm_output, "svcadm enable svc:system/test_suspend_svc") os.unlink(svcadm_output) @@ -315,7 +315,7 @@ cmdstr = "--debug actuator_cmds_dir=%s" % self.testdata_dir self.pkg(cmdstr + " install basics@1.5") self.pkg("verify") - self.file_contains(svcadm_output, "svcadm disable -t svc:system/test_suspend_svc") + self.file_contains(svcadm_output, "svcadm disable -st svc:system/test_suspend_svc") self.file_contains(svcadm_output, "svcadm enable -t svc:system/test_suspend_svc") os.unlink(svcadm_output) @@ -323,7 +323,7 @@ cmdstr = "--debug actuator_cmds_dir=%s" % self.testdata_dir self.pkg(cmdstr + " uninstall basics") self.pkg("verify") - self.file_contains(svcadm_output, "svcadm disable svc:system/test_disable_svc") + self.file_contains(svcadm_output, "svcadm disable -s svc:system/test_disable_svc") def file_does_not_exist(self, path): file_path = os.path.join(self.get_img_path(), path)