You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2015/03/23 18:05:07 UTC

[1/2] ambari git commit: AMBARI-10181. Hosts page: JS error after deleting host (alexantonenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk 34ac699aa -> b770c992d


AMBARI-10181. Hosts page: JS error after deleting host (alexantonenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b770c992
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b770c992
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b770c992

Branch: refs/heads/trunk
Commit: b770c992d0aea3aa16c5a71d744f9106bc16f660
Parents: c830c7e
Author: Alex Antonenko <hi...@gmail.com>
Authored: Mon Mar 23 18:22:52 2015 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Mon Mar 23 19:05:04 2015 +0200

----------------------------------------------------------------------
 ambari-web/app/controllers/main/host/details.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b770c992/ambari-web/app/controllers/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js
index 47f6cce..b9e83fc 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -1830,7 +1830,9 @@ App.MainHostDetailsController = Em.Controller.extend({
   deleteHostSuccessCallback: function (data, rq, requestBody) {
     var self = this;
     App.router.get('updateController').updateHost(function () {
-      self.loadConfigs('loadHiveConfigs');
+      if (!!App.Service.find().findProperty('serviceName', 'HIVE')) {
+        self.loadConfigs('loadHiveConfigs');
+      }
       self.loadConfigs();
       App.router.transitionTo('hosts.index');
     });


[2/2] ambari git commit: AMBARI-10175. Repo URL containing a ":" with no port number causes failed SSH Agent reg to fail (alexantonenko)

Posted by al...@apache.org.
AMBARI-10175. Repo URL containing a ":" with no port number causes failed SSH Agent reg to fail (alexantonenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c830c7e6
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c830c7e6
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c830c7e6

Branch: refs/heads/trunk
Commit: c830c7e66c2d0cd5f1213e21ba56520af71e2677
Parents: 34ac699
Author: Alex Antonenko <hi...@gmail.com>
Authored: Mon Mar 23 16:25:35 2015 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Mon Mar 23 19:05:04 2015 +0200

----------------------------------------------------------------------
 ambari-web/app/assets/test/tests.js             |   1 +
 ambari-web/app/models/repository.js             |   6 +-
 ambari-web/app/templates/wizard/step1.hbs       |   4 +-
 ambari-web/app/views/wizard/step1_view.js       |  18 +--
 ambari-web/test/models/repository_test.js       | 110 +++++++++++++++++++
 ambari-web/test/views/wizard/step1_view_test.js |  34 +++---
 6 files changed, 143 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c830c7e6/ambari-web/app/assets/test/tests.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js
index cc764e2..72b5278 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -266,6 +266,7 @@ var files = ['test/init_model_test',
   'test/models/host_test',
   'test/models/host_component_test',
   'test/models/hosts_test',
+  'test/models/repository_test',
   'test/models/service_config_test',
   'test/models/stack_service_component_test',
   'test/models/service_test',

http://git-wip-us.apache.org/repos/asf/ambari/blob/c830c7e6/ambari-web/app/models/repository.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/repository.js b/ambari-web/app/models/repository.js
index 3d75d85..8515514 100644
--- a/ambari-web/app/models/repository.js
+++ b/ambari-web/app/models/repository.js
@@ -39,8 +39,10 @@ App.Repository = DS.Model.extend({
     return this.get('operatingSystem.isSelected');
   }.property('id','operatingSystem.isSelected'),
 
-  emptyError: function() {
-    return !this.get('baseUrl');
+  invalidFormatError: function() {
+    var remotePattern = /^(?:(?:https?|ftp):\/{2})(?:\S+(?::\S*)?@)?(?:(?:(?:[\w\-.]))*)(?::[0-9]+)?(?:\/\S*)?$/,
+      localPattern = /^file:\/{2,3}([a-zA-Z][:|]\/){0,1}[\w~!*'();@&=\/\\\-+$,?%#.\[\]]+$/;
+    return !(remotePattern.test(this.get('baseUrl')) || localPattern.test(this.get('baseUrl')));
   }.property('baseUrl'),
 
   invalidError: function() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/c830c7e6/ambari-web/app/templates/wizard/step1.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/wizard/step1.hbs b/ambari-web/app/templates/wizard/step1.hbs
index bf3278e..c64fe08 100644
--- a/ambari-web/app/templates/wizard/step1.hbs
+++ b/ambari-web/app/templates/wizard/step1.hbs
@@ -70,7 +70,7 @@
                             {{view view.popoverView repositoryBinding="repository"}}
                           {{/if}}
                         </div>
-                        <div {{bindAttr class=":url-td operatingSystem.osType repository.repoId operatingSystem.isSelected::disabled-textfield repository.emptyError:textfield-error repository.invalidError:textfield-error"}}>
+                        <div {{bindAttr class=":url-td operatingSystem.osType repository.repoId operatingSystem.isSelected::disabled-textfield repository.invalidFormatError:textfield-error repository.invalidError:textfield-error"}}>
                           {{view Ember.TextField valueBinding="repository.baseUrl"}}
                         </div>
                         <div class="clear-td">
@@ -99,7 +99,7 @@
               <i class="icon-question-sign" rel="skip-validation-tooltip"
                  data-toggle="tooltip" {{translateAttr title="installer.step1.advancedRepo.skipValidation.tooltip"}}></i></label>
           </div>
-          {{#if view.emptyRepoExist}}
+          {{#if view.invalidFormatUrlExist}}
             <div class="alert">{{t installer.step1.attentionNeeded}}</div>
           {{/if}}
           {{#if view.invalidUrlExist}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/c830c7e6/ambari-web/app/views/wizard/step1_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/step1_view.js b/ambari-web/app/views/wizard/step1_view.js
index 1ae9e05..c88fe68 100644
--- a/ambari-web/app/views/wizard/step1_view.js
+++ b/ambari-web/app/views/wizard/step1_view.js
@@ -75,17 +75,17 @@ App.WizardStep1View = Em.View.extend({
    * Verify if some repo has empty base-url
    * @type {bool}
    */
-  emptyRepoExist: function () {
-    return this.get('allRepositories').someProperty('emptyError', true);
-  }.property('allRepositories.@each.emptyError'),
+  invalidFormatUrlExist: function () {
+    return this.get('allRepositories').someProperty('invalidFormatError', true);
+  }.property('allRepositories.@each.invalidFormatError'),
 
   /**
    * Disable submit button flag
    * @type {bool}
    */
   isSubmitDisabled: function () {
-    return this.get('emptyRepoExist') || this.get('isNoOsChecked') || this.get('invalidUrlExist');
-  }.property('emptyRepoExist', 'isNoOsChecked', 'invalidUrlExist'),
+    return this.get('invalidFormatUrlExist') || this.get('isNoOsChecked') || this.get('invalidUrlExist');
+  }.property('invalidFormatUrlExist', 'isNoOsChecked', 'invalidUrlExist'),
 
   /**
    * Verify if some invalid repo-urls exist
@@ -108,16 +108,16 @@ App.WizardStep1View = Em.View.extend({
    * @type {number}
    */
   totalErrorCnt: function () {
-    var emptyCnt = this.get('allRepositories').filterProperty('emptyError').length;
+    var invalidFormatCnt = this.get('allRepositories').filterProperty('invalidFormatError').length;
     var invalidCnt = this.get('allRepositories').filterProperty('validation', App.Repository.validation['INVALID']).length;
     if (this.get('isNoOsChecked')) {
       return 1;
-    } else if (emptyCnt || invalidCnt) {
-      return emptyCnt + invalidCnt;
+    } else if (invalidFormatCnt || invalidCnt) {
+      return invalidFormatCnt + invalidCnt;
     } else {
       return 0;
     }
-  }.property('allRepositories.@each.emptyError', 'isNoOsChecked', 'allRepositories.@each.validation'),
+  }.property('allRepositories.@each.invalidFormatError', 'isNoOsChecked', 'allRepositories.@each.validation'),
 
   /**
    * Checkbox for each stack

http://git-wip-us.apache.org/repos/asf/ambari/blob/c830c7e6/ambari-web/test/models/repository_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/repository_test.js b/ambari-web/test/models/repository_test.js
new file mode 100644
index 0000000..2c65907
--- /dev/null
+++ b/ambari-web/test/models/repository_test.js
@@ -0,0 +1,110 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+require('models/repository');
+
+describe('App.Repository', function () {
+
+  var model;
+
+  beforeEach(function () {
+    model = App.Repository.createRecord();
+  });
+
+  describe('#invalidFormatError', function () {
+
+    var cases = [
+      {
+        baseUrl: 'http://domain-name_0.com/path/subpath?p0=v0&p1=v1@v2.v3#!~hash0,(hash1)+hash2[hash3]/*;hash_4%2F',
+        invalidFormatError: false,
+        title: 'valid http url'
+      },
+      {
+        baseUrl: 'https://domain.com/path?p=v',
+        invalidFormatError: false,
+        title: 'valid https url'
+      },
+      {
+        baseUrl: 'ftp://domain.com:123',
+        invalidFormatError: false,
+        title: 'valid ftp url'
+      },
+      {
+        baseUrl: 'ftp://user_:password0@domain.com',
+        invalidFormatError: false,
+        title: 'valid ftp url with authorization'
+      },
+      {
+        baseUrl: 'ftp://user :password/@domain.com',
+        invalidFormatError: true,
+        title: 'ftp url with disallowed characters'
+      },
+      {
+        baseUrl: 'http://domain.com:/path',
+        invalidFormatError: true,
+        title: 'no port specified when expected'
+      },
+      {
+        baseUrl: 'file://etc/file.repo',
+        invalidFormatError: false,
+        title: 'valid Unix file url'
+      },
+      {
+        baseUrl: 'file:///etc/file.repo',
+        invalidFormatError: false,
+        title: 'valid Unix file url (3 slashes)'
+      },
+      {
+        baseUrl: 'file://c:/file.repo',
+        invalidFormatError: false,
+        title: 'valid Windows file url'
+      },
+      {
+        baseUrl: 'file:///c:/file.repo',
+        invalidFormatError: false,
+        title: 'valid Windows file url (3 slashes)'
+      },
+      {
+        baseUrl: 'file://c|/file.repo',
+        invalidFormatError: false,
+        title: 'valid Windows file url (| separator)'
+      },
+      {
+        baseUrl: 'file://C:/file.repo',
+        invalidFormatError: false,
+        title: 'valid Windows file url (capital drive char)'
+      },
+      {
+        baseUrl: 'file://etc /file.repo',
+        invalidFormatError: true,
+        title: 'file url with disallowed characters'
+      }
+    ];
+
+    cases.forEach(function (item) {
+      it(item.title, function () {
+        model.set('baseUrl', item.baseUrl);
+        expect(model.get('invalidFormatError')).to.equal(item.invalidFormatError);
+      });
+    });
+
+  });
+
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/c830c7e6/ambari-web/test/views/wizard/step1_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/wizard/step1_view_test.js b/ambari-web/test/views/wizard/step1_view_test.js
index 2f6de84..d868115 100644
--- a/ambari-web/test/views/wizard/step1_view_test.js
+++ b/ambari-web/test/views/wizard/step1_view_test.js
@@ -184,7 +184,7 @@ describe('App.WizardStep1View', function () {
     });
   });
 
-  describe('#emptyRepoExist', function () {
+  describe('#invalidFormatUrlExist', function () {
 
     controller = App.WizardStep1Controller.create({
       content: {
@@ -199,8 +199,8 @@ describe('App.WizardStep1View', function () {
       return Em.Object.create({hide: Em.K, toggle: Em.K});
     });
 
-    it(view.get('allRepositories').mapProperty('emptyError').join(', '), function () {
-      expect(view.get('emptyRepoExist')).to.equal(false);
+    it(view.get('allRepositories').mapProperty('invalidFormatError').join(', '), function () {
+      expect(view.get('invalidFormatUrlExist')).to.equal(false);
     });
   });
 
@@ -280,49 +280,49 @@ describe('App.WizardStep1View', function () {
 
     var tests = Em.A([
       {
-        emptyRepoExist: false,
+        invalidFormatUrlExist: false,
         isNoOsChecked: false,
         invalidUrlExist: false,
         e: false
       },
       {
-        emptyRepoExist: true,
+        invalidFormatUrlExist: true,
         isNoOsChecked: false,
         invalidUrlExist: false,
         e: true
       },
       {
-        emptyRepoExist: false,
+        invalidFormatUrlExist: false,
         isNoOsChecked: true,
         invalidUrlExist: false,
         e: true
       },
       {
-        emptyRepoExist: false,
+        invalidFormatUrlExist: false,
         isNoOsChecked: false,
         invalidUrlExist: true,
         e: true
       },
       {
-        emptyRepoExist: true,
+        invalidFormatUrlExist: true,
         isNoOsChecked: false,
         invalidUrlExist: true,
         e: true
       },
       {
-        emptyRepoExist: true,
+        invalidFormatUrlExist: true,
         isNoOsChecked: true,
         invalidUrlExist: false,
         e: true
       },
       {
-        emptyRepoExist: false,
+        invalidFormatUrlExist: false,
         isNoOsChecked: true,
         invalidUrlExist: true,
         e: true
       },
       {
-        emptyRepoExist: true,
+        invalidFormatUrlExist: true,
         isNoOsChecked: true,
         invalidUrlExist: true,
         e: true
@@ -330,10 +330,10 @@ describe('App.WizardStep1View', function () {
     ]);
 
     tests.forEach(function (test) {
-      it(test.emptyRepoExist.toString() + ' ' + test.isNoOsChecked.toString() + ' ' + test.invalidUrlExist.toString(), function () {
+      it(test.invalidFormatUrlExist.toString() + ' ' + test.isNoOsChecked.toString() + ' ' + test.invalidUrlExist.toString(), function () {
         view = App.WizardStep1View.create();
         view.reopen({
-          emptyRepoExist: test.emptyRepoExist,
+          invalidFormatUrlExist: test.invalidFormatUrlExist,
           isNoOsChecked: test.isNoOsChecked,
           invalidUrlExist: test.invalidUrlExist
         });
@@ -383,8 +383,8 @@ describe('App.WizardStep1View', function () {
       },
       {
         allRepositories: [
-          {'emptyError': true},
-          {'emptyError': true}
+          {'invalidFormatError': true},
+          {'invalidFormatError': true}
         ],
         isNoOsChecked: false,
         m: 'two with empty-error',
@@ -401,8 +401,8 @@ describe('App.WizardStep1View', function () {
       },
       {
         allRepositories: [
-          {'emptyError': true, 'validation': 'icon-exclamation-sign'},
-          {'emptyError': true, 'validation': 'icon-exclamation-sign'}
+          {'invalidFormatError': true, 'validation': 'icon-exclamation-sign'},
+          {'invalidFormatError': true, 'validation': 'icon-exclamation-sign'}
         ],
         isNoOsChecked: false,
         m: 'two with empty-error, two with validation="icon-exclamation-sign"',