[ambari] branch trunk updated: [AMBARI-23930]q - Provide a Framework For Regenerating Keytabs During Upgrade (#1355)

2018-05-23 Thread jonathanhurley
This is an automated email from the ASF dual-hosted git repository.

jonathanhurley pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
 new 7b3aca8  [AMBARI-23930]q - Provide a Framework For Regenerating 
Keytabs During Upgrade (#1355)
7b3aca8 is described below

commit 7b3aca83483cbc3cad777ba2eadf7015c1234d0d
Author: Jonathan Hurley 
AuthorDate: Wed May 23 15:45:14 2018 -0400

[AMBARI-23930]q - Provide a Framework For Regenerating Keytabs During 
Upgrade (#1355)
---
 .../ambari/server/controller/KerberosHelper.java   |   7 +
 .../server/controller/KerberosHelperImpl.java  | 144 ++---
 .../internal/UpgradeResourceProvider.java  | 110 
 .../serveraction/upgrades/AddComponentAction.java  |   2 +-
 .../org/apache/ambari/server/stack/HostsType.java  |  20 ++-
 .../ambari/server/stack/MasterHostResolver.java|  14 +-
 .../state/stack/upgrade/ClusterGrouping.java   |  34 -
 .../server/state/stack/upgrade/Grouping.java   |   3 +
 .../state/stack/upgrade/RegenerateKeytabsTask.java |  81 
 .../server/state/stack/upgrade/StageWrapper.java   |   3 +-
 .../ambari/server/state/stack/upgrade/Task.java|  12 +-
 .../server/state/stack/upgrade/TaskWrapper.java|   4 +-
 .../stack-hooks/before-SET_KEYTAB/scripts/hook.py  |  38 ++
 ambari-server/src/main/resources/upgrade-pack.xsd  |   9 +-
 .../server/controller/KerberosHelperTest.java  |  45 ++-
 .../internal/UpgradeResourceProviderTest.java  |  48 ++-
 .../before-SET_KEYTAB/test_before_set_keytab.py|  41 ++
 .../stacks/2.2/KERBEROS/test_kerberos_client.py|   2 +-
 .../upgrades/upgrade_test_regenerate_keytabs.xml   |  41 ++
 19 files changed, 558 insertions(+), 100 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelper.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelper.java
index 297fc3c..38701e2 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelper.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelper.java
@@ -132,6 +132,13 @@ public interface KerberosHelper {
   String PRECONFIGURE_SERVICES = "preconfigure_services";
 
   /**
+   * If {@code true}, then this will create the stages and tasks as being
+   * retry-able. A failure during Kerberos operations will not cause the entire
+   * request to be aborted.
+   */
+  String ALLOW_RETRY = "allow_retry_on_failure";
+
+  /**
* Toggles Kerberos security to enable it or remove it depending on the 
state of the cluster.
* 
* The cluster "security_type" property is used to determine the security 
state of the cluster.
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
index c492173..0fc8165 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
@@ -279,6 +279,12 @@ public class KerberosHelperImpl implements KerberosHelper {
 throw new AmbariException(String.format("Custom operation %s 
can only be requested with the security type cluster property: %s", 
operation.name(), SecurityType.KERBEROS.name()));
   }
 
+  boolean retryAllowed = false;
+  if (requestProperties.containsKey(ALLOW_RETRY)) {
+String allowRetryString = requestProperties.get(ALLOW_RETRY);
+retryAllowed = Boolean.parseBoolean(allowRetryString);
+  }
+
   CreatePrincipalsAndKeytabsHandler handler = null;
 
   Set hostFilter = parseHostFilter(requestProperties);
@@ -296,6 +302,8 @@ public class KerberosHelperImpl implements KerberosHelper {
   }
 
   if (handler != null) {
+handler.setRetryAllowed(retryAllowed);
+
 requestStageContainer = handle(cluster, 
getKerberosDetails(cluster, manageIdentities),
   serviceComponentFilter, hostFilter, null, null, 
requestStageContainer, handler);
   } else {
@@ -473,7 +481,7 @@ public class KerberosHelperImpl implements KerberosHelper {
 // If Ambari is managing it own identities then add AMBARI to the set of 
installed service so
 // that its Kerberos descriptor entries will be included.
 if (createAmbariIdentities(existingConfigurations.get(KERBEROS_ENV))) {
-  installedServices = new HashMap(installedServices);
+  installedServices = new HashMap<>(installedServices);
   installedServices.put(RootService.AMBARI.name(), 

[ambari] branch trunk updated: AMBARI-23935 ambari ui fails to load due to js error

2018-05-23 Thread atkach
This is an automated email from the ASF dual-hosted git repository.

atkach pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
 new a031dba  AMBARI-23935 ambari ui fails to load due to js error
a031dba is described below

commit a031dba6e3bf355786a2ed70904d8eda6b883cce
Author: Andrii Tkach 
AuthorDate: Wed May 23 14:06:04 2018 +0300

AMBARI-23935 ambari ui fails to load due to js error
---
 ambari-web/app/controllers/global/cluster_controller.js  | 3 +++
 .../app/controllers/main/admin/stack_and_upgrade_controller.js   | 5 -
 .../test/controllers/main/admin/stack_and_upgrade_controller_test.js | 2 ++
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/ambari-web/app/controllers/global/cluster_controller.js 
b/ambari-web/app/controllers/global/cluster_controller.js
index ba9034e..63b16f8 100644
--- a/ambari-web/app/controllers/global/cluster_controller.js
+++ b/ambari-web/app/controllers/global/cluster_controller.js
@@ -65,6 +65,8 @@ App.ClusterController = 
Em.Controller.extend(App.ReloadPopupMixin, {
 
   isServiceContentFullyLoaded: Em.computed.and('isServiceMetricsLoaded', 
'isComponentsStateLoaded', 'isComponentsConfigLoaded'),
 
+  isStackVersionsLoaded: false,
+
   clusterName: Em.computed.alias('App.clusterName'),
 
   updateLoadStatus: function (item) {
@@ -355,6 +357,7 @@ App.ClusterController = 
Em.Controller.extend(App.ReloadPopupMixin, {
 upgradeController.loadCompatibleVersions();
 upgradeController.updateCurrentStackVersion();
 App.set('stackVersionsAvailable', 
App.StackVersion.find().content.length > 0);
+self.set('isStackVersionsLoaded', true);
   });
 });
   },
diff --git 
a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js 
b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
index 55ac6d0..dbad1dc 100644
--- a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
+++ b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
@@ -2194,6 +2194,9 @@ App.MainAdminStackAndUpgradeController = 
Em.Controller.extend(App.LocalStorage,
* it should be fetched from the repo which corresponds to the 
desiredRepositoryVersionId of the service
*/
   getServiceVersionFromRepo: function () {
+if (!App.router.get('clusterController.isLoaded') || 
!App.router.get('clusterController.isStackVersionsLoaded')) {
+  return;
+}
 
 var currentStackName = App.get('currentStackName');
 var currentStackVersionNumber = App.get('currentStackVersionNumber');
@@ -2226,6 +2229,6 @@ App.MainAdminStackAndUpgradeController = 
Em.Controller.extend(App.LocalStorage,
   }
   map[serviceName] = serviceVersion;
 });
-  }.observes('App.router.clusterController.isLoaded')
+  }.observes('App.router.clusterController.isLoaded', 
'App.router.clusterController.isStackVersionsLoaded')
 
 });
