Advertisement
Guest User

2014-05-26, TSergey, error characters

a guest
May 25th, 2014
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.84 KB | None | 0 0
  1. Вот пируль:
  2.  
  3. # -*- coding: utf-8 -*-
  4. ##----------------------------------------------------------------------
  5. ## отправить список коммутаторов, готовых к перезагрузке
  6. ##----------------------------------------------------------------------
  7. ## INTERFACE: IPeriodicTask
  8. ##----------------------------------------------------------------------
  9. ## DESCRIPTION:
  10. ## add managed object
  11. ##----------------------------------------------------------------------
  12. ## Copyright (C) 2007-2014 The NOC Project
  13. ## See LICENSE for details
  14. ##----------------------------------------------------------------------
  15. from noc.main.models.notificationgroup import *
  16. from noc.sa.models import *
  17. import string
  18.  
  19. @pyrule
  20. def mail_test(timeout = None):
  21. TAG="boot"
  22. string_mo="=== reboot list"
  23. i=1
  24.  
  25. mo = ManagedObject.objects.filter()
  26. for m in mo:
  27. if m.tags.count(TAG)!=0:
  28. string_mo = string_mo + "\n" + string.rjust(str(i),3) + ". " + string.ljust(m.name,15) + string.ljust(m.get_attr("platform","default"),15) + string.strip(m.street) + ", " + m.home
  29. i+=1
  30. string_mo = string_mo + "\n==="
  31. if i>1:
  32. subj="reboot list"
  33. body=string_mo
  34. NotificationGroup.objects.get(name="report").notify(subject = subj, body = body)
  35.  
  36. return True
  37.  
  38.  
  39. ==============================
  40. А вот трэйс:
  41.  
  42.  
  43. 2014-05-26 08:00:14,489 UNHANDLED EXCEPTION (2014-05-26 08:00:14.486925)
  44. Working directory: /opt/noc
  45. <type 'exceptions.UnicodeEncodeError'>
  46. 'ascii' codec can't encode characters in position 100-108: ordinal not in range(128)
  47. START OF TRACEBACK
  48. ------------------------------------------------------------------------
  49. File: /opt/noc/main/models/__init__.py (Line: 396)
  50. Function: __call__
  51. 389 with self.compiled_lock:
  52. 390 requires_recompile = (self.name not in self.compiled_changed or
  53. 391 self.compiled_changed[self.name] < self.changed)
  54. 392 if not requires_recompile:
  55. 393 f = self.compiled_pyrules[self.name]
  56. 394 # Recompile rule and place in cache when necessary
  57. 395 if requires_recompile:
  58. 396 ==> f = self.compile_text(str(self.text))
  59. 397 with self.compiled_lock:
  60. 398 self.compiled_pyrules[self.name] = f
  61. 399 self.compiled_changed[self.name] = t
  62. 400 # Check interface
  63. 401 i = self.interface_class()
  64. 402 kwargs = i.clean(**kwargs)
  65. Variables:
  66. requires_recompile = True
  67. self = <PyRule: mail_test>
  68. t = datetime.datetime(2014, 5, 26, 8, 0, 14, 486841)
  69. kwargs = {'timeout': None}
  70. ------------------------------------------------------------------------
  71. File: /opt/noc/main/models/__init__.py (Line: 413)
  72. Function: call
  73. 406 return i.clean_result(result)
  74. 407
  75. 408 @classmethod
  76. 409 def call(cls, py_rule_name, **kwargs):
  77. 410 """
  78. 411 Call pyRule by name
  79. 412 """
  80. 413 ==> return cls.lookup(py_rule_name)(**kwargs)
  81. 414
  82. 415 ##
  83. 416 ## Search patters
  84. 417 ##
  85. 418 rx_mac_3_octets = re.compile("^([0-9A-F]{6}|[0-9A-F]{12})$", re.IGNORECASE)
  86. 419
  87. Variables:
  88. py_rule_name = u'mail_test'
  89. cls = <class 'noc.main.models.PyRule'>
  90. kwargs = {'timeout': None}
  91. ------------------------------------------------------------------------
  92. File: /opt/noc/main/scheduler/periodic.py (Line: 72)
  93. Function: task_wrapper
  94. 65 """Periodic thread target"""
  95. 66 logging.info(u"Periodic task=%s status=running" % unicode(task))
  96. 67 t = datetime.datetime.now()
  97. 68 cwd = os.getcwd()
  98. 69 try:
  99. 70 if task.periodic_name.startswith("pyrule:"):
  100. 71 status = PyRule.call(task.periodic_name[7:],
  101. 72 ==> timeout=task.timeout)
  102. 73 else:
  103. 74 status = task.periodic(task.timeout).execute()
  104. 75 except:
  105. 76 error_report()
  106. 77 status = False
  107. 78 logging.info(u"Periodic task=%s status=%s" % (unicode(task),
  108. Variables:
  109. self = <PeriodicScheduler(Thread-1, started daemon 139830202849024)>
  110. task = <Schedule: pyrule:mail_test:Any>
  111. cwd = '/opt/noc'
  112. t = datetime.datetime(2014, 5, 26, 8, 0, 14, 420948)
  113. ------------------------------------------------------------------------
  114. END OF TRACEBACK
  115. 2014-05-26 08:00:14,489 Periodic task=pyrule:mail_test:Any status=failed
  116. 2014-05-26 08:00:14,928 [main.jobs] Invalid job class: None
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement