Skip to content

Commit

Permalink
Merge pull request #4 from johscheuer/read-optional-config
Browse files Browse the repository at this point in the history
Read optional config
  • Loading branch information
Felix Hupfeld committed May 12, 2016
2 parents cdeb46f + 02dd867 commit 566ed3f
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion quobyte-docker-volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,21 @@ def getenv_mandatory(name):
MOUNT_DIRECTORY = '/run/docker/quobyte/mnt'


def read_optional_config():
global MOUNT_QUOBYTE_PATH
MOUNT_QUOBYTE_PATH = os.getenv("MOUNT_QUOBYTE_PATH")
global QMGMT_PATH
QMGMT_PATH = os.getenv("QMGMT_PATH")
options = os.getenv("MOUNT_QUOBYTE_OPTIONS")
if options:
global MOUNT_QUOBYTE_OPTIONS
MOUNT_QUOBYTE_OPTIONS = options
config = os.getenv("DEFAULT_VOLUME_CONFIGURATION")
if config:
global DEFAULT_VOLUME_CONFIGURATION
DEFAULT_VOLUME_CONFIGURATION = config


def mount_all():
binary = "mount.quobyte"
if MOUNT_QUOBYTE_PATH:
Expand Down Expand Up @@ -147,7 +162,7 @@ def respond(self, msg):
print "Responding with", json.dumps(msg)
self.wfile.write(json.dumps(msg))

def do_post(self):
def do_POST(self):
print self.get_request()
if self.path == "/Plugin.Activate":
self.respond({"Implements": ["VolumeDriver"]})
Expand Down Expand Up @@ -216,6 +231,7 @@ def volume_driver_list(self):


if __name__ == '__main__':
read_optional_config()
try:
os.makedirs(MOUNT_DIRECTORY)
except OSError as error:
Expand Down

0 comments on commit 566ed3f

Please sign in to comment.