jkosh44 commented on a change in pull request #1052: Issue 1003 - Refactor remove and init apis to check if running URL: https://github.com/apache/fluo/pull/1052#discussion_r222893696
########## File path: modules/command/src/main/java/org/apache/fluo/command/FluoInit.java ########## @@ -134,65 +135,60 @@ public static void main(String[] args) { try (FluoAdminImpl admin = new FluoAdminImpl(config)) { - if (admin.applicationRunning()) { - System.err.println("Error - The Fluo '" + config.getApplicationName() + "' application" - + " is already running and must be stopped before running 'fluo init'. " - + " Aborted initialization."); - System.exit(-1); - } - FluoAdmin.InitializationOptions initOpts = new FluoAdmin.InitializationOptions(); if (opts.getUpdate()) { System.out.println("Updating configuration for the Fluo '" + config.getApplicationName() + "' application in Zookeeper using " + opts.getAppPropsPath()); - admin.updateSharedConfig(); - System.out.println("Update is complete."); - System.exit(0); - } - - if (opts.getForce()) { - initOpts.setClearZookeeper(true).setClearTable(true); + initOpts.setUpdateWithoutInitializing(true); Review comment: Two alternatives that may make this cleaner 1. We call `admin.initialize(initOpts); System.exit(0)` This would remove the need for surrounding everything else in an else block. 2. Create a `FluoAdminImpl.updateSharedConfigForStoppedApp()` method. This would first check if the app is runnung, if it is it would throw an exception, if not it would call `FluoAdminImpl.updateSharedConfig()`. With this we wouldn't have to add `updateWithoutInitializing` property to `InitializationOptions` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services