bareos / python-bareos Goto Github PK
View Code? Open in Web Editor NEWPython libraries to access Bareos
Python libraries to access Bareos
Looks like i found another bug, there is output from bconsole:
*status job=oracle_weekly_ow-backup03
Job "oracle_weekly_ow-backup03" is not running.
Python:
In [136]: console.call("status job=oracle_weekly_ow-backup03")
Out[136]:
{u'error': {u'code': 1,
u'data': {u'messages': {u'error': [u'Job "oracle_weekly_ow-backup03" is not running.\n']},
u'result': {}},
u'message': u'failed'},
u'id': None,
u'jsonrpc': u'2.0'}
Am i wrong and it's expected behavior?
PS
I found another strange behavior, bconsole:
*.status dir current
1000 OK .status
Python:
In [137]: console.call(".status dir current")
Out[137]: {}
Should i open another one issue for that?
I'm trying to get all connected clients;
director.call('status director')['client-connection']
However the output is incomplete (there are two clients in my setup) :
{u'protocol_version': 54, u'connect_time': u'22-Mar-17 12:05', u'authenticated': 1, u'name': u'LaptopSvenn'}
When I call
director.call('status director')
I get both clients but the format is incorrect.
{u'protocol_version': 54, u'connect_time': u'22-Mar-17 12:06', u'authenticated': 1, u'name': u'rocky', u'client-connection': {u'protocol_version': 54, u'connect_time': u'22-Mar-17 12:05', u'authenticated': 1, u'name': u'LaptopSvenn'}}
I ran this on Centos 7 / Python 2.7.5
For reference this is the non-json result :
[root@lungo-02 python]# python test.py
### director.call('status director')
{u'protocol_version': 54, u'connect_time': u'22-Mar-17 12:06', u'authenticated': 1, u'name': u'rocky', u'client-connection': {u'protocol_version': 54, u'connect_time': u'22-Mar-17 12:05', u'authenticated': 1, u'name': u'LaptopSvenn'}}
### director.call('status director')['client-connection']
{u'protocol_version': 54, u'connect_time': u'22-Mar-17 12:05', u'authenticated': 1, u'name': u'LaptopSvenn'}
### director.call('status director')
bareos-dir Version: 16.2.4 (01 July 2016) x86_64-redhat-linux-gnu redhat CentOS Linux release 7.0.1406 (Core)
Daemon started 22-Mar-17 12:05. Jobs: run=0, running=0 mode=0 db=mysql
Heap: heap=1,142,784 smbytes=230,022 max_bytes=234,702 bufs=1,388 max_bufs=1,401
Plugin Info:
Plugin : python-dir.so
Description: Python Director Daemon Plugin
Version : 3, Date: October 2013
Author : Marco van Wieringen
License : Bareos AGPLv3
Usage : python:instance=<instance_id>:module_path=<path-to-python-mod
Scheduled Jobs:
Level Type Pri Scheduled Name Volume
===========================================================================
Incremental Backup 10 22-Mar-17 21:00 backup-bareos-fd Incremen
[...]
Full Backup 11 22-Mar-17 21:10 BackupCatalog Incremen
====
Running Jobs:
Console connected at 22-Mar-17 12:26
Console connected at 22-Mar-17 12:27
No Jobs running.
====
Terminated Jobs:
JobId Level Files Bytes Status Finished Name
====================================================================
145 Incr 0 0 OK 22-Mar-17 02:07 TriggerBackup
146 Incr 0 0 OK 22-Mar-17 03:07 TriggerBackup
147 Incr 0 0 OK 22-Mar-17 04:07 TriggerBackup
148 Incr 0 0 OK 22-Mar-17 05:07 TriggerBackup
149 Incr 0 0 OK 22-Mar-17 06:07 TriggerBackup
150 Incr 0 0 OK 22-Mar-17 07:07 TriggerBackup
151 Incr 0 0 OK 22-Mar-17 08:07 TriggerBackup
152 Incr 0 0 OK 22-Mar-17 09:07 TriggerBackup
153 Incr 0 0 OK 22-Mar-17 10:07 TriggerBackup
154 Incr 2 213 OK 22-Mar-17 11:07 TriggerBackup
Client Initiated Connections (waiting for jobs):
Connect time Protocol Authenticated Name
===========================================================================
22-Mar-17 12:05 54 1 LaptopSvenn
22-Mar-17 12:06 54 1 rocky
====
Perhaps relevant I get this error :
bareos-dir: ERROR in output_formatter.c:126 Failed to add JSON reference client-connection (stack size: 1) already exists. This should not happen. Ignoring.
when clone the code and install using setuptools installing ,an erro with requires dateutil. Is this package is python-dateutil belongs to PyPI?
Hello. Do you have any plans to implement asyncio coroutines support in the lib?
the comment of util.path is
"""
Class to handle Bareos passwords.
"""
but by reading the code cannot find anything aboat password
is this a mistake or i'm misunderstanding
thinks for provide this conveniently module
In [14]: directorconsole.call('show jobs')
Out[14]:
{'error': {'code': 2,
'data': bytearray(b'Job {\n Name = "RestoreFiles"\n Description = "Standard Restore template. Only one such job is needed for all standard Jobs/Clients/Storage ..."\n Type = Restore\n Messages = "Standard"\n Storage = "mia-backup03_storage03-sd"\n Pool = "mia-backup03_mixed_incremental"\n Client = "mia-backup03-fd"\n FileSet = "LinuxAll"\n Where = "/tmp/bareos-restores"\n}\n\n ##CUT##}\n\n{"result":{},"jsonrpc":"2.0","id":null}'),
'message': 'No JSON object could be decoded'}}
% dpkg -l|grep python-bareos
ii python-bareos 0.4.1509724938.4a5bd79-48.1 all Backup Archiving REcovery Open Sourced - Python module
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.