diff --git 
a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js 
b/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
index ff0f3be..9cd79fe 100644
--- 
a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
+++ 
b/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js
@@ -3485,6 +3485,7 @@ describe('App.MainAdminStackAndUpgradeController', 
function() {
   App.Service.find.restore();
   App.StackService.find.restore();
   App.RepositoryVersion.find.restore();
+  App.router.get.restore();
   controller.set('serviceVersionsMap', {});
 });
 
@@ -3494,6 +3495,7 @@ describe('App.MainAdminStackAndUpgradeController', 
function() {
 sinon.stub(App.Service, 'find').returns(item.services);
 sinon.stub(App.StackService, 'find').returns(item.stackServices);
 sinon.stub(App.RepositoryVersion, 'find').returns(item.repoVersions);
+sinon.stub(App.router, 'get').returns(true);
 controller.getServiceVersionFromRepo();
 expect(controller.get('serviceVersionsMap')).to.be.eql(item.expected);
   });

-- 
To stop receiving notification emails like this one, please contact
atk...@apache.org.


[ambari] 02/02: [AMBARI-23897] Log Search UI: login with invalid password – no error message is displayed

2018-05-23 Thread ababiichuk
This is an automated email from the ASF dual-hosted git repository.

ababiichuk pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git

commit abb5295f4ae0f1b0f98f4078dfb7bec9718986f6
Author: Tobias Istvan 
AuthorDate: Wed May 23 09:31:46 2018 +0200

