qm2k/bbts

ValueError: time data '11:39:07 -0500' does not match format '%Y-%m-%d %H:%M:%S'

Closed this issue · 2 comments

Hello,

I'm trying to backup a new client on a brand new server (so no prior backups). I noticed burp is sending /data/burp/data/client_name/current as current path and this file doesn't exists. In the client_name directory I only have files .command and .created. The file .created contains a timestamp (2023-01-13 11:39:07 -0500).

The script is crashing with this stack trace:

Jan 13 11:39:07 dsb5 burp[3307127]: WARNING: Traceback (most recent call last):
Jan 13 11:39:07 dsb5 burp[3307127]: WARNING:   File "/usr/local/bin/timer_script.py", line 436, in <module>
Jan 13 11:39:07 dsb5 burp[3307127]: WARNING:     sys.exit(main(sys.argv))
Jan 13 11:39:07 dsb5 burp[3307127]: WARNING:   File "/usr/local/bin/timer_script.py", line 431, in main
Jan 13 11:39:07 dsb5 burp[3307127]: WARNING:     conditions_check = check_conditions(prior_path, *argument_strings)
Jan 13 11:39:07 dsb5 burp[3307127]: WARNING:   File "/usr/local/bin/timer_script.py", line 403, in check_conditions
Jan 13 11:39:07 dsb5 burp[3307127]: WARNING:     prior_backup = Backup(prior_path)
Jan 13 11:39:07 dsb5 burp[3307127]: WARNING:   File "/usr/local/bin/timer_script.py", line 127, in __init__
Jan 13 11:39:07 dsb5 burp[3307127]: WARNING:     self.client_created = self.__get_client_created_timestamp() if self.path and self.is_new() else None
Jan 13 11:39:07 dsb5 burp[3307127]: WARNING:   File "/usr/local/bin/timer_script.py", line 116, in __get_client_created_timestamp
Jan 13 11:39:07 dsb5 burp[3307127]: WARNING:     return read_timestamp(filename)
Jan 13 11:39:07 dsb5 burp[3307127]: WARNING:   File "/usr/local/bin/timer_script.py", line 93, in read_timestamp
Jan 13 11:39:07 dsb5 burp[3307127]: WARNING:     timestamp = datetime.datetime.strptime(timestamp_string, '%Y-%m-%d %H:%M:%S')
Jan 13 11:39:07 dsb5 burp[3307127]: WARNING:   File "/usr/lib/python3.10/_strptime.py", line 568, in _strptime_datetime
Jan 13 11:39:07 dsb5 burp[3307127]: WARNING:     tt, fraction, gmtoff_fraction = _strptime(data_string, format)
Jan 13 11:39:07 dsb5 burp[3307127]: WARNING:   File "/usr/lib/python3.10/_strptime.py", line 349, in _strptime
Jan 13 11:39:07 dsb5 burp[3307127]: WARNING:     raise ValueError("time data %r does not match format %r" %
Jan 13 11:39:07 dsb5 burp[3307127]: WARNING: ValueError: time data '11:39:07 -0500' does not match format '%Y-%m-%d %H:%M:%S'
Jan 13 11:39:07 dsb5 burp[3307127]: /usr/local/bin/timer_script.py returned: 1

Running on Ubuntu 22.04, BURP 2.4.0, Python 3.10.6.

Thanks!

qm2k commented

Thanks for reporting. Seems like BURP has changed the .created file format for new backups in release 2.3.10, specifically this commit. I wonder why it was done.

In any case, it's not hard for me to handle this new format. Can you please try this version of the script and tell if it fixes the problem?

Hello,

Yes it works fine with this version.

Thanks!