You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2013/05/14 03:11:48 UTC

svn commit: r1482166 - in /incubator/ambari/trunk: ./ ambari-web/app/ ambari-web/app/controllers/ ambari-web/app/controllers/wizard/ ambari-web/app/styles/ ambari-web/app/templates/wizard/ ambari-web/app/utils/ ambari-web/app/views/wizard/

Author: yusaku
Date: Tue May 14 01:11:48 2013
New Revision: 1482166

URL: http://svn.apache.org/r1482166
Log:
 AMBARI-2123. Allow the user to specify a non-root ssh user in Install Options. (yusaku)

Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/ambari-web/app/controllers/wizard.js
    incubator/ambari/trunk/ambari-web/app/controllers/wizard/step2_controller.js
    incubator/ambari/trunk/ambari-web/app/controllers/wizard/step3_controller.js
    incubator/ambari/trunk/ambari-web/app/messages.js
    incubator/ambari/trunk/ambari-web/app/styles/application.less
    incubator/ambari/trunk/ambari-web/app/templates/wizard/step2.hbs
    incubator/ambari/trunk/ambari-web/app/utils/ajax.js
    incubator/ambari/trunk/ambari-web/app/views/wizard/step2_view.js

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1482166&r1=1482165&r2=1482166&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Tue May 14 01:11:48 2013
@@ -12,6 +12,9 @@ Trunk (unreleased changes):
 
  NEW FEATURES
 
+ AMBARI-2123. Allow the user to specify a non-root ssh user in Install Options.
+ (yusaku)
+
  AMBARI-2096. Create smoke test for HISTORYSERVER. (swagle)
 
  AMBARI-2094. Create smoke test for NODEMANAGER component as a part of 

Modified: incubator/ambari/trunk/ambari-web/app/controllers/wizard.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/wizard.js?rev=1482166&r1=1482165&r2=1482166&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/wizard.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/wizard.js Tue May 14 01:11:48 2013
@@ -434,7 +434,8 @@ App.WizardController = Em.Controller.ext
     javaHome: App.defaultJavaHome, //string
     localRepo: false, //true, false
     sshKey: "", //string
-    bootRequestId: null //string
+    bootRequestId: null, //string
+    sshUser: "root" //string
   },
 
   loadedServiceComponents: null,

Modified: incubator/ambari/trunk/ambari-web/app/controllers/wizard/step2_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/wizard/step2_controller.js?rev=1482166&r1=1482165&r2=1482166&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/wizard/step2_controller.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/wizard/step2_controller.js Tue May 14 01:11:48 2013
@@ -43,6 +43,10 @@ App.WizardStep2Controller = Em.Controlle
     return this.get('content.installOptions.sshKey');
   }.property('content.installOptions.sshKey'),
 
+  sshUser: function () {
+    return this.get('content.installOptions.sshUser');
+  }.property('content.installOptions.sshUser'),
+
   installType: function () {
     return this.get('manualInstall') ? 'manualDriven' : 'ambariDriven';
   }.property('manualInstall'),
@@ -120,6 +124,13 @@ App.WizardStep2Controller = Em.Controlle
     return null;
   }.property('sshKey', 'manualInstall', 'hasSubmitted'),
 
+  sshUserError: function(){
+    if (this.get('manualInstall') === false && this.get('sshUser').trim() === '') {
+      return Em.I18n.t('installer.step2.sshUser.required');
+    }
+    return null;
+  }.property('sshUser', 'hasSubmitted', 'manualInstall'),
+
   /**
    * Get host info, which will be saved in parent controller
    */
@@ -161,11 +172,7 @@ App.WizardStep2Controller = Em.Controlle
     this.set('hasSubmitted', true);
 
     this.checkHostError();
-    if (this.get('hostsError')) {
-      return false;
-    }
-
-    if (this.get('sshKeyError')) {
+    if (this.get('hostsError') || this.get('sshUserError') || this.get('sshKeyError')) {
       return false;
     }
 
@@ -235,7 +242,7 @@ App.WizardStep2Controller = Em.Controlle
       return false;
     }
 
