Moved Docker stuff to "Docker" folder

Created k8s folder for k8s stuff
Added early-stage service.yaml for K8s deployment
This commit is contained in:
erichardso
2018-08-28 11:51:23 -07:00
parent 176e2f2062
commit d880f44ca6
138 changed files with 11 additions and 0 deletions

View File

@@ -0,0 +1,67 @@
#===========================================================================
#
# Config parsing
#
#===========================================================================
__doc__ = """Config parsing.
"""
from .util import Data
import ConfigParser
import glob
import os.path
#===========================================================================
def parse( configDir ):
# Parse the files. Default xform makes all keys lower case so set
# it to str to stop that behavior.
p = ConfigParser.ConfigParser()
p.optionxform = str
files = glob.glob( os.path.join( configDir, "*.conf" ) )
for f in files:
p.read( f )
cfg = Data( _config = p )
for s in p.sections():
d = Data()
for o in p.options( s ):
setattr( d, o, p.get( s, o ) )
setattr( cfg, s, d )
return cfg
#===========================================================================
def update( data, secDef ):
for section, fields in secDef.iteritems():
if not hasattr( data, section ):
setattr( data, section, Data() )
secData = data[section]
for name, convertFunc, defaultValue in fields:
if hasattr( secData, name ):
secData[name] = convertFunc( secData[name] )
else:
secData[name] = defaultValue
#===========================================================================
def toPath( value ):
"""TODO: doc
"""
if value is None:
return None
value = str( value )
if "$" in value:
value = os.path.expandvars( value )
if "~" in value:
value = os.path.expanduser( value )
return value
#===========================================================================