HandyGuySoftware / dupReport

Email summary reporting tool for use with Duplicati backup system
MIT License
77 stars 9 forks source link

Error in SafeConfigParser #184

Closed HandyGuySoftware closed 7 months ago

HandyGuySoftware commented 7 months ago

[quote="Taomyn, post:132, topic:1116"] Hi, is this still being maintained?

Having an issue after upgrading the server I run dupReport on, from Fedora 38 to 39, it was throwing an error:

[root@maggie ~]# /usr/bin/python3 /usr/share/dupReport/dupReport.py
Traceback (most recent call last):
  File "/usr/share/dupReport/dupReport.py", line 23, in <module>
    import report
  File "/usr/share/dupReport/report.py", line 26, in <module>
    import options
  File "/usr/share/dupReport/options.py", line 12, in <module>
    from configparser import SafeConfigParser
ImportError: cannot import name 'SafeConfigParser' from 'configparser' (/usr/lib64/python3.12/configparser.py). Did you mean: 'RawConfigParser'?

I fixed this by replacing all “SafeConfigParser” in options.py with just “ConfigParser” and now it runs but with some warnings:

[root@maggie ~]# /usr/bin/python3 /usr/share/dupReport/dupReport.py
/usr/share/dupReport/options.py:39: SyntaxWarning: invalid escape sequence '\w'
  ('main',        'srcregex',         '\w+',                                                                      True),
/usr/share/dupReport/options.py:40: SyntaxWarning: invalid escape sequence '\w'
  ('main',        'destregex',        '\w+',                                                                      True),
[root@maggie ~]#

It seemed to work and generated a report etc, but not sure what else this could break. [/quote]

Taomyn commented 7 months ago

Log as requested:

