-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
999 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import sys | ||
import os | ||
import pathlib | ||
import logging | ||
|
||
logger = logging.getLogger() | ||
logging.basicConfig(level = logging.DEBUG) | ||
|
||
|
||
BIN_PATH = pathlib.Path(sys.argv[0]).absolute().parent | ||
APP_PATH = BIN_PATH.parent | ||
LIB_PATH = APP_PATH / 'lib' | ||
LBX_PATH = APP_PATH / 'lib-exec' | ||
|
||
sys.path.insert(0, str(LIB_PATH)) | ||
|
||
from Bastion.Common import * | ||
from Bastion.Site import Site | ||
from Bastion.Condo import Condex | ||
import Bastion.HPSS | ||
from Bastion.Curator import BLOND | ||
|
||
""" | ||
zone backup procedure... | ||
1. read conf file(s) | ||
2. connect to the storage vault | ||
3. retrieve manifest for given zone | ||
4. get most recent anchor snap | ||
5. compute drift between current datetime and most recent anchor snap | ||
6. perform backup | ||
a. differential if drift < policy | ||
b. anchor (full) if drift >= policy | ||
""" | ||
|
||
|
||
class App: | ||
CONF_SEARCH_ORDER = [ | ||
pathlib.Path('/etc/bastion'), | ||
APP_PATH / 'etc', | ||
pathlib.Path('~/.bastion').expanduser() | ||
] | ||
|
||
def info(self, msg): | ||
logger.info(msg) | ||
|
||
def debug(self, msg): | ||
logger.debug(msg) | ||
|
||
def warn(self, msg): | ||
logger.warn(msg) | ||
|
||
def error(self, msg): | ||
logger.error(msg) | ||
|
||
def critical(self, msg): | ||
logger.critical(msg) | ||
|
||
def __init__(self): | ||
self.conf = Condex() | ||
|
||
def configured(self): | ||
for folder in App.CONF_SEARCH_ORDER: | ||
folder = folder.expanduser() | ||
for confile in folder.rglob("conf-*.yaml"): | ||
self.info("reading conf from {}".format(str(folder / confile))) | ||
self.conf.load(folder / confile) | ||
return self | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
if __name__ == '__main__': | ||
app = App().configured() | ||
#app.run( ) | ||
|
||
vault = Bastion.HPSS.Vault('fortress').configured(app.conf) | ||
site = Site('idifhub').configured(app.conf) | ||
|
||
RzLiDAR = site.zones[0] | ||
assets = site.assets(RzLiDAR) | ||
asset = assets[0] | ||
|
||
|
||
|
||
#bastion site {site} backup | ||
#bastion zone {zone} backup | ||
#bastion manifest {zone} | ||
#bastion backups tidy idifhub | ||
#bastion backups update idifhub | ||
#bastion backups catalog idifhub | ||
#bastion keytab refresh fortress | ||
#bastion zone { } restore | ||
#bastion asset { } restore | ||
#bastion asset { } backup | ||
#bastion zone { } backup | ||
|
||
#bastion restore asset { } | ||
#bastion restore zone { } | ||
#bastion backup asset { } | ||
#bastion backup zone { } | ||
#bastion export zone manifest { } | ||
#bastion export asset manifest { } | ||
#bastion export site list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
""" | ||
Bastion.Actions | ||
I am the functions that execute the various actions of the bastion app. | ||
""" |
Oops, something went wrong.