Even root access i execute and get the same error:

[image: Screenshot_20240708_095358.png]

Im using this bareos version: bareos-dir Version: 23.0.3~pre34.9a6c163ce 
(13 March 2024) and Python 3.9.

The same code works fine with bareos version 20.0.1 and Python 2.7
[image: Screenshot_20240708_100429.png]
Em quarta-feira, 5 de junho de 2024 às 06:08:09 UTC-3, Jörg Steffens 
escreveu:

> Hi,
>
> I guess, you are using other credentials in Python than in the bconsole. 
> The bconsole has normally root access, while in Python you are typically 
> using a named console with limited permissions (profile).
>
> Regards,
> Jörg
>
> On 31.05.24 at 18:39 wrote Yan Silva:
> > Hi folks!!
> > 
> > I have a script in python to get a number of jobs in Warning and Error, 
> > but when i try to execute the script, for example: python 
> > testing_script.py get_error_jobs, hes show me this error:
> > 
> >    File 
> > "/usr/lib/python3.9/site-packages/bareos/bsock/directorconsolejson.py", 
> > line 93, in call
> >     raise bareos.exceptions.JsonRpcErrorReceivedException(json)
> > bareos.exceptions.JsonRpcErrorReceivedException: failed: .sql: is an 
> > invalid command.
> > 
> > The function from script is:
> > 
> > def get_error_jobs(args):
> >     console = create_console()
> >     error_jobs = console.call('.sql query="SELECT COUNT(Job) FROM Job 
> > where jobstatus=\'E\' AND starttime >= current_date - INTERVAL \'1 
> > days\';"')
> >     try:
> >         print((error_jobs["query"][0]["count"]))
> >     except KeyError:
> >         print(0)
> > 
> > I execute directly this comand (.sql query="SELECT COUNT(Job) FROM Job 
> > where jobstatus=\'E\' AND starttime >= current_date - INTERVAL \'1 
> > days\';) in the bconsole, and hes works fine.
> > 
> > Has anyone experienced this problem?
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "bareos-users" group.
> > To unsubscribe from this group and stop receiving emails from it, send 
> > an email to bareos-users...@googlegroups.com 
> > <mailto:bareos-users...@googlegroups.com>.
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/bareos-users/ca42ebd4-19b8-4de3-a855-0160ad718700n%40googlegroups.com
>  
> <
> https://groups.google.com/d/msgid/bareos-users/ca42ebd4-19b8-4de3-a855-0160ad718700n%40googlegroups.com?utm_medium=email&utm_source=footer
> >.
>
> -- 
> Jörg Steffens joerg.s...@bareos.com
> Bareos GmbH & Co. KG Phone: +49 221 630693-91 <+49%20221%2063069391>
> https://www.bareos.com
>
> Sitz der Gesellschaft: Köln | Amtsgericht Köln: HRA 29646
> Komplementär: Bareos Verwaltungs-GmbH
> Geschäftsführer: Stephan Dühr, Jörg Steffens, Philipp Storz
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"bareos-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bareos-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bareos-users/967cac25-077e-4d28-b24b-0d902595815an%40googlegroups.com.

Reply via email to