[AMBARI-23897] Log Search UI: login with invalid password – no error 
message is displayed
---
 .../src/app/components/login-form/login-form.component.html   | 2 +-
 .../src/app/components/login-form/login-form.component.ts | 5 +
 .../ambari-logsearch-web/src/app/services/auth.service.ts | 4 ++--
 .../ambari-logsearch-web/src/app/services/http-client.service.ts  | 2 +-
 ambari-logsearch/ambari-logsearch-web/src/assets/i18n/en.json | 8 +++-
 5 files changed, 8 insertions(+), 13 deletions(-)

diff --git 
a/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.html
 
b/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.html
index 9e8b2a5..3db75c6 100644
--- 
a/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.html
+++ 
b/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.html
@@ -16,7 +16,7 @@
 -->
 
 
-  
+  {{errorMessage}}
   
 
   {{'authorization.name' | translate}}
diff --git 
a/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.ts
 
b/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.ts
index eee0b1b..d38fe33 100644
--- 
a/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.ts
+++ 
b/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.ts
@@ -76,10 +76,7 @@ export class LoginFormComponent implements OnInit, OnDestroy 
{
   }
 
   private onLoginError = (resp: Boolean): void => {
-Observable.combineLatest(
-  this.translateService.get('login.error.title'),
-  this.translateService.get('login.error.message')
-).first().subscribe(([title, message]: [string, string]) => {
+
this.translateService.get('authorization.error.401').first().subscribe((message:
 string) => {
   this.errorMessage = message;
   this.isLoginAlertDisplayed = true;
 });
diff --git 
a/ambari-logsearch/ambari-logsearch-web/src/app/services/auth.service.ts 
b/ambari-logsearch/ambari-logsearch-web/src/app/services/auth.service.ts
index a3ed9b8..b78a88b 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/services/auth.service.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/services/auth.service.ts
@@ -81,7 +81,7 @@ export class AuthService {
 const response$ = this.httpClient.postFormData('login', {
   username: username,
   password: password
-}).share();
+});
 response$.subscribe(
   (resp: Response) => this.onLoginResponse(resp),
   (resp: Response) => this.onLoginError(resp)
@@ -103,7 +103,7 @@ export class AuthService {
* @returns {Observable}
*/
   logout(): Observable {
-const response$ = this.httpClient.get('logout').share();
+const response$ = this.httpClient.get('logout');
 response$.subscribe(
   (resp: Response) => this.onLogoutResponse(resp),
   (resp: Response) => this.onLogoutError(resp)
diff --git 
a/ambari-logsearch/ambari-logsearch-web/src/app/services/http-client.service.ts 
b/ambari-logsearch/ambari-logsearch-web/src/app/services/http-client.service.ts
index 19a12ab..c65278b 100644
--- 
a/ambari-logsearch/ambari-logsearch-web/src/app/services/http-client.service.ts
+++ 
b/ambari-logsearch/ambari-logsearch-web/src/app/services/http-client.service.ts
@@ -171,7 +171,7 @@ export class HttpClientService extends Http {
   }
   return handled;
 };
-return super.request(this.generateUrl(url), options).first()
+return super.request(this.generateUrl(url), options).first().share()
   .map(response => response)
   .catch((error: any) => {
 return handleResponseError(error) ? Observable.of(error) : 
Observable.throw(error);
diff --git a/ambari-logsearch/ambari-logsearch-web/src/assets/i18n/en.json 
b/ambari-logsearch/ambari-logsearch-web/src/assets/i18n/en.json
index fec6991..ad69e1b 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/assets/i18n/en.json
+++ b/ambari-logsearch/ambari-logsearch-web/src/assets/i18n/en.json
@@ -24,7 +24,9 @@
   "authorization.name": "Username",
   "authorization.password": "Password",
   "authorization.signIn": "Sign In",
-  "authorization.error": "Error! Invalid User 
credentials.Please try again.",
+  "authorization.error.401": "Unable to sign in. Invalid username/password 
combination.",
+
+  "login.title": "Login",
 
   "topMenu.undo": "Undo",
   "topMenu.redo": "Redo",
@@ -218,10 +220,6 @@
   "logIndexFilter.update.success": "Log Index Filter for cluster {{cluster}} has been successfully updated.",
   

[ambari] 01/02: [AMBARI-23897] Log Search UI: login with invalid password – no error message is displayed

2018-05-23 Thread ababiichuk
This is an automated email from the ASF dual-hosted git repository.

ababiichuk pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git

commit 9e07d7460642b36b0d3dd195920ab6aa2a0dd608
Author: Tobias Istvan 
AuthorDate: Mon May 21 15:36:53 2018 +0200

[AMBARI-23897] Log Search UI: login with invalid password – no error 
message is displayed
---
 .../login-form/login-form.component.html   |  2 +-
 .../login-form/login-form.component.spec.ts| 23 
 .../components/login-form/login-form.component.ts  | 61 --
 .../src/app/services/auth.service.ts   | 31 ---
 .../ambari-logsearch-web/src/assets/i18n/en.json   |  2 +
 5 files changed, 86 insertions(+), 33 deletions(-)

diff --git 
a/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.html
 
b/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.html
index 8b9c957..9e8b2a5 100644
--- 
a/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.html
+++ 
b/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.html
@@ -16,7 +16,7 @@
 -->
 
 
-  
+  
   
 
   {{'authorization.name' | translate}}
diff --git 
a/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.spec.ts
 
b/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.spec.ts
index 7e2f7a7..3ec55fd 100644
--- 
a/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.spec.ts
+++ 
b/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.spec.ts
@@ -26,20 +26,23 @@ import {AuthService} from '@app/services/auth.service';
 
 import {LoginFormComponent} from './login-form.component';
 import {RouterTestingModule} from '@angular/router/testing';
+import {NotificationsService} from 'angular2-notifications';
+import {NotificationService} from 
'@app/modules/shared/services/notification.service';
 
 describe('LoginFormComponent', () => {
   let component: LoginFormComponent;
   let fixture: ComponentFixture;
 
   const authMock = {
-isError: false
+isError: false,
+isAuthorized: false
   };
-  const httpClient = {
-isAuthorized: true,
-postFormData: () => {
+
+  const AuthServiceMock = {
+login: () => {
   return {
-subscribe: (success: () => void, error: () => void) => {
-  authMock.isError ? error() : success();
+subscribe: (observer: (resp) => void, error: (resp) => void) => {
+  authMock.isAuthorized ? observer(authMock.isAuthorized) : 
error(authMock.isAuthorized);
 }
   };
 }
@@ -59,10 +62,11 @@ describe('LoginFormComponent', () => {
   providers: [
 AppStateService,
 {
-  provide: HttpClientService,
-  useValue: httpClient
+  provide: AuthService,
+  useValue: AuthServiceMock
 },
-AuthService
+NotificationsService,
+NotificationService
   ]
 })
 .compileComponents();
@@ -98,6 +102,7 @@ describe('LoginFormComponent', () => {
   describe(test.title, () => {
 beforeEach(() => {
   authMock.isError = test.isError;
+  authMock.isAuthorized = test.isAuthorized;
   component.login();
 });
 
diff --git 
a/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.ts
 
b/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.ts
index e3570c4..eee0b1b 100644
--- 
a/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.ts
+++ 
b/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.ts
@@ -16,19 +16,23 @@
  * limitations under the License.
  */
 
-import {Component} from '@angular/core';
+import {Component, ViewChild, OnInit, OnDestroy} from '@angular/core';
 import {Response} from '@angular/http';
+import {Observable} from 'rxjs/Observable';
 import 'rxjs/add/operator/finally';
+import {Subscription} from 'rxjs/Subscription';
 import {AppStateService} from '@app/services/storage/app-state.service';
 import {AuthService} from '@app/services/auth.service';
-import {Observable} from 'rxjs/Observable';
+import {NotificationService, NotificationType} from 
'@modules/shared/services/notification.service';
+import {TranslateService} from '@ngx-translate/core';
+import {FormGroup} from '@angular/forms';
 
 @Component({
   selector: 'login-form',
   templateUrl: './login-form.component.html',
   styleUrls: ['./login-form.component.less']
 })
-export class LoginFormComponent {
+export class LoginFormComponent implements OnInit, OnDestroy {
 
   username: string;
 
@@ -38,24 +42,47 @@ export class LoginFormComponent {
 
   isLoginInProgress$: Observable = 

[ambari] branch trunk updated (8a5d252 -> abb5295)

2018-05-23 Thread ababiichuk
This is an automated email from the ASF dual-hosted git repository.

ababiichuk pushed a change to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git.


from 8a5d252  Update team page. (yusaku)
 new 9e07d74  [AMBARI-23897] Log Search UI: login with invalid password – 
no error message is displayed
 new abb5295  [AMBARI-23897] Log Search UI: login with invalid password – 
no error message is displayed

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../login-form/login-form.component.html   |  2 +-
 .../login-form/login-form.component.spec.ts| 23 +
 .../components/login-form/login-form.component.ts  | 58 +++---
 .../src/app/services/auth.service.ts   | 27 --
 .../src/app/services/http-client.service.ts|  2 +-
 .../ambari-logsearch-web/src/assets/i18n/en.json   |  6 +--
 6 files changed, 83 insertions(+), 35 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
ababiic...@apache.org.