diff --git a/bin/pfstorage b/bin/pfstorage index 3057a25..6e750d8 100755 --- a/bin/pfstorage +++ b/bin/pfstorage @@ -10,14 +10,14 @@ import sys, os, pudb, socket, json sys.path.insert(1, os.path.join(os.path.dirname(__file__), '..')) -from pypx import PfStorage, swiftStorage, swiftStore +from pypx import swiftStore from argparse import RawTextHelpFormatter from argparse import ArgumentParser from pfmisc._colors import Colors str_name = "pfstorage" -str_version = "3.2.6" +str_version = "3.2.7" str_desc = Colors.CYAN + """ __ _ @@ -211,6 +211,14 @@ def synopsis(ab_shortOnly = False): parser = ArgumentParser(description = str_desc, formatter_class = RawTextHelpFormatter) +parser.add_argument( + '--storeBaseLocation', + action = 'store', + dest = 'str_storeBaseLocation', + type = str, + default = '', + help = 'Base location where a File system is mounted') + parser.add_argument( '--swiftIP', action = 'store', diff --git a/pypx/__init__.py b/pypx/__init__.py index 242320f..ddb05d9 100644 --- a/pypx/__init__.py +++ b/pypx/__init__.py @@ -7,7 +7,7 @@ from .do import Do from .push import Push from .register import Register -from .pfstorage import PfStorage, swiftStorage +from .pfstorage import swiftStorage, fileStorage def echo(opt={}): return Echo(opt).run() @@ -37,4 +37,7 @@ def register(opt={}): return Register(opt).run(opt) def swiftStore(opt={}): - return swiftStorage(opt).run(opt) + if opt.get("str_storeBaseLocation"): + return fileStorage(opt).run(opt) + else : + return swiftStorage(opt).run(opt) diff --git a/pypx/pfstorage.py b/pypx/pfstorage.py index 52a0765..a053174 100755 --- a/pypx/pfstorage.py +++ b/pypx/pfstorage.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3.5 import abc +import glob import sys from io import BytesIO as IO @@ -1019,7 +1020,7 @@ def connect(self, *args, **kwargs): def ls(self, *args, **kwargs): pass - def ls_process(self, *args, **kwargs): + def ls_process(self, *args, **kwargs) -> dict: pass def objExists(self, *args, **kwargs): diff --git a/workflow.sh b/workflow.sh index 01d1d4a..3d3fe8f 100644 --- a/workflow.sh +++ b/workflow.sh @@ -60,6 +60,8 @@ export PYPX=local/pypx # Edit any/all of the following as appropriate to your local env. +# storage type +export STORAGETYPE=swift # # swift storage environment # @@ -170,10 +172,11 @@ docker run --rm -ti -v $BASEMOUNT:$BASEMOUNT -v $LOCALDICOMDIR:$LOCALDICOMDIR \ # Set the swift login info in a key-ref'd service px-smdb \ --logdir $DB \ - --action swift \ + --action storage \ --actionArgs ' { "'$SWIFTKEY'": { + "storagetype": "'$STORAGETYPE'", "ip": "'$SWIFTHOST'", "port":"'$SWIFTPORT'", "login":"'$SWIFTLOGIN'" @@ -185,9 +188,9 @@ px-smdb \ docker run --rm -ti -v $BASEMOUNT:$BASEMOUNT $PYPX \ --px-smdb \ --logdir $DB \ - --action swift \ + --action storage \ --actionArgs \ -'{\"'$SWIFTKEY'\":{\"ip\":\"'$SWIFTHOST'\",\"port\":\"'$SWIFTPORT'\",\"login\":\"'$SWIFTLOGIN'\"}}' +'{\"'$SWIFTKEY'\":{\"storagetype\":\"'$STORAGETYPE'\",\"ip\":\"'$SWIFTHOST'\",\"port\":\"'$SWIFTPORT'\",\"login\":\"'$SWIFTLOGIN'\"}}' # Get the swift login details for all keys # This examines the service file, swift.json, located in @@ -199,7 +202,7 @@ px-smdb \ docker run --rm -ti -v $BASEMOUNT:$BASEMOUNT $PYPX \ --px-smdb \ --logdir $DB \ - --action swift + --action storage # Query smdb for all image dirs on a patient px-smdb \