View Issue Details

IDProjectCategoryView StatusLast Update
0000769bareos-coredirectorpublic2017-01-20 11:19
Reporterglbyers Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionunable to reproduce 
PlatformLinuxOSCentOSOS Version7
Product Version16.2.4 
Summary0000769: On 64-bit, Python "int" types are returned as "long"
DescriptionI'm unable to implement a simple director python plugin, as all values expected to be "int" are returned as "long" (see below). After removing the explicit int() cast, code continues but I hit similar issue when using various other modules, such as socket and subprocess.

c7.vagrant.apnic.net (150): python-dir.c:631-36 python-dir: Traceback (most recent call last):
  File "/usr/lib64/bareos/plugins/BareosDirWrapper.py", line 38, in handle_plugin_event
    return bareos_dir_plugin_object.handle_plugin_event(context, event)
  File "/usr/lib64/bareos/plugins/BareosDirPluginSensuHandler.py", line 43, in handle_plugin_event
    context, event)
  File "/usr/lib64/bareos/plugins/BareosDirPluginBaseclass.py", line 136, in han
dle_plugin_event
    self.jobErrors = int(bareosdir.GetValue(context, brDirVariable['bDirVarJobEr
rors']))
TypeError: an integer is required

Inspecting the type of any integer value (brDirVarJobId, bDirVarJobErrors, bDirVarJobBytes, bDirVarJobFiles, bDirVarNumVols), they reveal as "long". This can be worked around in the BareosDirPluginBaseclass by either removing the casts or casting to long, but it causes problems with other modules too. Here's an example;

  File "/usr/lib64/bareos/plugins/BareosDirPluginSensuHandler.py", line 90, in post_results
    (self.host, self.port), self.timeout)
  File "/usr/lib64/python2.7/socket.py", line 557, in create_connection
    sock = socket(af, socktype, proto)
  File "/usr/lib64/python2.7/socket.py", line 189, in __init__
    for method in _delegate_methods:
TypeError: an integer is required
Steps To ReproduceCreate & attempt to use a simple director python plugin that extends BareosDirPluginBaseclass on a 64-bit CentOS 7 system.
Tagsdirector, plugin, python

Activities

glbyers

glbyers

2017-01-18 05:26

reporter   ~0002510

If possible, can someone please mask out the hostname in the stack trace above? Thanks.
maik

maik

2017-01-19 12:50

administrator   ~0002511

Could not reproduce; instead I could successfully run:

- experimental grafana dir-plugin on Bareos 16.4.2 on SLE11 and Centos 7
- nsca-sender plugin on Bareos 16.4.3 (master) on Centos 7

Issue History

Date Modified Username Field Change
2017-01-18 04:38 glbyers New Issue
2017-01-18 05:24 glbyers Tag Attached: plugin
2017-01-18 05:24 glbyers Tag Attached: director
2017-01-18 05:24 glbyers Tag Attached: python
2017-01-18 05:26 glbyers Note Added: 0002510
2017-01-19 12:50 maik Note Added: 0002511
2017-01-19 12:50 maik Status new => resolved
2017-01-19 12:50 maik Resolution open => unable to reproduce
2017-01-19 12:50 maik Assigned To => maik
2017-01-20 11:19 maik Status resolved => closed
2017-01-20 11:19 maik Assigned To maik =>