Create .orig version of custom config
This commit is contained in:
@@ -8,9 +8,9 @@ Render Templates
|
|||||||
|
|
||||||
class WOTemplate():
|
class WOTemplate():
|
||||||
def tmpl_render(self, fileconf, template, data, overwrite=True):
|
def tmpl_render(self, fileconf, template, data, overwrite=True):
|
||||||
|
data = dict(data)
|
||||||
if (not overwrite):
|
if (not overwrite):
|
||||||
if not os.path.isfile('{0}'.format(fileconf)):
|
if not os.path.isfile('{0}'.format(fileconf)):
|
||||||
data = dict(data)
|
|
||||||
Log.debug(self, 'Writting the configuration to '
|
Log.debug(self, 'Writting the configuration to '
|
||||||
'file {0}'.format(fileconf))
|
'file {0}'.format(fileconf))
|
||||||
wo_template = open('{0}'.format(fileconf),
|
wo_template = open('{0}'.format(fileconf),
|
||||||
@@ -21,7 +21,6 @@ class WOTemplate():
|
|||||||
else:
|
else:
|
||||||
if (not os.path.isfile('{0}.custom'
|
if (not os.path.isfile('{0}.custom'
|
||||||
.format(fileconf))):
|
.format(fileconf))):
|
||||||
data = dict(data)
|
|
||||||
Log.debug(self, 'Writting the configuration to '
|
Log.debug(self, 'Writting the configuration to '
|
||||||
'file {0}'.format(fileconf))
|
'file {0}'.format(fileconf))
|
||||||
wo_template = open('{0}'.format(fileconf),
|
wo_template = open('{0}'.format(fileconf),
|
||||||
@@ -29,3 +28,11 @@ class WOTemplate():
|
|||||||
self.app.render((data), '{0}'.format(template),
|
self.app.render((data), '{0}'.format(template),
|
||||||
out=wo_template)
|
out=wo_template)
|
||||||
wo_template.close()
|
wo_template.close()
|
||||||
|
else:
|
||||||
|
Log.debug(self, 'Writting the configuration to '
|
||||||
|
'file {0}.orig'.format(fileconf))
|
||||||
|
wo_template = open('{0}.orig'.format(fileconf),
|
||||||
|
encoding='utf-8', mode='w')
|
||||||
|
self.app.render((data), '{0}'.format(template),
|
||||||
|
out=wo_template)
|
||||||
|
wo_template.close()
|
||||||
|
|||||||
Reference in New Issue
Block a user