From f70a4c96a1be21cd75fe9dd4c498747f4aa9a0e4 Mon Sep 17 00:00:00 2001 From: Eric Torres Date: Sun, 17 Mar 2019 09:34:01 -0700 Subject: [PATCH] Initialize all properties of Snapshot object in __init__ --- rbackup/hierarchy/snapshot.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/rbackup/hierarchy/snapshot.py b/rbackup/hierarchy/snapshot.py index a2fe1b1..083e454 100644 --- a/rbackup/hierarchy/snapshot.py +++ b/rbackup/hierarchy/snapshot.py @@ -1,13 +1,19 @@ """ .. author:: Eric Torres -.. module:: r/tmp.hierarchy.snapshot +.. module:: rbackup.hierarchy.snapshot :synopsis: Classes for creating the /tmp hierarchy. """ +import logging import os.path from rbackup.hierarchy.hierarchy import Hierarchy +# ========== Logging Setup =========== +syslog = logging.getLogger(__name__) + + +# ========== Classes ========== class Snapshot(Hierarchy): """Hierarchy for a single snapshot. Attributes @@ -24,6 +30,11 @@ class Snapshot(Hierarchy): """Default constructor for the Snapshot class.""" super().__init__(path) + self._boot_dir = os.path.join(self.path, "boot") + self._etc_dir = os.path.join(self.path, "etc") + self._home_dir = os.path.join(self.path, "home") + self._root_home_dir = os.path.join(self.path, "root") + @property def name(self): """Return the name of this snapshot. @@ -50,7 +61,7 @@ class Snapshot(Hierarchy): :rtype: str """ - return os.path.join(self.path, "boot") + return self._boot_dir @property def etc_dir(self): @@ -64,7 +75,7 @@ class Snapshot(Hierarchy): :rtype: str """ - return os.path.join(self.path, "etc") + return self._etc_dir @property def home_dir(self): @@ -78,7 +89,7 @@ class Snapshot(Hierarchy): :rtype: str """ - return os.path.join(self.path, "home") + return self._home_dir @property def root_home_dir(self): @@ -92,7 +103,7 @@ class Snapshot(Hierarchy): :rtype: str """ - return os.path.join(self.path, "root") + return self._root_home_dir # ========== Functions ==========