Martin Peřina has uploaded a new change for review. Change subject: tools: Adds validate only argument to notifier ......................................................................
tools: Adds validate only argument to notifier Adds command line argument to notifier, that executes only validation of notification properties and exits after. Change-Id: I2d95f2f4225652d47732c12e5e0716b7f625bbe3 Bug-Url: https://bugzilla.redhat.com/989382 Signed-off-by: Martin Perina <mper...@redhat.com> --- M backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/Notifier.java 1 file changed, 20 insertions(+), 3 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/28/22628/1 diff --git a/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/Notifier.java b/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/Notifier.java index b21c82b..935f461 100644 --- a/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/Notifier.java +++ b/backend/manager/tools/src/main/java/org/ovirt/engine/core/notifier/Notifier.java @@ -28,6 +28,11 @@ private static ScheduledExecutorService monitorScheduler = Executors.newSingleThreadScheduledExecutor(); /** + * Command line argument, that tells Notifier to validate properties only (it exits after validation) + */ + private static final String ARG_VALIDATE = "validate"; + + /** * Initializes logging configuration */ private static void initLogging() { @@ -48,7 +53,22 @@ * [0] configuration file absolute path */ public static void main(String[] args) { + NotificationProperties prop = null; initLogging(); + + try { + prop = NotificationProperties.getInstance(); + prop.validate(); + } catch (Exception ex) { + log.error("Failed to parse configuration.", ex); + System.exit(1); + } + + if (args != null && args.length > 0 && ARG_VALIDATE.equals(args[0])) { + // command line argument to validate only entered + System.exit(0); + } + NotifierSignalHandler handler = new NotifierSignalHandler(); handler.addScheduledExecutorService(notifyScheduler); handler.addScheduledExecutorService(monitorScheduler); @@ -57,9 +77,6 @@ NotificationService notificationService = null; EngineMonitorService engineMonitorService = null; try { - NotificationProperties prop = NotificationProperties.getInstance(); - prop.validate(); - notificationService = new NotificationService(prop); engineMonitorService = new EngineMonitorService(prop); -- To view, visit http://gerrit.ovirt.org/22628 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2d95f2f4225652d47732c12e5e0716b7f625bbe3 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Martin Peřina <mper...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches