Yedidyah Bar David has uploaded a new change for review.

Change subject: packaging: setup: add params to js.quartz.properties
......................................................................

packaging: setup: add params to js.quartz.properties

Edit js.quartz.properties on upgrade to have three new required params.

Change-Id: I2f9a42e4f7303f3a3cebe65e1e7166a5645278c7
Bug-Url: https://bugzilla.redhat.com/1209540
Signed-off-by: Yedidyah Bar David <d...@redhat.com>
---
M 
packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-reports/jasper/deploy.py
1 file changed, 27 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-reports refs/changes/79/39679/1

diff --git 
a/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-reports/jasper/deploy.py
 
b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-reports/jasper/deploy.py
index 8e5c427..424cd1d 100644
--- 
a/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-reports/jasper/deploy.py
+++ 
b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-reports/jasper/deploy.py
@@ -549,23 +549,23 @@
     )
     def _export(self):
         config = self._jasperConfiguration()
-        self._quartzprops = os.path.join(self._temproot, 'quartzprops')
 
         if (
             os.path.exists(
                 oreportscons.FileLocations.OVIRT_ENGINE_REPORTS_JASPER_WAR
             )
         ):
-            shutil.copyfile(
+            with open(
                 oreportscons.FileLocations.OVIRT_ENGINE_REPORTS_JASPER_QUARTZ,
-                self._quartzprops,
-            )
+                'r'
+            ) as f:
+                self._quartzprops = f.read().splitlines()
         elif (
             os.path.exists(
                 self.environment[oreportscons.ConfigEnv.LEGACY_REPORTS_WAR]
             )
         ):
-            shutil.copyfile(
+            with open(
                 os.path.join(
                     self.environment[
                         oreportscons.ConfigEnv.LEGACY_REPORTS_WAR
@@ -573,8 +573,9 @@
                     'WEB-INF',
                     'js.quartz.properties'
                 ),
-                self._quartzprops,
-            )
+                'r'
+            ) as f:
+                self._quartzprops = f.read().splitlines()
 
         else:
             raise RuntimeError(
@@ -725,6 +726,12 @@
             )
         )
 
+    QUARTZ_NEEDED_PROPS = {
+        'report.quartz.misfirepolicy.singlesimplejob': 'SMART_POLICY',
+        'report.quartz.misfirepolicy.repeatingsimplejob': 'SMART_POLICY',
+        'report.quartz.misfirepolicy.calendarjob': 'SMART_POLICY',
+    }
+
     @plugin.event(
         stage=plugin.Stages.STAGE_MISC,
         name=oreportscons.Stages.JASPER_DEPLOY_IMPORT,
@@ -739,10 +746,20 @@
         self.logger.info(_('Importing data into Jasper'))
 
         if self._quartzprops:
-            shutil.copyfile(
-                self._quartzprops,
+            with open(
                 oreportscons.FileLocations.OVIRT_ENGINE_REPORTS_JASPER_QUARTZ,
-            )
+                'w'
+            ) as f:
+                f.write(
+                    '\n'.join(
+                        osetuputil.editConfigContent(
+                            content=self._quartzprops,
+                            params=self.QUARTZ_NEEDED_PROPS,
+                            new_line_tpl='{spaces}{param}={value}',
+                        )
+                    )
+                )
+
             os.chmod(
                 oreportscons.FileLocations.OVIRT_ENGINE_REPORTS_JASPER_QUARTZ,
                 0o644,


-- 
To view, visit https://gerrit.ovirt.org/39679
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2f9a42e4f7303f3a3cebe65e1e7166a5645278c7
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-reports
Gerrit-Branch: master
Gerrit-Owner: Yedidyah Bar David <d...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to