diff --git a/src/main/java/org/shirdrn/azk/client/actions/FetchScheduleAction.java b/src/main/java/org/shirdrn/azk/client/actions/FetchScheduleAction.java index 68e92ce..37215cd 100644 --- a/src/main/java/org/shirdrn/azk/client/actions/FetchScheduleAction.java +++ b/src/main/java/org/shirdrn/azk/client/actions/FetchScheduleAction.java @@ -45,9 +45,14 @@ public void operate() { String res = response.body().string(); JSONObject j = JSONObject.parseObject(res); logResponse(LOG, res); - String scheduleId = j.getJSONObject("schedule").getString("scheduleId"); - LOG.info("Schedule fetched: scheduleId=" + scheduleId); - scheduleIds.add(scheduleId); + JSONObject jsonSchedule = j.getJSONObject("schedule"); + // A scheduleId for delete actions are not present! + if (jsonSchedule != null) { // prevent for NPE by delete actions + String scheduleId = jsonSchedule.getString("scheduleId"); + LOG.info("Schedule fetched: scheduleId=" + scheduleId); + scheduleIds.add(scheduleId); + } + } } catch (IOException e) { Throwables.propagate(e); diff --git a/src/main/resources/config.properties b/src/main/resources/config.properties index c97657d..9807698 100644 --- a/src/main/resources/config.properties +++ b/src/main/resources/config.properties @@ -3,10 +3,11 @@ # java -jar target/azkaban-app-deployer-0.0.1-SNAPSHOT-jar-with-dependencies.jar -t exec -c /Users/yanjun/Workspaces/github/azk-client/src/main/resources/config.properties # java -jar target/azkaban-app-deployer-0.0.1-SNAPSHOT-jar-with-dependencies.jar -t delete -c /Users/yanjun/Workspaces/github/azk-client/src/main/resources/config.properties -azkaban.server.url = http://172.16.117.62:8099 -azkaban.user = azkaban -azkaban.password = azkaban -project.name = test-demo-hourly -project.description = test-demo-hourly -job.zip.file = /Users/yanjun/Azkaban/demo/demo-syj.zip -cron.expr = 0 45 * * * ? \ No newline at end of file +azkaban.server.url = http://127.0.0.1:8081 +azkaban.user = admin +azkaban.password = admin +project.name = test-client +project.description = test client from CLI +job.zip.file = /home/dweiss/tmp/job.zip +cron.expr = */5 * * * * +# cron.expr = 0 45 * * * ? \ No newline at end of file