Move borg objects to database package
- remove debug print statement
This commit is contained in:
parent
db30225b18
commit
a815cfb0b7
|
@ -1,7 +1 @@
|
||||||
from .dbobject import DBObject
|
|
||||||
from .repo import Repo
|
|
||||||
from .archive import Archive
|
|
||||||
from .stats import Stats
|
|
||||||
from .error import Error
|
|
||||||
from .label import Label
|
|
||||||
from .outputhandler import OutputHandler
|
from .outputhandler import OutputHandler
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from borgmanager import borg
|
from borgmanager.database.object import Repo, Archive, Error, Stats
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,11 +15,11 @@ class OutputHandler(object):
|
||||||
self.error = True
|
self.error = True
|
||||||
|
|
||||||
def get_borg_info(self):
|
def get_borg_info(self):
|
||||||
repo = borg.Repo.from_json(self.borg_json['repository'])
|
repo = Repo.from_json(self.borg_json['repository'])
|
||||||
archive = borg.Archive.from_json(self.borg_json['archive'])
|
archive = Archive.from_json(self.borg_json['archive'])
|
||||||
stats = borg.Stats.from_json(self.borg_json['archive']['stats'])
|
stats = Stats.from_json(self.borg_json['archive']['stats'])
|
||||||
|
|
||||||
return repo, archive, stats
|
return repo, archive, stats
|
||||||
|
|
||||||
def get_borg_error(self):
|
def get_borg_error(self):
|
||||||
return borg.Error(self.borg_output, datetime.now())
|
return Error(self.borg_output, datetime.now())
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from .connection import RepoConn, ArchiveConn, StatsConn, ErrorConn, LabelConn
|
from .connection import RepoConn, ArchiveConn, StatsConn, ErrorConn, LabelConn
|
||||||
from borgmanager.borg.label import Label
|
from .object.label import Label
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,6 @@ class LabelConn(DatabaseConnection):
|
||||||
self.sql_execute(f"UPDATE {self._sql_table} SET label = ? WHERE id = ?;",
|
self.sql_execute(f"UPDATE {self._sql_table} SET label = ? WHERE id = ?;",
|
||||||
(record.label, primary_key))
|
(record.label, primary_key))
|
||||||
else:
|
else:
|
||||||
print("updating record")
|
|
||||||
self.sql_execute(f"UPDATE {self._sql_table} SET repo_id = ?, label = ? WHERE id = ?;",
|
self.sql_execute(f"UPDATE {self._sql_table} SET repo_id = ?, label = ? WHERE id = ?;",
|
||||||
(repo_id, record.label, primary_key))
|
(repo_id, record.label, primary_key))
|
||||||
self.sql_commit()
|
self.sql_commit()
|
||||||
|
|
6
src/borgmanager/database/object/__init__.py
Normal file
6
src/borgmanager/database/object/__init__.py
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
from .dbobject import DBObject
|
||||||
|
from .repo import Repo
|
||||||
|
from .archive import Archive
|
||||||
|
from .stats import Stats
|
||||||
|
from .error import Error
|
||||||
|
from .label import Label
|
|
@ -1,4 +1,4 @@
|
||||||
from borgmanager.borg import Repo, Stats
|
from borgmanager.database.object import Repo, Stats
|
||||||
|
|
||||||
|
|
||||||
class Summary(object):
|
class Summary(object):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user