Alon Bar-Lev has uploaded a new change for review. Change subject: packaging: setup: apply processTemplate ......................................................................
packaging: setup: apply processTemplate Change-Id: I3f7f8d5196e1afb87cff34825916387986e4a097 Signed-off-by: Alon Bar-Lev <[email protected]> --- M packaging/legacy-setup/common_utils.py M packaging/legacy-setup/ovirt-engine-reports-setup.py 2 files changed, 15 insertions(+), 8 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-reports refs/changes/12/23412/1 diff --git a/packaging/legacy-setup/common_utils.py b/packaging/legacy-setup/common_utils.py index 9ec9e28..dd87796 100755 --- a/packaging/legacy-setup/common_utils.py +++ b/packaging/legacy-setup/common_utils.py @@ -1321,3 +1321,12 @@ output, rc = runPostgresSuQuery(sql_query) return '1' in output + +def processTemplate(template, target, subst={}): + content = '' + with open(template, 'r') as f: + content = f.read() + for k, v in subst.items(): + content = content.replace(str(k), str(v)) + with open(target, 'w') as f: + f.write(content) diff --git a/packaging/legacy-setup/ovirt-engine-reports-setup.py b/packaging/legacy-setup/ovirt-engine-reports-setup.py index d632391..89d9752 100755 --- a/packaging/legacy-setup/ovirt-engine-reports-setup.py +++ b/packaging/legacy-setup/ovirt-engine-reports-setup.py @@ -952,19 +952,17 @@ def configureApache(): - with open( + utils.processTemplate( os.path.join( REPORTS_PACKAGE_DIR, 'conf', 'ovirt-engine-reports-proxy.conf.in', - ) - ) as f: - content = f.read().replace('@JBOSS_AJP_PORT@', '8702') - with open( + ), '/etc/httpd/conf.d/z-ovirt-engine-reports-proxy.conf', - 'w', - ) as f: - f.write(content) + subst={ + '@JBOSS_AJP_PORT@': '8702', + }, + ) def main(options): -- To view, visit http://gerrit.ovirt.org/23412 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3f7f8d5196e1afb87cff34825916387986e4a097 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-reports Gerrit-Branch: master Gerrit-Owner: Alon Bar-Lev <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