[2024-03-13T10:36:36.623694][NOTICE][main][startup]dupReport Log - Start
[2024-03-13T10:36:36.623714][NOTICE][main][startup]Program Version 3.0.9 Release
[2024-03-13T10:36:36.623720][NOTICE][main][startup]Database Version 3.0.1
[2024-03-13T10:36:36.623725][NOTICE][main][startup]Python version 3.12.2 (main, Feb 21 2024, 00:00:00) [GCC 13.2.1 20231205 (Red Hat 13.2.1-6)]
[2024-03-13T10:36:36.624923][NOTICE][main][startup]OS Platform: Linux-6.7.7-200.fc39.x86_64-x86_64-with-glibc2.38
[2024-03-13T10:36:36.624936][NOTICE][main][startup]Program path: /usr/share/dupReport
[2024-03-13T10:36:36.624943][NOTICE][Options][initOptions]Initializing global program options.
[2024-03-13T10:36:36.624947][NOTICE][Options][OptionManager]Initializing option manager.
[2024-03-13T10:36:36.624951][NOTICE][Options][processCmdLineArgs]Processing command line arguments.
[2024-03-13T10:36:36.627226][NOTICE][Options][processCmdLineArgs]rcpath = [None]
[2024-03-13T10:36:36.627240][NOTICE][Options][processCmdLineArgs]dbpath = [None]
[2024-03-13T10:36:36.627246][NOTICE][Options][processCmdLineArgs]logpath = [None]
[2024-03-13T10:36:36.627250][NOTICE][Options][processCmdLineArgs]verbose = [None]
[2024-03-13T10:36:36.627254][NOTICE][Options][processCmdLineArgs]Version = [False]
[2024-03-13T10:36:36.627258][NOTICE][Options][processCmdLineArgs]append = [False]
[2024-03-13T10:36:36.627261][NOTICE][Options][processCmdLineArgs]size = [None]
[2024-03-13T10:36:36.627265][NOTICE][Options][processCmdLineArgs]initdb = [False]
[2024-03-13T10:36:36.627268][NOTICE][Options][processCmdLineArgs]rollback = [None]
[2024-03-13T10:36:36.627272][NOTICE][Options][processCmdLineArgs]rollbackx = [None]
[2024-03-13T10:36:36.627275][NOTICE][Options][processCmdLineArgs]file = [None]
[2024-03-13T10:36:36.627279][NOTICE][Options][processCmdLineArgs]fileattach = [None]
[2024-03-13T10:36:36.627282][NOTICE][Options][processCmdLineArgs]guidedsetup= [False]
[2024-03-13T10:36:36.627285][NOTICE][Options][processCmdLineArgs]noguidedsetup= [False]
[2024-03-13T10:36:36.627289][NOTICE][Options][processCmdLineArgs]nomail = [False]
[2024-03-13T10:36:36.627292][NOTICE][Options][processCmdLineArgs]remove = [None]
[2024-03-13T10:36:36.627296][NOTICE][Options][processCmdLineArgs]purgedb = [False]
[2024-03-13T10:36:36.627299][NOTICE][Options][processCmdLineArgs]stopbackupwarn = [False]
[2024-03-13T10:36:36.627303][NOTICE][Options][processCmdLineArgs]collect = [False]
[2024-03-13T10:36:36.627307][NOTICE][Options][processCmdLineArgs]report = [False]
[2024-03-13T10:36:36.627310][NOTICE][Options][processCmdLineArgs]masksensitive = [False]
[2024-03-13T10:36:36.627313][NOTICE][Options][processCmdLineArgs]nomasksensitive = [False]
[2024-03-13T10:36:36.627317][NOTICE][Options][processCmdLineArgs]validatereport = [False]
[2024-03-13T10:36:36.627320][NOTICE][Options][processCmdLineArgs]layout = [None]
[2024-03-13T10:36:36.627324][NOTICE][Options][processCmdLineArgs]emailservers = [None]
[2024-03-13T10:36:36.627327][NOTICE][Options][processCmdLineArgs]RC path not specified on command line. Using default.
[2024-03-13T10:36:36.627333][NOTICE][Options][processCmdLineArgs]Final RC path=[*********************************]
[2024-03-13T10:36:36.627337][NOTICE][Options][openRcFile]Opening .rc file *********************************
[2024-03-13T10:36:36.628114][NOTICE][Options][checkRcFileVersion]Current version number=310. Need to upgrade rc file? False
[2024-03-13T10:36:36.628124][NOTICE][Options][setRcDefaults]Setting .rc file defaults
[2024-03-13T10:36:36.628164][NOTICE][Options][setRcDefaults]needUpdate = False defaultsOK=True
[2024-03-13T10:36:36.628169][NOTICE][Options][readRcOptions]Reading .rc file options
[2024-03-13T10:36:36.628273][NOTICE][Options][readRcOptions]Need to restart? False
[2024-03-13T10:36:36.628278][NOTICE][Options][initOptions]Option initialization complete. Continuing program.
[2024-03-13T10:36:36.628287][NOTICE][Report][Init]Initializing report object.
[2024-03-13T10:36:36.628292][NOTICE][Options][getRcSection]Retrieving .rc section: [report]
[2024-03-13T10:36:36.628320][NOTICE][Report][validateReportFields]Validating report specifications in .rc file.
[2024-03-13T10:36:36.628329][NOTICE][Report][validateColumns]Validating columns for [report] report section.
[2024-03-13T10:36:36.628374][NOTICE][Options][getRcSection]Retrieving .rc section: [lastseen]
[2024-03-13T10:36:36.628390][NOTICE][Options][getRcSection]Retrieving .rc section: [bysrc]
[2024-03-13T10:36:36.628398][NOTICE][Report][validateColumns]Validating columns for [bysrc] report section.
[2024-03-13T10:36:36.628433][NOTICE][Options][getRcSection]Retrieving .rc section: [bydest]
[2024-03-13T10:36:36.628441][NOTICE][Report][validateColumns]Validating columns for [bydest] report section.
[2024-03-13T10:36:36.628475][NOTICE][Options][getRcSection]Retrieving .rc section: [noactivity]
[2024-03-13T10:36:36.628483][NOTICE][Report][validateReportFields]Found 0 report validation errors.
[2024-03-13T10:36:36.628489][NOTICE][Report][Init]Getting configuration for ['lastseen'] report.
[2024-03-13T10:36:36.628493][NOTICE][Options][getRcOption]Retrieving .rc option: [lastseen]type=
[2024-03-13T10:36:36.628503][NOTICE][Options][getRcSection]Retrieving .rc section: [lastseen]
[2024-03-13T10:36:36.628512][NOTICE][Report][Init]Getting configuration for ['bysrc'] report.
[2024-03-13T10:36:36.628517][NOTICE][Options][getRcOption]Retrieving .rc option: [bysrc]type=
[2024-03-13T10:36:36.628525][NOTICE][Options][getRcSection]Retrieving .rc section: [bysrc]
[2024-03-13T10:36:36.628560][NOTICE][Report][Init]Getting configuration for ['bydest'] report.
[2024-03-13T10:36:36.628564][NOTICE][Options][getRcOption]Retrieving .rc option: [bydest]type=
[2024-03-13T10:36:36.628571][NOTICE][Options][getRcSection]Retrieving .rc section: [bydest]
[2024-03-13T10:36:36.628605][NOTICE][Report][Init]Getting configuration for ['noactivity'] report.
[2024-03-13T10:36:36.628609][NOTICE][Options][getRcOption]Retrieving .rc option: [noactivity]type=
[2024-03-13T10:36:36.628616][NOTICE][Options][getRcSection]Retrieving .rc section: [noactivity]
[2024-03-13T10:36:36.628662][NOTICE][Report][Init]Adding runtime report.
[2024-03-13T10:36:36.628671][NOTICE][Options][getRcOption]Retrieving .rc option: [apprise]enabled=
[2024-03-13T10:36:36.628680][NOTICE][Database][Init]Initializing database manager.
[2024-03-13T10:36:36.634886][NOTICE][Database][execSqlStmt]Executing SQL statement: [SELECT major, minor, subminor FROM version WHERE desc = 'database']
HandyGuySoftware commented 7 months ago

Thanks, what version of Python are you using?

Taomyn commented 7 months ago

Thanks, what version of Python are you using?

Python v3.12.2

HandyGuySoftware commented 7 months ago

OK, I see what's happening here. I've coded up a fix but want to let it burn in a day or so to make sure there aren't any side effects. If you're interested in also testing let me know.

Taomyn commented 7 months ago

OK, I see what's happening here. I've coded up a fix but want to let it burn in a day or so to make sure there aren't any side effects. If you're interested in also testing let me know.

Sure, if I can get the fix before my daily run starts I'll have some emails to test against.

HandyGuySoftware commented 7 months ago

Pull the latest code from the Issue_184 branch and give that a try.

Taomyn commented 7 months ago

Pull the latest code from the Issue_184 branch and give that a try.

Ran but different warnings this time

[root@maggie ~]# /usr/bin/python3 /usr/share/dupReport/dupReport.py
/usr/share/dupReport/drdatetime.py:47: SyntaxWarning: invalid escape sequence '\s'
  dateParseRegex = '(\s)*(\d)+[/\-\.](\s)*(\d)+[/\-\.](\s)*(\d)+'     # i.e., <numbers>[/-.]<numbers>[/-.]<numbers>
/usr/share/dupReport/drdatetime.py:48: SyntaxWarning: invalid escape sequence '\d'
  timeParseRegex = '(\d)+[:](\d+)[:](\d+)'                            # i.e., <numbers>:<numbers>:<numbers>
/usr/share/dupReport/drdatetime.py:49: SyntaxWarning: invalid escape sequence '\-'
  validDateDelims = '[/\-\.]'                                         # Valid delimiters in a date string
/usr/share/dupReport/drdatetime.py:275: SyntaxWarning: invalid escape sequence '\d'
  p = re.compile('\d+[smhdw]')
HandyGuySoftware commented 7 months ago

I think I've found them all now. Updated the Issue_184 branch.

Taomyn commented 7 months ago

I think I've found them all now. Updated the Issue_184 branch.

I rolled back to the previous files and updated with the latest, marked all today's emails as unread then re-ran. No warnings and got the report that appears to be good.

[2024-03-13T21:04:24.005204][NOTICE][main][startup]dupReport Log - Start
[2024-03-13T21:04:24.005236][NOTICE][main][startup]Program Version 3.0.10 Release
[2024-03-13T21:04:24.005246][NOTICE][main][startup]Database Version 3.0.1
[2024-03-13T21:04:24.005253][NOTICE][main][startup]Python version 3.12.2 (main, Feb 21 2024, 00:00:00) [GCC 13.2.1 20231205 (Red Hat 13.2.1-6)]
[2024-03-13T21:04:24.006466][NOTICE][main][startup]OS Platform: Linux-6.7.7-200.fc39.x86_64-x86_64-with-glibc2.38
[2024-03-13T21:04:24.006481][NOTICE][main][startup]Program path: /usr/share/dupReport
[2024-03-13T21:04:24.006490][NOTICE][Options][initOptions]Initializing global program options.
[2024-03-13T21:04:24.006496][NOTICE][Options][OptionManager]Initializing option manager.
[2024-03-13T21:04:24.006501][NOTICE][Options][processCmdLineArgs]Processing command line arguments.
[2024-03-13T21:04:24.009103][NOTICE][Options][processCmdLineArgs]rcpath = [None]
[2024-03-13T21:04:24.009118][NOTICE][Options][processCmdLineArgs]dbpath = [None]
[2024-03-13T21:04:24.009124][NOTICE][Options][processCmdLineArgs]logpath = [None]
[2024-03-13T21:04:24.009128][NOTICE][Options][processCmdLineArgs]verbose = [None]
[2024-03-13T21:04:24.009133][NOTICE][Options][processCmdLineArgs]Version = [False]
[2024-03-13T21:04:24.009137][NOTICE][Options][processCmdLineArgs]append = [False]
[2024-03-13T21:04:24.009141][NOTICE][Options][processCmdLineArgs]size = [None]
[2024-03-13T21:04:24.009145][NOTICE][Options][processCmdLineArgs]initdb = [False]
[2024-03-13T21:04:24.009149][NOTICE][Options][processCmdLineArgs]rollback = [None]
[2024-03-13T21:04:24.009153][NOTICE][Options][processCmdLineArgs]rollbackx = [None]
[2024-03-13T21:04:24.009156][NOTICE][Options][processCmdLineArgs]file = [None]
[2024-03-13T21:04:24.009160][NOTICE][Options][processCmdLineArgs]fileattach = [None]
[2024-03-13T21:04:24.009164][NOTICE][Options][processCmdLineArgs]guidedsetup= [False]
[2024-03-13T21:04:24.009168][NOTICE][Options][processCmdLineArgs]noguidedsetup= [False]
[2024-03-13T21:04:24.009172][NOTICE][Options][processCmdLineArgs]nomail = [False]
[2024-03-13T21:04:24.009175][NOTICE][Options][processCmdLineArgs]remove = [None]
[2024-03-13T21:04:24.009179][NOTICE][Options][processCmdLineArgs]purgedb = [False]
[2024-03-13T21:04:24.009183][NOTICE][Options][processCmdLineArgs]stopbackupwarn = [False]
[2024-03-13T21:04:24.009187][NOTICE][Options][processCmdLineArgs]collect = [False]
[2024-03-13T21:04:24.009191][NOTICE][Options][processCmdLineArgs]report = [False]
[2024-03-13T21:04:24.009194][NOTICE][Options][processCmdLineArgs]masksensitive = [False]
[2024-03-13T21:04:24.009198][NOTICE][Options][processCmdLineArgs]nomasksensitive = [False]
[2024-03-13T21:04:24.009202][NOTICE][Options][processCmdLineArgs]validatereport = [False]
[2024-03-13T21:04:24.009206][NOTICE][Options][processCmdLineArgs]layout = [None]
[2024-03-13T21:04:24.009210][NOTICE][Options][processCmdLineArgs]emailservers = [None]
[2024-03-13T21:04:24.009214][NOTICE][Options][processCmdLineArgs]RC path not specified on command line. Using default.
[2024-03-13T21:04:24.009220][NOTICE][Options][processCmdLineArgs]Final RC path=[*********************************]
[2024-03-13T21:04:24.009226][NOTICE][Options][openRcFile]Opening .rc file *********************************
[2024-03-13T21:04:24.009968][NOTICE][Options][checkRcFileVersion]Current version number=310. Need to upgrade rc file? False
[2024-03-13T21:04:24.009979][NOTICE][Options][setRcDefaults]Setting .rc file defaults
[2024-03-13T21:04:24.010031][NOTICE][Options][setRcDefaults]needUpdate = False defaultsOK=True
[2024-03-13T21:04:24.010037][NOTICE][Options][readRcOptions]Reading .rc file options
[2024-03-13T21:04:24.010145][NOTICE][Options][readRcOptions]Need to restart? False
[2024-03-13T21:04:24.010151][NOTICE][Options][initOptions]Option initialization complete. Continuing program.
[2024-03-13T21:04:24.010162][NOTICE][Report][Init]Initializing report object.
[2024-03-13T21:04:24.010170][NOTICE][Options][getRcSection]Retrieving .rc section: [report]
[2024-03-13T21:04:24.010204][NOTICE][Report][validateReportFields]Validating report specifications in .rc file.
[2024-03-13T21:04:24.010215][NOTICE][Report][validateColumns]Validating columns for [report] report section.
[2024-03-13T21:04:24.010246][NOTICE][Options][getRcSection]Retrieving .rc section: [lastseen]
[2024-03-13T21:04:24.010260][NOTICE][Options][getRcSection]Retrieving .rc section: [bysrc]
[2024-03-13T21:04:24.010267][NOTICE][Report][validateColumns]Validating columns for [bysrc] report section.
[2024-03-13T21:04:24.010301][NOTICE][Options][getRcSection]Retrieving .rc section: [bydest]
[2024-03-13T21:04:24.010309][NOTICE][Report][validateColumns]Validating columns for [bydest] report section.
[2024-03-13T21:04:24.010342][NOTICE][Options][getRcSection]Retrieving .rc section: [noactivity]
[2024-03-13T21:04:24.010350][NOTICE][Report][validateReportFields]Found 0 report validation errors.
[2024-03-13T21:04:24.010370][NOTICE][Report][Init]Getting configuration for ['lastseen'] report.
[2024-03-13T21:04:24.010376][NOTICE][Options][getRcOption]Retrieving .rc option: [lastseen]type=
[2024-03-13T21:04:24.010387][NOTICE][Options][getRcSection]Retrieving .rc section: [lastseen]
[2024-03-13T21:04:24.010396][NOTICE][Report][Init]Getting configuration for ['bysrc'] report.
[2024-03-13T21:04:24.010401][NOTICE][Options][getRcOption]Retrieving .rc option: [bysrc]type=
[2024-03-13T21:04:24.010409][NOTICE][Options][getRcSection]Retrieving .rc section: [bysrc]
[2024-03-13T21:04:24.010444][NOTICE][Report][Init]Getting configuration for ['bydest'] report.
[2024-03-13T21:04:24.010449][NOTICE][Options][getRcOption]Retrieving .rc option: [bydest]type=
[2024-03-13T21:04:24.010456][NOTICE][Options][getRcSection]Retrieving .rc section: [bydest]
[2024-03-13T21:04:24.010489][NOTICE][Report][Init]Getting configuration for ['noactivity'] report.
[2024-03-13T21:04:24.010494][NOTICE][Options][getRcOption]Retrieving .rc option: [noactivity]type=
[2024-03-13T21:04:24.010501][NOTICE][Options][getRcSection]Retrieving .rc section: [noactivity]
[2024-03-13T21:04:24.010547][NOTICE][Report][Init]Adding runtime report.
[2024-03-13T21:04:24.010556][NOTICE][Options][getRcOption]Retrieving .rc option: [apprise]enabled=
[2024-03-13T21:04:24.010567][NOTICE][Database][Init]Initializing database manager.
[2024-03-13T21:04:24.010674][NOTICE][Database][execSqlStmt]Executing SQL statement: [SELECT major, minor, subminor FROM version WHERE desc = 'database']
HandyGuySoftware commented 7 months ago

Excellent! No issues on my test system either. I'll let it bake in for a few days and then promote it to the main branch. Let me know if you see any more issues.

Thanks for the notice.

HandyGuySoftware commented 7 months ago

Fixed in version 3.0.10