Kaydet (Commit) 0ffd3670 authored tarafından Suleyman Poyraz's avatar Suleyman Poyraz

Bazı görünümsel düzenlemeler

* Çok bir şey yapıldı sayılmaz. tek if içerisinde kontrol çeşitli buglara sebep olabilirdi. Bundan kaçınmak için ufak bir fix yapıldı.

* is_method_missing fonksiyonuna python için missing eklendi, debug'a Method'un bulunmadığı bilgisi basıldı.
 
üst ef7d1bd6
......@@ -45,7 +45,8 @@ def is_char_valid(char):
def is_method_missing(exception):
"""Tells if exception is about missing method in SCOM script"""
if "tr.org.sulin.scom.Missing" in str(exception):
if ("tr.org.sulin.scom.Missing" or "tr.org.sulin.scom.python.missing") in str(exception):
ctx.ui.debug(str(exception).split(":")[-1])
return True
return False
......@@ -146,7 +147,7 @@ def post_install(package_name, provided_scripts,
if not is_method_missing(exception):
raise Error(_("Script error for \"{0}\" package: {1}.").format(package_name, exception))
if (self_post and hasattr(link.System.Package[package_name],"postInstall")):
if (self_post and hasattr(link.System.Package[package_name], "postInstall")):
if not fromVersion:
fromVersion = ""
if not fromRelease:
......@@ -171,15 +172,16 @@ def pre_remove(package_name, metapath, filepath):
package_name = safe_script_name(package_name)
if (package_name in list(link.System.Package) and hasattr(link.System.Package[package_name],"preRemove")):
ctx.ui.debug(_("Running package's pre remove script for \"{}\" package.").format(package_name))
try:
link.System.Package[package_name].preRemove(
timeout=ctx.dbus_timeout)
except dbus.exceptions.DBusException as exception:
# Do nothing if preRemove method is not defined in package script
if not is_method_missing(exception):
raise Error(_("Script error: {}").format(exception))
if package_name in list(link.System.Package):
if hasattr(link.System.Package[package_name], "preRemove"):
ctx.ui.debug(_("Running package's pre remove script for \"{}\" package.").format(package_name))
try:
link.System.Package[package_name].preRemove(
timeout=ctx.dbus_timeout)
except dbus.exceptions.DBusException as exception:
# Do nothing if preRemove method is not defined in package script
if not is_method_missing(exception):
raise Error(_("Script error: {}").format(exception))
ctx.ui.debug(_("Calling pre remove handlers for \"{}\" package.").format(package_name))
for handler in list(link.System.PackageHandler):
......@@ -206,15 +208,16 @@ def post_remove(package_name, metapath, filepath, provided_scripts=None):
in provided_scripts if s.name])
scripts.add(package_name)
if (package_name in list(link.System.Package) and hasattr(link.System.Package[package_name],"postRemove")):
ctx.ui.debug(_("Running package's postremove script for \"{}\" package.").format(package_name))
try:
link.System.Package[package_name].postRemove(
timeout=ctx.dbus_timeout)
except dbus.exceptions.DBusException as exception:
# Do nothing if postRemove method is not defined in package script
if not is_method_missing(exception):
raise Error(_("Script error: {}").format(exception))
if package_name in list(link.System.Package):
if hasattr(link.System.Package[package_name], "postRemove"):
ctx.ui.debug(_("Running package's postremove script for \"{}\" package.").format(package_name))
try:
link.System.Package[package_name].postRemove(
timeout=ctx.dbus_timeout)
except dbus.exceptions.DBusException as exception:
# Do nothing if postRemove method is not defined in package script
if not is_method_missing(exception):
raise Error(_("Script error: {}").format(exception))
ctx.ui.debug(_("Calling post remove handlers for \"{}\" package.").format(package_name))
for handler in list(link.System.PackageHandler):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment