Repository: ambari Updated Branches: refs/heads/trunk d58382a87 -> 807b3b25c
AMBARI-17113. Add user home directory verification as part of Service Check (pallavkul) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/807b3b25 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/807b3b25 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/807b3b25 Branch: refs/heads/trunk Commit: 807b3b25c3453c445d3b15c0536bdda6e7c9dd2c Parents: d58382a Author: Pallav Kulshreshtha <[email protected]> Authored: Fri Jun 10 18:13:48 2016 +0530 Committer: Pallav Kulshreshtha <[email protected]> Committed: Fri Jun 10 18:13:48 2016 +0530 ---------------------------------------------------------------------- .../main/resources/ui/app/templates/splash.hbs | 3 +-- contrib/views/hive/pom.xml | 5 +++++ .../apache/ambari/view/hive/HelpService.java | 12 ++++++++++ .../view/hive/resources/files/FileService.java | 16 ++++++++++++++ .../ui/hive-web/app/controllers/splash.js | 19 ++++++++++------ .../resources/ui/hive-web/app/routes/splash.js | 4 +++- .../ui/hive-web/app/templates/splash.hbs | 23 ++++++++++++++++---- contrib/views/pig/pom.xml | 5 +++++ .../view/pig/resources/files/FileService.java | 18 +++++++++++++++ .../ambari/view/pig/services/HelpService.java | 14 ++++++++++++ .../ui/pig-web/app/controllers/splash.js | 8 +++---- .../resources/ui/pig-web/app/routes/splash.js | 4 +++- .../ui/pig-web/app/templates/splash.hbs | 17 +++++++++++++-- .../resources/ui/pig-web/app/translations.js | 3 ++- 14 files changed, 129 insertions(+), 22 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/807b3b25/contrib/views/files/src/main/resources/ui/app/templates/splash.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/files/src/main/resources/ui/app/templates/splash.hbs b/contrib/views/files/src/main/resources/ui/app/templates/splash.hbs index 4a45366..26dbff0 100644 --- a/contrib/views/files/src/main/resources/ui/app/templates/splash.hbs +++ b/contrib/views/files/src/main/resources/ui/app/templates/splash.hbs @@ -18,7 +18,6 @@ <div class="spinner"></div> <div class="container-fluid"> - <h1>Welcome to the File Browser View</h1> {{#if allTestsCompleted }} <h3>Service checks completed.</h3> {{else}} @@ -49,7 +48,7 @@ <i class="fa fa-arrow-right"></i> {{/if}} </td> - <td>hdfs service test</td> + <td>HDFS test</td> </tr> </tbody> </table> http://git-wip-us.apache.org/repos/asf/ambari/blob/807b3b25/contrib/views/hive/pom.xml ---------------------------------------------------------------------- diff --git a/contrib/views/hive/pom.xml b/contrib/views/hive/pom.xml index 1c92f74..444cd98 100644 --- a/contrib/views/hive/pom.xml +++ b/contrib/views/hive/pom.xml @@ -226,6 +226,11 @@ <artifactId>commons-csv</artifactId> <version>1.1</version> </dependency> + <dependency> + <groupId>org.apache.ambari.contrib.views</groupId> + <artifactId>ambari-views-commons</artifactId> + <version>2.0.0.0-SNAPSHOT</version> + </dependency> </dependencies> <properties> http://git-wip-us.apache.org/repos/asf/ambari/blob/807b3b25/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/HelpService.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/HelpService.java b/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/HelpService.java index 3a7f823..f18a422 100644 --- a/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/HelpService.java +++ b/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/HelpService.java @@ -79,6 +79,18 @@ public class HelpService extends BaseService { } /** + * HomeDirectory Status + * @return status + */ + @GET + @Path("/userhomeStatus") + @Produces(MediaType.APPLICATION_JSON) + public Response userhomeStatus (){ + FileService.userhomeSmokeTest(context); + return getOKResponse(); + } + + /** * ATS Status * @return status */ http://git-wip-us.apache.org/repos/asf/ambari/blob/807b3b25/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/resources/files/FileService.java ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/resources/files/FileService.java b/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/resources/files/FileService.java index ab2b933..4e1d24f 100644 --- a/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/resources/files/FileService.java +++ b/contrib/views/hive/src/main/java/org/apache/ambari/view/hive/resources/files/FileService.java @@ -45,6 +45,7 @@ import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.util.HashMap; +import org.apache.ambari.view.commons.hdfs.UserService; /** * File access resource @@ -235,6 +236,21 @@ public class FileService extends BaseService { } /** + * Checks connection to User HomeDirectory + * @param context View Context + */ + public static void userhomeSmokeTest(ViewContext context) { + try { + UserService userservice = new UserService(context); + userservice.homeDir(); + } catch (WebApplicationException ex) { + throw ex; + } catch (Exception ex) { + throw new ServiceFormattedException(ex.getMessage(), ex); + } + } + + /** * Wrapper object for json mapping */ public static class FileResourceRequest { http://git-wip-us.apache.org/repos/asf/ambari/blob/807b3b25/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/splash.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/splash.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/splash.js index 5db93f7..6f495ed 100644 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/splash.js +++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/splash.js @@ -60,12 +60,11 @@ export default Ember.Controller.extend({ } model.set(name + 'TestDone', true); - var percent = model.get('percent'); - model.set('percent', percent + 33.33); + model.set('percent', percent + 25); }; - var promises = ['hdfs', 'hiveserver', 'ats'].map(function(name) { + var promises = ['hdfs', 'hiveserver', 'ats', 'userhome'].map(function(name) { var finalurl = ((name == 'hiveserver') ? self.get('databaseService.baseUrl') : (url + name + 'Status')) || '' ; @@ -88,13 +87,17 @@ export default Ember.Controller.extend({ }.property("model.percent"), allTestsCompleted: function(){ - return this.get('modelhdfsTestDone') && this.get('modelhiveserverTestDone') && this.get('modelatsTestDone'); - }.property('modelhdfsTestDone', 'modelhiveserverTestDone', 'modelatsTestDone'), + return this.get('modelhdfsTestDone') && this.get('modelhiveserverTestDone') && this.get('modelatsTestDone') && this.get('modeluserhomeTestDone'); + }.property('modelhdfsTestDone', 'modelhiveserverTestDone', 'modelatsTestDone', 'modeluserhomeTestDone'), modelhdfsTestDone: function() { return this.get('model.hdfsTestDone'); }.property('model.hdfsTestDone' ), + modeluserhomeTestDone: function() { + return this.get('model.userhomeTestDone'); + }.property('model.userhomeTestDone' ), + modelhiveserverTestDone: function() { return this.get('model.hiveserverTestDone'); }.property('model.hiveserverTestDone' ), @@ -107,6 +110,10 @@ export default Ember.Controller.extend({ return this.get('model.hdfsTest'); }.property('model.hdfsTest' ), + modeluserhomeTest: function() { + return this.get('model.userhomeTest'); + }.property('model.userhomeTest' ), + modelhiveserverTest: function() { return this.get('model.hiveserverTest'); }.property('model.hiveserverTest' ), @@ -122,5 +129,3 @@ export default Ember.Controller.extend({ } } }); - - http://git-wip-us.apache.org/repos/asf/ambari/blob/807b3b25/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/splash.js ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/splash.js b/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/splash.js index 05bcbcf..463a1c6 100644 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/splash.js +++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/routes/splash.js @@ -28,6 +28,8 @@ export default Ember.Route.extend({ hiveserverTestDone: null, atsTest: null, atsTestDone: null, + userhomeTest: null, + userhomeTestDone: null, percent: 0 }); }, @@ -42,7 +44,7 @@ export default Ember.Route.extend({ var self = this; controller.startTests().then(function() { - if (model.get("hiveserverTest") && model.get("hdfsTest") && model.get("atsTest")) { + if (model.get("hiveserverTest") && model.get("hdfsTest") && model.get("atsTest") && model.get("userhomeTest")) { Ember.run.later(this, function() { self.send('transition'); }, 2000); http://git-wip-us.apache.org/repos/asf/ambari/blob/807b3b25/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/splash.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/splash.hbs b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/splash.hbs index 84c7a71..5612542 100644 --- a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/splash.hbs +++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/splash.hbs @@ -18,7 +18,6 @@ <div class="spinner"></div> <div class="container-fluid"> - <h1>Welcome to the Hive View</h1> {{#if allTestsCompleted }} <h3>Service checks completed.</h3> {{else}} @@ -49,7 +48,7 @@ <i class="fa fa-arrow-right"></i> {{/if}} </td> - <td>hdfs service test</td> + <td>HDFS test</td> </tr> <tr> <td> @@ -63,7 +62,7 @@ <i class="fa fa-arrow-right"></i> {{/if}} </td> - <td>hiveserver service test</td> + <td>HiveServer test</td> </tr> <tr> <td> @@ -77,8 +76,24 @@ <i class="fa fa-arrow-right"></i> {{/if}} </td> - <td>ats service test</td> + <td>ATS test</td> </tr> + + <tr> + <td> + {{#if modeluserhomeTestDone}} + {{#if modeluserhomeTest}} + <i class="fa fa-check"></i> + {{else}} + <i class="fa fa-remove"></i> + {{/if}} + {{else}} + <i class="fa fa-arrow-right"></i> + {{/if}} + </td> + <td>User Home Directory test</td> + </tr> + </tbody> </table> {{#if errors}} http://git-wip-us.apache.org/repos/asf/ambari/blob/807b3b25/contrib/views/pig/pom.xml ---------------------------------------------------------------------- diff --git a/contrib/views/pig/pom.xml b/contrib/views/pig/pom.xml index 36fb59e..595537a 100644 --- a/contrib/views/pig/pom.xml +++ b/contrib/views/pig/pom.xml @@ -140,6 +140,11 @@ <artifactId>ambari-views-utils</artifactId> <version>2.0.0.0-SNAPSHOT</version> </dependency> + <dependency> + <groupId>org.apache.ambari.contrib.views</groupId> + <artifactId>ambari-views-commons</artifactId> + <version>2.0.0.0-SNAPSHOT</version> + </dependency> </dependencies> <properties> http://git-wip-us.apache.org/repos/asf/ambari/blob/807b3b25/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/files/FileService.java ---------------------------------------------------------------------- diff --git a/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/files/FileService.java b/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/files/FileService.java index 40bc9a7..4791103 100644 --- a/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/files/FileService.java +++ b/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/files/FileService.java @@ -25,6 +25,7 @@ import org.apache.ambari.view.pig.services.BaseService; import org.apache.ambari.view.pig.utils.*; import org.apache.ambari.view.utils.hdfs.HdfsApi; import org.apache.ambari.view.utils.hdfs.HdfsUtil; +import org.apache.ambari.view.commons.hdfs.UserService; import org.apache.hadoop.fs.FSDataOutputStream; import org.apache.hadoop.fs.FileAlreadyExistsException; import org.apache.hadoop.fs.FileStatus; @@ -40,6 +41,7 @@ import java.io.IOException; import java.util.LinkedList; import java.util.List; + /** * File access resource * API: @@ -196,6 +198,22 @@ public class FileService extends BaseService { } } + + /** + * Checks connection to User HomeDirectory + * @param context View Context + */ + public static void userhomeSmokeTest(ViewContext context) { + try { + UserService userservice = new UserService(context); + userservice.homeDir(); + } catch (WebApplicationException ex) { + throw ex; + } catch (Exception ex) { + throw new ServiceFormattedException(ex.getMessage(), ex); + } + } + /** * Wrapper object for json mapping */ http://git-wip-us.apache.org/repos/asf/ambari/blob/807b3b25/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/services/HelpService.java ---------------------------------------------------------------------- diff --git a/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/services/HelpService.java b/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/services/HelpService.java index eb363a0..a67bfc5 100644 --- a/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/services/HelpService.java +++ b/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/services/HelpService.java @@ -92,6 +92,20 @@ public class HelpService extends BaseService { return getOKResponse(); } + + /** + * HomeDirectory Status + * @return status + */ + @GET + @Path("/userhomeStatus") + @Produces(MediaType.APPLICATION_JSON) + public Response userhomeStatus (){ + FileService.userhomeSmokeTest(context); + return getOKResponse(); + } + + /** * WebHCat Status * @return status http://git-wip-us.apache.org/repos/asf/ambari/blob/807b3b25/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/splash.js ---------------------------------------------------------------------- diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/splash.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/splash.js index f58d437..d1b571d 100644 --- a/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/splash.js +++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/controllers/splash.js @@ -57,9 +57,9 @@ App.SplashController = Ember.ObjectController.extend({ } model.set(name + 'TestDone', true); var percent = model.get('percent'); - model.set('percent', percent + 33.33); + model.set('percent', percent + 25); }; - var promises = ['storage', 'webhcat', 'hdfs'].map(function(name) { + var promises = ['storage', 'webhcat', 'hdfs', 'userhome'].map(function(name) { return Ember.$.getJSON('/' + url + name + 'Status') .then( function(data) { @@ -78,7 +78,7 @@ App.SplashController = Ember.ObjectController.extend({ }.property("model.percent"), allTestsCompleted: function(){ - return this.get("model").get("hdfsTestDone") && this.get("model").get("webhcatTestDone") && this.get("model").get("storageTestDone"); - }.property('model.hdfsTestDone', 'model.webhcatTestDone', 'model.storageTestDone') + return this.get("model").get("hdfsTestDone") && this.get("model").get("webhcatTestDone") && this.get("model").get("storageTestDone") && this.get("model").get("userhomeTestDone"); + }.property('model.hdfsTestDone', 'model.webhcatTestDone', 'model.storageTestDone', 'model.userhomeTestDone') }); http://git-wip-us.apache.org/repos/asf/ambari/blob/807b3b25/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/splash.js ---------------------------------------------------------------------- diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/splash.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/splash.js index 1d848e3..b30552d 100644 --- a/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/splash.js +++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/routes/splash.js @@ -27,6 +27,8 @@ App.SplashRoute = Em.Route.extend({ webhcatTestDone: null, hdfsTest: null, hdfsTestDone: null, + userhomeTest: null, + userhomeTestDone: null, percent: 0 }); }, @@ -37,7 +39,7 @@ App.SplashRoute = Em.Route.extend({ controller.set('model', model); var self = this; controller.startTests(model).then(function() { - if (model.get("storageTest") && model.get("webhcatTest") && model.get("hdfsTest")) { + if (model.get("storageTest") && model.get("webhcatTest") && model.get("hdfsTest") && model.get("userhomeTest")) { Ember.run.later(this, function() { previousTransition = App.get('previousTransition'); if (previousTransition) { http://git-wip-us.apache.org/repos/asf/ambari/blob/807b3b25/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/splash.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/splash.hbs b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/splash.hbs index d635a91..c97d724 100644 --- a/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/splash.hbs +++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/templates/splash.hbs @@ -17,8 +17,6 @@ }} <div class="container-fluid"> - <h1>{{t 'splash.welcome'}}</h1> - {{#if allTestsCompleted }} <h3>Service checks completed.</h3> {{else}} @@ -82,6 +80,21 @@ <td>{{t 'splash.webhcat_test'}}</td> </tr> + <tr> + <td> + {{#if userhomeTestDone}} + {{#if userhomeTest}} + <span class="glyphicon glyphicon-ok green"></span> + {{else}} + <span class="glyphicon glyphicon-remove red"></span> + {{/if}} + {{else}} + <span class="glyphicon glyphicon-arrow-right"></span> + {{/if}} + </td> + <td>{{t 'splash.userhome_test'}}</td> + </tr> + </tbody> </table> http://git-wip-us.apache.org/repos/asf/ambari/blob/807b3b25/contrib/views/pig/src/main/resources/ui/pig-web/app/translations.js ---------------------------------------------------------------------- diff --git a/contrib/views/pig/src/main/resources/ui/pig-web/app/translations.js b/contrib/views/pig/src/main/resources/ui/pig-web/app/translations.js index 072b5c7..151c88c 100644 --- a/contrib/views/pig/src/main/resources/ui/pig-web/app/translations.js +++ b/contrib/views/pig/src/main/resources/ui/pig-web/app/translations.js @@ -173,6 +173,7 @@ Ember.I18n.translations = { 'please_wait':'Testing connection to services...please wait.', 'storage_test':'Storage test', 'hdfs_test':'HDFS test', - 'webhcat_test':'WebHCat test' + 'webhcat_test':'WebHCat test', + 'userhome_test':'User Home Directory test' } };