-    var bootStrapData = JSON.stringify({'verbose': true, 'sshKey': this.get('sshKey'), hosts: this.get('hostNameArr')});
+    var bootStrapData = JSON.stringify({'verbose': true, 'sshKey': this.get('sshKey'), 'hosts': this.get('hostNameArr'), 'user': this.get('sshUser')});
 
     if (App.skipBootstrap) {
       this.saveHosts();
@@ -306,8 +313,8 @@ App.WizardStep2Controller = Em.Controlle
   },
 
   isSubmitDisabled: function () {
-    return (this.get('hostsError') || this.get('sshKeyError'));
-  }.property('hostsError', 'sshKeyError'),
+    return (this.get('hostsError') || this.get('sshKeyError') || this.get('sshUserError'))  ;
+  }.property('hostsError', 'sshKeyError', 'sshUserError'),
 
   saveHosts: function(){
     this.set('content.hosts', this.getHostInfo());

Modified: incubator/ambari/trunk/ambari-web/app/controllers/wizard/step3_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/wizard/step3_controller.js?rev=1482166&r1=1482165&r2=1482166&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/wizard/step3_controller.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/wizard/step3_controller.js Tue May 14 01:11:48 2013
@@ -224,7 +224,7 @@ App.WizardStep3Controller = Em.Controlle
   },
 
   retryHosts: function (hosts) {
-    var bootStrapData = JSON.stringify({'verbose': true, 'sshKey': this.get('content.installOptions.sshKey'), hosts: hosts.mapProperty('name')});
+    var bootStrapData = JSON.stringify({'verbose': true, 'sshKey': this.get('content.installOptions.sshKey'), 'hosts': hosts.mapProperty('name'), 'user': this.get('content.installOptions.sshUser')});
     this.numPolls = 0;
     if (this.get('content.installOptions.manualInstall') !== true) {
       var requestId = App.router.get('installerController').launchBootstrap(bootStrapData);

Modified: incubator/ambari/trunk/ambari-web/app/messages.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/messages.js?rev=1482166&r1=1482165&r2=1482166&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/messages.js (original)
+++ incubator/ambari/trunk/ambari-web/app/messages.js Tue May 14 01:11:48 2013
@@ -130,6 +130,7 @@ Em.I18n.translations = {
   'common.operations': 'Operations',
   'common.install': 'Install',
   'common.errorPopup.header': 'An error has been encountered',
+  'common.use': 'Use',
 
   'requestInfo.installComponents':'Install Components',
   'requestInfo.installServices':'Install Services',
@@ -263,10 +264,11 @@ Em.I18n.translations = {
   'installer.step2.javaHome.label' : 'Path to 64-bit JDK',
   'installer.step2.javaHome.tooltip.title' : 'JAVA_HOME',
   'installer.step2.javaHome.tooltip.content' : 'Path to 64-bit JAVA_HOME. /usr/jdk/jdk1.6.0_31 is the default used by Ambari. You can override this to a specific path that contains the JDK. <br/> Note: the path must be valid on <b>ALL</b> hosts in your cluster.',
+  'installer.step2.javaHome.tooltip.placeholder' : '/usr/jdk/jdk1.6.0_31',
   'installer.step2.useSsh.provide' : 'Provide your',
-  'installer.step2.useSsh.provide_id_rsa' : '(id_rsa for root) and use SSH to automatically register hosts',
+  'installer.step2.useSsh.provide_id_rsa' : ' to automatically register hosts',
   'installer.step2.useSsh.tooltip.title':'SSH Private Key',
-  'installer.step2.useSsh.tooltip.content':'The <b>SSH Private Key File</b> is used for the root access to the target hosts in your cluster.',
+  'installer.step2.useSsh.tooltip.content':'The <b>SSH Private Key File</b> is used to connect to the target hosts in your cluster to install the Ambari Agent.',
   'installer.step2.manualInstall.perform':'Perform',
   'installer.step2.manualInstall.perform_on_hosts':'on hosts and do not use SSH',
   'installer.step2.manualInstall.tooltip.title':'manual registration',
@@ -278,6 +280,12 @@ Em.I18n.translations = {
   'installer.step2.evaluateStep.installedHosts':'These hosts are already installed on the cluster and will be ignored:',
   'installer.step2.evaluateStep.continueConfirm':'Do you want to continue?',
   'installer.step2.evaluateStep.hostRegInProgress':'Host Registration is currently in progress.  Please try again later.',
+  'installer.step2.sshUser':'SSH user (root or',
+  'installer.step2.sshUser.link':'passwordless sudo',
+  'installer.step2.sshUser.account':'account)',
+  'installer.step2.sshUser.toolTip':'An account that can execute sudo without entering a password',
+  'installer.step2.sshUser.placeholder':'Enter user name',
+  'installer.step2.sshUser.required':'User name is required',
 
   'installer.step3.header':'Confirm Hosts',
   'installer.step3.body':'Registering your hosts.<br>' +
@@ -1119,6 +1127,6 @@ Em.I18n.translations = {
 
   'quick.links.error.label': 'Hostname is undefined',
 
-  'contact.administrator': 'Contact System Administrator for more information'
+  'contact.administrator': 'Contact System Administrator for more information!'
 
 };
\ No newline at end of file

Modified: incubator/ambari/trunk/ambari-web/app/styles/application.less
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/styles/application.less?rev=1482166&r1=1482165&r2=1482166&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/styles/application.less (original)
+++ incubator/ambari/trunk/ambari-web/app/styles/application.less Tue May 14 01:11:48 2013
@@ -298,6 +298,10 @@ h1 {
       width: 504px;
       height: auto;
     }
+    .ssh-user {
+      margin-right: 10px;
+      padding-top: 5px;
+    }
     #targetHosts {
       .target-hosts-input {
         padding-left: 18px;

Modified: incubator/ambari/trunk/ambari-web/app/templates/wizard/step2.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/wizard/step2.hbs?rev=1482166&r1=1482165&r2=1482166&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/templates/wizard/step2.hbs (original)
+++ incubator/ambari/trunk/ambari-web/app/templates/wizard/step2.hbs Tue May 14 01:11:48 2013
@@ -55,17 +55,33 @@
             {{t installer.step2.useSsh.tooltip.title}}</a>
         {{t installer.step2.useSsh.provide_id_rsa}}
       </label>
-      <div {{bindAttr class="sshKeyError:error :control-group :ssh-key-input"}}>
+      <div class="ssh-key-input">
         {{#if view.isFileApi}}
           {{view App.SshKeyFileUploader disabledBinding="view.sshKeyState"}}
         {{/if}}
-          <div class="controls">
+        <div {{bindAttr class="sshKeyError:error :controls :control-group"}}>
             {{view Ember.TextArea class="span6" rows="3" id="sshKey"
             placeholder="ssh private key" disabledBinding="view.sshKeyState" valueBinding="content.installOptions.sshKey"}}
             {{#if sshKeyError}}
                 <span class="help-inline">{{sshKeyError}}</span>
             {{/if}}
+        </div>
+        <div>
+            <label class="ssh-user pull-left">
+              {{t installer.step2.sshUser}}
+                <a href="javascript:void(null)"
+                   rel="popover"
+                  {{translateAttr title="installer.step2.sshUser.link" data-content="installer.step2.sshUser.toolTip"}}>
+                  {{t installer.step2.sshUser.link}}</a>
+              {{t installer.step2.sshUser.account}}
+            </label>
+          <div {{bindAttr class="sshUserError:error :control-group"}}>
+            {{view view.textFieldView valueBinding="content.installOptions.sshUser"}}
+            {{#if sshUserError}}
+                <span class="help-inline">{{sshUserError}}</span>
+            {{/if}}
           </div>
+        </div>
       </div>
 
       <label class="radio">
@@ -105,7 +121,9 @@
           {{translateAttr title="installer.step2.javaHome.tooltip.title" data-content="installer.step2.javaHome.tooltip.content"}}>
             {{t installer.step2.javaHome.tooltip.title}}</a>
       </div>
-      {{view App.WizardTextField valueBinding="content.installOptions.javaHome" placeholder="/usr/jdk/jdk1.6.0_31"}}
+    </label>
+    <label class="checkbox">
+      {{view view.textFieldView valueBinding="content.installOptions.javaHome" isEnabledBinding="content.installOptions.isJavaHome" placeholderName="installer.step2.javaHome.tooltip.placeholder"}}
     </label>
     {{/if}}
   </div>

Modified: incubator/ambari/trunk/ambari-web/app/utils/ajax.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/utils/ajax.js?rev=1482166&r1=1482165&r2=1482166&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/utils/ajax.js (original)
+++ incubator/ambari/trunk/ambari-web/app/utils/ajax.js Tue May 14 01:11:48 2013
@@ -447,9 +447,9 @@ var urls = {
   'wizard.launch_bootstrap': {
     'real': '/bootstrap',
     'mock': '/data/wizard/bootstrap/bootstrap.json',
+    'type': 'POST',
     'format': function (data) {
       return {
-        type: 'POST',
         async: false,
         contentType: 'application/json',
         data: data.bootStrapData

Modified: incubator/ambari/trunk/ambari-web/app/views/wizard/step2_view.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/wizard/step2_view.js?rev=1482166&r1=1482165&r2=1482166&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/wizard/step2_view.js (original)
+++ incubator/ambari/trunk/ambari-web/app/views/wizard/step2_view.js Tue May 14 01:11:48 2013
@@ -43,16 +43,6 @@ App.SshKeyFileUploader = Ember.View.exte
   }
 });
 
-//TODO: move it to App.WizardStep2View
-App.WizardTextField = Ember.TextField.extend({
-  disabled: function(){
-    return !this.get('controller.content.installOptions.isJavaHome');
-  }.property('controller.content.installOptions.isJavaHome'),
-  click: function(){
-    return false;
-  }
-})
-
 App.WizardStep2View = Em.View.extend({
 
   templateName: require('templates/wizard/step2'),
@@ -117,6 +107,12 @@ App.WizardStep2View = Em.View.extend({
       this.set('controller.content.installOptions.manualInstall', true);
       this.set('controller.content.installOptions.useSsh', false);
     }
+  }),
+
+  textFieldView: Ember.TextField.extend({
+    disabled: function(){
+      return !this.get('controller.content.installOptions.useSsh');
+    }.property('controller.content.installOptions.useSsh')
   })
 });