You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by rl...@apache.org on 2017/11/16 19:45:17 UTC
[01/50] [abbrv] ambari git commit: AMBARI-22293. Improve KDC
integration [addendum - fix unit tests] (rlevas)
Repository: ambari
Updated Branches:
refs/heads/branch-feature-AMBARI-20859 ceead2241 -> d173011c8
AMBARI-22293. Improve KDC integration [addendum - fix unit tests] (rlevas)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/08d38265
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/08d38265
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/08d38265
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 08d382652052172aeb15082a919a18666de93eb7
Parents: 0f67d1c
Author: Robert Levas <rl...@hortonworks.com>
Authored: Wed Nov 8 12:26:00 2017 -0500
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Wed Nov 8 12:26:00 2017 -0500
----------------------------------------------------------------------
.../KDCKerberosOperationHandlerTest.java | 22 +++++++++++++++++---
.../MITKerberosOperationHandlerTest.java | 6 +++---
2 files changed, 22 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/08d38265/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/KDCKerberosOperationHandlerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/KDCKerberosOperationHandlerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/KDCKerberosOperationHandlerTest.java
index 271c787..095b92a 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/KDCKerberosOperationHandlerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/KDCKerberosOperationHandlerTest.java
@@ -19,7 +19,9 @@
package org.apache.ambari.server.serveraction.kerberos;
import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.anyString;
import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.getCurrentArguments;
import java.lang.reflect.Method;
import java.util.Map;
@@ -27,6 +29,7 @@ import java.util.Map;
import org.apache.ambari.server.utils.ShellCommandUtil;
import org.apache.commons.lang.StringUtils;
import org.easymock.EasyMock;
+import org.easymock.IAnswer;
import org.easymock.IArgumentMatcher;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -37,9 +40,12 @@ abstract public class KDCKerberosOperationHandlerTest extends KerberosOperationH
static Method methodExecuteCommand;
+ static Method methodGetExecutable;
+
@BeforeClass
public static void beforeKDCKerberosOperationHandlerTest() throws Exception {
methodExecuteCommand = KDCKerberosOperationHandler.class.getDeclaredMethod("executeCommand", String[].class, Map.class, ShellCommandUtil.InteractiveHandler.class);
+ methodGetExecutable = KerberosOperationHandler.class.getDeclaredMethod("getExecutable", String.class);
}
@Test
@@ -66,7 +72,17 @@ abstract public class KDCKerberosOperationHandlerTest extends KerberosOperationH
@Override
protected KerberosOperationHandler createMockedHandler() throws KerberosOperationException {
- return createMockedHandler(methodExecuteCommand);
+ KDCKerberosOperationHandler handler = createMockedHandler(methodExecuteCommand, methodGetExecutable);
+
+ expect(handler.getExecutable(anyString()))
+ .andAnswer(new IAnswer<String>() {
+ @Override
+ public String answer() throws Throwable {
+ Object[] args = getCurrentArguments();
+ return args[0].toString();
+ }
+ }).anyTimes();
+ return handler;
}
@Override
@@ -74,7 +90,7 @@ abstract public class KDCKerberosOperationHandlerTest extends KerberosOperationH
ShellCommandUtil.Result result = createMock(ShellCommandUtil.Result.class);
expect(result.isSuccessful()).andReturn(true);
- expect(handler.executeCommand(arrayContains("/usr/bin/kinit"), anyObject(Map.class), anyObject(KDCKerberosOperationHandler.InteractivePasswordHandler.class)))
+ expect(handler.executeCommand(arrayContains("kinit"), anyObject(Map.class), anyObject(KDCKerberosOperationHandler.InteractivePasswordHandler.class)))
.andReturn(result)
.anyTimes();
}
@@ -87,7 +103,7 @@ abstract public class KDCKerberosOperationHandlerTest extends KerberosOperationH
expect(result.getStdout()).andReturn("STDOUT data").once();
expect(result.getStderr()).andReturn("STDERR data").once();
- expect(handler.executeCommand(arrayContains("/usr/bin/kinit"), anyObject(Map.class), anyObject(KDCKerberosOperationHandler.InteractivePasswordHandler.class)))
+ expect(handler.executeCommand(arrayContains("kinit"), anyObject(Map.class), anyObject(KDCKerberosOperationHandler.InteractivePasswordHandler.class)))
.andReturn(result)
.anyTimes();
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/08d38265/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandlerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandlerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandlerTest.java
index 848d479..f94adbe 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandlerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandlerTest.java
@@ -275,7 +275,7 @@ public class MITKerberosOperationHandlerTest extends KDCKerberosOperationHandler
.andReturn("Authenticating as principal admin/admin with password.")
.anyTimes();
- expect(handler.executeCommand(arrayContains(new String[]{"/usr/sbin/kadmin", "add_principal"}), anyObject(Map.class), anyObject(KDCKerberosOperationHandler.InteractivePasswordHandler.class)))
+ expect(handler.executeCommand(arrayContains(new String[]{"kadmin", "add_principal"}), anyObject(Map.class), anyObject(KDCKerberosOperationHandler.InteractivePasswordHandler.class)))
.andReturn(result)
.anyTimes();
}
@@ -292,7 +292,7 @@ public class MITKerberosOperationHandlerTest extends KDCKerberosOperationHandler
.andReturn("Authenticating as principal admin/admin with password.")
.anyTimes();
- expect(handler.executeCommand(arrayContains(new String[]{"/usr/sbin/kadmin", "get_principal"}), anyObject(Map.class), anyObject(KDCKerberosOperationHandler.InteractivePasswordHandler.class)))
+ expect(handler.executeCommand(arrayContains(new String[]{"kadmin", "get_principal"}), anyObject(Map.class), anyObject(KDCKerberosOperationHandler.InteractivePasswordHandler.class)))
.andReturn(result)
.anyTimes();
}
@@ -329,7 +329,7 @@ public class MITKerberosOperationHandlerTest extends KDCKerberosOperationHandler
"Policy: [none]", (service) ? "service/host" : "user"))
.anyTimes();
- expect(handler.executeCommand(arrayContains(new String[]{"/usr/sbin/kadmin", "get_principal"}), anyObject(Map.class), anyObject(KDCKerberosOperationHandler.InteractivePasswordHandler.class)))
+ expect(handler.executeCommand(arrayContains(new String[]{"kadmin", "get_principal"}), anyObject(Map.class), anyObject(KDCKerberosOperationHandler.InteractivePasswordHandler.class)))
.andReturn(result)
.anyTimes();
}
[06/50] [abbrv] ambari git commit: AMBARI-22388 Log Search UI:
restyle logs list. (Istvan Tobias via ababiichuk)
Posted by rl...@apache.org.
AMBARI-22388 Log Search UI: restyle logs list. (Istvan Tobias via ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/38476f7a
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/38476f7a
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/38476f7a
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 38476f7a1a7a371fd0f57af2f931427f1e276d27
Parents: 5f714ce
Author: Istvan Tobias <to...@gmail.com>
Authored: Thu Nov 9 13:24:16 2017 +0200
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Thu Nov 9 13:24:16 2017 +0200
----------------------------------------------------------------------
.../ambari-logsearch-web/src/app/app.module.ts | 4 +
.../log-level/log-level.component.html | 18 +++
.../log-level/log-level.component.spec.ts | 73 +++++++++++
.../components/log-level/log-level.component.ts | 52 ++++++++
.../log-message/log-message.component.html | 24 ++++
.../log-message/log-message.component.less | 69 ++++++++++
.../log-message/log-message.component.spec.ts | 64 +++++++++
.../log-message/log-message.component.ts | 129 ++++++++++++++++++
.../logs-list/logs-list.component.html | 92 +++++++------
.../logs-list/logs-list.component.less | 130 +++++++++----------
.../ambari-logsearch-web/webpack.config.js | 15 ++-
11 files changed, 550 insertions(+), 120 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/38476f7a/ambari-logsearch/ambari-logsearch-web/src/app/app.module.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/app.module.ts b/ambari-logsearch/ambari-logsearch-web/src/app/app.module.ts
index 488437e..56562df 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/app.module.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/app.module.ts
@@ -68,6 +68,8 @@ import {FilterButtonComponent} from '@app/components/filter-button/filter-button
import {AccordionPanelComponent} from '@app/components/accordion-panel/accordion-panel.component';
import {CollapsiblePanelComponent} from '@app/components/collapsible-panel/collapsible-panel.component';
import {LogsListComponent} from '@app/components/logs-list/logs-list.component';
+import {LogMessageComponent} from '@app/components/log-message/log-message.component';
+import {LogLevelComponent} from '@app/components/log-level/log-level.component';
import {DropdownButtonComponent} from '@app/components/dropdown-button/dropdown-button.component';
import {PaginationComponent} from '@app/components/pagination/pagination.component';
import {PaginationControlsComponent} from '@app/components/pagination-controls/pagination-controls.component';
@@ -121,6 +123,8 @@ export function getXHRBackend(injector: Injector, browser: BrowserXhr, xsrf: XSR
AccordionPanelComponent,
CollapsiblePanelComponent,
LogsListComponent,
+ LogLevelComponent,
+ LogMessageComponent,
DropdownButtonComponent,
PaginationComponent,
PaginationControlsComponent,
http://git-wip-us.apache.org/repos/asf/ambari/blob/38476f7a/ambari-logsearch/ambari-logsearch-web/src/app/components/log-level/log-level.component.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/log-level/log-level.component.html b/ambari-logsearch/ambari-logsearch-web/src/app/components/log-level/log-level.component.html
new file mode 100644
index 0000000..d72c9d33
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/log-level/log-level.component.html
@@ -0,0 +1,18 @@
+<!--
+ 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.
+-->
+<i class="fa {{cssClass}}"></i>
+{{logEntry.level}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/38476f7a/ambari-logsearch/ambari-logsearch-web/src/app/components/log-level/log-level.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/log-level/log-level.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/log-level/log-level.component.spec.ts
new file mode 100644
index 0000000..c13d373
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/log-level/log-level.component.spec.ts
@@ -0,0 +1,73 @@
+/**
+ * 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.
+ */
+import {DebugElement} from '@angular/core';
+import {async, ComponentFixture, TestBed} from '@angular/core/testing';
+
+import {LogLevelComponent} from './log-level.component';
+import {By} from '@angular/platform-browser';
+
+describe('LogLevelComponent', () => {
+ let component: LogLevelComponent;
+ let fixture: ComponentFixture<LogLevelComponent>;
+ let de: DebugElement;
+ let el: HTMLElement;
+ let logLevelMap = {
+ warn: 'fa-exclamation-triangle',
+ fatal: 'fa-exclamation-circle',
+ error: 'fa-exclamation-circle',
+ info: 'fa-info-circle',
+ debug: 'fa-bug',
+ trace: 'fa-random',
+ unknown: 'fa-question-circle'
+ };
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ LogLevelComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(LogLevelComponent);
+ component = fixture.componentInstance;
+ component.logEntry = {level: 'unknown'};
+ fixture.detectChanges();
+ de = fixture.debugElement.query(By.css('i.fa'));
+ el = de.nativeElement;
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+
+ Object.keys(logLevelMap).forEach((level) => {
+ describe(level, () => {
+ beforeEach(() => {
+ component.logEntry = {level: level};
+ fixture.detectChanges();
+ });
+ it(`should return with the ${logLevelMap[level]} css class for ${level} log level`, () => {
+ expect(component.cssClass).toEqual(logLevelMap[level]);
+ });
+ it(`should set the ${logLevelMap[level]} css class on the icon element`, () => {
+ expect(el.classList).toContain(logLevelMap[level]);
+ });
+ });
+ });
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/38476f7a/ambari-logsearch/ambari-logsearch-web/src/app/components/log-level/log-level.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/log-level/log-level.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/log-level/log-level.component.ts
new file mode 100644
index 0000000..8542770
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/log-level/log-level.component.ts
@@ -0,0 +1,52 @@
+/**
+ * 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.
+ */
+import {Component, Input} from '@angular/core';
+
+/**
+ * This is a simple UI component to display the log message. The goal is to be able to show one line and be collapsile
+ * to show the full log message with new lines.
+ * @class LogMessageComponent
+ */
+@Component({
+ selector: 'log-level',
+ templateUrl: './log-level.component.html',
+ styleUrls: []
+})
+export class LogLevelComponent {
+
+ /**
+ * This is the log entry object
+ * @type {object}
+ */
+ @Input()
+ logEntry: any;
+
+ private classMap: object = {
+ warn: 'fa-exclamation-triangle',
+ fatal: 'fa-exclamation-circle',
+ error: 'fa-exclamation-circle',
+ info: 'fa-info-circle',
+ debug: 'fa-bug',
+ trace: 'fa-random',
+ unknown: 'fa-question-circle'
+ };
+
+ get cssClass() {
+ return this.classMap[((this.logEntry && this.logEntry.level) || 'unknown').toLowerCase()];
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/38476f7a/ambari-logsearch/ambari-logsearch-web/src/app/components/log-message/log-message.component.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/log-message/log-message.component.html b/ambari-logsearch/ambari-logsearch-web/src/app/components/log-message/log-message.component.html
new file mode 100644
index 0000000..d4c2902
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/log-message/log-message.component.html
@@ -0,0 +1,24 @@
+<!--
+ 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.
+-->
+<div [ngClass]="{
+ 'log-message-container': true,
+ 'log-message-container-collapsible': addCaret,
+ 'log-message-container-open': isOpen
+ }">
+ <button *ngIf="addCaret" (click)="onCaretClick($event)"><i class="caret"></i></button>
+ <div #content class="log-message-content"><ng-content></ng-content></div>
+</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/38476f7a/ambari-logsearch/ambari-logsearch-web/src/app/components/log-message/log-message.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/log-message/log-message.component.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/log-message/log-message.component.less
new file mode 100644
index 0000000..602d7bd
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/log-message/log-message.component.less
@@ -0,0 +1,69 @@
+/**
+ * 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.
+ */
+@import '../variables';
+:host {
+ .log-message-container {
+ display: block;
+ margin: 0;
+ padding: 0;
+
+ .caret {
+ margin-top: -3px;
+ transition: transform 250ms;
+ transform: rotate(-90deg);
+ }
+ &.log-message-container-open .caret {
+ transform: rotate(0deg);
+ }
+
+ .log-message-content {
+ max-height: calc(20em/14); // from Bootstrap
+ overflow: hidden;
+ padding-left: 1em;
+ position: relative;
+ }
+ &.log-message-container-open .log-message-content {
+ max-height: none;
+ white-space: pre-wrap;
+ &:before {
+ display: none;
+ }
+ }
+ &.log-message-container-collapsible {
+ .log-message-content {
+ padding-left: 0;
+ &:before {
+ content: "...";
+ float: right;
+ margin-left: 1em;
+ }
+ }
+
+ }
+
+ button, button:active {
+ background: none transparent;
+ border: none transparent;
+ color: @base-font-color;
+ cursor: pointer;
+ float: left;
+ height: 1em;
+ outline: none;
+ padding: 0 .15em;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/38476f7a/ambari-logsearch/ambari-logsearch-web/src/app/components/log-message/log-message.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/log-message/log-message.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/log-message/log-message.component.spec.ts
new file mode 100644
index 0000000..edc2515
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/log-message/log-message.component.spec.ts
@@ -0,0 +1,64 @@
+/**
+ * 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.
+ */
+import {async, ComponentFixture, TestBed} from '@angular/core/testing';
+
+import {LogMessageComponent} from './log-message.component';
+
+describe('LogMessageComponent', () => {
+ let component: LogMessageComponent;
+ let fixture: ComponentFixture<LogMessageComponent>;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ LogMessageComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(LogMessageComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+
+ it('event handler should call the toggleOpen method', () => {
+ let mockEvent: MouseEvent = document.createEvent('MouseEvent');
+ mockEvent.initEvent('click', true, true);
+ spyOn(component,'toggleOpen');
+ component.onCaretClick(mockEvent);
+ expect(component.toggleOpen).toHaveBeenCalled();
+ });
+
+ it('event handler should prevent the default behaviour of the action', () => {
+ let mockEvent: MouseEvent = document.createEvent('MouseEvent');
+ mockEvent.initEvent('click', true, true);
+ spyOn(mockEvent,'preventDefault');
+ component.onCaretClick(mockEvent);
+ expect(mockEvent.preventDefault).toHaveBeenCalled();
+ });
+
+ it('calling the toggleOpen method should negate the isOpen property', () => {
+ let currentState = component.isOpen;
+ component.toggleOpen();
+ expect(component.isOpen).toEqual(!currentState);
+ });
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/38476f7a/ambari-logsearch/ambari-logsearch-web/src/app/components/log-message/log-message.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/log-message/log-message.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/log-message/log-message.component.ts
new file mode 100644
index 0000000..b8be61b
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/log-message/log-message.component.ts
@@ -0,0 +1,129 @@
+/**
+ * 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.
+ */
+import {Component, Input, AfterViewInit, ElementRef, ViewChild, OnChanges, SimpleChanges, HostListener, ChangeDetectorRef} from '@angular/core';
+
+/**
+ * This is a simple UI component to display the log message. The goal is to be able to show one line and be collapsile
+ * to show the full log message with new lines.
+ * @class LogMessageComponent
+ */
+@Component({
+ selector: 'log-message',
+ templateUrl: './log-message.component.html',
+ styleUrls: ['./log-message.component.less']
+})
+export class LogMessageComponent implements AfterViewInit, OnChanges {
+
+ /**
+ * This is the element reference to the message log container element. So that we can calculate if the caret should be
+ * displayed or not.
+ * @type ElementRef
+ */
+ @ViewChild('content') content: ElementRef;
+
+ /**
+ * This is the flag property to indicate if the content container is open or not.
+ * @type {boolean}
+ */
+ @Input()
+ isOpen: boolean = false;
+
+ /**
+ * This is a helper property to handle the changes on the parent component. The goal of this input is to be able to
+ * react when the parent component (currently the log-list component) has changed (its size) in a way that the
+ * LogMessageComponent should check if the caret should be visible or not.
+ */
+ @Input()
+ listenChangesOn: any;
+
+ /**
+ * This is a private flag to check if it should display the caret or not, it depends on the size of the size of
+ * the content container element. Handled by the @checkAddCaret method
+ * @type {boolean}
+ */
+ private addCaret: boolean = false;
+
+ /**
+ * This is a primary check if the message content does contain new line (/n) characters. If so than we display the
+ * caret to give a possibility to the user to see the message as it is (pre-wrapped).
+ * @type {boolean}
+ */
+ private isMultiLineMessage: boolean = false;
+
+ constructor(private cdRef:ChangeDetectorRef) {}
+
+ /**
+ * This change handler's goal is to check if we should add the caret or not. Mainly it is because currently we have
+ * the LogListComponent where columns can be added or removed and we have to recheck the visibility of the caret every
+ * changes of the displayed columns.
+ * @param {SimpleChanges} changes
+ */
+ ngOnChanges(changes: SimpleChanges): void {
+ if (changes.listenChangesOn !== undefined) {
+ this.checkAddCaret();
+ }
+ }
+
+ /**
+ * The goal is to perform a initial caret display check when the component has been initialized.
+ */
+ ngAfterViewInit(): void {
+ let text = this.content.nativeElement.textContent;
+ let newLinePos = text.indexOf('\n');
+ this.isMultiLineMessage = ((text.length - 1) > newLinePos) && (newLinePos > 0);
+ this.checkAddCaret();
+ }
+
+ /**
+ * Since the size of the column is depends on the window size we have to listen the resize event and show/hide the
+ * caret corresponding the new size of the content container element.
+ * Using the arrow function will keep the instance scope.
+ */
+ @HostListener('window:resize', ['$event'])
+ onWindowResize = (): void => {
+ this.isMultiLineMessage || this.checkAddCaret();
+ };
+
+ /**
+ * The goal is to perform a height check on the content container element. It is based on the comparison of the
+ * scrollHeight and the clientHeight.
+ */
+ checkAddCaret = (): void => {
+ let el = this.content.nativeElement;
+ this.addCaret = this.isMultiLineMessage || (el.scrollHeight > el.clientHeight);
+ this.cdRef.detectChanges();
+ };
+
+ /**
+ * This is the click event handler of the caret button element. It will only toggle the isOpen property so that the
+ * component element css classes will follow its state.
+ * @param ev {MouseEvent}
+ */
+ onCaretClick(ev:MouseEvent) {
+ ev.preventDefault();
+ this.toggleOpen();
+ }
+
+ /**
+ * This is a simple property toggle method of the @isOpen property.
+ * The goal is to separate this logic from the event handling and give a way to call it from anywhere.
+ */
+ toggleOpen():void {
+ this.isOpen = !this.isOpen;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/38476f7a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.html b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.html
index 1e0f49c..10f4af1 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.html
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.html
@@ -20,46 +20,54 @@
[defaultLabel]="filters.sorting.defaultLabel" [isRightAlign]="true"
class="col-md-12"></filter-dropdown>
</form>
-<div *ngFor="let log of logs; let i = index" class="row">
- <div class="logs-header col-md-12"
- *ngIf="!isServiceLogsFileView && (i === 0 || isDifferentDates(log.logtime, logs[i - 1].logtime))">
- <div class="col-md-12">{{log.logtime | amTz: timeZone | amDateFormat: dateFormat}}</div>
- </div>
- <accordion-panel *ngIf="!isServiceLogsFileView" [toggleId]="'details-' + i" class="col-md-12">
- <ng-template>
- <div *ngIf="isColumnDisplayed('level')" [ngClass]="'hexagon ' + (log.level ? log.level.toLowerCase() : '')"></div>
- <div class="col-md-1">
- <dropdown-button iconClass="fa fa-ellipsis-h" [hideCaret]="true" [options]="logActions"
- [additionalArgs]="[log]"></dropdown-button>
- </div>
- <div *ngIf="isColumnDisplayed('level')" [ngClass]="'col-md-1 log-status ' + (log.level ? log.level.toLowerCase() : '')">
- {{log.level}}
- </div>
- <div *ngIf="isColumnDisplayed('type') || isColumnDisplayed('logtime')" class="col-md-3">
- <div *ngIf="isColumnDisplayed('type')" class="log-type">{{log.type}}</div>
- <time *ngIf="isColumnDisplayed('logtime')" class="log-time">
- {{log.logtime | amTz: timeZone | amDateFormat: timeFormat}}
- </time>
- </div>
- <div class="col-md-6 log-content-wrapper">
- <div class="collapse log-actions" attr.id="details-{{i}}">
- <!-- TODO remove after restyling the table -->
- </div>
- <div class="log-content-inner-wrapper">
- <div class="log-content" *ngIf="isColumnDisplayed('log_message')"
- (contextmenu)="openMessageContextMenu($event)">{{log.log_message}}</div>
- </div>
- </div>
- <div *ngFor="let column of displayedColumns">
- <div *ngIf="customStyledColumns.indexOf(column.name) === -1" [innerHTML]="log[column.name]"
- class="col-md-1"></div>
- </div>
- </ng-template>
- </accordion-panel>
- <log-file-entry *ngIf="isServiceLogsFileView" [time]="log.logtime" [level]="log.level"
- [fileName]="log.file" [lineNumber]="log.line_number" [message]="log.log_message"></log-file-entry>
+<div class="panel panel-default">
+ <div class="panel-body">
+ <table class="table table-hover">
+ <tbody>
+ <ng-container *ngFor="let log of logs; let i = index">
+ <tr *ngIf="!isServiceLogsFileView && (i === 0 || isDifferentDates(log.logtime, logs[i - 1].logtime))"
+ class="log-date-row" >
+ <th attr.colspan="{{displayedColumns.length + 1}}">
+ {{log.logtime | amTz: timeZone | amDateFormat: dateFormat}}
+ </th>
+ </tr>
+ <tr class="log-item-row">
+ <td class="log-action">
+ <dropdown-button iconClass="fa fa-ellipsis-h action" [hideCaret]="true" [options]="logActions"
+ [additionalArgs]="[log]"></dropdown-button>
+ </td>
+ <td *ngIf="isColumnDisplayed('logtime')" class="log-time">
+ <time>
+ {{log.logtime | amTz: timeZone | amDateFormat: timeFormat}}
+ </time>
+ </td>
+ <td *ngIf="isColumnDisplayed('level')" [ngClass]="'log-level ' + log.level.toLowerCase()">
+ <log-level [logEntry]="log"></log-level>
+ </td>
+ <td *ngIf="isColumnDisplayed('type')" [ngClass]="'log-type'">
+ {{log.type}}
+ </td>
+ <td *ngIf="isColumnDisplayed('log_message')" [ngClass]="'log-message'" width="*"
+ (contextmenu)="openMessageContextMenu($event)">
+ <log-message [listenChangesOn]="displayedColumns">{{log.log_message}}</log-message>
+ </td>
+ <ng-container *ngFor="let column of displayedColumns">
+ <td *ngIf="customStyledColumns.indexOf(column.name) === -1"
+ [ngClass]="'log-' + column.name">{{log[column.name]}}</td>
+ </ng-container>
+ </tr>
+ </ng-container>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td attr.colspan="{{displayedColumns.length + 1}}">
+ <pagination class="col-md-12" *ngIf="logs && logs.length" [totalCount]="totalCount"
+ [filtersForm]="filtersForm" [filterInstance]="filters.pageSize" [currentCount]="logs.length"></pagination>
+ </td>
+ </tr>
+ </tfoot>
+ </table>
+ <ul #contextmenu data-component="dropdown-list" class="dropdown-menu context-menu" [items]="contextMenuItems"
+ (selectedItemChange)="updateQuery($event)"></ul>
+ </div>
</div>
-<ul #contextmenu *ngIf="!isServiceLogsFileView" data-component="dropdown-list" class="dropdown-menu context-menu"
- [items]="contextMenuItems" (selectedItemChange)="updateQuery($event)"></ul>
-<pagination class="pull-right" *ngIf="logs && logs.length" [totalCount]="totalCount" [filtersForm]="filtersForm"
- [filterInstance]="filters.pageSize" [currentCount]="logs.length"></pagination>
http://git-wip-us.apache.org/repos/asf/ambari/blob/38476f7a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.less
index 67d0615..c5c4c5a 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.less
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.less
@@ -17,93 +17,81 @@
@import '../mixins';
-.logs-header {
- // TODO get rid of magic numbers, base on actual design
- margin: 10px 0;
- padding: 5px 0;
- background-color: @list-header-background-color; // TODO implement actual color
- overflow: hidden;
-}
-
-/deep/ filter-dropdown {
- justify-content: flex-end;
-}
-
-.hexagon {
- // TODO remove, since it's not a part of updated design
- left: -7.5px;
-
- &.fatal {
- .common-hexagon(15px, @fatal-color);
- }
-
- &.error {
- .common-hexagon(15px, @error-color);
+:host {
+ /deep/ filter-dropdown {
+ justify-content: flex-end;
}
- &.warn {
- .common-hexagon(15px, @warning-color);
+ .panel-body {
+ overflow: hidden;
+ width: 100%;
}
- &.info {
- .common-hexagon(15px, @info-color);
+ table {
+ width: 100%;
}
- &.debug {
- .common-hexagon(15px, @debug-color);
+ tr.log-date-row, tr.log-date-row:hover {
+ background: @list-header-background-color;
+ border: none transparent;
+ th {
+ border: none transparent;
+ }
}
-
- &.trace {
- .common-hexagon(15px, @trace-color);
+ tr.log-item-row td {
+ background: none transparent;
}
- &.unknown {
- .common-hexagon(15px, @unknown-color);
+ td {
+ &.log-action {
+ min-width: 3em;
+ /deep/ .btn, /deep/ .filter-label {
+ font-size: 1em;
+ height: auto;
+ line-height: 1em;
+ padding: 0;
+ }
+ }
+ &.log-time {
+ color: @grey-color;
+ min-width: 7em;
+ text-align: right;
+ }
+ &.log-level {
+ text-transform: uppercase;
+ min-width: 8em;
+ .log-colors;
+ }
+ &.log-type {
+ color: @link-color;
+ }
+ &.log-message, &.log-path {
+ width: 100%;
+ }
}
-}
-
-.log-status {
- text-transform: uppercase;
- .log-colors;
-}
-
-.log-type {
- color: @link-color;
-}
-
-.log-time {
- color: @grey-color;
-}
-
-.log-content-wrapper {
- position: relative;
- // TODO get rid of magic numbers, base on actual design
- .log-content-inner-wrapper {
- overflow: hidden;
- max-height: @default-line-height * 2em;
- padding-right: 65px;
-
- .log-content {
- white-space: pre-wrap;
+ tr:hover td.log-action {
+ /deep/ .btn {
+ display: inline-block;
}
}
- .log-actions {
- &.collapsing + .log-content-inner-wrapper, &.collapse.in + .log-content-inner-wrapper {
- min-height: 6em;
- max-height: none;
- overflow-x: auto;
+ .table.table-hover>tbody>tr{
+ box-sizing: border-box;
+ border-width: 1px;
+ >td {
+ border-top: 0 none;
}
-
- .action-icon {
- .clickable-item;
- display: block;
- padding: 5px;
+ &:first-of-type {
+ border-top-color: transparent;
+ }
+ &:last-of-type {
+ border-bottom-color: transparent;
}
}
-}
-.context-menu {
- position: fixed;
+ .context-menu {
+ position: fixed;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/38476f7a/ambari-logsearch/ambari-logsearch-web/webpack.config.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/webpack.config.js b/ambari-logsearch/ambari-logsearch-web/webpack.config.js
index 7a60df2..75d6aee 100644
--- a/ambari-logsearch/ambari-logsearch-web/webpack.config.js
+++ b/ambari-logsearch/ambari-logsearch-web/webpack.config.js
@@ -81,18 +81,17 @@ module.exports = {
"resolve": {
"extensions": [
".ts",
- ".js"
+ ".js",
+ ".less"
],
"modules": [
- "./node_modules",
- "./node_modules"
+ "node_modules"
],
"symlinks": true
},
"resolveLoader": {
"modules": [
- "./node_modules",
- "./node_modules"
+ "node_modules"
]
},
"entry": {
@@ -229,7 +228,9 @@ module.exports = {
"loader": "less-loader",
"options": {
"sourceMap": false,
- "paths": []
+ "paths": [
+ "./node_modules"
+ ]
}
}
]
@@ -359,7 +360,7 @@ module.exports = {
"loader": "less-loader",
"options": {
"sourceMap": false,
- "paths": []
+ "paths": ["./node_modules"]
}
}
]
[49/50] [abbrv] ambari git commit: AMBARI-22444 - Add Native
Libraries To Tez Tarball (part4) (jonathanhurley)
Posted by rl...@apache.org.
AMBARI-22444 - Add Native Libraries To Tez Tarball (part4) (jonathanhurley)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/365c91e9
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/365c91e9
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/365c91e9
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 365c91e92698f6a566b8503486f80c736af79e70
Parents: f51b1cc
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Thu Nov 16 14:11:28 2017 -0500
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Thu Nov 16 14:12:32 2017 -0500
----------------------------------------------------------------------
.../resource_management/libraries/functions/copy_tarball.py | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/365c91e9/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py b/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py
index 9b6fb98..dda1a18 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py
@@ -101,6 +101,9 @@ def _prepare_tez_tarball():
with closing(tarfile.open(tez_tarball_with_native_lib, "w:gz")) as new_tez_tarball:
new_tez_tarball.add(tez_temp_dir, arcname=os.path.sep)
+ # ensure that the tarball can be read and uploaded
+ sudo.chmod(tez_tarball_with_native_lib, 0744)
+
# cleanup
sudo.rmtree(mapreduce_temp_dir)
sudo.rmtree(tez_temp_dir)
[07/50] [abbrv] ambari git commit: AMBARI-22389. Exclude test scope
jars from Log Search / Log Feeder rpm/deb packages (oleewere)
Posted by rl...@apache.org.
AMBARI-22389. Exclude test scope jars from Log Search / Log Feeder rpm/deb packages (oleewere)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/444718a1
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/444718a1
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/444718a1
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 444718a10479c02dc6251ab8dc56eae70723f7bb
Parents: 38476f7
Author: Oliver Szabo <ol...@gmail.com>
Authored: Thu Nov 9 14:18:46 2017 +0100
Committer: Oliver Szabo <ol...@gmail.com>
Committed: Thu Nov 9 14:19:17 2017 +0100
----------------------------------------------------------------------
ambari-logsearch/ambari-logsearch-logfeeder/pom.xml | 2 +-
ambari-logsearch/ambari-logsearch-server/pom.xml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/444718a1/ambari-logsearch/ambari-logsearch-logfeeder/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/pom.xml b/ambari-logsearch/ambari-logsearch-logfeeder/pom.xml
index 6b7d94f..01710bf 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/pom.xml
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/pom.xml
@@ -240,12 +240,12 @@
</goals>
<configuration>
- <artifactItems>*</artifactItems>
<outputAbsoluteArtifactFilename>true</outputAbsoluteArtifactFilename>
<outputDirectory>${basedir}/target/libs</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
+ <includeScope>compile</includeScope>
</configuration>
</execution>
</executions>
http://git-wip-us.apache.org/repos/asf/ambari/blob/444718a1/ambari-logsearch/ambari-logsearch-server/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/pom.xml b/ambari-logsearch/ambari-logsearch-server/pom.xml
index 2ad35f5..5444b00 100755
--- a/ambari-logsearch/ambari-logsearch-server/pom.xml
+++ b/ambari-logsearch/ambari-logsearch-server/pom.xml
@@ -118,13 +118,13 @@
<goal>copy-dependencies</goal>
</goals>
<configuration>
- <artifactItems>*</artifactItems>
<excludeArtifactIds>ambari-logsearch-web</excludeArtifactIds>
<outputAbsoluteArtifactFilename>true</outputAbsoluteArtifactFilename>
<outputDirectory>${basedir}/target/libs</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
+ <includeScope>compile</includeScope>
</configuration>
</execution>
</executions>
[23/50] [abbrv] ambari git commit: AMBARI-22390. Implement
many-to-many relation between keytabs and principals (echekanskiy)
Posted by rl...@apache.org.
AMBARI-22390. Implement many-to-many relation between keytabs and principals (echekanskiy)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/18e54903
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/18e54903
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/18e54903
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 18e549034e893aac4ade80e49bda70604d5147f3
Parents: 6e706d4
Author: Eugene Chekanskiy <ec...@hortonworks.com>
Authored: Mon Nov 13 17:01:16 2017 +0200
Committer: Eugene Chekanskiy <ec...@hortonworks.com>
Committed: Mon Nov 13 17:01:29 2017 +0200
----------------------------------------------------------------------
.../server/controller/KerberosHelperImpl.java | 59 ++++++++++++++------
.../AbstractPrepareKerberosServerAction.java | 23 +++-----
.../kerberos/CreatePrincipalsServerAction.java | 6 +-
.../kerberos/KerberosServerAction.java | 21 +++++++
.../stageutils/ResolvedKerberosKeytab.java | 16 +++---
5 files changed, 82 insertions(+), 43 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/18e54903/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
----------------------------------------------------------------------
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 f913831..474c335 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
@@ -1546,19 +1546,21 @@ public class KerberosHelperImpl implements KerberosHelper {
keytabFileOwnerAccess,
keytabFileGroupName,
keytabFileGroupAccess,
- Sets.newHashSet(Pair.of(hostId, evaluatedPrincipal)),
+ Sets.newHashSet(Pair.of(hostId, Pair.of(evaluatedPrincipal, principalType))),
serviceName.equalsIgnoreCase("AMBARI"),
componentName.equalsIgnoreCase("AMBARI_SERVER_SELF")
);
if (resolvedKeytabs.containsKey(keytabFilePath)) {
ResolvedKerberosKeytab sameKeytab = resolvedKeytabs.get(keytabFilePath);
// validating owner and group
- String warnTemplate = "Keytab '{}' on host '{}' have different {}, originally set to '{}' and '{}:{}' has '{}', using '{}'";
+ boolean differentOwners = false;
+ String warnTemplate = "Keytab '{}' on host '{}' has different {}, originally set to '{}' and '{}:{}' has '{}', using '{}'";
if (!resolvedKeytab.getOwnerName().equals(sameKeytab.getOwnerName())) {
LOG.warn(warnTemplate,
keytabFilePath, hostname, "owners", sameKeytab.getOwnerName(),
serviceName, componentName, resolvedKeytab.getOwnerName(),
sameKeytab.getOwnerName());
+ differentOwners = true;
}
if (!resolvedKeytab.getOwnerAccess().equals(sameKeytab.getOwnerAccess())) {
LOG.warn(warnTemplate,
@@ -1570,16 +1572,39 @@ public class KerberosHelperImpl implements KerberosHelper {
// TODO with different owners, so make sure that keytabs are accessible through group acls
// TODO this includes same group name and group 'r' mode
if (!resolvedKeytab.getGroupName().equals(sameKeytab.getGroupName())) {
- LOG.warn(warnTemplate,
- keytabFilePath, hostname, "groups", sameKeytab.getGroupName(),
- serviceName, componentName, resolvedKeytab.getGroupName(),
- sameKeytab.getGroupName());
+ if(differentOwners) {
+ LOG.error(warnTemplate,
+ keytabFilePath, hostname, "groups", sameKeytab.getGroupName(),
+ serviceName, componentName, resolvedKeytab.getGroupName(),
+ sameKeytab.getGroupName());
+ } else {
+ LOG.warn(warnTemplate,
+ keytabFilePath, hostname, "groups", sameKeytab.getGroupName(),
+ serviceName, componentName, resolvedKeytab.getGroupName(),
+ sameKeytab.getGroupName());
+ }
}
if (!resolvedKeytab.getGroupAccess().equals(sameKeytab.getGroupAccess())) {
- LOG.warn(warnTemplate,
- keytabFilePath, hostname, "group access", sameKeytab.getGroupAccess(),
- serviceName, componentName, resolvedKeytab.getGroupAccess(),
- sameKeytab.getGroupAccess());
+ if(differentOwners) {
+ if (!sameKeytab.getGroupAccess().contains("r")) {
+ LOG.error("Keytab '{}' on host '{}' referenced by multiple identities which have different owners," +
+ "but 'r' attribute missing for group. Make sure all users (that need this keytab) are in '{}' +" +
+ "group and keytab can be read by this group",
+ keytabFilePath,
+ hostname,
+ sameKeytab.getGroupName()
+ );
+ }
+ LOG.error(warnTemplate,
+ keytabFilePath, hostname, "group access", sameKeytab.getGroupAccess(),
+ serviceName, componentName, resolvedKeytab.getGroupAccess(),
+ sameKeytab.getGroupAccess());
+ } else {
+ LOG.warn(warnTemplate,
+ keytabFilePath, hostname, "group access", sameKeytab.getGroupAccess(),
+ serviceName, componentName, resolvedKeytab.getGroupAccess(),
+ sameKeytab.getGroupAccess());
+ }
}
// end validating
// merge principal to keytab
@@ -1877,15 +1902,17 @@ public class KerberosHelperImpl implements KerberosHelper {
if (kerberosKeytabDAO.find(resolvedKerberosKeytab.getFile()) == null) {
kerberosKeytabDAO.create(resolvedKerberosKeytab.getFile());
}
- for (Pair<Long, String> principalPair : resolvedKerberosKeytab.getMappedPrincipals()) {
- String principal = principalPair.getRight();
+ for (Pair<Long, Pair<String, String>> principalPair : resolvedKerberosKeytab.getMappedPrincipals()) {
+ Pair<String, String> principal = principalPair.getRight();
+ String principalName = principal.getLeft();
+ String principalType = principal.getRight();
Long hostId = principalPair.getLeft();
- if (!kerberosPrincipalDAO.exists(principal)) {
- kerberosPrincipalDAO.create(principal, false);
+ if (!kerberosPrincipalDAO.exists(principalName)) {
+ kerberosPrincipalDAO.create(principalName, "service".equalsIgnoreCase(principalType));
}
if (hostId != null) {
- if(!kerberosPrincipalHostDAO.exists(principal, hostId, resolvedKerberosKeytab.getFile())) {
- kerberosPrincipalHostDAO.create(principal, hostId, resolvedKerberosKeytab.getFile());
+ if(!kerberosPrincipalHostDAO.exists(principalName, hostId, resolvedKerberosKeytab.getFile())) {
+ kerberosPrincipalHostDAO.create(principalName, hostId, resolvedKerberosKeytab.getFile());
}
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/18e54903/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/AbstractPrepareKerberosServerAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/AbstractPrepareKerberosServerAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/AbstractPrepareKerberosServerAction.java
index 1dc8ca8..4008620 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/AbstractPrepareKerberosServerAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/AbstractPrepareKerberosServerAction.java
@@ -196,7 +196,7 @@ public abstract class AbstractPrepareKerberosServerAction extends KerberosServer
List<KerberosIdentityDescriptor> componentIdentities = Collections.singletonList(identity);
kerberosHelper.addIdentities(kerberosIdentityDataFileWriter, componentIdentities,
- identityFilter, StageUtils.getHostName(), ambariServerHostID(), "AMBARI",componentName, kerberosConfigurations, currentConfigurations,
+ identityFilter, StageUtils.getHostName(), ambariServerHostID(), "AMBARI", componentName, kerberosConfigurations, currentConfigurations,
resolvedKeytabs, realm);
propertiesToIgnore = gatherPropertiesToIgnore(componentIdentities, propertiesToIgnore);
}
@@ -236,19 +236,9 @@ public abstract class AbstractPrepareKerberosServerAction extends KerberosServer
protected Map<String, ? extends Collection<String>> getServiceComponentFilter() {
String serializedValue = getCommandParameterValue(SERVICE_COMPONENT_FILTER);
- if(serializedValue != null) {
- Type type = new TypeToken<Map<String, ? extends Collection<String>>>() {}.getType();
- return StageUtils.getGson().fromJson(serializedValue, type);
- } else {
- return null;
- }
- }
-
- protected Set<String> getHostFilter() {
- String serializedValue = getCommandParameterValue(HOST_FILTER);
-
- if(serializedValue != null) {
- Type type = new TypeToken<Set<String>>() {}.getType();
+ if (serializedValue != null) {
+ Type type = new TypeToken<Map<String, ? extends Collection<String>>>() {
+ }.getType();
return StageUtils.getGson().fromJson(serializedValue, type);
} else {
return null;
@@ -258,8 +248,9 @@ public abstract class AbstractPrepareKerberosServerAction extends KerberosServer
protected Collection<String> getIdentityFilter() {
String serializedValue = getCommandParameterValue(IDENTITY_FILTER);
- if(serializedValue != null) {
- Type type = new TypeToken<Collection<String>>() {}.getType();
+ if (serializedValue != null) {
+ Type type = new TypeToken<Collection<String>>() {
+ }.getType();
return StageUtils.getGson().fromJson(serializedValue, type);
} else {
return null;
http://git-wip-us.apache.org/repos/asf/ambari/blob/18e54903/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/CreatePrincipalsServerAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/CreatePrincipalsServerAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/CreatePrincipalsServerAction.java
index 59d5327..0c90659 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/CreatePrincipalsServerAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/CreatePrincipalsServerAction.java
@@ -135,10 +135,11 @@ public class CreatePrincipalsServerAction extends KerberosServerAction {
KerberosPrincipalEntity kerberosPrincipalEntity = kerberosPrincipalDAO.find(evaluatedPrincipal);
boolean regenerateKeytabs = getOperationType(getCommandParameters()) == OperationType.RECREATE_ALL;
-
+ boolean servicePrincipal = "service".equalsIgnoreCase(identityRecord.get(KerberosIdentityDataFileReader.PRINCIPAL_TYPE));
if (regenerateKeytabs) {
// force recreation of principal due to keytab regeneration
- processPrincipal = true;
+ // regenerate only service principals if request filtered by hosts
+ processPrincipal = !hasHostFilters() || servicePrincipal;
} else if (kerberosPrincipalEntity == null) {
// This principal has not been processed before, process it.
processPrincipal = true;
@@ -156,7 +157,6 @@ public class CreatePrincipalsServerAction extends KerberosServerAction {
String password = principalPasswordMap.get(evaluatedPrincipal);
if (password == null) {
- boolean servicePrincipal = "service".equalsIgnoreCase(identityRecord.get(KerberosIdentityDataFileReader.PRINCIPAL_TYPE));
CreatePrincipalResult result = createPrincipal(evaluatedPrincipal, servicePrincipal, kerberosConfiguration, operationHandler, regenerateKeytabs, actionLog);
if (result == null) {
commandReport = createCommandReport(1, HostRoleStatus.FAILED, "{}", actionLog.getStdOut(), actionLog.getStdErr());
http://git-wip-us.apache.org/repos/asf/ambari/blob/18e54903/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/KerberosServerAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/KerberosServerAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/KerberosServerAction.java
index 3491f18..ff5f5ce 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/KerberosServerAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/KerberosServerAction.java
@@ -22,8 +22,10 @@ import static org.apache.ambari.server.serveraction.kerberos.KerberosIdentityDat
import java.io.File;
import java.io.IOException;
+import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.Map;
+import java.util.Set;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.actionmanager.HostRoleStatus;
@@ -42,6 +44,7 @@ import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.reflect.TypeToken;
import com.google.inject.Inject;
/**
@@ -579,6 +582,24 @@ public abstract class KerberosServerAction extends AbstractServerAction {
}
}
+
+ protected Set<String> getHostFilter() {
+ String serializedValue = getCommandParameterValue(HOST_FILTER);
+
+ if (serializedValue != null) {
+ Type type = new TypeToken<Set<String>>() {
+ }.getType();
+ return StageUtils.getGson().fromJson(serializedValue, type);
+ } else {
+ return null;
+ }
+ }
+
+ protected boolean hasHostFilters() {
+ Set<String> hostFilers = getHostFilter();
+ return hostFilers != null && hostFilers.size() > 0;
+ }
+
protected Long ambariServerHostID(){
String ambariServerHostName = StageUtils.getHostName();
HostEntity ambariServerHostEntity = hostDAO.findByName(ambariServerHostName);
http://git-wip-us.apache.org/repos/asf/ambari/blob/18e54903/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/stageutils/ResolvedKerberosKeytab.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/stageutils/ResolvedKerberosKeytab.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/stageutils/ResolvedKerberosKeytab.java
index f66d273..17e484a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/stageutils/ResolvedKerberosKeytab.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/stageutils/ResolvedKerberosKeytab.java
@@ -40,7 +40,7 @@ public class ResolvedKerberosKeytab {
private String groupName = null;
private String groupAccess = null;
private String file = null;
- private Set<Pair<Long, String>> mappedPrincipals = null;
+ private Set<Pair<Long, Pair<String, String>>> mappedPrincipals = null;
private boolean isAmbariServerKeytab = false;
private boolean mustWriteAmbariJaasFile = false;
@@ -50,7 +50,7 @@ public class ResolvedKerberosKeytab {
String ownerAccess,
String groupName,
String groupAccess,
- Set<Pair<Long, String>> mappedPrincipals,
+ Set<Pair<Long, Pair<String, String>>> mappedPrincipals,
boolean isAmbariServerKeytab,
boolean writeAmbariJaasFile
) {
@@ -177,7 +177,7 @@ public class ResolvedKerberosKeytab {
*
* @return a Set with mappedPrincipals associated with given keytab
*/
- public Set<Pair<Long, String>> getMappedPrincipals() {
+ public Set<Pair<Long, Pair<String, String>>> getMappedPrincipals() {
return mappedPrincipals;
}
@@ -186,7 +186,7 @@ public class ResolvedKerberosKeytab {
*
* @param mappedPrincipals a Map with host-to-principal mapping associated with given keytab
*/
- public void setMappedPrincipals(Set<Pair<Long, String>> mappedPrincipals) {
+ public void setMappedPrincipals(Set<Pair<Long, Pair<String, String>>> mappedPrincipals) {
this.mappedPrincipals = mappedPrincipals;
}
@@ -197,7 +197,7 @@ public class ResolvedKerberosKeytab {
*/
public Set<Long> getHosts() {
ImmutableSet.Builder<Long> builder = ImmutableSet.builder();
- for (Pair<Long, String> principal : getMappedPrincipals()) {
+ for (Pair<Long, Pair<String, String>> principal : getMappedPrincipals()) {
if (principal.getLeft() != null) {
builder.add(principal.getLeft());
}
@@ -210,9 +210,9 @@ public class ResolvedKerberosKeytab {
*
* @return a Set of principals
*/
- public Set<String> getPrincipals() {
- ImmutableSet.Builder<String> builder = ImmutableSet.builder();
- for (Pair<Long, String> principal : getMappedPrincipals()) {
+ public Set<Pair<String, String>> getPrincipals() {
+ ImmutableSet.Builder<Pair<String, String>> builder = ImmutableSet.builder();
+ for (Pair<Long, Pair<String, String>> principal : getMappedPrincipals()) {
builder.add(principal.getRight());
}
return builder.build();
[11/50] [abbrv] ambari git commit: AMBARI-22338 : Review Request for
new HDP StackFeatures entry(mradhakrishnan on behalf of ydavis)
Posted by rl...@apache.org.
AMBARI-22338 : Review Request for new HDP StackFeatures entry(mradhakrishnan on behalf of ydavis)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c693de36
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c693de36
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c693de36
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: c693de3650d9b115a3da7639dbd97931c6ebb61b
Parents: 430dcbf
Author: Madhuvanthi Radhakrishnan <mr...@hortonworks.com>
Authored: Thu Nov 9 11:09:32 2017 -0800
Committer: Madhuvanthi Radhakrishnan <mr...@hortonworks.com>
Committed: Thu Nov 9 11:09:32 2017 -0800
----------------------------------------------------------------------
.../resources/stacks/HDP/2.0.6/properties/stack_features.json | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/c693de36/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_features.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_features.json b/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_features.json
index 86de20d..702fb13 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_features.json
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_features.json
@@ -427,6 +427,11 @@
"name": "hadoop_custom_extensions",
"description": "Support hadoop custom extensions",
"min_version": "2.6.0.0"
+ },
+ {
+ "name": "sam_storage_core_in_registry",
+ "description": "Storage core module moved to registry",
+ "min_version": "2.6.0.0"
}
]
}
[38/50] [abbrv] ambari git commit: AMBARI-22418. Make Ambari
configuration API consistent with existing API. (rlevas)
Posted by rl...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceComponentConfigurationResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceComponentConfigurationResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceComponentConfigurationResourceProviderTest.java
new file mode 100644
index 0000000..5016160
--- /dev/null
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceComponentConfigurationResourceProviderTest.java
@@ -0,0 +1,393 @@
+/*
+ * Licensed 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.
+ */
+
+package org.apache.ambari.server.controller.internal;
+
+import static org.apache.ambari.server.controller.internal.RootServiceComponentConfigurationResourceProvider.CONFIGURATION_CATEGORY_PROPERTY_ID;
+import static org.apache.ambari.server.controller.internal.RootServiceComponentConfigurationResourceProvider.CONFIGURATION_COMPONENT_NAME_PROPERTY_ID;
+import static org.apache.ambari.server.controller.internal.RootServiceComponentConfigurationResourceProvider.CONFIGURATION_PROPERTIES_PROPERTY_ID;
+import static org.apache.ambari.server.controller.internal.RootServiceComponentConfigurationResourceProvider.CONFIGURATION_SERVICE_NAME_PROPERTY_ID;
+import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.capture;
+import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.newCapture;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+
+import javax.persistence.EntityManager;
+
+import org.apache.ambari.server.controller.RootComponent;
+import org.apache.ambari.server.controller.RootService;
+import org.apache.ambari.server.controller.predicate.AndPredicate;
+import org.apache.ambari.server.controller.spi.Predicate;
+import org.apache.ambari.server.controller.spi.Request;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.spi.ResourceProvider;
+import org.apache.ambari.server.controller.utilities.PredicateBuilder;
+import org.apache.ambari.server.events.AmbariConfigurationChangedEvent;
+import org.apache.ambari.server.events.publishers.AmbariEventPublisher;
+import org.apache.ambari.server.orm.dao.AmbariConfigurationDAO;
+import org.apache.ambari.server.orm.entities.AmbariConfigurationEntity;
+import org.apache.ambari.server.security.TestAuthenticationFactory;
+import org.apache.ambari.server.security.authorization.AuthorizationException;
+import org.easymock.Capture;
+import org.easymock.EasyMockSupport;
+import org.junit.After;
+import org.junit.Test;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.context.SecurityContextHolder;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+import junit.framework.Assert;
+
+public class RootServiceComponentConfigurationResourceProviderTest extends EasyMockSupport {
+
+ private static final String CATEGORY_NAME_1 = "test-category-1";
+ private static final String CATEGORY_NAME_2 = "test-category-2";
+
+ @After
+ public void clearAuthentication() {
+ SecurityContextHolder.getContext().setAuthentication(null);
+ }
+
+ @Test
+ public void testCreateResources_Administrator() throws Exception {
+ testCreateResources(TestAuthenticationFactory.createAdministrator());
+ }
+
+ @Test(expected = AuthorizationException.class)
+ public void testCreateResources_ClusterAdministrator() throws Exception {
+ testCreateResources(TestAuthenticationFactory.createClusterAdministrator());
+ }
+
+ @Test(expected = AuthorizationException.class)
+ public void testCreateResources_ClusterOperator() throws Exception {
+ testCreateResources(TestAuthenticationFactory.createClusterOperator());
+ }
+
+ @Test(expected = AuthorizationException.class)
+ public void testCreateResources_ServiceAdministrator() throws Exception {
+ testCreateResources(TestAuthenticationFactory.createServiceAdministrator());
+ }
+
+ @Test(expected = AuthorizationException.class)
+ public void testCreateResources_ServiceOperator() throws Exception {
+ testCreateResources(TestAuthenticationFactory.createServiceOperator());
+ }
+
+ private void testCreateResources(Authentication authentication) throws Exception {
+ Injector injector = createInjector();
+
+ ResourceProvider resourceProvider = injector.getInstance(RootServiceComponentConfigurationResourceProvider.class);
+
+ Set<Map<String, Object>> propertySets = new HashSet<>();
+
+ Map<String, String> properties1 = new HashMap<>();
+ properties1.put("property1a", "value1");
+ properties1.put("property2a", "value2");
+ propertySets.add(toRequestProperties(CATEGORY_NAME_1, properties1));
+
+ Map<String, String> properties2 = new HashMap<>();
+ properties2.put("property1b", "value1");
+ properties2.put("property2b", "value2");
+ propertySets.add(toRequestProperties(CATEGORY_NAME_2, properties2));
+
+ Request request = createMock(Request.class);
+ expect(request.getProperties()).andReturn(propertySets).once();
+
+ Capture<Map<String, String>> capturedProperties1 = newCapture();
+ Capture<Map<String, String>> capturedProperties2 = newCapture();
+
+ AmbariConfigurationDAO dao = injector.getInstance(AmbariConfigurationDAO.class);
+ expect(dao.reconcileCategory(eq(CATEGORY_NAME_1), capture(capturedProperties1), eq(true)))
+ .andReturn(true)
+ .once();
+ expect(dao.reconcileCategory(eq(CATEGORY_NAME_2), capture(capturedProperties2), eq(true)))
+ .andReturn(true)
+ .once();
+
+ AmbariEventPublisher publisher = injector.getInstance(AmbariEventPublisher.class);
+ publisher.publish(anyObject(AmbariConfigurationChangedEvent.class));
+ expectLastCall().times(2);
+
+ replayAll();
+
+ SecurityContextHolder.getContext().setAuthentication(authentication);
+
+ resourceProvider.createResources(request);
+
+ verifyAll();
+
+ validateCapturedProperties(properties1, capturedProperties1);
+ validateCapturedProperties(properties2, capturedProperties2);
+ }
+
+ @Test
+ public void testDeleteResources_Administrator() throws Exception {
+ testDeleteResources(TestAuthenticationFactory.createAdministrator());
+ }
+
+ @Test(expected = AuthorizationException.class)
+ public void testDeleteResources_ClusterAdministrator() throws Exception {
+ testDeleteResources(TestAuthenticationFactory.createClusterAdministrator());
+ }
+
+ @Test(expected = AuthorizationException.class)
+ public void testDeleteResources_ClusterOperator() throws Exception {
+ testDeleteResources(TestAuthenticationFactory.createClusterOperator());
+ }
+
+ @Test(expected = AuthorizationException.class)
+ public void testDeleteResources_ServiceAdministrator() throws Exception {
+ testDeleteResources(TestAuthenticationFactory.createServiceAdministrator());
+ }
+
+ @Test(expected = AuthorizationException.class)
+ public void testDeleteResources_ServiceOperator() throws Exception {
+ testDeleteResources(TestAuthenticationFactory.createServiceOperator());
+ }
+
+ private void testDeleteResources(Authentication authentication) throws Exception {
+ Injector injector = createInjector();
+
+ ResourceProvider resourceProvider = injector.getInstance(RootServiceComponentConfigurationResourceProvider.class);
+
+ Predicate predicate = createPredicate(RootService.AMBARI.name(), RootComponent.AMBARI_SERVER.name(), CATEGORY_NAME_1);
+
+ Request request = createMock(Request.class);
+
+ AmbariConfigurationDAO dao = injector.getInstance(AmbariConfigurationDAO.class);
+ expect(dao.removeByCategory(CATEGORY_NAME_1)).andReturn(1).once();
+
+ AmbariEventPublisher publisher = injector.getInstance(AmbariEventPublisher.class);
+ publisher.publish(anyObject(AmbariConfigurationChangedEvent.class));
+ expectLastCall().once();
+
+ replayAll();
+
+ SecurityContextHolder.getContext().setAuthentication(authentication);
+
+ resourceProvider.deleteResources(request, predicate);
+
+ verifyAll();
+ }
+
+ @Test
+ public void testGetResources_Administrator() throws Exception {
+ testGetResources(TestAuthenticationFactory.createAdministrator());
+ }
+
+ @Test(expected = AuthorizationException.class)
+ public void testGetResources_ClusterAdministrator() throws Exception {
+ testGetResources(TestAuthenticationFactory.createClusterAdministrator());
+ }
+
+ @Test(expected = AuthorizationException.class)
+ public void testGetResources_ClusterOperator() throws Exception {
+ testGetResources(TestAuthenticationFactory.createClusterOperator());
+ }
+
+ @Test(expected = AuthorizationException.class)
+ public void testGetResources_ServiceAdministrator() throws Exception {
+ testGetResources(TestAuthenticationFactory.createServiceAdministrator());
+ }
+
+ @Test(expected = AuthorizationException.class)
+ public void testGetResources_ServiceOperator() throws Exception {
+ testGetResources(TestAuthenticationFactory.createServiceOperator());
+ }
+
+ private void testGetResources(Authentication authentication) throws Exception {
+ Injector injector = createInjector();
+
+ ResourceProvider resourceProvider = injector.getInstance(RootServiceComponentConfigurationResourceProvider.class);
+
+ Predicate predicate = createPredicate(RootService.AMBARI.name(), RootComponent.AMBARI_SERVER.name(), CATEGORY_NAME_1);
+
+ Request request = createMock(Request.class);
+ expect(request.getPropertyIds()).andReturn(null).anyTimes();
+
+ Map<String, String> properties = new HashMap<>();
+ properties.put("property1a", "value1");
+ properties.put("property2a", "value2");
+
+ AmbariConfigurationDAO dao = injector.getInstance(AmbariConfigurationDAO.class);
+ expect(dao.findByCategory(CATEGORY_NAME_1)).andReturn(createEntities(CATEGORY_NAME_1, properties)).once();
+
+ replayAll();
+
+ SecurityContextHolder.getContext().setAuthentication(authentication);
+
+ Set<Resource> response = resourceProvider.getResources(request, predicate);
+
+ verifyAll();
+
+ Assert.assertNotNull(response);
+ Assert.assertEquals(1, response.size());
+
+ Resource resource = response.iterator().next();
+ Assert.assertEquals(Resource.Type.RootServiceComponentConfiguration, resource.getType());
+
+ Map<String, Map<String, Object>> propertiesMap = resource.getPropertiesMap();
+ Assert.assertEquals(2, propertiesMap.size());
+
+ Assert.assertEquals(CATEGORY_NAME_1, propertiesMap.get(RootServiceComponentConfigurationResourceProvider.RESOURCE_KEY).get("category"));
+
+ Map<String, Object> retrievedProperties = propertiesMap.get(RootServiceComponentConfigurationResourceProvider.RESOURCE_KEY + "/properties");
+ Assert.assertEquals(2, retrievedProperties.size());
+
+ for (Map.Entry<String, String> entry : properties.entrySet()) {
+ Assert.assertEquals(entry.getValue(), retrievedProperties.get(entry.getKey()));
+ }
+ }
+
+ @Test
+ public void testUpdateResources_Administrator() throws Exception {
+ testUpdateResources(TestAuthenticationFactory.createAdministrator());
+ }
+
+ @Test(expected = AuthorizationException.class)
+ public void testUpdateResources_ClusterAdministrator() throws Exception {
+ testUpdateResources(TestAuthenticationFactory.createClusterAdministrator());
+ }
+
+ @Test(expected = AuthorizationException.class)
+ public void testUpdateResources_ClusterOperator() throws Exception {
+ testUpdateResources(TestAuthenticationFactory.createClusterOperator());
+ }
+
+ @Test(expected = AuthorizationException.class)
+ public void testUpdateResources_ServiceAdministrator() throws Exception {
+ testUpdateResources(TestAuthenticationFactory.createServiceAdministrator());
+ }
+
+ @Test(expected = AuthorizationException.class)
+ public void testUpdateResources_ServiceOperator() throws Exception {
+ testUpdateResources(TestAuthenticationFactory.createServiceOperator());
+ }
+
+ private void testUpdateResources(Authentication authentication) throws Exception {
+ Injector injector = createInjector();
+
+ ResourceProvider resourceProvider = injector.getInstance(RootServiceComponentConfigurationResourceProvider.class);
+
+ Predicate predicate = createPredicate(RootService.AMBARI.name(), RootComponent.AMBARI_SERVER.name(), CATEGORY_NAME_1);
+
+ Set<Map<String, Object>> propertySets = new HashSet<>();
+
+ Map<String, String> properties1 = new HashMap<>();
+ properties1.put("property1a", "value1");
+ properties1.put("property2a", "value2");
+ propertySets.add(toRequestProperties(CATEGORY_NAME_1, properties1));
+
+ Request request = createMock(Request.class);
+ expect(request.getProperties()).andReturn(propertySets).once();
+
+ Capture<Map<String, String>> capturedProperties1 = newCapture();
+
+ AmbariConfigurationDAO dao = injector.getInstance(AmbariConfigurationDAO.class);
+ expect(dao.reconcileCategory(eq(CATEGORY_NAME_1), capture(capturedProperties1), eq(false)))
+ .andReturn(true)
+ .once();
+
+ AmbariEventPublisher publisher = injector.getInstance(AmbariEventPublisher.class);
+ publisher.publish(anyObject(AmbariConfigurationChangedEvent.class));
+ expectLastCall().times(1);
+
+ replayAll();
+
+ SecurityContextHolder.getContext().setAuthentication(authentication);
+
+ resourceProvider.updateResources(request, predicate);
+
+ verifyAll();
+
+ validateCapturedProperties(properties1, capturedProperties1);
+ }
+
+ private Predicate createPredicate(String serviceName, String componentName, String categoryName) {
+ Predicate predicateService = new PredicateBuilder()
+ .property(CONFIGURATION_SERVICE_NAME_PROPERTY_ID)
+ .equals(serviceName)
+ .toPredicate();
+ Predicate predicateComponent = new PredicateBuilder()
+ .property(CONFIGURATION_COMPONENT_NAME_PROPERTY_ID)
+ .equals(componentName)
+ .toPredicate();
+ Predicate predicateCategory = new PredicateBuilder()
+ .property(CONFIGURATION_CATEGORY_PROPERTY_ID)
+ .equals(categoryName)
+ .toPredicate();
+ return new AndPredicate(predicateService, predicateComponent, predicateCategory);
+ }
+
+ private List<AmbariConfigurationEntity> createEntities(String categoryName, Map<String, String> properties) {
+ List<AmbariConfigurationEntity> entities = new ArrayList<>();
+
+ for (Map.Entry<String, String> property : properties.entrySet()) {
+ AmbariConfigurationEntity entity = new AmbariConfigurationEntity();
+ entity.setCategoryName(categoryName);
+ entity.setPropertyName(property.getKey());
+ entity.setPropertyValue(property.getValue());
+ entities.add(entity);
+ }
+
+ return entities;
+ }
+
+ private Map<String, Object> toRequestProperties(String categoryName1, Map<String, String> properties) {
+ Map<String, Object> requestProperties = new HashMap<>();
+ requestProperties.put(CONFIGURATION_SERVICE_NAME_PROPERTY_ID, "AMBARI");
+ requestProperties.put(CONFIGURATION_COMPONENT_NAME_PROPERTY_ID, "AMBARI_SERVER");
+ requestProperties.put(CONFIGURATION_CATEGORY_PROPERTY_ID, categoryName1);
+ for (Map.Entry<String, String> entry : properties.entrySet()) {
+ requestProperties.put(CONFIGURATION_PROPERTIES_PROPERTY_ID + "/" + entry.getKey(), entry.getValue());
+ }
+ return requestProperties;
+ }
+
+ private void validateCapturedProperties(Map<String, String> expectedProperties, Capture<Map<String, String>> capturedProperties) {
+ Assert.assertTrue(capturedProperties.hasCaptured());
+
+ Map<String, String> properties = capturedProperties.getValue();
+ Assert.assertNotNull(properties);
+
+ // Convert the Map to a TreeMap to help with comparisons
+ expectedProperties = new TreeMap<>(expectedProperties);
+ properties = new TreeMap<>(properties);
+ Assert.assertEquals(expectedProperties, properties);
+ }
+
+ private Injector createInjector() throws Exception {
+ return Guice.createInjector(new AbstractModule() {
+ @Override
+ protected void configure() {
+ bind(EntityManager.class).toInstance(createNiceMock(EntityManager.class));
+ bind(AmbariConfigurationDAO.class).toInstance(createMock(AmbariConfigurationDAO.class));
+ bind(AmbariEventPublisher.class).toInstance(createMock(AmbariEventPublisher.class));
+ }
+ });
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceComponentPropertyProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceComponentPropertyProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceComponentPropertyProviderTest.java
index a202516..d3f9bd1 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceComponentPropertyProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceComponentPropertyProviderTest.java
@@ -24,7 +24,8 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
-import org.apache.ambari.server.controller.RootServiceResponseFactory;
+import org.apache.ambari.server.controller.RootComponent;
+import org.apache.ambari.server.controller.RootService;
import org.apache.ambari.server.controller.spi.Request;
import org.apache.ambari.server.controller.spi.Resource;
import org.apache.ambari.server.controller.utilities.PropertyHelper;
@@ -34,27 +35,27 @@ import org.junit.Test;
public class RootServiceComponentPropertyProviderTest {
@Test
public void testPopulateResources_AmbariServer_None() throws Exception {
- testPopulateResources(RootServiceResponseFactory.Components.AMBARI_SERVER.name(), false, false, false, false);
+ testPopulateResources(RootComponent.AMBARI_SERVER.name(), false, false, false, false);
}
@Test
public void testPopulateResources_AmbariServer_CiphersAndJCEPolicy() throws Exception {
- testPopulateResources(RootServiceResponseFactory.Components.AMBARI_SERVER.name(), true, true, true, true);
+ testPopulateResources(RootComponent.AMBARI_SERVER.name(), true, true, true, true);
}
@Test
public void testPopulateResources_AmbariServer_JCEPolicy() throws Exception {
- testPopulateResources(RootServiceResponseFactory.Components.AMBARI_SERVER.name(), false, true, false, true);
+ testPopulateResources(RootComponent.AMBARI_SERVER.name(), false, true, false, true);
}
@Test
public void testPopulateResources_AmbariServer_Ciphers() throws Exception {
- testPopulateResources(RootServiceResponseFactory.Components.AMBARI_SERVER.name(), true, false, true, false);
+ testPopulateResources(RootComponent.AMBARI_SERVER.name(), true, false, true, false);
}
@Test
public void testPopulateResources_AmbariAgent_CiphersAndJCEPolicy() throws Exception {
- testPopulateResources(RootServiceResponseFactory.Components.AMBARI_AGENT.name(), true, true, false, false);
+ testPopulateResources(RootComponent.AMBARI_AGENT.name(), true, true, false, false);
}
public void testPopulateResources(String componentName,
@@ -64,7 +65,7 @@ public class RootServiceComponentPropertyProviderTest {
Resource resource = new ResourceImpl(Resource.Type.RootService);
resource.setProperty(RootServiceComponentResourceProvider.COMPONENT_NAME_PROPERTY_ID, componentName);
- resource.setProperty(RootServiceComponentResourceProvider.SERVICE_NAME_PROPERTY_ID, RootServiceResponseFactory.Services.AMBARI.name());
+ resource.setProperty(RootServiceComponentResourceProvider.SERVICE_NAME_PROPERTY_ID, RootService.AMBARI.name());
HashSet<String> requestIds = new HashSet<>();
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceComponentResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceComponentResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceComponentResourceProviderTest.java
index 222340b..4316647 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceComponentResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceComponentResourceProviderTest.java
@@ -29,8 +29,9 @@ import java.util.Map;
import java.util.Set;
import org.apache.ambari.server.controller.AmbariManagementController;
+import org.apache.ambari.server.controller.RootComponent;
+import org.apache.ambari.server.controller.RootService;
import org.apache.ambari.server.controller.RootServiceComponentResponse;
-import org.apache.ambari.server.controller.RootServiceResponseFactory;
import org.apache.ambari.server.controller.spi.Predicate;
import org.apache.ambari.server.controller.spi.Request;
import org.apache.ambari.server.controller.spi.Resource;
@@ -50,12 +51,12 @@ public class RootServiceComponentResourceProviderTest {
AmbariManagementController managementController = createMock(AmbariManagementController.class);
Set<RootServiceComponentResponse> allResponse = new HashSet<>();
- String serviceName = RootServiceResponseFactory.Services.AMBARI.name();
+ String serviceName = RootService.AMBARI.name();
Map<String, String> emptyMap = Collections.emptyMap();
allResponse.add(new RootServiceComponentResponse(serviceName, "component1", "1.1.1", emptyMap));
allResponse.add(new RootServiceComponentResponse(serviceName, "component2", "1.1.1", emptyMap));
allResponse.add(new RootServiceComponentResponse(serviceName, "component3", "1.1.1", emptyMap));
- allResponse.add(new RootServiceComponentResponse(serviceName, RootServiceResponseFactory.Components.AMBARI_SERVER.name(), "1.1.1", emptyMap));
+ allResponse.add(new RootServiceComponentResponse(serviceName, RootComponent.AMBARI_SERVER.name(), "1.1.1", emptyMap));
Set<RootServiceComponentResponse> nameResponse = new HashSet<>();
nameResponse.add(new RootServiceComponentResponse(serviceName, "component4", "1.1.1", emptyMap));
@@ -92,7 +93,7 @@ public class RootServiceComponentResourceProviderTest {
String componentName = (String) resource.getPropertyValue(RootServiceComponentResourceProvider.COMPONENT_NAME_PROPERTY_ID);
String componentVersion = (String) resource.getPropertyValue(RootServiceComponentResourceProvider.COMPONENT_VERSION_PROPERTY_ID);
Long server_clock = (Long) resource.getPropertyValue(RootServiceComponentResourceProvider.SERVER_CLOCK_PROPERTY_ID);
- if (componentName.equals(RootServiceResponseFactory.Components.AMBARI_SERVER.name())){
+ if (componentName.equals(RootComponent.AMBARI_SERVER.name())){
Assert.assertNotNull(server_clock);
} else {
Assert.assertNull(server_clock);
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/test/java/org/apache/ambari/server/ldap/LdapModuleFunctionalTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/ldap/LdapModuleFunctionalTest.java b/ambari-server/src/test/java/org/apache/ambari/server/ldap/LdapModuleFunctionalTest.java
index 30f5e22..3917cdf 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/ldap/LdapModuleFunctionalTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/ldap/LdapModuleFunctionalTest.java
@@ -125,8 +125,8 @@ public class LdapModuleFunctionalTest {
return ldapPropsMap;
}
- private static Map<String, Object> getADProps() {
- Map<String, Object> ldapPropsMap = Maps.newHashMap();
+ private static Map<String, String> getADProps() {
+ Map<String, String> ldapPropsMap = Maps.newHashMap();
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/test/java/org/apache/ambari/server/ldap/domain/TestAmbariLdapConfigurationFactory.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/ldap/domain/TestAmbariLdapConfigurationFactory.java b/ambari-server/src/test/java/org/apache/ambari/server/ldap/domain/TestAmbariLdapConfigurationFactory.java
index aa26498..1082250 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/ldap/domain/TestAmbariLdapConfigurationFactory.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/ldap/domain/TestAmbariLdapConfigurationFactory.java
@@ -23,7 +23,7 @@ import java.util.Map;
public class TestAmbariLdapConfigurationFactory implements AmbariLdapConfigurationFactory {
@Override
- public AmbariLdapConfiguration createLdapConfiguration(Map<String, Object> configuration) {
+ public AmbariLdapConfiguration createLdapConfiguration(Map<String, String> configuration) {
return new AmbariLdapConfiguration(configuration);
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/AmbariLdapFacadeTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/AmbariLdapFacadeTest.java b/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/AmbariLdapFacadeTest.java
index db0e5a9..97ce30e 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/AmbariLdapFacadeTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/AmbariLdapFacadeTest.java
@@ -163,12 +163,12 @@ public class AmbariLdapFacadeTest extends EasyMockSupport {
public void testShouldLdapAttributeDetectionDelegateToTheRightServiceCalls() throws Exception {
// configuration map with user attributes detected
- Map<String, Object> userConfigMap = Maps.newHashMap();
+ Map<String, String> userConfigMap = Maps.newHashMap();
userConfigMap.put(AmbariLdapConfigKeys.USER_NAME_ATTRIBUTE.key(), "uid");
AmbariLdapConfiguration userAttrDecoratedConfig = ambariLdapConfigurationFactory.createLdapConfiguration(userConfigMap);
// configuration map with user+group attributes detected
- Map<String, Object> groupConfigMap = Maps.newHashMap(userConfigMap);
+ Map<String, String> groupConfigMap = Maps.newHashMap(userConfigMap);
groupConfigMap.put(AmbariLdapConfigKeys.GROUP_NAME_ATTRIBUTE.key(), "dn");
AmbariLdapConfiguration groupAttrDecoratedConfig = ambariLdapConfigurationFactory.createLdapConfiguration(groupConfigMap);
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionServiceTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionServiceTest.java
index 09dea1c..a44bf7c 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionServiceTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionServiceTest.java
@@ -78,7 +78,7 @@ public class DefaultLdapAttributeDetectionServiceTest extends EasyMockSupport {
@SuppressWarnings("unchecked")
public void shouldLdapUserAttributeDetection() throws Exception {
// GIVEN
- Map<String, Object> configMap = Maps.newHashMap();
+ Map<String, String> configMap = Maps.newHashMap();
configMap.put(AmbariLdapConfigKeys.USER_SEARCH_BASE.key(), "dc=example,dc=com");
AmbariLdapConfiguration ldapConfiguration = ldapConfigurationFactory.createLdapConfiguration(configMap);
@@ -109,7 +109,7 @@ public class DefaultLdapAttributeDetectionServiceTest extends EasyMockSupport {
@Test(expected = AmbariLdapException.class)
public void testShouldUserAttributeDetectionFailWhenLdapOerationFails() throws Exception {
// GIVEN
- Map<String, Object> configMap = Maps.newHashMap();
+ Map<String, String> configMap = Maps.newHashMap();
configMap.put(AmbariLdapConfigKeys.USER_SEARCH_BASE.key(), "dc=example,dc=com");
AmbariLdapConfiguration ldapConfiguration = ldapConfigurationFactory.createLdapConfiguration(configMap);
@@ -129,7 +129,7 @@ public class DefaultLdapAttributeDetectionServiceTest extends EasyMockSupport {
@SuppressWarnings("unchecked")
public void shouldLdapGroupAttributeDetection() throws Exception {
// GIVEN
- Map<String, Object> configMap = Maps.newHashMap();
+ Map<String, String> configMap = Maps.newHashMap();
configMap.put(AmbariLdapConfigKeys.GROUP_SEARCH_BASE.key(), "dc=example,dc=com");
AmbariLdapConfiguration ldapConfiguration = ldapConfigurationFactory.createLdapConfiguration(configMap);
@@ -160,7 +160,7 @@ public class DefaultLdapAttributeDetectionServiceTest extends EasyMockSupport {
@Test(expected = AmbariLdapException.class)
public void testShouldGroupAttributeDetectionFailWhenLdapOerationFails() throws Exception {
// GIVEN
- Map<String, Object> configMap = Maps.newHashMap();
+ Map<String, String> configMap = Maps.newHashMap();
configMap.put(AmbariLdapConfigKeys.GROUP_SEARCH_BASE.key(), "dc=example,dc=com");
AmbariLdapConfiguration ldapConfiguration = ldapConfigurationFactory.createLdapConfiguration(configMap);
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConfigurationServiceTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConfigurationServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConfigurationServiceTest.java
index 4d6d2a6..ec78e56 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConfigurationServiceTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConfigurationServiceTest.java
@@ -102,7 +102,7 @@ public class DefaultLdapConfigurationServiceTest extends EasyMockSupport {
@Test
public void testShouldUserAttributeConfigurationCheckSucceedWhenUserDnIsFound() throws Exception {
// GIVEN
- Map<String, Object> configMap = Maps.newHashMap();
+ Map<String, String> configMap = Maps.newHashMap();
configMap.put(AmbariLdapConfigKeys.USER_OBJECT_CLASS.key(), "person");
configMap.put(AmbariLdapConfigKeys.USER_NAME_ATTRIBUTE.key(), "uid");
@@ -126,7 +126,7 @@ public class DefaultLdapConfigurationServiceTest extends EasyMockSupport {
@Test(expected = AmbariLdapException.class)
public void testShouldUserAttributeConfigurationCheckFailWhenNoUsersFound() throws Exception {
// GIVEN
- Map<String, Object> configMap = Maps.newHashMap();
+ Map<String, String> configMap = Maps.newHashMap();
configMap.put(AmbariLdapConfigKeys.USER_OBJECT_CLASS.key(), "posixAccount");
configMap.put(AmbariLdapConfigKeys.USER_NAME_ATTRIBUTE.key(), "dn");
@@ -155,7 +155,7 @@ public class DefaultLdapConfigurationServiceTest extends EasyMockSupport {
public void testShouldGroupAttributeConfigurationCheckSucceedWhenGroupForUserDnIsFound() throws Exception {
// GIVEN
- Map<String, Object> configMap = groupConfigObjectMap();
+ Map<String, String> configMap = groupConfigObjectMap();
SearchRequest sr = new SearchRequestImpl();
@@ -184,7 +184,7 @@ public class DefaultLdapConfigurationServiceTest extends EasyMockSupport {
public void testShouldGroupAttributeConfigurationCheckFailWhenNoGroupsForUserDnFound() throws Exception {
// GIVEN
- Map<String, Object> configMap = groupConfigObjectMap();
+ Map<String, String> configMap = groupConfigObjectMap();
SearchRequest sr = new SearchRequestImpl();
@@ -208,8 +208,8 @@ public class DefaultLdapConfigurationServiceTest extends EasyMockSupport {
}
- private Map<String, Object> groupConfigObjectMap() {
- Map<String, Object> configMap = Maps.newHashMap();
+ private Map<String, String> groupConfigObjectMap() {
+ Map<String, String> configMap = Maps.newHashMap();
configMap.put(AmbariLdapConfigKeys.GROUP_OBJECT_CLASS.key(), "groupOfNames");
configMap.put(AmbariLdapConfigKeys.GROUP_SEARCH_BASE.key(), "dc=example,dc=com");
configMap.put(AmbariLdapConfigKeys.GROUP_NAME_ATTRIBUTE.key(), "uid");
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/test/java/org/apache/ambari/server/metadata/AgentAlertDefinitionsTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/metadata/AgentAlertDefinitionsTest.java b/ambari-server/src/test/java/org/apache/ambari/server/metadata/AgentAlertDefinitionsTest.java
index adaf236..cb234ea 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/metadata/AgentAlertDefinitionsTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/metadata/AgentAlertDefinitionsTest.java
@@ -22,7 +22,7 @@ import java.util.List;
import javax.persistence.EntityManager;
import org.apache.ambari.server.H2DatabaseCleaner;
-import org.apache.ambari.server.controller.RootServiceResponseFactory.Components;
+import org.apache.ambari.server.controller.RootComponent;
import org.apache.ambari.server.orm.GuiceJpaInitializer;
import org.apache.ambari.server.orm.InMemoryDefaultTestModule;
import org.apache.ambari.server.state.alert.AlertDefinition;
@@ -63,7 +63,7 @@ public class AgentAlertDefinitionsTest {
Assert.assertEquals(3, definitions.size());
for( AlertDefinition definition : definitions){
- Assert.assertEquals(Components.AMBARI_AGENT.name(),
+ Assert.assertEquals(RootComponent.AMBARI_AGENT.name(),
definition.getComponentName());
Assert.assertEquals("AMBARI", definition.getServiceName());
@@ -80,7 +80,7 @@ public class AgentAlertDefinitionsTest {
Assert.assertEquals(4, definitions.size());
for (AlertDefinition definition : definitions) {
- Assert.assertEquals(Components.AMBARI_SERVER.name(),
+ Assert.assertEquals(RootComponent.AMBARI_SERVER.name(),
definition.getComponentName());
Assert.assertEquals("AMBARI", definition.getServiceName());
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertDefinitionDAOTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertDefinitionDAOTest.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertDefinitionDAOTest.java
index d559e0c..9ebc2e5 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertDefinitionDAOTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertDefinitionDAOTest.java
@@ -31,7 +31,8 @@ import java.util.TimeZone;
import java.util.UUID;
import org.apache.ambari.server.H2DatabaseCleaner;
-import org.apache.ambari.server.controller.RootServiceResponseFactory;
+import org.apache.ambari.server.controller.RootComponent;
+import org.apache.ambari.server.controller.RootService;
import org.apache.ambari.server.orm.GuiceJpaInitializer;
import org.apache.ambari.server.orm.InMemoryDefaultTestModule;
import org.apache.ambari.server.orm.OrmTestHelper;
@@ -148,8 +149,8 @@ public class AlertDefinitionDAOTest {
for (; i < 15; i++) {
AlertDefinitionEntity definition = new AlertDefinitionEntity();
definition.setDefinitionName("Alert Definition " + i);
- definition.setServiceName(RootServiceResponseFactory.Services.AMBARI.name());
- definition.setComponentName(RootServiceResponseFactory.Components.AMBARI_AGENT.name());
+ definition.setServiceName(RootService.AMBARI.name());
+ definition.setComponentName(RootComponent.AMBARI_AGENT.name());
definition.setClusterId(clusterId);
definition.setHash(UUID.randomUUID().toString());
definition.setScheduleInterval(60);
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertReceivedListenerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertReceivedListenerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertReceivedListenerTest.java
index 3ec6943..3056dd1 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertReceivedListenerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertReceivedListenerTest.java
@@ -30,8 +30,8 @@ import javax.persistence.EntityManager;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.H2DatabaseCleaner;
-import org.apache.ambari.server.controller.RootServiceResponseFactory.Components;
-import org.apache.ambari.server.controller.RootServiceResponseFactory.Services;
+import org.apache.ambari.server.controller.RootComponent;
+import org.apache.ambari.server.controller.RootService;
import org.apache.ambari.server.events.AlertReceivedEvent;
import org.apache.ambari.server.events.AlertStateChangeEvent;
import org.apache.ambari.server.events.listeners.alerts.AlertReceivedListener;
@@ -335,8 +335,8 @@ public class AlertReceivedListenerTest {
@Test
public void testAgentAlertFromInvalidHost() {
String definitionName = ALERT_DEFINITION + "1";
- String serviceName = Services.AMBARI.name();
- String componentName = Components.AMBARI_AGENT.name();
+ String serviceName = RootService.AMBARI.name();
+ String componentName = RootComponent.AMBARI_AGENT.name();
Alert alert = new Alert(definitionName, null, serviceName, componentName, HOST1,
AlertState.OK);
@@ -374,8 +374,8 @@ public class AlertReceivedListenerTest {
@Test
public void testAmbariServerValidAlerts() {
String definitionName = ALERT_DEFINITION + "1";
- String serviceName = Services.AMBARI.name();
- String componentName = Components.AMBARI_SERVER.name();
+ String serviceName = RootService.AMBARI.name();
+ String componentName = RootComponent.AMBARI_SERVER.name();
Alert alert = new Alert(definitionName, null, serviceName, componentName, HOST1,
AlertState.OK);
@@ -415,8 +415,8 @@ public class AlertReceivedListenerTest {
@Test
public void testMissingClusterAndInvalidHost() {
String definitionName = ALERT_DEFINITION + "1";
- String serviceName = Services.AMBARI.name();
- String componentName = Components.AMBARI_AGENT.name();
+ String serviceName = RootService.AMBARI.name();
+ String componentName = RootComponent.AMBARI_AGENT.name();
Alert alert1 = new Alert(definitionName, null, serviceName, componentName, HOST1,
AlertState.OK);
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertStateChangedEventTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertStateChangedEventTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertStateChangedEventTest.java
index bc8222c..c3db717 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertStateChangedEventTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertStateChangedEventTest.java
@@ -24,7 +24,7 @@ import java.util.List;
import java.util.Set;
import org.apache.ambari.server.H2DatabaseCleaner;
-import org.apache.ambari.server.controller.RootServiceResponseFactory.Services;
+import org.apache.ambari.server.controller.RootService;
import org.apache.ambari.server.events.AggregateAlertRecalculateEvent;
import org.apache.ambari.server.events.AlertEvent;
import org.apache.ambari.server.events.AlertStateChangeEvent;
@@ -501,7 +501,7 @@ public class AlertStateChangedEventTest extends EasyMockSupport {
// create the definition for the AMBARI service
AlertDefinitionEntity definition = createNiceMock(AlertDefinitionEntity.class);
EasyMock.expect(definition.getDefinitionId()).andReturn(1L).anyTimes();
- EasyMock.expect(definition.getServiceName()).andReturn(Services.AMBARI.name()).anyTimes();
+ EasyMock.expect(definition.getServiceName()).andReturn(RootService.AMBARI.name()).anyTimes();
EasyMock.expect(definition.getLabel()).andReturn("ambari-foo-alert").anyTimes();
EasyMock.expect(definition.getDescription()).andReturn("Ambari Foo Alert").anyTimes();
[14/50] [abbrv] ambari git commit: AMBARI-22346. Beeline connection
hangs for longer time when connection to HS2 with metastore DB down
(aonishuk)
Posted by rl...@apache.org.
AMBARI-22346. Beeline connection hangs for longer time when connection to HS2 with metastore DB down (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/98915a11
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/98915a11
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/98915a11
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 98915a114769c7ddd590854ccf0ab33beabddcf3
Parents: 46ad6c6
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Fri Nov 10 13:28:27 2017 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Fri Nov 10 13:28:27 2017 +0200
----------------------------------------------------------------------
.../HIVE/0.12.0.2.0/package/alerts/alert_hive_thrift_port.py | 3 ++-
.../1.2.1/package/scripts/alerts/alert_spark_thrift_port.py | 8 +++++++-
.../2.0.0/package/scripts/alerts/alert_spark2_thrift_port.py | 8 +++++++-
3 files changed, 16 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/98915a11/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/alerts/alert_hive_thrift_port.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/alerts/alert_hive_thrift_port.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/alerts/alert_hive_thrift_port.py
index 3560bf8..6db92b0 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/alerts/alert_hive_thrift_port.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/alerts/alert_hive_thrift_port.py
@@ -28,6 +28,7 @@ from resource_management.libraries.functions import format
from resource_management.libraries.functions import get_kinit_path
from ambari_commons.os_check import OSConst
from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
+from resource_management.core.signal_utils import TerminateStrategy
OK_MESSAGE = "TCP OK - {0:.3f}s response on port {1}"
CRITICAL_MESSAGE = "Connection failed on host {0}:{1} ({2})"
@@ -271,7 +272,7 @@ def execute(configurations={}, parameters={}, host_name=None):
start_time = time.time()
try:
- Execute(cmd, user=hiveuser, timeout=30)
+ Execute(cmd, user=hiveuser, timeout=30, timeout_kill_strategy=TerminateStrategy.KILL_PROCESS_TREE)
total_time = time.time() - start_time
result_code = 'OK'
label = OK_MESSAGE.format(total_time, port)
http://git-wip-us.apache.org/repos/asf/ambari/blob/98915a11/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/alerts/alert_spark_thrift_port.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/alerts/alert_spark_thrift_port.py b/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/alerts/alert_spark_thrift_port.py
index 3f80fd9..6874cb4 100644
--- a/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/alerts/alert_spark_thrift_port.py
+++ b/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/alerts/alert_spark_thrift_port.py
@@ -27,6 +27,7 @@ from resource_management.libraries.script.script import Script
from resource_management.libraries.functions import get_kinit_path
from resource_management.core.resources import Execute
from resource_management.core import global_lock
+from resource_management.core.signal_utils import TerminateStrategy
stack_root = Script.get_stack_root()
@@ -140,7 +141,12 @@ def execute(configurations={}, parameters={}, host_name=None):
start_time = time.time()
try:
- Execute(cmd, user=hiveruser, path=[beeline_cmd], timeout=CHECK_COMMAND_TIMEOUT_DEFAULT)
+ Execute(cmd,
+ user=hiveruser,
+ path=[beeline_cmd],
+ timeout=CHECK_COMMAND_TIMEOUT_DEFAULT,
+ timeout_kill_strategy=TerminateStrategy.KILL_PROCESS_TREE,
+ )
total_time = time.time() - start_time
result_code = 'OK'
label = OK_MESSAGE.format(total_time, port)
http://git-wip-us.apache.org/repos/asf/ambari/blob/98915a11/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/alerts/alert_spark2_thrift_port.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/alerts/alert_spark2_thrift_port.py b/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/alerts/alert_spark2_thrift_port.py
index 9e1afea..d3660de 100644
--- a/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/alerts/alert_spark2_thrift_port.py
+++ b/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/alerts/alert_spark2_thrift_port.py
@@ -27,6 +27,7 @@ from resource_management.libraries.script.script import Script
from resource_management.libraries.functions import get_kinit_path
from resource_management.core.resources import Execute
from resource_management.core import global_lock
+from resource_management.core.signal_utils import TerminateStrategy
stack_root = Script.get_stack_root()
@@ -141,7 +142,12 @@ def execute(configurations={}, parameters={}, host_name=None):
start_time = time.time()
try:
- Execute(cmd, user=hiveruser, path=[beeline_cmd], timeout=CHECK_COMMAND_TIMEOUT_DEFAULT)
+ Execute(cmd,
+ user=hiveruser,
+ path=[beeline_cmd],
+ timeout=CHECK_COMMAND_TIMEOUT_DEFAULT,
+ timeout_kill_strategy=TerminateStrategy.KILL_PROCESS_TREE
+ )
total_time = time.time() - start_time
result_code = 'OK'
label = OK_MESSAGE.format(total_time, port)
[13/50] [abbrv] ambari git commit: AMBARI-22303. Spark history server
is stopped (with umask 027 and custom spark log/pid dir) (aonishuk)
Posted by rl...@apache.org.
AMBARI-22303. Spark history server is stopped (with umask 027 and custom spark log/pid dir) (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/46ad6c68
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/46ad6c68
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/46ad6c68
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 46ad6c6878b00f7791845ecf7c2b3fef7244faad
Parents: feccebc
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Fri Nov 10 12:53:06 2017 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Fri Nov 10 12:53:06 2017 +0200
----------------------------------------------------------------------
.../SPARK/1.2.1/package/scripts/setup_spark.py | 3 ++-
.../SPARK2/2.0.0/package/scripts/setup_spark.py | 3 ++-
.../python/stacks/2.2/SPARK/test_job_history_server.py | 12 ++++++++----
.../test/python/stacks/2.2/SPARK/test_spark_client.py | 12 ++++++++----
.../python/stacks/2.3/SPARK/test_spark_thrift_server.py | 6 ++++--
5 files changed, 24 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/46ad6c68/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/setup_spark.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/setup_spark.py b/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/setup_spark.py
index 53c8f9e..6a29efb 100644
--- a/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/setup_spark.py
+++ b/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/setup_spark.py
@@ -52,7 +52,8 @@ def setup_spark(env, type, upgrade_type=None, action=None, config_dir=None):
owner=params.spark_user,
group=params.user_group,
mode=0775,
- create_parents = True
+ create_parents = True,
+ cd_access = 'a',
)
if type == 'server' and action == 'config':
params.HdfsResource(params.spark_hdfs_user_dir,
http://git-wip-us.apache.org/repos/asf/ambari/blob/46ad6c68/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/setup_spark.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/setup_spark.py b/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/setup_spark.py
index a7b8459..792b2a1 100755
--- a/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/setup_spark.py
+++ b/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/setup_spark.py
@@ -42,7 +42,8 @@ def setup_spark(env, type, upgrade_type = None, action = None):
owner=params.spark_user,
group=params.user_group,
mode=0775,
- create_parents = True
+ create_parents = True,
+ cd_access = 'a',
)
if type == 'server' and action == 'config':
params.HdfsResource(params.spark_hdfs_user_dir,
http://git-wip-us.apache.org/repos/asf/ambari/blob/46ad6c68/ambari-server/src/test/python/stacks/2.2/SPARK/test_job_history_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.2/SPARK/test_job_history_server.py b/ambari-server/src/test/python/stacks/2.2/SPARK/test_job_history_server.py
index 922ace2..8801746 100644
--- a/ambari-server/src/test/python/stacks/2.2/SPARK/test_job_history_server.py
+++ b/ambari-server/src/test/python/stacks/2.2/SPARK/test_job_history_server.py
@@ -165,13 +165,15 @@ class TestJobHistoryServer(RMFTestCase):
owner = 'spark',
group = 'hadoop',
create_parents = True,
- mode = 0775
+ mode = 0775,
+ cd_access = 'a',
)
self.assertResourceCalled('Directory', '/var/log/spark',
owner = 'spark',
group = 'hadoop',
create_parents = True,
- mode = 0775
+ mode = 0775,
+ cd_access = 'a',
)
self.assertResourceCalled('HdfsResource', '/user/spark',
immutable_paths = self.DEFAULT_IMMUTABLE_PATHS,
@@ -246,13 +248,15 @@ class TestJobHistoryServer(RMFTestCase):
owner = 'spark',
group = 'hadoop',
create_parents = True,
- mode = 0775
+ mode = 0775,
+ cd_access = 'a',
)
self.assertResourceCalled('Directory', '/var/log/spark',
owner = 'spark',
group = 'hadoop',
create_parents = True,
- mode = 0775
+ mode = 0775,
+ cd_access = 'a',
)
self.assertResourceCalled('HdfsResource', '/user/spark',
immutable_paths = self.DEFAULT_IMMUTABLE_PATHS,
http://git-wip-us.apache.org/repos/asf/ambari/blob/46ad6c68/ambari-server/src/test/python/stacks/2.2/SPARK/test_spark_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.2/SPARK/test_spark_client.py b/ambari-server/src/test/python/stacks/2.2/SPARK/test_spark_client.py
index b4535cd..e15d5a4 100644
--- a/ambari-server/src/test/python/stacks/2.2/SPARK/test_spark_client.py
+++ b/ambari-server/src/test/python/stacks/2.2/SPARK/test_spark_client.py
@@ -58,13 +58,15 @@ class TestSparkClient(RMFTestCase):
owner = 'spark',
group = 'hadoop',
create_parents = True,
- mode = 0775
+ mode = 0775,
+ cd_access = 'a',
)
self.assertResourceCalled('Directory', '/var/log/spark',
owner = 'spark',
group = 'hadoop',
create_parents = True,
- mode = 0775
+ mode = 0775,
+ cd_access = 'a',
)
self.assertResourceCalled('PropertiesFile', '/usr/hdp/current/spark-client/conf/spark-defaults.conf',
owner = 'spark',
@@ -108,13 +110,15 @@ class TestSparkClient(RMFTestCase):
owner = 'spark',
group = 'hadoop',
create_parents = True,
- mode = 0775
+ mode = 0775,
+ cd_access = 'a',
)
self.assertResourceCalled('Directory', '/var/log/spark',
owner = 'spark',
group = 'hadoop',
create_parents = True,
- mode = 0775
+ mode = 0775,
+ cd_access = 'a',
)
self.assertResourceCalled('PropertiesFile', '/usr/hdp/current/spark-client/conf/spark-defaults.conf',
owner = 'spark',
http://git-wip-us.apache.org/repos/asf/ambari/blob/46ad6c68/ambari-server/src/test/python/stacks/2.3/SPARK/test_spark_thrift_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.3/SPARK/test_spark_thrift_server.py b/ambari-server/src/test/python/stacks/2.3/SPARK/test_spark_thrift_server.py
index fbe5403..78d45cf 100644
--- a/ambari-server/src/test/python/stacks/2.3/SPARK/test_spark_thrift_server.py
+++ b/ambari-server/src/test/python/stacks/2.3/SPARK/test_spark_thrift_server.py
@@ -85,13 +85,15 @@ class TestSparkThriftServer(RMFTestCase):
owner = 'spark',
group = 'hadoop',
create_parents = True,
- mode = 0775
+ mode = 0775,
+ cd_access = 'a',
)
self.assertResourceCalled('Directory', '/var/log/spark',
owner = 'spark',
group = 'hadoop',
create_parents = True,
- mode = 0775
+ mode = 0775,
+ cd_access = 'a',
)
self.assertResourceCalled('HdfsResource', '/user/spark',
immutable_paths = self.DEFAULT_IMMUTABLE_PATHS,
[20/50] [abbrv] ambari git commit: AMBARI-22417. Ambari checks fail
with FIPS mode is activated on the OS (rlevas)
Posted by rl...@apache.org.
AMBARI-22417. Ambari checks fail with FIPS mode is activated on the OS (rlevas)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5122671d
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5122671d
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5122671d
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 5122671d0076612f4b39f4ae51c2ad627544d768
Parents: 7c4a7e4
Author: Robert Levas <rl...@hortonworks.com>
Authored: Mon Nov 13 05:20:25 2017 -0500
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Mon Nov 13 05:20:25 2017 -0500
----------------------------------------------------------------------
.../libraries/functions/curl_krb_request.py | 22 +++++++-------------
1 file changed, 7 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/5122671d/ambari-common/src/main/python/resource_management/libraries/functions/curl_krb_request.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/curl_krb_request.py b/ambari-common/src/main/python/resource_management/libraries/functions/curl_krb_request.py
index 95e8625..55395ce 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/curl_krb_request.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/curl_krb_request.py
@@ -21,28 +21,20 @@ Ambari Agent
"""
__all__ = ["curl_krb_request"]
+import hashlib
import logging
import os
+
import time
+from get_kinit_path import get_kinit_path
+from get_klist_path import get_klist_path
from resource_management.core import global_lock
from resource_management.core import shell
from resource_management.core.exceptions import Fail
-from get_kinit_path import get_kinit_path
-from get_klist_path import get_klist_path
from resource_management.libraries.functions.get_user_call_output import get_user_call_output
-# hashlib is supplied as of Python 2.5 as the replacement interface for md5
-# and other secure hashes. In 2.6, md5 is deprecated. Import hashlib if
-# available, avoiding a deprecation warning under 2.6. Import md5 otherwise,
-# preserving 2.4 compatibility.
-try:
- import hashlib
- _md5 = hashlib.md5
-except ImportError:
- import md5
- _md5 = md5.new
-
+HASH_ALGORITHM = hashlib.sha224
CONNECTION_TIMEOUT_DEFAULT = 10
MAX_TIMEOUT_DEFAULT = CONNECTION_TIMEOUT_DEFAULT + 2
@@ -103,10 +95,10 @@ def curl_krb_request(tmp_dir, keytab, principal, url, cache_file_prefix,
is_kinit_required = False
# Create the kerberos credentials cache (ccache) file and set it in the environment to use
- # when executing curl. Use the md5 hash of the combination of the principal and keytab file
+ # when executing curl. Use a hash of the combination of the principal and keytab file
# to generate a (relatively) unique cache filename so that we can use it as needed. Scope
# this file by user in order to prevent sharing of cache files by multiple users.
- ccache_file_name = _md5("{0}|{1}".format(principal, keytab)).hexdigest()
+ ccache_file_name = HASH_ALGORITHM("{0}|{1}".format(principal, keytab)).hexdigest()
curl_krb_cache_path = os.path.join(tmp_dir, "curl_krb_cache")
if not os.path.exists(curl_krb_cache_path):
[35/50] [abbrv] ambari git commit: AMBARI-22398. Upstart is not able
to stop the ambari-agent - fix unit test
Posted by rl...@apache.org.
AMBARI-22398. Upstart is not able to stop the ambari-agent - fix unit test
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a4e7bf37
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a4e7bf37
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a4e7bf37
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: a4e7bf379dc2392253bd9bad3ab42ab9c2d9552e
Parents: 2b917f4
Author: Attila Doroszlai <ad...@hortonworks.com>
Authored: Wed Nov 15 12:56:23 2017 +0100
Committer: Attila Doroszlai <ad...@hortonworks.com>
Committed: Wed Nov 15 12:56:23 2017 +0100
----------------------------------------------------------------------
ambari-agent/src/test/python/ambari_agent/TestAmbariAgent.py | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/a4e7bf37/ambari-agent/src/test/python/ambari_agent/TestAmbariAgent.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestAmbariAgent.py b/ambari-agent/src/test/python/ambari_agent/TestAmbariAgent.py
index 8ff192a..56a73fc 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestAmbariAgent.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestAmbariAgent.py
@@ -35,8 +35,7 @@ class TestAmbariAgent(unittest.TestCase):
@patch("os.path.isfile")
@patch("os.remove")
@patch("os.killpg")
- @patch("os.setpgrp")
- def test_main(self, os_setpgrp_mock, os_killpg_mock, os_remove_mock,
+ def test_main(self, os_killpg_mock, os_remove_mock,
os_path_isfile_mock, subprocess_popen_mock):
facter1 = MagicMock()
facter2 = MagicMock()
@@ -49,7 +48,6 @@ class TestAmbariAgent(unittest.TestCase):
sys.argv[0] = "test data"
AmbariAgent.main()
- self.assertTrue(os_setpgrp_mock.called)
self.assertTrue(subprocess_popen_mock.called)
self.assertTrue(subprocess_popen_mock.call_count == 2)
self.assertTrue(facter1.communicate.called)
[46/50] [abbrv] ambari git commit: AMBARI-22460. NFSGateway start
failed (aonishuk)
Posted by rl...@apache.org.
AMBARI-22460. NFSGateway start failed (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f087874e
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f087874e
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f087874e
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: f087874e7b0bc1e5b5a2398c7571264aaec15fa5
Parents: 4042f9f
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Thu Nov 16 12:26:56 2017 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Thu Nov 16 12:26:56 2017 +0200
----------------------------------------------------------------------
.../src/main/resources/stacks/HDP/2.0.6/role_command_order.json | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/f087874e/ambari-server/src/main/resources/stacks/HDP/2.0.6/role_command_order.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/role_command_order.json b/ambari-server/src/main/resources/stacks/HDP/2.0.6/role_command_order.json
index 78a31f1..3f576bf 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/role_command_order.json
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/role_command_order.json
@@ -14,6 +14,7 @@
"HIVE_SERVER-RESTART": ["NODEMANAGER-RESTART", "MYSQL_SERVER-RESTART", "ZOOKEEPER_SERVER-RESTART"],
"HUE_SERVER-START": ["HIVE_SERVER-START", "HCAT-START", "OOZIE_SERVER-START"],
"FLUME_HANDLER-START": ["OOZIE_SERVER-START"],
+ "NFS_GATEWAY-START": ["NAMENODE-START"],
"MAPREDUCE_SERVICE_CHECK-SERVICE_CHECK": ["NODEMANAGER-START", "RESOURCEMANAGER-START"],
"OOZIE_SERVICE_CHECK-SERVICE_CHECK": ["OOZIE_SERVER-START", "MAPREDUCE2_SERVICE_CHECK-SERVICE_CHECK"],
"HBASE_SERVICE_CHECK-SERVICE_CHECK": ["HBASE_MASTER-START", "HBASE_REGIONSERVER-START"],
[43/50] [abbrv] ambari git commit: AMBARI-22445. Warn the user
appropriately for default MySQL server install for Hive (vsubramanian)
Posted by rl...@apache.org.
AMBARI-22445. Warn the user appropriately for default MySQL server install for Hive (vsubramanian)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8fe6ac4b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8fe6ac4b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8fe6ac4b
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 8fe6ac4bd03739202a35f8862270be7dcec95421
Parents: c67a324
Author: Vivek Ratnavel Subramanian <vi...@gmail.com>
Authored: Wed Nov 15 14:28:22 2017 -0800
Committer: Vivek Ratnavel Subramanian <vi...@gmail.com>
Committed: Wed Nov 15 14:28:22 2017 -0800
----------------------------------------------------------------------
ambari-web/app/views/common/controls_view.js | 9 +++++++--
ambari-web/test/views/common/controls_view_test.js | 2 +-
2 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/8fe6ac4b/ambari-web/app/views/common/controls_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/controls_view.js b/ambari-web/app/views/common/controls_view.js
index 530b60a..63d08ce 100644
--- a/ambari-web/app/views/common/controls_view.js
+++ b/ambari-web/app/views/common/controls_view.js
@@ -543,8 +543,8 @@ App.ServiceConfigRadioButtons = Ember.View.extend(App.ServiceConfigCalculateId,
if ((App.get('isHadoopWindowsStack') && this.get('inMSSQLWithIA')) || this.get('serviceConfig.name') === 'DB_FLAVOR') {
this.onOptionsChange();
}
- this.handleDBConnectionProperty();
}
+ this.handleDBConnectionProperty();
}
},
@@ -748,6 +748,11 @@ App.ServiceConfigRadioButtons = Ember.View.extend(App.ServiceConfigCalculateId,
// check for all db types when installing Ranger - not only for existing ones
checkDatabase = true;
}
+ // Hive specific
+ if (this.get('serviceConfig.serviceName') === 'HIVE') {
+ // check for all db types when installing Hive - not only for existing ones
+ checkDatabase = true;
+ }
if (propertyAppendTo1) {
propertyAppendTo1.set('additionalView', null);
}
@@ -757,7 +762,7 @@ App.ServiceConfigRadioButtons = Ember.View.extend(App.ServiceConfigCalculateId,
var shouldAdditionalViewsBeSet = currentDB && checkDatabase && handledProperties.contains(this.get('serviceConfig.name')),
driver = this.getDefaultPropertyValue('sql_jar_connector') ? this.getDefaultPropertyValue('sql_jar_connector').split("/").pop() : 'driver.jar',
dbType = this.getDefaultPropertyValue('db_type'),
- additionalView1 = shouldAdditionalViewsBeSet ? App.CheckDBConnectionView.extend({databaseName: dbType}) : null,
+ additionalView1 = shouldAdditionalViewsBeSet && !this.get('isNewDb') ? App.CheckDBConnectionView.extend({databaseName: dbType}) : null,
additionalView2 = shouldAdditionalViewsBeSet ? Ember.View.extend({
template: Ember.Handlebars.compile('<div class="alert alert-warning">{{{view.message}}}</div>'),
message: function() {
http://git-wip-us.apache.org/repos/asf/ambari/blob/8fe6ac4b/ambari-web/test/views/common/controls_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/controls_view_test.js b/ambari-web/test/views/common/controls_view_test.js
index 17dd6e1..76742fa 100644
--- a/ambari-web/test/views/common/controls_view_test.js
+++ b/ambari-web/test/views/common/controls_view_test.js
@@ -59,7 +59,7 @@ describe('App.ServiceConfigRadioButtons', function () {
propertyAppendTo1: 'javax.jdo.option.ConnectionURL',
propertyAppendTo2: 'hive_database',
isAdditionalView1Null: true,
- isAdditionalView2Null: true,
+ isAdditionalView2Null: false,
title: 'Hive, embedded database'
},
{
[28/50] [abbrv] ambari git commit: AMBARI-22439 Host check operation
is being performed on all hosts during host add should not get stuck.
(atkach)
Posted by rl...@apache.org.
AMBARI-22439 Host check operation is being performed on all hosts during host add should not get stuck. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d0ef1449
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d0ef1449
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d0ef1449
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: d0ef1449af23e22ee6b95726ce4ca0b1f3544cc4
Parents: d11faab
Author: Andrii Tkach <at...@apache.org>
Authored: Tue Nov 14 18:11:56 2017 +0200
Committer: Andrii Tkach <at...@apache.org>
Committed: Tue Nov 14 18:11:56 2017 +0200
----------------------------------------------------------------------
ambari-web/app/mixins/main/host/details/actions/check_host.js | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d0ef1449/ambari-web/app/mixins/main/host/details/actions/check_host.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/main/host/details/actions/check_host.js b/ambari-web/app/mixins/main/host/details/actions/check_host.js
index 2e2e021..66baf5a 100644
--- a/ambari-web/app/mixins/main/host/details/actions/check_host.js
+++ b/ambari-web/app/mixins/main/host/details/actions/check_host.js
@@ -111,6 +111,8 @@ App.CheckHostMixin = Em.Mixin.create({
*/
warningsTimeInterval: 60000,
+ finishStates: ["FAILED", "COMPLETED", "TIMEDOUT", "ABORTED"],
+
/**
* disables host check on Add host wizard as per the experimental flag
*/
@@ -206,7 +208,7 @@ App.CheckHostMixin = Em.Mixin.create({
//if resolution host check has corrupted data then skip it
return this.getGeneralHostCheck();
}
- if (["FAILED", "COMPLETED", "TIMEDOUT"].contains(data.Requests.request_status)) {
+ if (this.get('finishStates').contains(data.Requests.request_status)) {
if (data.Requests.inputs.indexOf("last_agent_env_check") != -1) {
this.set('stopChecking', true);
this.set('hostsPackagesData', data.tasks.map(function (task) {
@@ -369,7 +371,7 @@ App.CheckHostMixin = Em.Mixin.create({
data.tasks.forEach(function (task) {
var name = Em.I18n.t('installer.step3.hostWarningsPopup.resolution.validation.error');
var hostInfo = this.get("hostCheckWarnings").findProperty('name', name);
- if (["FAILED", "COMPLETED", "TIMEDOUT"].contains(task.Tasks.status)) {
+ if (this.get('finishStates').contains(task.Tasks.status)) {
if (task.Tasks.status === "COMPLETED" && !!Em.get(task, "Tasks.structured_out.host_resolution_check.failed_count")) {
var targetHostName = Em.get(task, "Tasks.host_name");
var relatedHostNames = Em.get(task, "Tasks.structured_out.host_resolution_check.hosts_with_failures") || [];
[30/50] [abbrv] ambari git commit: AMBARI-22426. Push down Logger
instances (adoroszlai)
Posted by rl...@apache.org.
AMBARI-22426. Push down Logger instances (adoroszlai)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ed7e121f
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ed7e121f
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ed7e121f
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: ed7e121f3aee519ee18e53b4d0b05661cca4b48a
Parents: d0ef144
Author: Attila Doroszlai <ad...@hortonworks.com>
Authored: Mon Nov 13 14:01:15 2017 +0100
Committer: Attila Doroszlai <ad...@hortonworks.com>
Committed: Tue Nov 14 18:30:01 2017 +0100
----------------------------------------------------------------------
.../ambari/server/api/handlers/BaseManagementHandler.java | 8 --------
.../org/apache/ambari/server/api/handlers/CreateHandler.java | 4 ++++
.../org/apache/ambari/server/api/services/BaseService.java | 5 +----
.../apache/ambari/server/api/services/LoggingService.java | 4 ++++
.../services/stackadvisor/commands/StackAdvisorCommand.java | 2 +-
.../ambari/server/checks/DatabaseConsistencyCheckHelper.java | 2 +-
.../apache/ambari/server/controller/AmbariHandlerList.java | 5 +----
.../server/controller/internal/AbstractPropertyProvider.java | 4 ++++
.../server/controller/internal/AbstractProviderModule.java | 2 +-
.../server/controller/internal/AbstractResourceProvider.java | 2 +-
.../server/controller/internal/ActionResourceProvider.java | 4 ++++
.../controller/internal/AlertDefinitionResourceProvider.java | 4 ++++
.../controller/internal/AlertGroupResourceProvider.java | 4 ++++
.../server/controller/internal/AlertResourceProvider.java | 4 ++++
.../controller/internal/AlertTargetResourceProvider.java | 4 ++++
.../server/controller/internal/ArtifactResourceProvider.java | 4 ++++
.../ambari/server/controller/internal/BaseProvider.java | 6 +-----
.../controller/internal/BlueprintConfigurationProcessor.java | 2 +-
.../controller/internal/BlueprintResourceProvider.java | 4 ++++
.../server/controller/internal/ClusterResourceProvider.java | 4 ++++
.../internal/ClusterStackVersionResourceProvider.java | 4 ++++
.../CompatibleRepositoryVersionResourceProvider.java | 4 ++++
.../controller/internal/ComponentResourceProvider.java | 4 ++++
.../controller/internal/CredentialResourceProvider.java | 4 ++++
.../server/controller/internal/GroupResourceProvider.java | 4 ++++
.../controller/internal/HostComponentResourceProvider.java | 4 ++++
.../server/controller/internal/HostResourceProvider.java | 2 ++
.../internal/HostStackVersionResourceProvider.java | 4 ++++
.../ambari/server/controller/internal/HostStatusHelper.java | 2 +-
.../server/controller/internal/HttpPropertyProvider.java | 2 +-
.../server/controller/internal/JsonHttpPropertyRequest.java | 2 +-
.../controller/internal/LdapSyncEventResourceProvider.java | 2 +-
.../server/controller/internal/MemberResourceProvider.java | 4 ++++
.../internal/QuickLinkArtifactResourceProvider.java | 4 ++++
.../controller/internal/RecommendationResourceProvider.java | 4 ++++
.../server/controller/internal/RequestResourceProvider.java | 4 ++++
.../internal/RoleAuthorizationResourceProvider.java | 4 ++++
.../server/controller/internal/ServiceResourceProvider.java | 5 +++++
.../controller/internal/StackAdvisorResourceProvider.java | 4 ++++
.../controller/internal/StackArtifactResourceProvider.java | 5 +++++
.../server/controller/internal/StageResourceProvider.java | 4 ++++
.../server/controller/internal/TaskResourceProvider.java | 4 ++++
.../controller/internal/ThemeArtifactResourceProvider.java | 4 ++++
.../controller/internal/UpgradeItemResourceProvider.java | 4 ++++
.../server/controller/internal/UserResourceProvider.java | 4 ++++
.../controller/internal/ValidationResourceProvider.java | 4 ++++
.../internal/VersionDefinitionResourceProvider.java | 4 ++++
.../ambari/server/controller/jdbc/JDBCResourceProvider.java | 2 +-
.../ambari/server/controller/jmx/JMXPropertyProvider.java | 2 +-
.../controller/metrics/MetricsCollectorHAClusterState.java | 2 +-
.../server/controller/metrics/MetricsCollectorHAManager.java | 2 +-
.../server/controller/metrics/MetricsDownsamplingMethod.java | 2 +-
.../server/controller/metrics/MetricsPropertyProvider.java | 2 +-
.../controller/metrics/MetricsReportPropertyProvider.java | 2 +-
.../controller/metrics/RestMetricsPropertyProvider.java | 2 +-
.../metrics/ThreadPoolEnabledPropertyProvider.java | 4 ++++
.../controller/metrics/ganglia/GangliaPropertyProvider.java | 2 +-
.../metrics/ganglia/GangliaReportPropertyProvider.java | 2 +-
.../controller/metrics/timeline/AMSPropertyProvider.java | 3 +++
.../metrics/timeline/AMSReportPropertyProvider.java | 3 +++
.../ambari/server/controller/utilities/DatabaseChecker.java | 2 +-
.../utilities/state/DefaultServiceCalculatedState.java | 2 +-
.../utilities/state/FlumeServiceCalculatedState.java | 4 ++++
.../utilities/state/HBaseServiceCalculatedState.java | 4 ++++
.../utilities/state/HDFSServiceCalculatedState.java | 4 ++++
.../utilities/state/HiveServiceCalculatedState.java | 4 ++++
.../utilities/state/OozieServiceCalculatedState.java | 4 ++++
.../utilities/state/YARNServiceCalculatedState.java | 4 ++++
.../ldap/service/ads/DefaultLdapConnectionConfigService.java | 2 +-
.../server/orm/entities/RemoteAmbariClusterEntity.java | 2 +-
.../authorization/AmbariLdapAuthenticationProvider.java | 2 +-
.../server/security/encryption/CredentialProvider.java | 2 +-
.../serveraction/kerberos/KDCKerberosOperationHandler.java | 2 +-
.../server/state/services/MetricsRetrievalService.java | 2 +-
.../java/org/apache/ambari/server/state/stack/OsFamily.java | 2 +-
.../ambari/server/topology/ClusterConfigurationRequest.java | 2 +-
.../apache/ambari/server/topology/PersistedStateImpl.java | 2 +-
.../java/org/apache/ambari/server/utils/RetryHelper.java | 2 +-
.../apache/ambari/server/view/ViewDataMigrationUtility.java | 2 +-
.../java/org/apache/ambari/server/view/ViewExtractor.java | 2 +-
.../java/org/apache/ambari/server/view/ViewRegistry.java | 2 +-
.../apache/ambari/server/view/ViewSubResourceProvider.java | 4 ++++
.../apache/ambari/server/view/persistence/DataStoreImpl.java | 2 +-
83 files changed, 212 insertions(+), 56 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/api/handlers/BaseManagementHandler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/handlers/BaseManagementHandler.java b/ambari-server/src/main/java/org/apache/ambari/server/api/handlers/BaseManagementHandler.java
index d0bd5d3..1fa55eb 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/handlers/BaseManagementHandler.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/handlers/BaseManagementHandler.java
@@ -36,20 +36,12 @@ import org.apache.ambari.server.controller.spi.RequestStatus;
import org.apache.ambari.server.controller.spi.RequestStatusMetaData;
import org.apache.ambari.server.controller.spi.Resource;
import org.apache.ambari.server.controller.utilities.ClusterControllerHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* Base handler for operations that persist state to the back-end.
*/
public abstract class BaseManagementHandler implements RequestHandler {
- /**
- * Logger instance.
- */
- protected final static Logger LOG =
- LoggerFactory.getLogger(BaseManagementHandler.class);
-
public static final String RESOURCES_NODE_NAME = "resources";
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/api/handlers/CreateHandler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/handlers/CreateHandler.java b/ambari-server/src/main/java/org/apache/ambari/server/api/handlers/CreateHandler.java
index 549da76..b614c5e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/handlers/CreateHandler.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/handlers/CreateHandler.java
@@ -31,6 +31,8 @@ import org.apache.ambari.server.controller.spi.ResourceAlreadyExistsException;
import org.apache.ambari.server.controller.spi.SystemException;
import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
import org.apache.ambari.server.security.authorization.AuthorizationException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
@@ -38,6 +40,8 @@ import org.apache.ambari.server.security.authorization.AuthorizationException;
*/
public class CreateHandler extends BaseManagementHandler {
+ private final static Logger LOG = LoggerFactory.getLogger(CreateHandler.class);
+
@Override
protected Result persist(ResourceInstance resource, RequestBody body) {
Result result;
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/api/services/BaseService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/BaseService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/BaseService.java
index d24780b..17155a4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/BaseService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/BaseService.java
@@ -90,10 +90,7 @@ public abstract class BaseService {
static final String FIELDS_SEPARATOR = ", ";
- /**
- * Logger instance.
- */
- protected final static Logger LOG = LoggerFactory.getLogger(BaseService.class);
+ private final static Logger LOG = LoggerFactory.getLogger(BaseService.class);
/**
* Factory for creating resource instances.
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/api/services/LoggingService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/LoggingService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/LoggingService.java
index c86b9a0..e830d3b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/LoggingService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/LoggingService.java
@@ -51,6 +51,8 @@ import org.apache.ambari.server.security.authorization.RoleAuthorization;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.utils.RetryHelper;
import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.inject.Inject;
@@ -63,6 +65,8 @@ import com.google.inject.Inject;
*/
public class LoggingService extends BaseService {
+ private final static Logger LOG = LoggerFactory.getLogger(LoggingService.class);
+
/**
* The user of authorizations for which a user must have one of in order to access LogSearch data
*/
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommand.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommand.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommand.java
index 2dc45de..91edf86 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommand.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommand.java
@@ -71,7 +71,7 @@ public abstract class StackAdvisorCommand<T extends StackAdvisorResponse> extend
*/
private Class<T> type;
- protected static Logger LOG = LoggerFactory.getLogger(StackAdvisorCommand.class);
+ private static final Logger LOG = LoggerFactory.getLogger(StackAdvisorCommand.class);
private static final String GET_HOSTS_INFO_URI = "/api/v1/hosts"
+ "?fields=Hosts/*&Hosts/host_name.in(%s)";
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
index 34888f2..669ab81 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
@@ -81,7 +81,7 @@ import com.google.inject.persist.Transactional;
public class DatabaseConsistencyCheckHelper {
- static Logger LOG = LoggerFactory.getLogger(DatabaseConsistencyCheckHelper.class);
+ private static final Logger LOG = LoggerFactory.getLogger(DatabaseConsistencyCheckHelper.class);
@Inject
private static Injector injector;
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariHandlerList.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariHandlerList.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariHandlerList.java
index e134f6d..23c9dee 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariHandlerList.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariHandlerList.java
@@ -111,10 +111,7 @@ public class AmbariHandlerList extends HandlerCollection implements ViewInstance
*/
private final Collection<Handler> nonViewHandlers = new HashSet<>();
- /**
- * The logger.
- */
- protected final static Logger LOG = LoggerFactory.getLogger(AmbariHandlerList.class);
+ private static final Logger LOG = LoggerFactory.getLogger(AmbariHandlerList.class);
// ----- Constructors ------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractPropertyProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractPropertyProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractPropertyProvider.java
index 322596e..05b0eaa 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractPropertyProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractPropertyProvider.java
@@ -45,12 +45,16 @@ import org.apache.ambari.server.security.authorization.AuthorizationHelper;
import org.apache.ambari.server.security.authorization.ResourceType;
import org.apache.ambari.server.security.authorization.RoleAuthorization;
import org.apache.hadoop.metrics2.sink.timeline.TimelineMetric;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Abstract property provider implementation.
*/
public abstract class AbstractPropertyProvider extends BaseProvider implements PropertyProvider {
+ private static final Logger LOG = LoggerFactory.getLogger(AbstractPropertyProvider.class);
+
/**
* The property/metric information for this provider keyed by component name / property id.
*/
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java
index 1501a01..caa21bc 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java
@@ -267,7 +267,7 @@ public abstract class AbstractProviderModule implements ProviderModule,
private volatile boolean initialized = false;
- protected final static Logger LOG =
+ private static final Logger LOG =
LoggerFactory.getLogger(AbstractProviderModule.class);
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractResourceProvider.java
index 5598650..40e1b2d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractResourceProvider.java
@@ -68,7 +68,7 @@ public abstract class AbstractResourceProvider extends BaseProvider implements R
*/
private final Set<ResourceProviderObserver> observers = new HashSet<>();
- protected final static Logger LOG = LoggerFactory.getLogger(AbstractResourceProvider.class);
+ private static final Logger LOG = LoggerFactory.getLogger(AbstractResourceProvider.class);
protected final static String PROPERTIES_ATTRIBUTES_REGEX = "properties_attributes/[a-zA-Z][a-zA-Z._-]*$";
public static Pattern propertiesAttributesPattern = Pattern.compile(".*/" + PROPERTIES_ATTRIBUTES_REGEX);
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ActionResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ActionResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ActionResourceProvider.java
index 4e618e7..290931555 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ActionResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ActionResourceProvider.java
@@ -43,9 +43,13 @@ import org.apache.ambari.server.controller.spi.SystemException;
import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
import org.apache.ambari.server.controller.utilities.PropertyHelper;
import org.apache.ambari.server.customactions.ActionDefinition;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class ActionResourceProvider extends AbstractControllerResourceProvider {
+ private static final Logger LOG = LoggerFactory.getLogger(ActionResourceProvider.class);
+
public static final String ACTION_NAME_PROPERTY_ID = PropertyHelper
.getPropertyId("Actions", "action_name");
public static final String ACTION_TYPE_PROPERTY_ID = PropertyHelper
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertDefinitionResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertDefinitionResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertDefinitionResourceProvider.java
index 32f1fd8..9579dca 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertDefinitionResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertDefinitionResourceProvider.java
@@ -61,6 +61,8 @@ import org.apache.ambari.server.state.alert.Scope;
import org.apache.ambari.server.state.alert.SourceType;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.NumberUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
@@ -73,6 +75,8 @@ import com.google.inject.Inject;
@StaticallyInject
public class AlertDefinitionResourceProvider extends AbstractControllerResourceProvider {
+ private static final Logger LOG = LoggerFactory.getLogger(AlertDefinitionResourceProvider.class);
+
protected static final String ALERT_DEF = "AlertDefinition";
protected static final String ALERT_DEF_CLUSTER_NAME = "AlertDefinition/cluster_name";
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertGroupResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertGroupResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertGroupResourceProvider.java
index cf4e747..0898bc3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertGroupResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertGroupResourceProvider.java
@@ -49,6 +49,8 @@ import org.apache.ambari.server.security.authorization.AuthorizationException;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.alert.AlertTarget;
import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.inject.Inject;
@@ -61,6 +63,8 @@ import com.google.inject.Inject;
public class AlertGroupResourceProvider extends
AbstractControllerResourceProvider {
+ private static final Logger LOG = LoggerFactory.getLogger(AlertGroupResourceProvider.class);
+
public static final String ALERT_GROUP = "AlertGroup";
public static final String ALERT_GROUP_ID = "AlertGroup/id";
public static final String ALERT_GROUP_CLUSTER_NAME = "AlertGroup/cluster_name";
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertResourceProvider.java
index c71651e..4ab78b7 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertResourceProvider.java
@@ -50,6 +50,8 @@ import org.apache.ambari.server.state.Clusters;
import org.apache.ambari.server.state.ConfigHelper;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.NumberUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -61,6 +63,8 @@ import com.google.inject.Provider;
public class AlertResourceProvider extends ReadOnlyResourceProvider implements
ExtendedResourceProvider {
+ private static final Logger LOG = LoggerFactory.getLogger(AlertResourceProvider.class);
+
public static final String ALERT_ID = "Alert/id";
public static final String ALERT_STATE = "Alert/state";
public static final String ALERT_ORIGINAL_TIMESTAMP = "Alert/original_timestamp";
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertTargetResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertTargetResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertTargetResourceProvider.java
index 43ee7fe..c1e9eb4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertTargetResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertTargetResourceProvider.java
@@ -53,6 +53,8 @@ import org.apache.ambari.server.state.AlertState;
import org.apache.ambari.server.state.alert.AlertGroup;
import org.apache.ambari.server.state.alert.AlertTarget;
import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.gson.Gson;
import com.google.inject.Inject;
@@ -67,6 +69,8 @@ import com.google.inject.persist.Transactional;
public class AlertTargetResourceProvider extends
AbstractAuthorizedResourceProvider {
+ private static final Logger LOG = LoggerFactory.getLogger(AlertTargetResourceProvider.class);
+
public static final String ALERT_TARGET = "AlertTarget";
public static final String ALERT_TARGET_ID = "AlertTarget/id";
public static final String ALERT_TARGET_NAME = "AlertTarget/name";
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ArtifactResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ArtifactResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ArtifactResourceProvider.java
index c5c02cf..567cfa9 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ArtifactResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ArtifactResourceProvider.java
@@ -47,6 +47,8 @@ import org.apache.ambari.server.controller.utilities.PropertyHelper;
import org.apache.ambari.server.orm.dao.ArtifactDAO;
import org.apache.ambari.server.orm.entities.ArtifactEntity;
import org.apache.ambari.server.state.Cluster;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.gson.Gson;
import com.google.inject.Inject;
@@ -62,6 +64,8 @@ import com.google.inject.Inject;
@StaticallyInject
public class ArtifactResourceProvider extends AbstractResourceProvider {
+ private static final Logger LOG = LoggerFactory.getLogger(ArtifactResourceProvider.class);
+
public static final String RESPONSE_KEY = "Artifacts";
public static final String ARTIFACT_NAME = "artifact_name";
public static final String CLUSTER_NAME = "cluster_name";
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseProvider.java
index 135eefe..c9fee7d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseProvider.java
@@ -61,11 +61,7 @@ public abstract class BaseProvider {
*/
private final Map<String, Pattern> patterns;
- /**
- * The logger.
- */
- protected final static Logger LOG =
- LoggerFactory.getLogger(BaseProvider.class);
+ private static final Logger LOG = LoggerFactory.getLogger(BaseProvider.class);
/**
* The regex pattern that will match on all $1, $2.method(0), and
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
index 5a7cda0..5b75532 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
@@ -67,7 +67,7 @@ import com.google.common.collect.Sets;
*/
public class BlueprintConfigurationProcessor {
- protected final static Logger LOG = LoggerFactory.getLogger(BlueprintConfigurationProcessor.class);
+ private static final Logger LOG = LoggerFactory.getLogger(BlueprintConfigurationProcessor.class);
private final static String COMMAND_RETRY_ENABLED_PROPERTY_NAME = "command_retry_enabled";
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintResourceProvider.java
index 73d2490..67f5448 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintResourceProvider.java
@@ -60,6 +60,8 @@ import org.apache.ambari.server.topology.InvalidTopologyException;
import org.apache.ambari.server.topology.SecurityConfiguration;
import org.apache.ambari.server.topology.SecurityConfigurationFactory;
import org.apache.ambari.server.utils.SecretReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
@@ -71,6 +73,8 @@ import com.google.gson.Gson;
*/
public class BlueprintResourceProvider extends AbstractControllerResourceProvider {
+ private static final Logger LOG = LoggerFactory.getLogger(BlueprintResourceProvider.class);
+
// ----- Property ID constants ---------------------------------------------
// Blueprints
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
index 54c8360..b9b3b56 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
@@ -56,6 +56,8 @@ import org.apache.ambari.server.topology.SecurityConfiguration;
import org.apache.ambari.server.topology.SecurityConfigurationFactory;
import org.apache.ambari.server.topology.TopologyManager;
import org.apache.ambari.server.topology.TopologyRequestFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.security.core.Authentication;
import com.google.gson.Gson;
@@ -66,6 +68,8 @@ import com.google.gson.Gson;
*/
public class ClusterResourceProvider extends AbstractControllerResourceProvider {
+ private static final Logger LOG = LoggerFactory.getLogger(ClusterResourceProvider.class);
+
// ----- Property ID constants ---------------------------------------------
// Clusters
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
index 98adcd1..24e4d70 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
@@ -88,6 +88,8 @@ import org.apache.ambari.server.utils.StageUtils;
import org.apache.ambari.server.utils.VersionUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
@@ -103,6 +105,8 @@ import com.google.inject.persist.Transactional;
@StaticallyInject
public class ClusterStackVersionResourceProvider extends AbstractControllerResourceProvider {
+ private static final Logger LOG = LoggerFactory.getLogger(ClusterStackVersionResourceProvider.class);
+
// ----- Property ID constants ---------------------------------------------
protected static final String CLUSTER_STACK_VERSION_ID_PROPERTY_ID = PropertyHelper.getPropertyId("ClusterStackVersions", "id");
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CompatibleRepositoryVersionResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CompatibleRepositoryVersionResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CompatibleRepositoryVersionResourceProvider.java
index f05ffbe..fa963c6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CompatibleRepositoryVersionResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CompatibleRepositoryVersionResourceProvider.java
@@ -51,6 +51,8 @@ import org.apache.ambari.server.state.StackInfo;
import org.apache.ambari.server.state.repository.ManifestServiceInfo;
import org.apache.ambari.server.state.repository.VersionDefinitionXml;
import org.apache.ambari.server.state.stack.UpgradePack;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Sets;
@@ -64,6 +66,8 @@ import com.google.inject.Provider;
@StaticallyInject
public class CompatibleRepositoryVersionResourceProvider extends ReadOnlyResourceProvider {
+ private static final Logger LOG = LoggerFactory.getLogger(CompatibleRepositoryVersionResourceProvider.class);
+
// ----- Property ID constants ---------------------------------------------
public static final String REPOSITORY_VERSION_ID_PROPERTY_ID = "CompatibleRepositoryVersions/id";
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java
index 2e86b2d..482e5d2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java
@@ -62,6 +62,8 @@ import org.apache.ambari.server.state.StackId;
import org.apache.ambari.server.state.State;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.Validate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.common.collect.Sets;
import com.google.inject.assistedinject.Assisted;
@@ -73,6 +75,8 @@ import com.google.inject.persist.Transactional;
*/
public class ComponentResourceProvider extends AbstractControllerResourceProvider {
+ private static final Logger LOG = LoggerFactory.getLogger(ComponentResourceProvider.class);
+
// ----- Property ID constants ---------------------------------------------
// Components
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CredentialResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CredentialResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CredentialResourceProvider.java
index 79254c6..ebc7645 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CredentialResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CredentialResourceProvider.java
@@ -45,6 +45,8 @@ import org.apache.ambari.server.security.credential.PrincipalKeyCredential;
import org.apache.ambari.server.security.encryption.CredentialStoreService;
import org.apache.ambari.server.security.encryption.CredentialStoreType;
import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
@@ -56,6 +58,8 @@ import com.google.inject.assistedinject.AssistedInject;
@StaticallyInject
public class CredentialResourceProvider extends AbstractControllerResourceProvider {
+ private static final Logger LOG = LoggerFactory.getLogger(CredentialResourceProvider.class);
+
// ----- Property ID constants ---------------------------------------------
public static final String CREDENTIAL_CLUSTER_NAME_PROPERTY_ID = PropertyHelper.getPropertyId("Credential", "cluster_name");
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/GroupResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/GroupResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/GroupResourceProvider.java
index f051651..6cdd24e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/GroupResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/GroupResourceProvider.java
@@ -38,12 +38,16 @@ import org.apache.ambari.server.controller.spi.SystemException;
import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
import org.apache.ambari.server.controller.utilities.PropertyHelper;
import org.apache.ambari.server.security.authorization.RoleAuthorization;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Resource provider for group resources.
*/
public class GroupResourceProvider extends AbstractControllerResourceProvider {
+ private static final Logger LOG = LoggerFactory.getLogger(GroupResourceProvider.class);
+
// ----- Property ID constants ---------------------------------------------
// Groups
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
index 6708560..94766a5 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
@@ -66,6 +66,8 @@ import org.apache.ambari.server.state.svccomphost.ServiceComponentHostDisableEve
import org.apache.ambari.server.state.svccomphost.ServiceComponentHostRestoreEvent;
import org.apache.ambari.server.topology.Setting;
import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.inject.Inject;
import com.google.inject.Injector;
@@ -77,6 +79,8 @@ import com.google.inject.assistedinject.AssistedInject;
*/
public class HostComponentResourceProvider extends AbstractControllerResourceProvider {
+ private static final Logger LOG = LoggerFactory.getLogger(HostComponentResourceProvider.class);
+
// ----- Property ID constants ---------------------------------------------
// Host Components
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
index 5373ffe..2b18eb2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
@@ -85,6 +85,8 @@ import com.google.inject.persist.Transactional;
*/
public class HostResourceProvider extends AbstractControllerResourceProvider {
+ private static final Logger LOG = LoggerFactory.getLogger(HostResourceProvider.class);
+
// ----- Property ID constants ---------------------------------------------
// Hosts
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java
index b106209..62fb530 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java
@@ -65,6 +65,8 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.Validate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.common.collect.Sets;
import com.google.inject.Inject;
@@ -76,6 +78,8 @@ import com.google.inject.Provider;
@StaticallyInject
public class HostStackVersionResourceProvider extends AbstractControllerResourceProvider {
+ private static final Logger LOG = LoggerFactory.getLogger(HostStackVersionResourceProvider.class);
+
// ----- Property ID constants ---------------------------------------------
protected static final String HOST_STACK_VERSION_ID_PROPERTY_ID = PropertyHelper.getPropertyId("HostStackVersions", "id");
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStatusHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStatusHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStatusHelper.java
index f94b979..44d3110 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStatusHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStatusHelper.java
@@ -34,7 +34,7 @@ import org.slf4j.LoggerFactory;
public class HostStatusHelper {
- protected final static Logger LOG =
+ private static final Logger LOG =
LoggerFactory.getLogger(HostStatusHelper.class);
public static boolean isHostComponentLive(AmbariManagementController managementController,
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HttpPropertyProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HttpPropertyProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HttpPropertyProvider.java
index c556b06..cb7afcd 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HttpPropertyProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HttpPropertyProvider.java
@@ -43,7 +43,7 @@ import org.slf4j.LoggerFactory;
*/
public class HttpPropertyProvider extends BaseProvider implements PropertyProvider {
- protected final static Logger LOG = LoggerFactory.getLogger(HttpPropertyProvider.class);
+ private static final Logger LOG = LoggerFactory.getLogger(HttpPropertyProvider.class);
private final StreamProvider streamProvider;
private final String clusterNamePropertyId;
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/JsonHttpPropertyRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/JsonHttpPropertyRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/JsonHttpPropertyRequest.java
index 2e51e8c..7fea2ff 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/JsonHttpPropertyRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/JsonHttpPropertyRequest.java
@@ -37,7 +37,7 @@ import com.google.gson.reflect.TypeToken;
* instance.
*/
public abstract class JsonHttpPropertyRequest extends HttpPropertyProvider.HttpPropertyRequest {
- protected final static Logger LOG = LoggerFactory.getLogger(JsonHttpPropertyRequest.class);
+ private static final Logger LOG = LoggerFactory.getLogger(JsonHttpPropertyRequest.class);
private static final Type MAP_TYPE = new TypeToken<Map<String, Object>>() {}.getType();
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/LdapSyncEventResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/LdapSyncEventResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/LdapSyncEventResourceProvider.java
index 4badc9c..fc409a3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/LdapSyncEventResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/LdapSyncEventResourceProvider.java
@@ -155,7 +155,7 @@ public class LdapSyncEventResourceProvider extends AbstractControllerResourcePro
/**
* The logger.
*/
- protected final static Logger LOG = LoggerFactory.getLogger(LdapSyncEventResourceProvider.class);
+ private static final Logger LOG = LoggerFactory.getLogger(LdapSyncEventResourceProvider.class);
// ----- Constructors ------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/MemberResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/MemberResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/MemberResourceProvider.java
index d9d56ee..3cecddb 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/MemberResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/MemberResourceProvider.java
@@ -39,6 +39,8 @@ import org.apache.ambari.server.controller.spi.SystemException;
import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
import org.apache.ambari.server.controller.utilities.PropertyHelper;
import org.apache.ambari.server.security.authorization.RoleAuthorization;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.inject.assistedinject.Assisted;
import com.google.inject.assistedinject.AssistedInject;
@@ -49,6 +51,8 @@ import com.google.inject.persist.Transactional;
*/
public class MemberResourceProvider extends AbstractControllerResourceProvider {
+ private static final Logger LOG = LoggerFactory.getLogger(MemberResourceProvider.class);
+
// ----- Property ID constants ---------------------------------------------
// Members
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/QuickLinkArtifactResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/QuickLinkArtifactResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/QuickLinkArtifactResourceProvider.java
index 073ec60..f293941 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/QuickLinkArtifactResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/QuickLinkArtifactResourceProvider.java
@@ -44,9 +44,13 @@ import org.apache.ambari.server.state.StackInfo;
import org.apache.ambari.server.state.quicklinks.Link;
import org.apache.ambari.server.state.quicklinks.QuickLinks;
import org.apache.ambari.server.state.quicklinksprofile.QuickLinkVisibilityController;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class QuickLinkArtifactResourceProvider extends AbstractControllerResourceProvider {
+ private static final Logger LOG = LoggerFactory.getLogger(QuickLinkArtifactResourceProvider.class);
+
public static final String STACK_NAME_PROPERTY_ID = PropertyHelper.getPropertyId("QuickLinkInfo", "stack_name");
public static final String STACK_VERSION_PROPERTY_ID = PropertyHelper.getPropertyId("QuickLinkInfo", "stack_version");
public static final String STACK_SERVICE_NAME_PROPERTY_ID = PropertyHelper.getPropertyId("QuickLinkInfo", "service_name");
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RecommendationResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RecommendationResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RecommendationResourceProvider.java
index 70ed3dc..9c6259c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RecommendationResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RecommendationResourceProvider.java
@@ -43,9 +43,13 @@ import org.apache.ambari.server.controller.spi.ResourceAlreadyExistsException;
import org.apache.ambari.server.controller.spi.SystemException;
import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
import org.apache.ambari.server.controller.utilities.PropertyHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class RecommendationResourceProvider extends StackAdvisorResourceProvider {
+ private static final Logger LOG = LoggerFactory.getLogger(RecommendationResourceProvider.class);
+
protected static final String RECOMMENDATION_ID_PROPERTY_ID = PropertyHelper.getPropertyId(
"Recommendation", "id");
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestResourceProvider.java
index 81f283c..26e3b86 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RequestResourceProvider.java
@@ -71,6 +71,8 @@ import org.apache.ambari.server.topology.LogicalRequest;
import org.apache.ambari.server.topology.TopologyManager;
import org.apache.ambari.server.utils.SecretReference;
import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.common.collect.Sets;
import com.google.inject.Inject;
@@ -81,6 +83,8 @@ import com.google.inject.Inject;
@StaticallyInject
public class RequestResourceProvider extends AbstractControllerResourceProvider {
+ private static final Logger LOG = LoggerFactory.getLogger(RequestResourceProvider.class);
+
@Inject
private static RequestDAO s_requestDAO = null;
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RoleAuthorizationResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RoleAuthorizationResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RoleAuthorizationResourceProvider.java
index 78eb80e..8dbe2bf 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RoleAuthorizationResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RoleAuthorizationResourceProvider.java
@@ -42,6 +42,8 @@ import org.apache.ambari.server.orm.dao.RoleAuthorizationDAO;
import org.apache.ambari.server.orm.entities.PermissionEntity;
import org.apache.ambari.server.orm.entities.RoleAuthorizationEntity;
import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.inject.Inject;
@@ -51,6 +53,8 @@ import com.google.inject.Inject;
@StaticallyInject
public class RoleAuthorizationResourceProvider extends ReadOnlyResourceProvider {
+ private static final Logger LOG = LoggerFactory.getLogger(RoleAuthorizationResourceProvider.class);
+
// ----- Property ID constants ---------------------------------------------
public static final String AUTHORIZATION_ID_PROPERTY_ID = PropertyHelper.getPropertyId("AuthorizationInfo", "authorization_id");
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java
index e55a380..9b12f03 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java
@@ -78,6 +78,8 @@ import org.apache.ambari.server.state.State;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.Validate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
@@ -87,6 +89,9 @@ import com.google.inject.assistedinject.AssistedInject;
* Resource provider for service resources.
*/
public class ServiceResourceProvider extends AbstractControllerResourceProvider {
+
+ private static final Logger LOG = LoggerFactory.getLogger(ServiceResourceProvider.class);
+
public static final String SERVICE_CLUSTER_NAME_PROPERTY_ID = PropertyHelper.getPropertyId(
"ServiceInfo", "cluster_name");
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackAdvisorResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackAdvisorResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackAdvisorResourceProvider.java
index 7035f0a..1ea664c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackAdvisorResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackAdvisorResourceProvider.java
@@ -41,6 +41,8 @@ import org.apache.ambari.server.controller.spi.Request;
import org.apache.ambari.server.controller.spi.Resource.Type;
import org.apache.ambari.server.controller.utilities.PropertyHelper;
import org.apache.ambari.server.state.ChangedConfigInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.inject.Inject;
@@ -49,6 +51,8 @@ import com.google.inject.Inject;
*/
public abstract class StackAdvisorResourceProvider extends ReadOnlyResourceProvider {
+ private static final Logger LOG = LoggerFactory.getLogger(StackAdvisorResourceProvider.class);
+
protected static final String STACK_NAME_PROPERTY_ID = PropertyHelper.getPropertyId("Versions",
"stack_name");
protected static final String STACK_VERSION_PROPERTY_ID = PropertyHelper.getPropertyId(
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackArtifactResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackArtifactResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackArtifactResourceProvider.java
index 6bb421b..d042f86 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackArtifactResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackArtifactResourceProvider.java
@@ -56,6 +56,8 @@ import org.apache.ambari.server.state.stack.Metric;
import org.apache.ambari.server.state.stack.MetricDefinition;
import org.apache.ambari.server.state.stack.WidgetLayout;
import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
@@ -73,6 +75,9 @@ import com.google.inject.Inject;
*/
@StaticallyInject
public class StackArtifactResourceProvider extends AbstractControllerResourceProvider {
+
+ private static final Logger LOG = LoggerFactory.getLogger(StackArtifactResourceProvider.class);
+
/**
* stack name
*/
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java
index 6a326b5..c4251c1 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java
@@ -56,6 +56,8 @@ import org.apache.ambari.server.topology.TopologyManager;
import org.apache.ambari.server.utils.SecretReference;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.NumberUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.common.collect.Sets;
@@ -65,6 +67,8 @@ import com.google.common.collect.Sets;
@StaticallyInject
public class StageResourceProvider extends AbstractControllerResourceProvider implements ExtendedResourceProvider {
+ private static final Logger LOG = LoggerFactory.getLogger(StageResourceProvider.class);
+
/**
* Used for querying stage resources.
*/
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TaskResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TaskResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TaskResourceProvider.java
index 0b4fcd9..39419ec 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TaskResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TaskResourceProvider.java
@@ -44,6 +44,8 @@ import org.apache.ambari.server.orm.entities.HostRoleCommandEntity;
import org.apache.ambari.server.topology.TopologyManager;
import org.apache.ambari.server.utils.StageUtils;
import org.codehaus.jackson.map.ObjectMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.inject.Inject;
@@ -53,6 +55,8 @@ import com.google.inject.Inject;
@StaticallyInject
public class TaskResourceProvider extends AbstractControllerResourceProvider {
+ private static final Logger LOG = LoggerFactory.getLogger(TaskResourceProvider.class);
+
// ----- Property ID constants ---------------------------------------------
// Tasks
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ThemeArtifactResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ThemeArtifactResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ThemeArtifactResourceProvider.java
index fc7cfe7..affd969 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ThemeArtifactResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ThemeArtifactResourceProvider.java
@@ -41,9 +41,13 @@ import org.apache.ambari.server.controller.utilities.PropertyHelper;
import org.apache.ambari.server.state.ServiceInfo;
import org.apache.ambari.server.state.StackInfo;
import org.apache.ambari.server.state.ThemeInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class ThemeArtifactResourceProvider extends AbstractControllerResourceProvider {
+ private static final Logger LOG = LoggerFactory.getLogger(ThemeArtifactResourceProvider.class);
+
public static final String STACK_NAME_PROPERTY_ID = PropertyHelper.getPropertyId("ThemeInfo", "stack_name");
public static final String STACK_VERSION_PROPERTY_ID = PropertyHelper.getPropertyId("ThemeInfo", "stack_version");
public static final String STACK_SERVICE_NAME_PROPERTY_ID = PropertyHelper.getPropertyId("ThemeInfo", "service_name");
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeItemResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeItemResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeItemResourceProvider.java
index 36eb3be..93b3e46 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeItemResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeItemResourceProvider.java
@@ -57,6 +57,8 @@ import org.apache.ambari.server.security.authorization.RoleAuthorization;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.utils.SecretReference;
import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.inject.Inject;
@@ -66,6 +68,8 @@ import com.google.inject.Inject;
@StaticallyInject
public class UpgradeItemResourceProvider extends ReadOnlyResourceProvider {
+ private static final Logger LOG = LoggerFactory.getLogger(UpgradeItemResourceProvider.class);
+
public static final String UPGRADE_CLUSTER_NAME = "UpgradeItem/cluster_name";
public static final String UPGRADE_REQUEST_ID = "UpgradeItem/request_id";
public static final String UPGRADE_GROUP_ID = "UpgradeItem/group_id";
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserResourceProvider.java
index c5c36e9..698f419 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserResourceProvider.java
@@ -41,12 +41,16 @@ import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
import org.apache.ambari.server.controller.utilities.PropertyHelper;
import org.apache.ambari.server.security.authorization.AuthorizationException;
import org.apache.ambari.server.security.authorization.RoleAuthorization;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Resource provider for user resources.
*/
public class UserResourceProvider extends AbstractControllerResourceProvider implements ResourcePredicateEvaluator {
+ private static final Logger LOG = LoggerFactory.getLogger(UserResourceProvider.class);
+
// ----- Property ID constants ---------------------------------------------
// Users
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ValidationResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ValidationResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ValidationResourceProvider.java
index b78c64a..5448784 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ValidationResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ValidationResourceProvider.java
@@ -42,9 +42,13 @@ import org.apache.ambari.server.controller.spi.ResourceAlreadyExistsException;
import org.apache.ambari.server.controller.spi.SystemException;
import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
import org.apache.ambari.server.controller.utilities.PropertyHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class ValidationResourceProvider extends StackAdvisorResourceProvider {
+ private static final Logger LOG = LoggerFactory.getLogger(ValidationResourceProvider.class);
+
protected static final String VALIDATION_ID_PROPERTY_ID = PropertyHelper.getPropertyId(
"Validation", "id");
protected static final String VALIDATE_PROPERTY_ID = "validate";
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProvider.java
index f94ac32..b8c956f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProvider.java
@@ -71,6 +71,8 @@ import org.apache.commons.lang.math.NumberUtils;
import org.codehaus.jackson.node.ArrayNode;
import org.codehaus.jackson.node.JsonNodeFactory;
import org.codehaus.jackson.node.ObjectNode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.common.base.Function;
import com.google.common.collect.Collections2;
@@ -86,6 +88,8 @@ import com.google.inject.Provider;
@StaticallyInject
public class VersionDefinitionResourceProvider extends AbstractAuthorizedResourceProvider {
+ private static final Logger LOG = LoggerFactory.getLogger(VersionDefinitionResourceProvider.class);
+
public static final String VERSION_DEF = "VersionDefinition";
public static final String VERSION_DEF_BASE64_PROPERTY = "version_base64";
public static final String VERSION_DEF_STACK_NAME = "VersionDefinition/stack_name";
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/jdbc/JDBCResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/jdbc/JDBCResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/jdbc/JDBCResourceProvider.java
index ec5363b..8bcbce4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/jdbc/JDBCResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/jdbc/JDBCResourceProvider.java
@@ -70,7 +70,7 @@ public class JDBCResourceProvider extends BaseProvider implements ResourceProvid
*/
private final Map<String, Map<String, String>> importedKeys = new HashMap<>();
- protected final static Logger LOG =
+ private static final Logger LOG =
LoggerFactory.getLogger(JDBCResourceProvider.class);
public JDBCResourceProvider(ConnectionFactory connectionFactory,
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXPropertyProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXPropertyProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXPropertyProvider.java
index 832d9ae..c22f90e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXPropertyProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/jmx/JMXPropertyProvider.java
@@ -116,7 +116,7 @@ public class JMXPropertyProvider extends ThreadPoolEnabledPropertyProvider {
"/jmx?get=Hadoop:service=NameNode,name=FSNamesystem::tag.HAState"));
}
- protected final static Logger LOG =
+ private static final Logger LOG =
LoggerFactory.getLogger(JMXPropertyProvider.class);
private static final Pattern dotReplacementCharPattern =
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsCollectorHAClusterState.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsCollectorHAClusterState.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsCollectorHAClusterState.java
index 9ff40b4..231d103 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsCollectorHAClusterState.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsCollectorHAClusterState.java
@@ -47,7 +47,7 @@ public class MetricsCollectorHAClusterState {
@Inject
AmbariManagementController managementController;
- protected final static Logger LOG =
+ private static final Logger LOG =
LoggerFactory.getLogger(MetricsCollectorHAClusterState.class);
public MetricsCollectorHAClusterState(String clusterName) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsCollectorHAManager.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsCollectorHAManager.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsCollectorHAManager.java
index f107aab..d4b5dae 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsCollectorHAManager.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsCollectorHAManager.java
@@ -38,7 +38,7 @@ public class MetricsCollectorHAManager {
protected AmbariEventPublisher eventPublisher;
private Map<String, MetricsCollectorHAClusterState> clusterCollectorHAState;
- protected final static Logger LOG =
+ private static final Logger LOG =
LoggerFactory.getLogger(MetricsCollectorHAManager.class);
public MetricsCollectorHAManager() {
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsDownsamplingMethod.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsDownsamplingMethod.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsDownsamplingMethod.java
index 5994f16..8059560 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsDownsamplingMethod.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsDownsamplingMethod.java
@@ -26,7 +26,7 @@ public abstract class MetricsDownsamplingMethod {
// Allow for 2 minute discrepancy to account for client side buffering,
// this ensures at least some data is returned in the initial few minutes.
private static final long OUT_OF_BAND_TIME_ALLOWANCE = 120000;
- static Logger LOG = LoggerFactory.getLogger(MetricsDownsamplingMethod.class);
+ private static final Logger LOG = LoggerFactory.getLogger(MetricsDownsamplingMethod.class);
// Downsampling methods iterate over the entire metrics result to create output array.
// Passing down @TemporalInfo avoids re-iterating to filter out out of band data.
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsPropertyProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsPropertyProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsPropertyProvider.java
index 04f8c78..d5d4368 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsPropertyProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsPropertyProvider.java
@@ -36,7 +36,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public abstract class MetricsPropertyProvider extends AbstractPropertyProvider {
- protected final static Logger LOG =
+ private static final Logger LOG =
LoggerFactory.getLogger(MetricsPropertyProvider.class);
protected static final Pattern questionMarkPattern = Pattern.compile("\\?");
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsReportPropertyProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsReportPropertyProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsReportPropertyProvider.java
index a11bcc9..46bc26b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsReportPropertyProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/MetricsReportPropertyProvider.java
@@ -43,7 +43,7 @@ public abstract class MetricsReportPropertyProvider extends AbstractPropertyProv
// ----- Constants --------------------------------------------------------
- protected final static Logger LOG =
+ private static final Logger LOG =
LoggerFactory.getLogger(MetricsReportPropertyProvider.class);
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/RestMetricsPropertyProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/RestMetricsPropertyProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/RestMetricsPropertyProvider.java
index 7ab16da..e2f0906 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/RestMetricsPropertyProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/RestMetricsPropertyProvider.java
@@ -70,7 +70,7 @@ import com.google.inject.assistedinject.AssistedInject;
*/
public class RestMetricsPropertyProvider extends ThreadPoolEnabledPropertyProvider {
- protected final static Logger LOG =
+ private static final Logger LOG =
LoggerFactory.getLogger(RestMetricsPropertyProvider.class);
@Inject
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/ThreadPoolEnabledPropertyProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/ThreadPoolEnabledPropertyProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/ThreadPoolEnabledPropertyProvider.java
index a2f7248..d571dae 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/ThreadPoolEnabledPropertyProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/ThreadPoolEnabledPropertyProvider.java
@@ -41,6 +41,8 @@ import org.apache.ambari.server.controller.spi.Resource;
import org.apache.ambari.server.controller.spi.SystemException;
import org.apache.ambari.server.controller.utilities.BufferedThreadPoolExecutorCompletionService;
import org.apache.ambari.server.controller.utilities.ScalingThreadPoolExecutor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.common.base.Throwables;
import com.google.common.cache.Cache;
@@ -75,6 +77,8 @@ import com.google.inject.Inject;
*/
public abstract class ThreadPoolEnabledPropertyProvider extends AbstractPropertyProvider {
+ private static final Logger LOG = LoggerFactory.getLogger(ThreadPoolEnabledPropertyProvider.class);
+
protected static Configuration configuration;
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/ganglia/GangliaPropertyProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/ganglia/GangliaPropertyProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/ganglia/GangliaPropertyProvider.java
index ecfd400..ac0c590 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/ganglia/GangliaPropertyProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/ganglia/GangliaPropertyProvider.java
@@ -77,7 +77,7 @@ public abstract class GangliaPropertyProvider extends MetricsPropertyProvider {
GANGLIA_CLUSTER_NAME_MAP.put("SUPERVISOR", Collections.singletonList("HDPSupervisor"));
}
- protected final static Logger LOG =
+ private static final Logger LOG =
LoggerFactory.getLogger(GangliaPropertyProvider.class);
// ----- Constructors ------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/ganglia/GangliaReportPropertyProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/ganglia/GangliaReportPropertyProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/ganglia/GangliaReportPropertyProvider.java
index f15615b..02ea9f3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/ganglia/GangliaReportPropertyProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/ganglia/GangliaReportPropertyProvider.java
@@ -49,7 +49,7 @@ import org.slf4j.LoggerFactory;
public class GangliaReportPropertyProvider extends MetricsReportPropertyProvider {
// ----- Constants --------------------------------------------------------
- protected final static Logger LOG =
+ private static final Logger LOG =
LoggerFactory.getLogger(GangliaReportPropertyProvider.class);
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProvider.java
index cae330b..3d4ad2c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSPropertyProvider.java
@@ -66,10 +66,13 @@ import org.apache.commons.lang.StringUtils;
import org.apache.hadoop.metrics2.sink.timeline.TimelineMetric;
import org.apache.hadoop.metrics2.sink.timeline.TimelineMetrics;
import org.apache.http.client.utils.URIBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.common.collect.Sets;
public abstract class AMSPropertyProvider extends MetricsPropertyProvider {
+ private static final Logger LOG = LoggerFactory.getLogger(AMSPropertyProvider.class);
private static final String METRIC_REGEXP_PATTERN = "\\([^)]*\\)";
private static final int COLLECTOR_DEFAULT_PORT = 6188;
private final TimelineMetricCache metricCache;
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSReportPropertyProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSReportPropertyProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSReportPropertyProvider.java
index 74df3a7..d86a671 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSReportPropertyProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSReportPropertyProvider.java
@@ -51,8 +51,11 @@ import org.apache.ambari.server.events.publishers.AmbariEventPublisher;
import org.apache.hadoop.metrics2.sink.timeline.TimelineMetric;
import org.apache.hadoop.metrics2.sink.timeline.TimelineMetrics;
import org.apache.http.client.utils.URIBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class AMSReportPropertyProvider extends MetricsReportPropertyProvider {
+ private static final Logger LOG = LoggerFactory.getLogger(AMSReportPropertyProvider.class);
private MetricsPaddingMethod metricsPaddingMethod;
private final TimelineMetricCache metricCache;
MetricsRequestHelper requestHelper;
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/DatabaseChecker.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/DatabaseChecker.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/DatabaseChecker.java
index 95352bf..8643fc8 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/DatabaseChecker.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/DatabaseChecker.java
@@ -58,7 +58,7 @@ import com.google.inject.Injector;
* now we will use DatabaseConsistencyChecker*/
public class DatabaseChecker {
- static Logger LOG = LoggerFactory.getLogger(DatabaseChecker.class);
+ private static final Logger LOG = LoggerFactory.getLogger(DatabaseChecker.class);
@Inject
static Injector injector;
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/DefaultServiceCalculatedState.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/DefaultServiceCalculatedState.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/DefaultServiceCalculatedState.java
index 5e02a64..ab07a08 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/DefaultServiceCalculatedState.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/DefaultServiceCalculatedState.java
@@ -55,7 +55,7 @@ import com.google.inject.Provider;
@StaticallyInject
public class DefaultServiceCalculatedState implements ServiceCalculatedState {
- protected final static Logger LOG = LoggerFactory.getLogger(DefaultServiceCalculatedState.class);
+ private static final Logger LOG = LoggerFactory.getLogger(DefaultServiceCalculatedState.class);
@Inject
protected static Provider<Clusters> clustersProvider = null;
[40/50] [abbrv] ambari git commit: AMBARI-22418. Make Ambari
configuration API consistent with existing API. (rlevas)
Posted by rl...@apache.org.
AMBARI-22418. Make Ambari configuration API consistent with existing API. (rlevas)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3f2743b5
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3f2743b5
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3f2743b5
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 3f2743b58ba65c4bdc7d37df5348d17124bf305a
Parents: 2d81d49
Author: Robert Levas <rl...@hortonworks.com>
Authored: Wed Nov 15 12:11:34 2017 -0500
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Wed Nov 15 12:11:34 2017 -0500
----------------------------------------------------------------------
.../resources/ResourceInstanceFactoryImpl.java | 9 +-
.../RootServiceComponentResourceDefinition.java | 9 +-
.../AmbariConfigurationRequestSwagger.java | 37 --
.../AmbariConfigurationResponseSwagger.java | 40 --
.../services/AmbariConfigurationService.java | 193 --------
.../server/api/services/AmbariMetaInfo.java | 4 +-
...iceComponentConfigurationRequestSwagger.java | 43 ++
...ceComponentConfigurationResponseSwagger.java | 43 ++
...ootServiceComponentConfigurationService.java | 226 +++++++++
.../server/api/services/RootServiceService.java | 7 +
.../api/services/ldap/AmbariConfiguration.java | 6 +-
.../services/ldap/LdapConfigurationRequest.java | 2 +-
.../services/ldap/LdapConfigurationService.java | 6 +-
.../commands/StackAdvisorCommand.java | 62 ++-
.../server/controller/ControllerModule.java | 4 +-
.../controller/MaintenanceStateHelper.java | 3 +-
.../controller/ResourceProviderFactory.java | 4 +-
.../ambari/server/controller/RootComponent.java | 27 ++
.../ambari/server/controller/RootService.java | 36 ++
.../controller/RootServiceResponseFactory.java | 44 +-
.../AbstractControllerResourceProvider.java | 4 +-
.../AmbariConfigurationResourceProvider.java | 302 ------------
...eComponentConfigurationResourceProvider.java | 476 +++++++++++++++++++
.../RootServiceComponentPropertyProvider.java | 4 +-
.../RootServiceComponentResourceProvider.java | 4 +-
.../ambari/server/controller/spi/Resource.java | 6 +-
.../listeners/alerts/AlertReceivedListener.java | 10 +-
.../alerts/AlertStateChangedListener.java | 6 +-
.../ldap/domain/AmbariLdapConfiguration.java | 6 +-
.../domain/AmbariLdapConfigurationFactory.java | 2 +-
.../AmbariLdapConfigurationProvider.java | 6 +-
.../metadata/AmbariServiceAlertDefinitions.java | 20 +-
.../server/orm/dao/AlertDefinitionDAO.java | 7 +-
.../ambari/server/orm/dao/AlertDispatchDAO.java | 4 +-
.../server/state/alert/AlertDefinitionHash.java | 8 +-
.../server/state/cluster/ClusterImpl.java | 4 +-
.../services/AmbariServerAlertService.java | 4 +-
.../commands/StackAdvisorCommandTest.java | 8 +-
.../AmbariManagementControllerTest.java | 16 +-
.../RootServiceResponseFactoryTest.java | 27 +-
...AmbariConfigurationResourceProviderTest.java | 377 ---------------
...ponentConfigurationResourceProviderTest.java | 393 +++++++++++++++
...ootServiceComponentPropertyProviderTest.java | 15 +-
...ootServiceComponentResourceProviderTest.java | 9 +-
.../server/ldap/LdapModuleFunctionalTest.java | 4 +-
.../TestAmbariLdapConfigurationFactory.java | 2 +-
.../ldap/service/AmbariLdapFacadeTest.java | 4 +-
...efaultLdapAttributeDetectionServiceTest.java | 8 +-
.../DefaultLdapConfigurationServiceTest.java | 12 +-
.../metadata/AgentAlertDefinitionsTest.java | 6 +-
.../server/orm/dao/AlertDefinitionDAOTest.java | 7 +-
.../state/alerts/AlertReceivedListenerTest.java | 16 +-
.../alerts/AlertStateChangedEventTest.java | 4 +-
53 files changed, 1444 insertions(+), 1142 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ResourceInstanceFactoryImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ResourceInstanceFactoryImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ResourceInstanceFactoryImpl.java
index f5fb6e9..fecaedc 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ResourceInstanceFactoryImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ResourceInstanceFactoryImpl.java
@@ -237,6 +237,11 @@ public class ResourceInstanceFactoryImpl implements ResourceInstanceFactory {
resourceDefinition = new RootServiceComponentResourceDefinition();
break;
+ case RootServiceComponentConfiguration:
+ resourceDefinition = new SimpleResourceDefinition(Resource.Type.RootServiceComponentConfiguration,
+ "configuration", "configurations");
+ break;
+
case RootServiceHostComponent:
resourceDefinition = new RootServiceHostComponentResourceDefinition();
break;
@@ -471,10 +476,6 @@ public class ResourceInstanceFactoryImpl implements ResourceInstanceFactory {
case RemoteCluster:
resourceDefinition = new RemoteClusterResourceDefinition();
break;
- case AmbariConfiguration:
- resourceDefinition = new SimpleResourceDefinition(Resource.Type.AmbariConfiguration, "ambariconfiguration", "ambariconfigurations");
-
- break;
default:
throw new IllegalArgumentException("Unsupported resource type: " + type);
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/api/resources/RootServiceComponentResourceDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/RootServiceComponentResourceDefinition.java b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/RootServiceComponentResourceDefinition.java
index e8cb570..1c036e4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/RootServiceComponentResourceDefinition.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/RootServiceComponentResourceDefinition.java
@@ -19,6 +19,7 @@
package org.apache.ambari.server.api.resources;
import java.util.Collections;
+import java.util.HashSet;
import java.util.Set;
import org.apache.ambari.server.controller.spi.Resource;
@@ -44,10 +45,12 @@ public class RootServiceComponentResourceDefinition extends
public String getSingularName() {
return "component";
}
-
+
@Override
public Set<SubResourceDefinition> getSubResourceDefinitions() {
- return Collections.singleton(new SubResourceDefinition(
- Resource.Type.RootServiceHostComponent, Collections.singleton(Resource.Type.Host), true));
+ Set<SubResourceDefinition> definitions = new HashSet<>();
+ definitions.add(new SubResourceDefinition(Resource.Type.RootServiceHostComponent, Collections.singleton(Resource.Type.Host), true));
+ definitions.add(new SubResourceDefinition(Resource.Type.RootServiceComponentConfiguration));
+ return definitions;
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationRequestSwagger.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationRequestSwagger.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationRequestSwagger.java
deleted file mode 100644
index 2dca9f5..0000000
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationRequestSwagger.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed 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.
- */
-package org.apache.ambari.server.api.services;
-
-import java.util.Map;
-
-import org.apache.ambari.server.controller.ApiModel;
-
-import io.swagger.annotations.ApiModelProperty;
-
-/**
- * Request data model for {@link org.apache.ambari.server.api.services.AmbariConfigurationService}
- */
-public interface AmbariConfigurationRequestSwagger extends ApiModel {
-
- @ApiModelProperty(name = "AmbariConfiguration")
- AmbariConfigurationRequestInfo getAmbariConfiguration();
-
- interface AmbariConfigurationRequestInfo {
- @ApiModelProperty
- String getCategoryName();
-
- @ApiModelProperty
- Map<String, Object> getProperties();
- }
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationResponseSwagger.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationResponseSwagger.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationResponseSwagger.java
deleted file mode 100644
index c55ac1d..0000000
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationResponseSwagger.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed 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.
- */
-package org.apache.ambari.server.api.services;
-
-import java.util.Map;
-
-import org.apache.ambari.server.controller.ApiModel;
-
-import io.swagger.annotations.ApiModelProperty;
-
-/**
- * Response data model for {@link org.apache.ambari.server.api.services.AmbariConfigurationService}
- */
-public interface AmbariConfigurationResponseSwagger extends ApiModel {
-
- @ApiModelProperty(name = "AmbariConfiguration")
- AmbariConfigurationResponseInfo getAmbariConfigurationResponse();
-
- interface AmbariConfigurationResponseInfo {
- @ApiModelProperty
- Long getId();
-
- @ApiModelProperty
- Map<String, Object> getData();
-
- @ApiModelProperty
- String getType();
- }
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
deleted file mode 100644
index 86ed666..0000000
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Licensed 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.
- */
-
-package org.apache.ambari.server.api.services;
-
-import java.util.Collections;
-
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-
-import org.apache.ambari.server.controller.spi.Resource;
-import org.apache.http.HttpStatus;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
-
-/**
- * Rest endpoint for managing ambari configurations. Supports CRUD operations.
- * Ambari configurations are resources that relate to the ambari server instance even before a cluster is provisioned.
- *
- * Ambari configuration resources may be shared with components and services in the cluster
- * (by recommending them as default values)
- *
- * Eg. LDAP configuration is stored as AmbariConfiguration.
- * The request payload has the form:
- *
- * <pre>
- * {
- * "AmbariConfiguration": {
- * "category": "ldap-configuration",
- * "properties": {
- * "authentication.ldap.primaryUrl": "localhost:33389"
- * "authentication.ldap.secondaryUrl": "localhost:333"
- * "authentication.ldap.baseDn": "dc=ambari,dc=apache,dc=org"
- * // ......
- * }
- * }
- * }
- * </pre>
- */
-@Path("/ambariconfigs/")
-@Api(value = "Ambari Configurations", description = "Endpoint for Ambari configuration related operations")
-public class AmbariConfigurationService extends BaseService {
-
- private static final String AMBARI_CONFIGURATION_REQUEST_TYPE =
- "org.apache.ambari.server.api.services.AmbariConfigurationRequestSwagger";
-
- /**
- * Creates an ambari configuration resource.
- *
- * @param body the payload in json format
- * @param headers http headers
- * @param uri request uri information
- * @return
- */
- @POST
- @Produces(MediaType.TEXT_PLAIN)
- @ApiOperation(value = "Creates an ambari configuration resource",
- nickname = "AmbariConfigurationService#createAmbariConfiguration")
- @ApiImplicitParams({
- @ApiImplicitParam(dataType = AMBARI_CONFIGURATION_REQUEST_TYPE, paramType = PARAM_TYPE_BODY)
- })
- @ApiResponses({
- @ApiResponse(code = HttpStatus.SC_CREATED, message = MSG_SUCCESSFUL_OPERATION),
- @ApiResponse(code = HttpStatus.SC_ACCEPTED, message = MSG_REQUEST_ACCEPTED),
- @ApiResponse(code = HttpStatus.SC_BAD_REQUEST, message = MSG_INVALID_ARGUMENTS),
- @ApiResponse(code = HttpStatus.SC_CONFLICT, message = MSG_RESOURCE_ALREADY_EXISTS),
- @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = MSG_NOT_AUTHENTICATED),
- @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = MSG_PERMISSION_DENIED),
- @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR),
- })
- public Response createAmbariConfiguration(String body, @Context HttpHeaders headers, @Context UriInfo uri) {
- return handleRequest(headers, body, uri, Request.Type.POST, createResource(Resource.Type.AmbariConfiguration,
- Collections.emptyMap()));
- }
-
- @GET
- @Produces(MediaType.TEXT_PLAIN)
- @ApiOperation(value = "Retrieve all ambari configuration resources",
- nickname = "AmbariConfigurationService#getAmbariConfigurations",
- notes = "Returns all Ambari configurations.",
- response = AmbariConfigurationResponseSwagger.class,
- responseContainer = RESPONSE_CONTAINER_LIST)
- @ApiImplicitParams({
- @ApiImplicitParam(name = QUERY_FIELDS, value = QUERY_FILTER_DESCRIPTION,
- defaultValue = "AmbariConfiguration/properties, AmbariConfiguration/category",
- dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY),
- @ApiImplicitParam(name = QUERY_SORT, value = QUERY_SORT_DESCRIPTION,
- defaultValue = "AmbariConfiguration/category",
- dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY),
- @ApiImplicitParam(name = QUERY_PAGE_SIZE, value = QUERY_PAGE_SIZE_DESCRIPTION, defaultValue = DEFAULT_PAGE_SIZE, dataType = DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY),
- @ApiImplicitParam(name = QUERY_FROM, value = QUERY_FROM_DESCRIPTION, defaultValue = DEFAULT_FROM, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY),
- @ApiImplicitParam(name = QUERY_TO, value = QUERY_TO_DESCRIPTION, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY)
- })
- @ApiResponses(value = {
- @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION),
- @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR)
- })
- public Response getAmbariConfigurations(String body, @Context HttpHeaders headers, @Context UriInfo uri) {
- return handleRequest(headers, body, uri, Request.Type.GET, createResource(Resource.Type.AmbariConfiguration,
- Collections.emptyMap()));
- }
-
- @GET
- @Path("{category}")
- @Produces(MediaType.TEXT_PLAIN)
- @ApiOperation(value = "Retrieve the details of an ambari configuration resource",
- nickname = "AmbariConfigurationService#getAmbariConfiguration",
- response = AmbariConfigurationResponseSwagger.class)
- @ApiImplicitParams({
- @ApiImplicitParam(name = QUERY_FIELDS, value = QUERY_FILTER_DESCRIPTION, defaultValue = "AmbariConfiguration/*",
- dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY)
- })
- @ApiResponses(value = {
- @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION),
- @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND),
- @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR)
- })
- public Response getAmbariConfiguration(String body, @Context HttpHeaders headers, @Context UriInfo uri,
- @PathParam("category") String category) {
- return handleRequest(headers, body, uri, Request.Type.GET, createResource(Resource.Type.AmbariConfiguration,
- Collections.singletonMap(Resource.Type.AmbariConfiguration, category)));
- }
-
- @PUT
- @Path("{category}")
- @Produces(MediaType.TEXT_PLAIN)
- @ApiOperation(value = "Updates ambari configuration resources ",
- nickname = "AmbariConfigurationService#updateAmbariConfiguration")
- @ApiImplicitParams({
- @ApiImplicitParam(dataType = AMBARI_CONFIGURATION_REQUEST_TYPE, paramType = PARAM_TYPE_BODY),
- @ApiImplicitParam(name = QUERY_FIELDS, value = QUERY_FILTER_DESCRIPTION, defaultValue = "AmbariConfiguration/*",
- dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY)
- })
- @ApiResponses({
- @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION),
- @ApiResponse(code = HttpStatus.SC_ACCEPTED, message = MSG_REQUEST_ACCEPTED),
- @ApiResponse(code = HttpStatus.SC_BAD_REQUEST, message = MSG_INVALID_ARGUMENTS),
- @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND),
- @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = MSG_NOT_AUTHENTICATED),
- @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = MSG_PERMISSION_DENIED),
- @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR),
- })
- public Response updateAmbariConfiguration(String body, @Context HttpHeaders headers, @Context UriInfo uri,
- @PathParam("category") String category) {
- return handleRequest(headers, body, uri, Request.Type.PUT, createResource(Resource.Type.AmbariConfiguration,
- Collections.singletonMap(Resource.Type.AmbariConfiguration, category)));
- }
-
- @DELETE
- @Path("{category}")
- @Produces(MediaType.TEXT_PLAIN)
- @ApiOperation(value = "Deletes an ambari configuration resource",
- nickname = "AmbariConfigurationService#deleteAmbariConfiguration")
- @ApiResponses({
- @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION),
- @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND),
- @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = MSG_NOT_AUTHENTICATED),
- @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = MSG_PERMISSION_DENIED),
- @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR),
- })
- public Response deleteAmbariConfiguration(String body, @Context HttpHeaders headers, @Context UriInfo uri,
- @PathParam("category") String category) {
- return handleRequest(headers, body, uri, Request.Type.DELETE, createResource(Resource.Type.AmbariConfiguration,
- Collections.singletonMap(Resource.Type.AmbariConfiguration, category)));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
index 46ee65a..b1eba8f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
@@ -43,7 +43,7 @@ import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.ParentObjectNotFoundException;
import org.apache.ambari.server.StackAccessException;
import org.apache.ambari.server.configuration.Configuration;
-import org.apache.ambari.server.controller.RootServiceResponseFactory.Services;
+import org.apache.ambari.server.controller.RootService;
import org.apache.ambari.server.controller.utilities.PropertyHelper;
import org.apache.ambari.server.customactions.ActionDefinition;
import org.apache.ambari.server.customactions.ActionDefinitionManager;
@@ -1179,7 +1179,7 @@ public class AmbariMetaInfo {
String componentName = definition.getComponentName();
// the AMBARI service is special, skip it here
- if (Services.AMBARI.name().equals(serviceName)) {
+ if (RootService.AMBARI.name().equals(serviceName)) {
continue;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/api/services/RootServiceComponentConfigurationRequestSwagger.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/RootServiceComponentConfigurationRequestSwagger.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/RootServiceComponentConfigurationRequestSwagger.java
new file mode 100644
index 0000000..dffa125
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/RootServiceComponentConfigurationRequestSwagger.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed 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.
+ */
+package org.apache.ambari.server.api.services;
+
+import java.util.Map;
+
+import org.apache.ambari.server.controller.ApiModel;
+
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * Request data model for {@link org.apache.ambari.server.api.services.RootServiceComponentConfigurationService}
+ */
+public interface RootServiceComponentConfigurationRequestSwagger extends ApiModel {
+
+ @ApiModelProperty(name = "Configuration")
+ RootServiceComponentConfigurationRequestInfo getRootServiceComponentConfigurationRequestInfo();
+
+ interface RootServiceComponentConfigurationRequestInfo {
+ @ApiModelProperty
+ String getServiceName();
+
+ @ApiModelProperty
+ String getComponentName();
+
+ @ApiModelProperty
+ String getCategoryName();
+
+ @ApiModelProperty
+ Map<String, String> getProperties();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/api/services/RootServiceComponentConfigurationResponseSwagger.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/RootServiceComponentConfigurationResponseSwagger.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/RootServiceComponentConfigurationResponseSwagger.java
new file mode 100644
index 0000000..fb3c09d
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/RootServiceComponentConfigurationResponseSwagger.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed 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.
+ */
+package org.apache.ambari.server.api.services;
+
+import java.util.Map;
+
+import org.apache.ambari.server.controller.ApiModel;
+
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * Response data model for {@link org.apache.ambari.server.api.services.RootServiceComponentConfigurationService}
+ */
+public interface RootServiceComponentConfigurationResponseSwagger extends ApiModel {
+
+ @ApiModelProperty(name = "Configuration")
+ RootServiceComponentConfigurationResponseInfo getRootServiceComponentConfigurationResponseInfo();
+
+ interface RootServiceComponentConfigurationResponseInfo {
+ @ApiModelProperty
+ String getServiceName();
+
+ @ApiModelProperty
+ String getComponentName();
+
+ @ApiModelProperty
+ String getCategoryName();
+
+ @ApiModelProperty
+ Map<String, Object> getProperties();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/api/services/RootServiceComponentConfigurationService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/RootServiceComponentConfigurationService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/RootServiceComponentConfigurationService.java
new file mode 100644
index 0000000..c7c37a6
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/RootServiceComponentConfigurationService.java
@@ -0,0 +1,226 @@
+/*
+ * 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.
+ */
+
+/*
+ * Licensed 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.
+ */
+
+package org.apache.ambari.server.api.services;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.http.HttpStatus;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+
+/**
+ * Rest endpoint for managing ambari root service component configurations. Supports CRUD operations.
+ * Ambari configurations are resources that relate to the ambari server instance even before a cluster is provisioned.
+ * <p>
+ * Ambari configuration resources may be shared with components and services in the cluster
+ * (by recommending them as default values)
+ * <p>
+ * Eg. LDAP configuration is stored as Configuration.
+ * The request payload has the form:
+ * <p>
+ * <pre>
+ * {
+ * "Configuration": {
+ * "service_name": "AMBARI",
+ * "component_name": "AMBARI_SERVER",
+ * "category": "ldap-configuration",
+ * "properties": {
+ * "authentication.ldap.primaryUrl": "localhost:33389"
+ * "authentication.ldap.secondaryUrl": "localhost:333"
+ * "authentication.ldap.baseDn": "dc=ambari,dc=apache,dc=org"
+ * // ......
+ * }
+ * }
+ * }
+ * </pre>
+ */
+@Api(value = "Root Service Configurations", description = "Endpoint for Ambari root service component configuration related operations")
+public class RootServiceComponentConfigurationService extends BaseService {
+
+ private static final String REQUEST_TYPE =
+ "org.apache.ambari.server.api.services.RootServiceComponentConfigurationRequestSwagger";
+
+ private final String serviceName;
+ private final String componentName;
+
+ public RootServiceComponentConfigurationService(String serviceName, String componentName) {
+ this.serviceName = serviceName;
+ this.componentName = componentName;
+ }
+
+ /**
+ * Creates a root service component configuration resource.
+ *
+ * @param body the payload in json format
+ * @param headers http headers
+ * @param uri request uri information
+ * @return
+ */
+ @POST
+ @Produces(MediaType.TEXT_PLAIN)
+ @ApiOperation(value = "Creates a root service component configuration resource",
+ nickname = "RootServiceComponentConfigurationService#createConfiguration")
+ @ApiImplicitParams({
+ @ApiImplicitParam(dataType = REQUEST_TYPE, paramType = PARAM_TYPE_BODY)
+ })
+ @ApiResponses({
+ @ApiResponse(code = HttpStatus.SC_CREATED, message = MSG_SUCCESSFUL_OPERATION),
+ @ApiResponse(code = HttpStatus.SC_ACCEPTED, message = MSG_REQUEST_ACCEPTED),
+ @ApiResponse(code = HttpStatus.SC_BAD_REQUEST, message = MSG_INVALID_ARGUMENTS),
+ @ApiResponse(code = HttpStatus.SC_CONFLICT, message = MSG_RESOURCE_ALREADY_EXISTS),
+ @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = MSG_NOT_AUTHENTICATED),
+ @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = MSG_PERMISSION_DENIED),
+ @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR),
+ })
+ public Response createConfiguration(String body, @Context HttpHeaders headers, @Context UriInfo uri) {
+ return handleRequest(headers, body, uri, Request.Type.POST, createResource(null));
+ }
+
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ @ApiOperation(value = "Retrieve all root service component configuration resources",
+ nickname = "RootServiceComponentConfigurationService#getConfigurations",
+ notes = "Returns all root service component configurations.",
+ response = RootServiceComponentConfigurationResponseSwagger.class,
+ responseContainer = RESPONSE_CONTAINER_LIST)
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = QUERY_FIELDS, value = QUERY_FILTER_DESCRIPTION,
+ defaultValue = "Configuration/properties, Configuration/category, Configuration/component_name, Configuration/service_name",
+ dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY),
+ @ApiImplicitParam(name = QUERY_SORT, value = QUERY_SORT_DESCRIPTION,
+ defaultValue = "Configuration/category",
+ dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY),
+ @ApiImplicitParam(name = QUERY_PAGE_SIZE, value = QUERY_PAGE_SIZE_DESCRIPTION, defaultValue = DEFAULT_PAGE_SIZE, dataType = DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY),
+ @ApiImplicitParam(name = QUERY_FROM, value = QUERY_FROM_DESCRIPTION, defaultValue = DEFAULT_FROM, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY),
+ @ApiImplicitParam(name = QUERY_TO, value = QUERY_TO_DESCRIPTION, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY)
+ })
+ @ApiResponses(value = {
+ @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION),
+ @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR)
+ })
+ public Response getConfigurations(String body, @Context HttpHeaders headers, @Context UriInfo uri) {
+ return handleRequest(headers, body, uri, Request.Type.GET, createResource(null));
+ }
+
+ @GET
+ @Path("{category}")
+ @Produces(MediaType.TEXT_PLAIN)
+ @ApiOperation(value = "Retrieve the details of a root service component configuration resource",
+ nickname = "RootServiceComponentConfigurationService#getConfiguration",
+ response = RootServiceComponentConfigurationResponseSwagger.class)
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = QUERY_FIELDS, value = QUERY_FILTER_DESCRIPTION, defaultValue = "Configuration/*",
+ dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY)
+ })
+ @ApiResponses(value = {
+ @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION),
+ @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND),
+ @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR)
+ })
+ public Response getConfiguration(String body, @Context HttpHeaders headers, @Context UriInfo uri,
+ @PathParam("category") String category) {
+ return handleRequest(headers, body, uri, Request.Type.GET, createResource(category));
+ }
+
+ @PUT
+ @Path("{category}")
+ @Produces(MediaType.TEXT_PLAIN)
+ @ApiOperation(value = "Updates root service component configuration resources ",
+ nickname = "RootServiceComponentConfigurationService#updateConfiguration")
+ @ApiImplicitParams({
+ @ApiImplicitParam(dataType = REQUEST_TYPE, paramType = PARAM_TYPE_BODY),
+ @ApiImplicitParam(name = QUERY_FIELDS, value = QUERY_FILTER_DESCRIPTION, defaultValue = "Configuration/*",
+ dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY)
+ })
+ @ApiResponses({
+ @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION),
+ @ApiResponse(code = HttpStatus.SC_ACCEPTED, message = MSG_REQUEST_ACCEPTED),
+ @ApiResponse(code = HttpStatus.SC_BAD_REQUEST, message = MSG_INVALID_ARGUMENTS),
+ @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND),
+ @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = MSG_NOT_AUTHENTICATED),
+ @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = MSG_PERMISSION_DENIED),
+ @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR),
+ })
+ public Response updateConfiguration(String body, @Context HttpHeaders headers, @Context UriInfo uri,
+ @PathParam("category") String category) {
+ return handleRequest(headers, body, uri, Request.Type.PUT, createResource(category));
+ }
+
+ @DELETE
+ @Path("{category}")
+ @Produces(MediaType.TEXT_PLAIN)
+ @ApiOperation(value = "Deletes a root service component configuration resource",
+ nickname = "RootServiceComponentConfigurationService#deleteConfiguration")
+ @ApiResponses({
+ @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION),
+ @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND),
+ @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = MSG_NOT_AUTHENTICATED),
+ @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = MSG_PERMISSION_DENIED),
+ @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR),
+ })
+ public Response deleteConfiguration(String body, @Context HttpHeaders headers, @Context UriInfo uri,
+ @PathParam("category") String category) {
+ return handleRequest(headers, body, uri, Request.Type.DELETE, createResource(category));
+ }
+
+ ResourceInstance createResource(String categoryName) {
+ Map<Resource.Type, String> mapIds = new HashMap<>();
+ mapIds.put(Resource.Type.RootService, serviceName);
+ mapIds.put(Resource.Type.RootServiceComponent, componentName);
+ mapIds.put(Resource.Type.RootServiceComponentConfiguration, categoryName);
+
+ return createResource(Resource.Type.RootServiceComponentConfiguration, mapIds);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/api/services/RootServiceService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/RootServiceService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/RootServiceService.java
index 5afb7dc..1ab2797 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/RootServiceService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/RootServiceService.java
@@ -297,6 +297,13 @@ public class RootServiceService extends BaseService {
return handleRequest(headers, body, ui, Request.Type.GET, resource);
}
+ @Path("{serviceName}/components/{componentName}/configurations")
+ public RootServiceComponentConfigurationService getAmbariServerConfigurationHandler(@Context javax.ws.rs.core.Request request,
+ @PathParam("serviceName") String serviceName,
+ @PathParam("componentName") String componentName) {
+ return new RootServiceComponentConfigurationService(serviceName, componentName);
+ }
+
protected ResourceInstance createServiceResource(String serviceName) {
Map<Resource.Type, String> mapIds = Collections.singletonMap(Resource.Type.RootService, serviceName);
return createResource(Resource.Type.RootService, mapIds);
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/AmbariConfiguration.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/AmbariConfiguration.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/AmbariConfiguration.java
index e9f0b1e..7bac65e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/AmbariConfiguration.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/AmbariConfiguration.java
@@ -26,7 +26,7 @@ public class AmbariConfiguration {
*/
private String type;
- private Map<String, Object> properties = null;
+ private Map<String, String> properties = null;
public String getType() {
return type;
@@ -36,11 +36,11 @@ public class AmbariConfiguration {
this.type = type;
}
- public Map<String, Object> getProperties() {
+ public Map<String, String> getProperties() {
return properties;
}
- public void setProperties(Map<String, Object> data) {
+ public void setProperties(Map<String, String> data) {
this.properties = data;
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationRequest.java
index 2e478c4..0e065e5 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationRequest.java
@@ -22,7 +22,7 @@ import com.google.gson.annotations.SerializedName;
*/
public class LdapConfigurationRequest {
- @SerializedName("AmbariConfiguration")
+ @SerializedName("Configuration")
private AmbariConfiguration ambariConfiguration;
@SerializedName("RequestInfo")
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
index 00c13f6..22784cd 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
@@ -40,7 +40,7 @@ import javax.ws.rs.core.Response;
import org.apache.ambari.annotations.ApiIgnore;
import org.apache.ambari.server.StaticallyInject;
-import org.apache.ambari.server.api.services.AmbariConfigurationService;
+import org.apache.ambari.server.api.services.BaseService;
import org.apache.ambari.server.api.services.Result;
import org.apache.ambari.server.api.services.ResultImpl;
import org.apache.ambari.server.api.services.ResultStatus;
@@ -64,7 +64,7 @@ import com.google.common.collect.Sets;
*/
@StaticallyInject
@Path("/ldapconfigs/")
-public class LdapConfigurationService extends AmbariConfigurationService {
+public class LdapConfigurationService extends BaseService {
private static final Logger LOGGER = LoggerFactory.getLogger(LdapConfigurationService.class);
@@ -133,7 +133,7 @@ public class LdapConfigurationService extends AmbariConfigurationService {
}
private void setResult(Set<String> groups, Result result) {
- Resource resource = new ResourceImpl(Resource.Type.AmbariConfiguration);
+ Resource resource = new ResourceImpl(Resource.Type.RootServiceComponentConfiguration);
resource.setProperty("groups", groups);
result.getResultTree().addChild(resource, "payload");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommand.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommand.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommand.java
index 91edf86..17591ec 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommand.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommand.java
@@ -45,6 +45,8 @@ import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorException;
import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorRequest;
import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorResponse;
import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorRunner;
+import org.apache.ambari.server.controller.RootComponent;
+import org.apache.ambari.server.controller.RootService;
import org.apache.ambari.server.controller.spi.Resource;
import org.apache.ambari.server.state.ServiceInfo;
import org.apache.ambari.server.utils.DateUtils;
@@ -84,7 +86,9 @@ public abstract class StackAdvisorCommand<T extends StackAdvisorResponse> extend
+ ",services/configurations/dependencies/StackConfigurationDependency/dependency_name"
+ ",services/configurations/dependencies/StackConfigurationDependency/dependency_type,services/configurations/StackConfigurations/type"
+ "&services/StackServices/service_name.in(%s)";
- private static final String GET_LDAP_CONFIG_URI = "/api/v1/configurations?AmbariConfiguration/type=ldap&fields=AmbariConfiguration/*";
+ private static final String GET_AMBARI_LDAP_CONFIG_URI = "/api/v1/services/AMBARI/components/AMBARI_SERVER/configurations" +
+ "?Configuration/category=ldap-configuration" +
+ "&fields=Configuration/properties";
private static final String SERVICES_PROPERTY = "services";
private static final String SERVICES_COMPONENTS_PROPERTY = "components";
private static final String CONFIG_GROUPS_PROPERTY = "config-groups";
@@ -96,7 +100,7 @@ public abstract class StackAdvisorCommand<T extends StackAdvisorResponse> extend
private static final String CHANGED_CONFIGURATIONS_PROPERTY = "changed-configurations";
private static final String USER_CONTEXT_PROPERTY = "user-context";
private static final String AMBARI_SERVER_CONFIGURATIONS_PROPERTY = "ambari-server-properties";
- protected static final String LDAP_CONFIGURATION_PROPERTY = "ldap-configuration";
+ static final String LDAP_CONFIGURATION_PROPERTY = "ldap-configuration";
private File recommendationsDir;
private String recommendationsArtifactsLifetime;
@@ -176,17 +180,18 @@ public abstract class StackAdvisorCommand<T extends StackAdvisorResponse> extend
/**
* Retrieves the LDAP configuration if exists and adds it to services.json
+ *
* @param root The JSON document that will become service.json when passed to the stack advisor engine
* @throws StackAdvisorException
* @throws IOException
*/
- protected void populateLdapConfiguration(ObjectNode root) throws StackAdvisorException, IOException {
- Response response = handleRequest(null, null, new LocalUriInfo(GET_LDAP_CONFIG_URI), Request.Type.GET,
+ void populateLdapConfiguration(ObjectNode root) throws StackAdvisorException, IOException {
+ Response response = handleRequest(null, null, new LocalUriInfo(GET_AMBARI_LDAP_CONFIG_URI), Request.Type.GET,
createConfigResource());
if (response.getStatus() != Status.OK.getStatusCode()) {
String message = String.format(
- "Error occured during retrieving ldap configuration, status=%s, response=%s",
+ "Error occurred during retrieving ldap configuration, status=%s, response=%s",
response.getStatus(), (String) response.getEntity());
LOG.warn(message);
throw new StackAdvisorException(message);
@@ -198,25 +203,28 @@ public abstract class StackAdvisorCommand<T extends StackAdvisorResponse> extend
}
JsonNode ldapConfigRoot = mapper.readTree(ldapConfigJSON);
- ArrayNode ldapConfigs = ((ArrayNode)ldapConfigRoot.get("items"));
+ ArrayNode ldapConfigs = ((ArrayNode) ldapConfigRoot.get("items"));
int numConfigs = ldapConfigs.size();
- // Zero or one config may exist
- switch (numConfigs) {
- case 0:
- LOG.debug("No LDAP config is stored in the DB");
- break;
- case 1:
- ArrayNode ldapConfigData = (ArrayNode)ldapConfigs.get(0).get("AmbariConfiguration").get("data");
- if (ldapConfigData.size() == 0) {
- throw new StackAdvisorException("No configuration data for LDAP configuration.");
- }
- if (ldapConfigData.size() > 1) {
- throw new StackAdvisorException("Ambigous configuration data for LDAP configuration.");
- }
- root.put(LDAP_CONFIGURATION_PROPERTY, ldapConfigData.get(0));
- break;
- default:
- throw new StackAdvisorException(String.format("Multiple (%s) LDAP configs are found in the DB.", numConfigs));
+
+ if (numConfigs == 1) {
+ JsonNode ldapConfigItem = ldapConfigs.get(0);
+ if (ldapConfigItem == null) {
+ throw new StackAdvisorException("Unexpected JSON document encountered: missing data");
+ }
+
+ JsonNode ldapConfiguration = ldapConfigItem.get("Configuration");
+ if (ldapConfiguration == null) {
+ throw new StackAdvisorException("Unexpected JSON document encountered: missing the Configuration object");
+ }
+
+ JsonNode ldapConfigurationProperties = ldapConfiguration.get("properties");
+ if (ldapConfigurationProperties == null) {
+ throw new StackAdvisorException("Unexpected JSON document encountered: missing the Configuration/properties object");
+ }
+
+ root.put(LDAP_CONFIGURATION_PROPERTY, ldapConfigurationProperties);
+ } else if (numConfigs > 1) {
+ throw new StackAdvisorException(String.format("Multiple (%s) LDAP configs are found in the DB.", numConfigs));
}
}
@@ -486,8 +494,12 @@ public abstract class StackAdvisorCommand<T extends StackAdvisorResponse> extend
return createResource(Resource.Type.Host, mapIds);
}
- protected ResourceInstance createConfigResource() {
- return createResource(Resource.Type.AmbariConfiguration, new HashMap<>());
+ private ResourceInstance createConfigResource() {
+ Map<Resource.Type, String> mapIds = new HashMap<>();
+ mapIds.put(Resource.Type.RootService, RootService.AMBARI.name());
+ mapIds.put(Resource.Type.RootServiceComponent, RootComponent.AMBARI_SERVER.name());
+
+ return createResource(Resource.Type.RootServiceComponentConfiguration, mapIds);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java
index 1425e1b..ed7513f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java
@@ -63,7 +63,6 @@ import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.configuration.Configuration.ConnectionPoolType;
import org.apache.ambari.server.configuration.Configuration.DatabaseType;
import org.apache.ambari.server.controller.internal.AlertTargetResourceProvider;
-import org.apache.ambari.server.controller.internal.AmbariConfigurationResourceProvider;
import org.apache.ambari.server.controller.internal.ClusterStackVersionResourceProvider;
import org.apache.ambari.server.controller.internal.ComponentResourceProvider;
import org.apache.ambari.server.controller.internal.CredentialResourceProvider;
@@ -73,6 +72,7 @@ import org.apache.ambari.server.controller.internal.HostResourceProvider;
import org.apache.ambari.server.controller.internal.KerberosDescriptorResourceProvider;
import org.apache.ambari.server.controller.internal.MemberResourceProvider;
import org.apache.ambari.server.controller.internal.RepositoryVersionResourceProvider;
+import org.apache.ambari.server.controller.internal.RootServiceComponentConfigurationResourceProvider;
import org.apache.ambari.server.controller.internal.ServiceResourceProvider;
import org.apache.ambari.server.controller.internal.UpgradeResourceProvider;
import org.apache.ambari.server.controller.internal.ViewInstanceResourceProvider;
@@ -471,10 +471,10 @@ public class ControllerModule extends AbstractModule {
.implement(ResourceProvider.class, Names.named("credential"), CredentialResourceProvider.class)
.implement(ResourceProvider.class, Names.named("kerberosDescriptor"), KerberosDescriptorResourceProvider.class)
.implement(ResourceProvider.class, Names.named("upgrade"), UpgradeResourceProvider.class)
- .implement(ResourceProvider.class, Names.named("ambariConfiguration"), AmbariConfigurationResourceProvider.class)
.implement(ResourceProvider.class, Names.named("clusterStackVersion"), ClusterStackVersionResourceProvider.class)
.implement(ResourceProvider.class, Names.named("alertTarget"), AlertTargetResourceProvider.class)
.implement(ResourceProvider.class, Names.named("viewInstance"), ViewInstanceResourceProvider.class)
+ .implement(ResourceProvider.class, Names.named("rootServiceHostComponentConfiguration"), RootServiceComponentConfigurationResourceProvider.class)
.build(ResourceProviderFactory.class));
install(new FactoryModuleBuilder().implement(
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/controller/MaintenanceStateHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/MaintenanceStateHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/MaintenanceStateHelper.java
index d9a585f..1ffe841 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/MaintenanceStateHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/MaintenanceStateHelper.java
@@ -24,7 +24,6 @@ import java.util.Set;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.HostNotFoundException;
-import org.apache.ambari.server.controller.RootServiceResponseFactory.Services;
import org.apache.ambari.server.controller.internal.RequestOperationLevel;
import org.apache.ambari.server.controller.internal.RequestResourceFilter;
import org.apache.ambari.server.controller.spi.Resource;
@@ -265,7 +264,7 @@ public class MaintenanceStateHelper {
}
// the AMBARI service is not a real service; it's never in MM
- if( StringUtils.equals(Services.AMBARI.name(), serviceName)){
+ if( StringUtils.equals(RootService.AMBARI.name(), serviceName)){
return MaintenanceState.OFF;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/controller/ResourceProviderFactory.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ResourceProviderFactory.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ResourceProviderFactory.java
index 711ae10..f6ca16b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ResourceProviderFactory.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ResourceProviderFactory.java
@@ -68,8 +68,8 @@ public interface ResourceProviderFactory {
@Named("upgrade")
UpgradeResourceProvider getUpgradeResourceProvider(AmbariManagementController managementController);
- @Named("ambariConfiguration")
- ResourceProvider getAmbariConfigurationResourceProvider();
+ @Named("rootServiceHostComponentConfiguration")
+ ResourceProvider getRootServiceHostComponentConfigurationResourceProvider();
@Named("clusterStackVersion")
ClusterStackVersionResourceProvider getClusterStackVersionResourceProvider(AmbariManagementController managementController);
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/controller/RootComponent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/RootComponent.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/RootComponent.java
new file mode 100644
index 0000000..74cdfcf
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/RootComponent.java
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+package org.apache.ambari.server.controller;
+
+/**
+ * RootComponent is an enumeration of root-level components.
+ */
+public enum RootComponent {
+ AMBARI_SERVER,
+ AMBARI_AGENT
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/controller/RootService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/RootService.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/RootService.java
new file mode 100644
index 0000000..22f571d
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/RootService.java
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+package org.apache.ambari.server.controller;
+
+/**
+ * RootService is an enumeration of root-level services.
+ */
+public enum RootService {
+ AMBARI(RootComponent.values());
+
+ private final RootComponent[] components;
+
+ RootService(RootComponent[] components) {
+ this.components = components;
+ }
+
+ public RootComponent[] getComponents() {
+ return components;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/controller/RootServiceResponseFactory.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/RootServiceResponseFactory.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/RootServiceResponseFactory.java
index ad9ed20..63d41fd 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/RootServiceResponseFactory.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/RootServiceResponseFactory.java
@@ -62,9 +62,9 @@ public class RootServiceResponseFactory extends
serviceName = request.getServiceName();
if (serviceName != null) {
- Services service;
+ RootService service;
try {
- service = Services.valueOf(serviceName);
+ service = RootService.valueOf(serviceName);
}
catch (IllegalArgumentException ex) {
throw new ObjectNotFoundException("Root service name: " + serviceName);
@@ -74,7 +74,7 @@ public class RootServiceResponseFactory extends
} else {
response = new HashSet<>();
- for (Services service: Services.values())
+ for (RootService service: RootService.values())
response.add(new RootServiceResponse(service.toString()));
}
return response;
@@ -87,10 +87,10 @@ public class RootServiceResponseFactory extends
String serviceName = request.getServiceName();
String componentName = request.getComponentName();
- Services service;
+ RootService service;
try {
- service = Services.valueOf(serviceName);
+ service = RootService.valueOf(serviceName);
}
catch (IllegalArgumentException ex) {
throw new ObjectNotFoundException("Root service name: " + serviceName);
@@ -100,9 +100,9 @@ public class RootServiceResponseFactory extends
}
if (componentName != null) {
- Components component;
+ RootComponent component;
try {
- component = Components.valueOf(componentName);
+ component = RootComponent.valueOf(componentName);
if (!ArrayUtils.contains(service.getComponents(), component))
throw new ObjectNotFoundException("No component name: " + componentName + "in service: " + serviceName);
}
@@ -114,7 +114,7 @@ public class RootServiceResponseFactory extends
getComponentProperties(componentName)));
} else {
- for (Components component: service.getComponents())
+ for (RootComponent component: service.getComponents())
response.add(new RootServiceComponentResponse(serviceName, component.toString(),
getComponentVersion(component.name(), null),
getComponentProperties(component.name())));
@@ -123,7 +123,7 @@ public class RootServiceResponseFactory extends
}
private String getComponentVersion(String componentName, HostResponse host) {
- Components component = Components.valueOf(componentName);
+ RootComponent component = RootComponent.valueOf(componentName);
String componentVersion;
switch (component) {
@@ -150,10 +150,10 @@ public class RootServiceResponseFactory extends
Map<String, String> response;
Set<String> propertiesToHideInResponse;
- Components component = null;
+ RootComponent component = null;
if (componentName != null) {
- component = Components.valueOf(componentName);
+ component = RootComponent.valueOf(componentName);
switch (component) {
case AMBARI_SERVER:
@@ -176,24 +176,6 @@ public class RootServiceResponseFactory extends
return response;
}
-
- public enum Services {
- AMBARI(Components.values());
- private Components[] components;
-
- Services(Components[] components) {
- this.components = components;
- }
-
- public Components[] getComponents() {
- return components;
- }
- }
-
- public enum Components {
- AMBARI_SERVER, AMBARI_AGENT
- }
-
@Override
public Set<RootServiceHostComponentResponse> getRootServiceHostComponent(RootServiceHostComponentRequest request, Set<HostResponse> hosts) throws AmbariException {
Set<RootServiceHostComponentResponse> response = new HashSet<>();
@@ -208,7 +190,7 @@ public class RootServiceResponseFactory extends
Set<HostResponse> filteredHosts = new HashSet<>(hosts);
//Make some filtering of hosts if need
- if (component.getComponentName().equals(Components.AMBARI_SERVER.name())) {
+ if (component.getComponentName().equals(RootComponent.AMBARI_SERVER.name())) {
CollectionUtils.filter(filteredHosts, new Predicate() {
@Override
public boolean evaluate(Object arg0) {
@@ -220,7 +202,7 @@ public class RootServiceResponseFactory extends
for (HostResponse host : filteredHosts) {
String state;
- if (component.getComponentName().equals(Components.AMBARI_SERVER.name())) {
+ if (component.getComponentName().equals(RootComponent.AMBARI_SERVER.name())) {
state = RUNNING_STATE;
} else {
state = host.getHostState().toString();
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProvider.java
index 1dc0841..cc2548c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProvider.java
@@ -206,6 +206,8 @@ public abstract class AbstractControllerResourceProvider extends AbstractAuthori
return new RootServiceResourceProvider(propertyIds, keyPropertyIds, managementController);
case RootServiceComponent:
return new RootServiceComponentResourceProvider(propertyIds, keyPropertyIds, managementController);
+ case RootServiceComponentConfiguration:
+ return resourceProviderFactory.getRootServiceHostComponentConfigurationResourceProvider();
case RootServiceHostComponent:
return new RootServiceHostComponentResourceProvider(propertyIds, keyPropertyIds, managementController);
case ConfigGroup:
@@ -254,8 +256,6 @@ public abstract class AbstractControllerResourceProvider extends AbstractAuthori
return new ClusterKerberosDescriptorResourceProvider(managementController);
case LoggingQuery:
return new LoggingResourceProvider(propertyIds, keyPropertyIds, managementController);
- case AmbariConfiguration:
- return resourceProviderFactory.getAmbariConfigurationResourceProvider();
case AlertTarget:
return resourceProviderFactory.getAlertTargetResourceProvider();
case ViewInstance:
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProvider.java
deleted file mode 100644
index a24400d..0000000
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProvider.java
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- * Licensed 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.
- */
-
-package org.apache.ambari.server.controller.internal;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-
-import org.apache.ambari.server.AmbariException;
-import org.apache.ambari.server.controller.spi.NoSuchParentResourceException;
-import org.apache.ambari.server.controller.spi.NoSuchResourceException;
-import org.apache.ambari.server.controller.spi.Predicate;
-import org.apache.ambari.server.controller.spi.Request;
-import org.apache.ambari.server.controller.spi.RequestStatus;
-import org.apache.ambari.server.controller.spi.Resource;
-import org.apache.ambari.server.controller.spi.ResourceAlreadyExistsException;
-import org.apache.ambari.server.controller.spi.SystemException;
-import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
-import org.apache.ambari.server.controller.utilities.PredicateHelper;
-import org.apache.ambari.server.controller.utilities.PropertyHelper;
-import org.apache.ambari.server.events.AmbariConfigurationChangedEvent;
-import org.apache.ambari.server.events.publishers.AmbariEventPublisher;
-import org.apache.ambari.server.orm.dao.AmbariConfigurationDAO;
-import org.apache.ambari.server.orm.entities.AmbariConfigurationEntity;
-import org.apache.ambari.server.security.authorization.RoleAuthorization;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.inject.Inject;
-
-/**
- * Resource provider for AmbariConfiguration resources.
- */
-public class AmbariConfigurationResourceProvider extends AbstractAuthorizedResourceProvider {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(AmbariConfigurationResourceProvider.class);
-
- static final String AMBARI_CONFIGURATION_CATEGORY_PROPERTY_ID = PropertyHelper.getPropertyId("AmbariConfiguration", "category");
- static final String AMBARI_CONFIGURATION_PROPERTIES_PROPERTY_ID = PropertyHelper.getPropertyId("AmbariConfiguration", "properties");
-
- private static final Set<String> PROPERTIES = Collections.unmodifiableSet(
- new HashSet<>(Arrays.asList(
- AMBARI_CONFIGURATION_CATEGORY_PROPERTY_ID,
- AMBARI_CONFIGURATION_PROPERTIES_PROPERTY_ID)
- )
- );
-
- private static final Map<Resource.Type, String> PK_PROPERTY_MAP = Collections.unmodifiableMap(
- Collections.singletonMap(Resource.Type.AmbariConfiguration, AMBARI_CONFIGURATION_CATEGORY_PROPERTY_ID)
- );
-
- private static final Set<String> PK_PROPERTY_IDS = Collections.unmodifiableSet(
- new HashSet<>(PK_PROPERTY_MAP.values())
- );
-
- @Inject
- private AmbariConfigurationDAO ambariConfigurationDAO;
-
- @Inject
- private AmbariEventPublisher publisher;
-
- public AmbariConfigurationResourceProvider() {
- super(PROPERTIES, PK_PROPERTY_MAP);
-
- Set<RoleAuthorization> authorizations = EnumSet.of(RoleAuthorization.AMBARI_MANAGE_CONFIGURATION);
- setRequiredCreateAuthorizations(authorizations);
- setRequiredDeleteAuthorizations(authorizations);
- setRequiredUpdateAuthorizations(authorizations);
- setRequiredGetAuthorizations(authorizations);
- }
-
- @Override
- protected Set<String> getPKPropertyIds() {
- return PK_PROPERTY_IDS;
- }
-
- @Override
- public RequestStatus createResourcesAuthorized(Request request)
- throws SystemException, UnsupportedPropertyException, ResourceAlreadyExistsException, NoSuchParentResourceException {
-
- createOrAddProperties(null, request.getProperties(), true);
-
- return getRequestStatus(null);
- }
-
- @Override
- protected Set<Resource> getResourcesAuthorized(Request request, Predicate predicate) throws SystemException,
- UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {
-
- return getResources(new Command<Set<Resource>>() {
- @Override
- public Set<Resource> invoke() throws AmbariException {
- Set<Resource> resources = new HashSet<>();
- Set<String> requestedIds = getRequestPropertyIds(request, predicate);
-
- if (CollectionUtils.isEmpty(requestedIds)) {
- requestedIds = PROPERTIES;
- }
-
- if (predicate == null) {
- Set<Resource> _resources = getAmbariConfigurationResources(requestedIds, null);
- if (!CollectionUtils.isEmpty(_resources)) {
- resources.addAll(_resources);
- }
- } else {
- for (Map<String, Object> propertyMap : getPropertyMaps(predicate)) {
- Set<Resource> _resources = getAmbariConfigurationResources(requestedIds, propertyMap);
- if (!CollectionUtils.isEmpty(_resources)) {
- resources.addAll(_resources);
- }
- }
- }
-
- return resources;
- }
- });
- }
-
-
- @Override
- protected RequestStatus deleteResourcesAuthorized(Request request, Predicate predicate) throws SystemException,
- UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {
-
- String categoryName = (String) PredicateHelper.getProperties(predicate).get(AMBARI_CONFIGURATION_CATEGORY_PROPERTY_ID);
-
- if (null == categoryName) {
- LOGGER.debug("No resource id provided in the request");
- } else {
- LOGGER.debug("Deleting Ambari configuration with id: {}", categoryName);
- try {
- ambariConfigurationDAO.removeByCategory(categoryName);
- } catch (IllegalStateException e) {
- throw new NoSuchResourceException(e.getMessage());
- }
- }
-
- // notify subscribers about the configuration changes
- publisher.publish(new AmbariConfigurationChangedEvent(categoryName));
- return getRequestStatus(null);
- }
-
- @Override
- protected RequestStatus updateResourcesAuthorized(Request request, Predicate predicate)
- throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {
-
- String categoryName = (String) PredicateHelper.getProperties(predicate).get(AMBARI_CONFIGURATION_CATEGORY_PROPERTY_ID);
- createOrAddProperties(categoryName, request.getProperties(), false);
-
- return getRequestStatus(null);
- }
-
- /**
- * Retrieves groups of properties from the request data and create or updates them as needed.
- * <p>
- * Each group of properties is expected to have a category (<code>AmbariConfiguration/category</code>)
- * value and one or more property (<code>AmbariConfiguration/properties/property.name</code>) values.
- * If a category cannot be determined from the propery set, the default category value (passed in)
- * is used. If a default category is set, it is assumed that it was parsed from the request predicate
- * (if availabe).
- *
- * @param defaultCategoryName the default category to use if needed
- * @param requestProperties a collection of property maps parsed from the request
- * @param removePropertiesIfNotSpecified <code>true</code> to remove existing properties that have not been specifed in the request; <code>false</code> append or update the existing set of properties with values from the request
- * @throws SystemException if an error occurs saving the configuration data
- */
- private void createOrAddProperties(String defaultCategoryName, Set<Map<String, Object>> requestProperties, boolean removePropertiesIfNotSpecified)
- throws SystemException {
- // set of resource properties (each entry in the set belongs to a different resource)
- if (requestProperties != null) {
- for (Map<String, Object> resourceProperties : requestProperties) {
- Map<String, Map<String, String>> entityMap = parseProperties(defaultCategoryName, resourceProperties);
-
- if (entityMap != null) {
- for (Map.Entry<String, Map<String, String>> entry : entityMap.entrySet()) {
- String categoryName = entry.getKey();
-
- if (ambariConfigurationDAO.reconcileCategory(categoryName, entry.getValue(), removePropertiesIfNotSpecified)) {
- // notify subscribers about the configuration changes
- publisher.publish(new AmbariConfigurationChangedEvent(categoryName));
- }
- }
- }
- }
- }
- }
-
- private Resource toResource(String categoryName, Map<String, String> properties, Set<String> requestedIds) {
- Resource resource = new ResourceImpl(Resource.Type.AmbariConfiguration);
- setResourceProperty(resource, AMBARI_CONFIGURATION_CATEGORY_PROPERTY_ID, categoryName, requestedIds);
- setResourceProperty(resource, AMBARI_CONFIGURATION_PROPERTIES_PROPERTY_ID, properties, requestedIds);
- return resource;
- }
-
- /**
- * Parse the property map from a request into a map of category names to maps of property names and values.
- *
- * @param defaultCategoryName the default category name to use if one is not found in the map of properties
- * @param resourceProperties a map of properties from a request item
- * @return a map of category names to maps of name/value pairs
- * @throws SystemException if an issue with the data is determined
- */
- private Map<String, Map<String, String>> parseProperties(String defaultCategoryName, Map<String, Object> resourceProperties) throws SystemException {
- String categoryName = null;
- Map<String, String> properties = new HashMap<>();
-
- for (Map.Entry<String, Object> entry : resourceProperties.entrySet()) {
- String propertyName = entry.getKey();
-
- if (AMBARI_CONFIGURATION_CATEGORY_PROPERTY_ID.equals(propertyName)) {
- if (entry.getValue() instanceof String) {
- categoryName = (String) entry.getValue();
- }
- } else {
- String propertyCategory = PropertyHelper.getPropertyCategory(entry.getKey());
- if ((propertyCategory != null) && propertyCategory.equals(AMBARI_CONFIGURATION_PROPERTIES_PROPERTY_ID)) {
- String name = PropertyHelper.getPropertyName(entry.getKey());
- Object value = entry.getValue();
- properties.put(name, (value == null) ? null : value.toString());
- }
- }
- }
-
- if (categoryName == null) {
- categoryName = defaultCategoryName;
- }
-
- if (StringUtils.isEmpty(categoryName)) {
- throw new SystemException("The configuration type must be set");
- }
-
- if (properties.isEmpty()) {
- throw new SystemException("The configuration properties must be set");
- }
-
- return Collections.singletonMap(categoryName, properties);
- }
-
- private Set<Resource> getAmbariConfigurationResources(Set<String> requestedIds, Map<String, Object> propertyMap) {
- Set<Resource> resources = new HashSet<>();
-
- String categoryName = getStringProperty(propertyMap, AMBARI_CONFIGURATION_CATEGORY_PROPERTY_ID);
-
- List<AmbariConfigurationEntity> entities = (categoryName == null)
- ? ambariConfigurationDAO.findAll()
- : ambariConfigurationDAO.findByCategory(categoryName);
-
- if (entities != null) {
- Map<String, Map<String, String>> configurations = new HashMap<>();
-
- for (AmbariConfigurationEntity entity : entities) {
- String category = entity.getCategoryName();
- Map<String, String> properties = configurations.get(category);
-
- if (properties == null) {
- properties = new TreeMap<>();
- configurations.put(category, properties);
- }
-
- properties.put(entity.getPropertyName(), entity.getPropertyValue());
- }
-
- for (Map.Entry<String, Map<String, String>> entry : configurations.entrySet()) {
- resources.add(toResource(entry.getKey(), entry.getValue(), requestedIds));
- }
- }
-
- return resources;
- }
-
- private String getStringProperty(Map<String, Object> propertyMap, String propertyId) {
- String value = null;
-
- if (propertyMap != null) {
- Object o = propertyMap.get(propertyId);
- if (o instanceof String) {
- value = (String) o;
- }
- }
-
- return value;
- }
-}
[24/50] [abbrv] ambari git commit: AMBARI-22347. Simplify Ambari
configuration tables from AMBARI-21307 (rlevas)
Posted by rl...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fa9ac55/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProviderTest.java
index c2a1421..a2ecb27 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProviderTest.java
@@ -14,238 +14,364 @@
package org.apache.ambari.server.controller.internal;
+import static org.apache.ambari.server.controller.internal.AmbariConfigurationResourceProvider.AMBARI_CONFIGURATION_CATEGORY_PROPERTY_ID;
+import static org.apache.ambari.server.controller.internal.AmbariConfigurationResourceProvider.AMBARI_CONFIGURATION_PROPERTIES_PROPERTY_ID;
+import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.capture;
+import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.newCapture;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.TreeMap;
+
+import javax.persistence.EntityManager;
import org.apache.ambari.server.controller.spi.Predicate;
import org.apache.ambari.server.controller.spi.Request;
import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.spi.ResourceProvider;
import org.apache.ambari.server.controller.utilities.PredicateBuilder;
-import org.apache.ambari.server.events.AmbariLdapConfigChangedEvent;
+import org.apache.ambari.server.events.AmbariConfigurationChangedEvent;
import org.apache.ambari.server.events.publishers.AmbariEventPublisher;
import org.apache.ambari.server.orm.dao.AmbariConfigurationDAO;
import org.apache.ambari.server.orm.entities.AmbariConfigurationEntity;
-import org.apache.ambari.server.orm.entities.ConfigurationBaseEntity;
+import org.apache.ambari.server.security.TestAuthenticationFactory;
+import org.apache.ambari.server.security.authorization.AuthorizationException;
import org.easymock.Capture;
-import org.easymock.EasyMock;
-import org.easymock.EasyMockRule;
import org.easymock.EasyMockSupport;
-import org.easymock.Mock;
-import org.easymock.TestSubject;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Rule;
+import org.junit.After;
import org.junit.Test;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.context.SecurityContextHolder;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
+import com.google.inject.AbstractModule;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
public class AmbariConfigurationResourceProviderTest extends EasyMockSupport {
- @Rule
- public EasyMockRule mocks = new EasyMockRule(this);
+ private static final String CATEGORY_NAME_1 = "test-category-1";
+ private static final String CATEGORY_NAME_2 = "test-category-2";
- @Mock
- private Request requestMock;
+ @After
+ public void clearAuthentication() {
+ SecurityContextHolder.getContext().setAuthentication(null);
+ }
- @Mock
- private AmbariConfigurationDAO ambariConfigurationDAO;
+ @Test
+ public void testCreateResources_Administrator() throws Exception {
+ testCreateResources(TestAuthenticationFactory.createAdministrator());
+ }
- @Mock
- private AmbariEventPublisher publisher;
+ @Test(expected = AuthorizationException.class)
+ public void testCreateResources_ClusterAdministrator() throws Exception {
+ testCreateResources(TestAuthenticationFactory.createClusterAdministrator());
+ }
- private Capture<AmbariConfigurationEntity> ambariConfigurationEntityCapture;
+ @Test(expected = AuthorizationException.class)
+ public void testCreateResources_ClusterOperator() throws Exception {
+ testCreateResources(TestAuthenticationFactory.createClusterOperator());
+ }
- private Gson gson;
+ @Test(expected = AuthorizationException.class)
+ public void testCreateResources_ServiceAdministrator() throws Exception {
+ testCreateResources(TestAuthenticationFactory.createServiceAdministrator());
+ }
- private static final String DATA_MOCK_STR = "[\n" +
- " {\n" +
- " \"authentication.ldap.baseDn\" : \"dc=ambari,dc=apache,dc=org\",\n" +
- " \"authentication.ldap.primaryUrl\" : \"localhost:33389\",\n" +
- " \"authentication.ldap.secondaryUrl\" : \"localhost:333\"\n" +
- " }\n" +
- " ]";
+ @Test(expected = AuthorizationException.class)
+ public void testCreateResources_ServiceOperator() throws Exception {
+ testCreateResources(TestAuthenticationFactory.createServiceOperator());
+ }
- private static final Long PK_LONG = Long.valueOf(1);
- private static final String PK_STRING = String.valueOf(1);
- private static final String VERSION_TAG = "test version";
- private static final String VERSION = "1";
- private static final String TYPE = "AmbariConfiguration";
+ private void testCreateResources(Authentication authentication) throws Exception {
+ Injector injector = createInjector();
- @TestSubject
- private AmbariConfigurationResourceProvider ambariConfigurationResourceProvider = new AmbariConfigurationResourceProvider();
+ ResourceProvider resourceProvider = injector.getInstance(AmbariConfigurationResourceProvider.class);
- @Before
- public void setup() {
- ambariConfigurationEntityCapture = Capture.newInstance();
- gson = new GsonBuilder().create();
- }
+ Set<Map<String, Object>> propertySets = new HashSet<>();
- @Test
- public void testCreateAmbariConfigurationRequestResultsInTheProperPersistenceCall() throws Exception {
-
- // GIVEN
- // configuration properties parsed from the request
- Set<Map<String, Object>> resourcePropertiesSet = Sets.newHashSet(
- new PropertiesMapBuilder()
- .withId(PK_LONG)
- .withVersion(VERSION)
- .withVersionTag(VERSION_TAG)
- .withData(DATA_MOCK_STR)
- .withType(TYPE)
- .build());
-
- // mock the request to return the properties
- EasyMock.expect(requestMock.getProperties()).andReturn(resourcePropertiesSet);
-
- // capture the entity the DAO gets called with
- ambariConfigurationDAO.create(EasyMock.capture(ambariConfigurationEntityCapture));
- publisher.publish(EasyMock.anyObject(AmbariLdapConfigChangedEvent.class));
+ Map<String, String> properties1 = new HashMap<>();
+ properties1.put("property1a", "value1");
+ properties1.put("property2a", "value2");
+ propertySets.add(toRequestProperties(CATEGORY_NAME_1, properties1));
+
+ Map<String, String> properties2 = new HashMap<>();
+ properties2.put("property1b", "value1");
+ properties2.put("property2b", "value2");
+ propertySets.add(toRequestProperties(CATEGORY_NAME_2, properties2));
+
+ Request request = createMock(Request.class);
+ expect(request.getProperties()).andReturn(propertySets).once();
+
+ Capture<Map<String, String>> capturedProperties1 = newCapture();
+ Capture<Map<String, String>> capturedProperties2 = newCapture();
+
+ AmbariConfigurationDAO dao = injector.getInstance(AmbariConfigurationDAO.class);
+ expect(dao.reconcileCategory(eq(CATEGORY_NAME_1), capture(capturedProperties1), eq(true)))
+ .andReturn(true)
+ .once();
+ expect(dao.reconcileCategory(eq(CATEGORY_NAME_2), capture(capturedProperties2), eq(true)))
+ .andReturn(true)
+ .once();
+
+ AmbariEventPublisher publisher = injector.getInstance(AmbariEventPublisher.class);
+ publisher.publish(anyObject(AmbariConfigurationChangedEvent.class));
+ expectLastCall().times(2);
replayAll();
- // WHEN
- ambariConfigurationResourceProvider.createResourcesAuthorized(requestMock);
+ SecurityContextHolder.getContext().setAuthentication(authentication);
- // THEN
- AmbariConfigurationEntity capturedAmbariConfigurationEntity = ambariConfigurationEntityCapture.getValue();
- Assert.assertNotNull(capturedAmbariConfigurationEntity);
- Assert.assertNull("The entity identifier should be null", capturedAmbariConfigurationEntity.getId());
- Assert.assertEquals("The entity version is not the expected", Integer.valueOf(VERSION),
- capturedAmbariConfigurationEntity.getConfigurationBaseEntity().getVersion());
- Assert.assertEquals("The entity version tag is not the expected", VERSION_TAG,
- capturedAmbariConfigurationEntity.getConfigurationBaseEntity().getVersionTag());
- Assert.assertEquals("The entity data is not the expected", DATA_MOCK_STR,
- gson.fromJson(capturedAmbariConfigurationEntity.getConfigurationBaseEntity().getConfigurationData(), String.class));
+ resourceProvider.createResources(request);
+
+ verifyAll();
+
+ validateCapturedProperties(properties1, capturedProperties1);
+ validateCapturedProperties(properties2, capturedProperties2);
}
@Test
- public void testRemoveAmbariConfigurationRequestResultsInTheProperPersistenceCall() throws Exception {
- // GIVEN
- Predicate predicate = new PredicateBuilder().property(
- AmbariConfigurationResourceProvider.ResourcePropertyId.ID.getPropertyId()).equals("1").toPredicate();
+ public void testDeleteResources_Administrator() throws Exception {
+ testDeleteResources(TestAuthenticationFactory.createAdministrator());
+ }
- Capture<Long> pkCapture = Capture.newInstance();
- ambariConfigurationDAO.removeByPK(EasyMock.capture(pkCapture));
- publisher.publish(EasyMock.anyObject(AmbariLdapConfigChangedEvent.class));
+ @Test(expected = AuthorizationException.class)
+ public void testDeleteResources_ClusterAdministrator() throws Exception {
+ testDeleteResources(TestAuthenticationFactory.createClusterAdministrator());
+ }
- replayAll();
+ @Test(expected = AuthorizationException.class)
+ public void testDeleteResources_ClusterOperator() throws Exception {
+ testDeleteResources(TestAuthenticationFactory.createClusterOperator());
+ }
- // WHEN
- ambariConfigurationResourceProvider.deleteResourcesAuthorized(requestMock, predicate);
+ @Test(expected = AuthorizationException.class)
+ public void testDeleteResources_ServiceAdministrator() throws Exception {
+ testDeleteResources(TestAuthenticationFactory.createServiceAdministrator());
+ }
- // THEN
- Assert.assertEquals("The pk of the entity to be removed doen't match the expected id", Long.valueOf(1), pkCapture.getValue());
+ @Test(expected = AuthorizationException.class)
+ public void testDeleteResources_ServiceOperator() throws Exception {
+ testDeleteResources(TestAuthenticationFactory.createServiceOperator());
}
+ private void testDeleteResources(Authentication authentication) throws Exception {
+ Injector injector = createInjector();
- @Test
- public void testRetrieveAmbariConfigurationShouldResultsInTheProperDAOCall() throws Exception {
- // GIVEN
- Predicate predicate = new PredicateBuilder().property(
- AmbariConfigurationResourceProvider.ResourcePropertyId.ID.getPropertyId()).equals("1").toPredicate();
+ ResourceProvider resourceProvider = injector.getInstance(AmbariConfigurationResourceProvider.class);
+
+ Predicate predicate = new PredicateBuilder()
+ .property(AMBARI_CONFIGURATION_CATEGORY_PROPERTY_ID)
+ .equals(CATEGORY_NAME_1)
+ .toPredicate();
+
+ Request request = createMock(Request.class);
+
+ AmbariConfigurationDAO dao = injector.getInstance(AmbariConfigurationDAO.class);
+ expect(dao.removeByCategory(CATEGORY_NAME_1)).andReturn(1).once();
+
+ AmbariEventPublisher publisher = injector.getInstance(AmbariEventPublisher.class);
+ publisher.publish(anyObject(AmbariConfigurationChangedEvent.class));
+ expectLastCall().once();
- EasyMock.expect(ambariConfigurationDAO.findAll()).andReturn(Lists.newArrayList(createDummyAmbariConfigurationEntity()));
replayAll();
- // WHEN
- Set<Resource> resourceSet = ambariConfigurationResourceProvider.getResourcesAuthorized(requestMock, predicate);
+ SecurityContextHolder.getContext().setAuthentication(authentication);
+
+ resourceProvider.deleteResources(request, predicate);
- // THEN
- Assert.assertNotNull(resourceSet);
- Assert.assertFalse(resourceSet.isEmpty());
+ verifyAll();
}
@Test
- public void testUpdateAmbariConfigurationShouldResultInTheProperDAOCalls() throws Exception {
- // GIVEN
+ public void testGetResources_Administrator() throws Exception {
+ testGetResources(TestAuthenticationFactory.createAdministrator());
+ }
+
+ @Test(expected = AuthorizationException.class)
+ public void testGetResources_ClusterAdministrator() throws Exception {
+ testGetResources(TestAuthenticationFactory.createClusterAdministrator());
+ }
+
+ @Test(expected = AuthorizationException.class)
+ public void testGetResources_ClusterOperator() throws Exception {
+ testGetResources(TestAuthenticationFactory.createClusterOperator());
+ }
+
+ @Test(expected = AuthorizationException.class)
+ public void testGetResources_ServiceAdministrator() throws Exception {
+ testGetResources(TestAuthenticationFactory.createServiceAdministrator());
+ }
+
+ @Test(expected = AuthorizationException.class)
+ public void testGetResources_ServiceOperator() throws Exception {
+ testGetResources(TestAuthenticationFactory.createServiceOperator());
+ }
+
+ private void testGetResources(Authentication authentication) throws Exception {
+ Injector injector = createInjector();
+
+ ResourceProvider resourceProvider = injector.getInstance(AmbariConfigurationResourceProvider.class);
- Predicate predicate = new PredicateBuilder().property(
- AmbariConfigurationResourceProvider.ResourcePropertyId.ID.getPropertyId()).equals("1").toPredicate();
+ Predicate predicate = new PredicateBuilder()
+ .property(AMBARI_CONFIGURATION_CATEGORY_PROPERTY_ID)
+ .equals(CATEGORY_NAME_1)
+ .toPredicate();
- // properteies in the request, representing the updated configuration
- Set<Map<String, Object>> resourcePropertiesSet = Sets.newHashSet(new PropertiesMapBuilder()
- .withId(PK_LONG)
- .withVersion("2")
- .withVersionTag("version-2")
- .withData(DATA_MOCK_STR)
- .withType(TYPE)
- .build());
+ Request request = createMock(Request.class);
+ expect(request.getPropertyIds()).andReturn(null).anyTimes();
- EasyMock.expect(requestMock.getProperties()).andReturn(resourcePropertiesSet);
+ Map<String, String> properties = new HashMap<>();
+ properties.put("property1a", "value1");
+ properties.put("property2a", "value2");
- AmbariConfigurationEntity persistedEntity = createDummyAmbariConfigurationEntity();
- EasyMock.expect(ambariConfigurationDAO.findByPK(PK_LONG)).andReturn(persistedEntity);
- ambariConfigurationDAO.update(EasyMock.capture(ambariConfigurationEntityCapture));
- publisher.publish(EasyMock.anyObject(AmbariLdapConfigChangedEvent.class));
+ AmbariConfigurationDAO dao = injector.getInstance(AmbariConfigurationDAO.class);
+ expect(dao.findByCategory(CATEGORY_NAME_1)).andReturn(createEntities(CATEGORY_NAME_1, properties)).once();
replayAll();
- // WHEN
- ambariConfigurationResourceProvider.updateResourcesAuthorized(requestMock, predicate);
+ SecurityContextHolder.getContext().setAuthentication(authentication);
- // the captured entity should be the updated one
- AmbariConfigurationEntity updatedEntity = ambariConfigurationEntityCapture.getValue();
+ Set<Resource> response = resourceProvider.getResources(request, predicate);
- // THEN
- Assert.assertNotNull(updatedEntity);
- Assert.assertEquals("The updated version is wrong", Integer.valueOf(2), updatedEntity.getConfigurationBaseEntity().getVersion());
- }
+ verifyAll();
- private class PropertiesMapBuilder {
+ junit.framework.Assert.assertNotNull(response);
+ junit.framework.Assert.assertEquals(1, response.size());
- private Map<String, Object> resourcePropertiesMap = Maps.newHashMap();
+ Resource resource = response.iterator().next();
+ junit.framework.Assert.assertEquals(Resource.Type.AmbariConfiguration, resource.getType());
- private PropertiesMapBuilder() {
- }
+ Map<String, Map<String, Object>> propertiesMap = resource.getPropertiesMap();
+ junit.framework.Assert.assertEquals(2, propertiesMap.size());
- public PropertiesMapBuilder withId(Long id) {
- resourcePropertiesMap.put(AmbariConfigurationResourceProvider.ResourcePropertyId.ID.getPropertyId(), id);
- return this;
- }
+ junit.framework.Assert.assertEquals(CATEGORY_NAME_1, propertiesMap.get(Resource.Type.AmbariConfiguration.name()).get("category"));
- private PropertiesMapBuilder withVersion(String version) {
- resourcePropertiesMap.put(AmbariConfigurationResourceProvider.ResourcePropertyId.VERSION.getPropertyId(), version);
- return this;
- }
+ Map<String, Object> retrievedProperties = propertiesMap.get(Resource.Type.AmbariConfiguration.name() + "/properties");
+ junit.framework.Assert.assertEquals(2, retrievedProperties.size());
- private PropertiesMapBuilder withVersionTag(String versionTag) {
- resourcePropertiesMap.put(AmbariConfigurationResourceProvider.ResourcePropertyId.VERSION_TAG.getPropertyId(), versionTag);
- return this;
+ for (Map.Entry<String, String> entry : properties.entrySet()) {
+ junit.framework.Assert.assertEquals(entry.getValue(), retrievedProperties.get(entry.getKey()));
}
+ }
- private PropertiesMapBuilder withData(String dataJson) {
- resourcePropertiesMap.put(AmbariConfigurationResourceProvider.ResourcePropertyId.DATA.getPropertyId(), dataJson);
- return this;
- }
+ @Test
+ public void testUpdateResources_Administrator() throws Exception {
+ testUpdateResources(TestAuthenticationFactory.createAdministrator());
+ }
- private PropertiesMapBuilder withType(String type) {
- resourcePropertiesMap.put(AmbariConfigurationResourceProvider.ResourcePropertyId.TYPE.getPropertyId(), type);
- return this;
- }
+ @Test(expected = AuthorizationException.class)
+ public void testUpdateResources_ClusterAdministrator() throws Exception {
+ testUpdateResources(TestAuthenticationFactory.createClusterAdministrator());
+ }
+ @Test(expected = AuthorizationException.class)
+ public void testUpdateResources_ClusterOperator() throws Exception {
+ testUpdateResources(TestAuthenticationFactory.createClusterOperator());
+ }
- public Map<String, Object> build() {
- return this.resourcePropertiesMap;
- }
+ @Test(expected = AuthorizationException.class)
+ public void testUpdateResources_ServiceAdministrator() throws Exception {
+ testUpdateResources(TestAuthenticationFactory.createServiceAdministrator());
+ }
+
+ @Test(expected = AuthorizationException.class)
+ public void testUpdateResources_ServiceOperator() throws Exception {
+ testUpdateResources(TestAuthenticationFactory.createServiceOperator());
+ }
+
+ private void testUpdateResources(Authentication authentication) throws Exception {
+ Injector injector = createInjector();
+
+ ResourceProvider resourceProvider = injector.getInstance(AmbariConfigurationResourceProvider.class);
+
+ Predicate predicate = new PredicateBuilder()
+ .property(AMBARI_CONFIGURATION_CATEGORY_PROPERTY_ID)
+ .equals(CATEGORY_NAME_1)
+ .toPredicate();
+
+ Set<Map<String, Object>> propertySets = new HashSet<>();
+ Map<String, String> properties1 = new HashMap<>();
+ properties1.put("property1a", "value1");
+ properties1.put("property2a", "value2");
+ propertySets.add(toRequestProperties(CATEGORY_NAME_1, properties1));
+
+ Request request = createMock(Request.class);
+ expect(request.getProperties()).andReturn(propertySets).once();
+
+ Capture<Map<String, String>> capturedProperties1 = newCapture();
+
+ AmbariConfigurationDAO dao = injector.getInstance(AmbariConfigurationDAO.class);
+ expect(dao.reconcileCategory(eq(CATEGORY_NAME_1), capture(capturedProperties1), eq(false)))
+ .andReturn(true)
+ .once();
+
+ AmbariEventPublisher publisher = injector.getInstance(AmbariEventPublisher.class);
+ publisher.publish(anyObject(AmbariConfigurationChangedEvent.class));
+ expectLastCall().times(1);
+
+ replayAll();
+
+ SecurityContextHolder.getContext().setAuthentication(authentication);
+
+ resourceProvider.updateResources(request, predicate);
+
+ verifyAll();
+
+ validateCapturedProperties(properties1, capturedProperties1);
}
- private AmbariConfigurationEntity createDummyAmbariConfigurationEntity() {
- AmbariConfigurationEntity acEntity = new AmbariConfigurationEntity();
- ConfigurationBaseEntity configurationBaseEntity = new ConfigurationBaseEntity();
- acEntity.setConfigurationBaseEntity(configurationBaseEntity);
- acEntity.setId(PK_LONG);
- acEntity.getConfigurationBaseEntity().setConfigurationData(DATA_MOCK_STR);
- acEntity.getConfigurationBaseEntity().setVersion(Integer.valueOf(VERSION));
- acEntity.getConfigurationBaseEntity().setVersionTag(VERSION_TAG);
- acEntity.getConfigurationBaseEntity().setType("ldap-config");
+ private List<AmbariConfigurationEntity> createEntities(String categoryName, Map<String, String> properties) {
+ List<AmbariConfigurationEntity> entities = new ArrayList<>();
- return acEntity;
+ for (Map.Entry<String, String> property : properties.entrySet()) {
+ AmbariConfigurationEntity entity = new AmbariConfigurationEntity();
+ entity.setCategoryName(categoryName);
+ entity.setPropertyName(property.getKey());
+ entity.setPropertyValue(property.getValue());
+ entities.add(entity);
+ }
+
+ return entities;
+ }
+
+ private Map<String, Object> toRequestProperties(String categoryName1, Map<String, String> properties) {
+ Map<String, Object> requestProperties = new HashMap<>();
+ requestProperties.put(AMBARI_CONFIGURATION_CATEGORY_PROPERTY_ID, categoryName1);
+ for (Map.Entry<String, String> entry : properties.entrySet()) {
+ requestProperties.put(AMBARI_CONFIGURATION_PROPERTIES_PROPERTY_ID + "/" + entry.getKey(), entry.getValue());
+ }
+ return requestProperties;
}
+ private void validateCapturedProperties(Map<String, String> expectedProperties, Capture<Map<String, String>> capturedProperties) {
+ junit.framework.Assert.assertTrue(capturedProperties.hasCaptured());
+ Map<String, String> properties = capturedProperties.getValue();
+ junit.framework.Assert.assertNotNull(properties);
+
+ // Convert the Map to a TreeMap to help with comparisons
+ expectedProperties = new TreeMap<>(expectedProperties);
+ properties = new TreeMap<>(properties);
+ junit.framework.Assert.assertEquals(expectedProperties, properties);
+ }
+
+ private Injector createInjector() throws Exception {
+ return Guice.createInjector(new AbstractModule() {
+ @Override
+ protected void configure() {
+ bind(EntityManager.class).toInstance(createNiceMock(EntityManager.class));
+ bind(AmbariConfigurationDAO.class).toInstance(createMock(AmbariConfigurationDAO.class));
+ bind(AmbariEventPublisher.class).toInstance(createMock(AmbariEventPublisher.class));
+ }
+ });
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fa9ac55/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AmbariConfigurationDAOTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AmbariConfigurationDAOTest.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AmbariConfigurationDAOTest.java
new file mode 100644
index 0000000..f801fd6
--- /dev/null
+++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AmbariConfigurationDAOTest.java
@@ -0,0 +1,298 @@
+/*
+ * 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.
+ */
+
+package org.apache.ambari.server.orm.dao;
+
+import static org.easymock.EasyMock.capture;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.newCapture;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+import javax.persistence.EntityManager;
+
+import org.apache.ambari.server.orm.entities.AmbariConfigurationEntity;
+import org.easymock.Capture;
+import org.easymock.CaptureType;
+import org.easymock.EasyMockSupport;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.google.inject.Provider;
+
+import junit.framework.Assert;
+
+public class AmbariConfigurationDAOTest extends EasyMockSupport {
+
+ private static final String CATEGORY_NAME = "test-category";
+ private static Method methodMerge;
+ private static Method methodRemove;
+ private static Method methodCreate;
+ private static Method methodFindByCategory;
+
+ private static Field fieldEntityManagerProvider;
+
+ @BeforeClass
+ public static void beforeKDCKerberosOperationHandlerTest() throws Exception {
+ methodMerge = AmbariConfigurationDAO.class.getMethod("merge", AmbariConfigurationEntity.class);
+ methodRemove = CrudDAO.class.getMethod("remove", Object.class);
+ methodCreate = AmbariConfigurationDAO.class.getMethod("create", AmbariConfigurationEntity.class);
+ methodFindByCategory = AmbariConfigurationDAO.class.getMethod("findByCategory", String.class);
+
+ fieldEntityManagerProvider = CrudDAO.class.getDeclaredField("entityManagerProvider");
+ }
+
+ @Test
+ public void testReconcileCategoryNewCategory() throws Exception {
+ Capture<AmbariConfigurationEntity> capturedEntities = newCapture(CaptureType.ALL);
+
+ AmbariConfigurationDAO dao = createDao();
+
+ expect(dao.findByCategory(CATEGORY_NAME)).andReturn(null).once();
+
+ dao.create(capture(capturedEntities));
+ expectLastCall().anyTimes();
+
+ replayAll();
+
+ Map<String, String> properties;
+ properties = new HashMap<>();
+ properties.put("property1", "value1");
+ properties.put("property2", "value2");
+ dao.reconcileCategory(CATEGORY_NAME, properties, true);
+
+ verifyAll();
+
+ validateCapturedEntities(CATEGORY_NAME, properties, capturedEntities);
+ }
+
+ @Test
+ public void testReconcileCategoryReplaceCategory() throws Exception {
+
+ Map<String, String> existingProperties;
+ existingProperties = new HashMap<>();
+ existingProperties.put("property1", "value1");
+ existingProperties.put("property2", "value2");
+
+ Capture<AmbariConfigurationEntity> capturedCreatedEntities = newCapture(CaptureType.ALL);
+ Capture<AmbariConfigurationEntity> capturedRemovedEntities = newCapture(CaptureType.ALL);
+
+ AmbariConfigurationDAO dao = createDao();
+
+ expect(dao.findByCategory(CATEGORY_NAME)).andReturn(toEntities(CATEGORY_NAME, existingProperties)).once();
+
+ dao.remove(capture(capturedRemovedEntities));
+ expectLastCall().anyTimes();
+
+ dao.create(capture(capturedCreatedEntities));
+ expectLastCall().anyTimes();
+
+ replayAll();
+
+ Map<String, String> newProperties;
+ newProperties = new HashMap<>();
+ newProperties.put("property1_new", "value1");
+ newProperties.put("property2_new", "value2");
+ dao.reconcileCategory(CATEGORY_NAME, newProperties, true);
+
+ verifyAll();
+
+ validateCapturedEntities(CATEGORY_NAME, newProperties, capturedCreatedEntities);
+ validateCapturedEntities(CATEGORY_NAME, existingProperties, capturedRemovedEntities);
+ }
+
+ @Test
+ public void testReconcileCategoryUpdateCategoryKeepNotSpecified() throws Exception {
+
+ Map<String, String> existingProperties;
+ existingProperties = new HashMap<>();
+ existingProperties.put("property1", "value1");
+ existingProperties.put("property2", "value2");
+
+ Capture<AmbariConfigurationEntity> capturedCreatedEntities = newCapture(CaptureType.ALL);
+ Capture<AmbariConfigurationEntity> capturedMergedEntities = newCapture(CaptureType.ALL);
+
+ AmbariConfigurationDAO dao = createDao();
+
+ expect(dao.findByCategory(CATEGORY_NAME)).andReturn(toEntities(CATEGORY_NAME, existingProperties)).once();
+
+ expect(dao.merge(capture(capturedMergedEntities))).andReturn(createNiceMock(AmbariConfigurationEntity.class)).anyTimes();
+
+ dao.create(capture(capturedCreatedEntities));
+ expectLastCall().anyTimes();
+
+ replayAll();
+
+ Map<String, String> newProperties;
+ newProperties = new HashMap<>();
+ newProperties.put("property1", "new_value1");
+ newProperties.put("property2_new", "value2");
+ newProperties.put("property3", "value3");
+ dao.reconcileCategory(CATEGORY_NAME, newProperties, false);
+
+ verifyAll();
+
+ Map<String, String> expectedProperties;
+
+ expectedProperties = new HashMap<>();
+ expectedProperties.put("property2_new", "value2");
+ expectedProperties.put("property3", "value3");
+ validateCapturedEntities(CATEGORY_NAME, expectedProperties, capturedCreatedEntities);
+
+ expectedProperties = new HashMap<>();
+ expectedProperties.put("property1", "new_value1");
+ validateCapturedEntities(CATEGORY_NAME, expectedProperties, capturedMergedEntities);
+ }
+
+ @Test
+ public void testReconcileCategoryUpdateCategoryRemoveNotSpecified() throws Exception {
+
+ Map<String, String> existingProperties;
+ existingProperties = new HashMap<>();
+ existingProperties.put("property1", "value1");
+ existingProperties.put("property2", "value2");
+
+ Capture<AmbariConfigurationEntity> capturedCreatedEntities = newCapture(CaptureType.ALL);
+ Capture<AmbariConfigurationEntity> capturedRemovedEntities = newCapture(CaptureType.ALL);
+ Capture<AmbariConfigurationEntity> capturedMergedEntities = newCapture(CaptureType.ALL);
+
+ AmbariConfigurationDAO dao = createDao();
+
+ expect(dao.findByCategory(CATEGORY_NAME)).andReturn(toEntities(CATEGORY_NAME, existingProperties)).once();
+
+ expect(dao.merge(capture(capturedMergedEntities))).andReturn(createNiceMock(AmbariConfigurationEntity.class)).anyTimes();
+
+ dao.remove(capture(capturedRemovedEntities));
+ expectLastCall().anyTimes();
+
+ dao.create(capture(capturedCreatedEntities));
+ expectLastCall().anyTimes();
+
+ replayAll();
+
+ Map<String, String> newProperties;
+ newProperties = new HashMap<>();
+ newProperties.put("property1", "new_value1");
+ newProperties.put("property2_new", "value2");
+ newProperties.put("property3", "value3");
+ dao.reconcileCategory(CATEGORY_NAME, newProperties, true);
+
+ verifyAll();
+
+ Map<String, String> expectedProperties;
+
+ expectedProperties = new HashMap<>();
+ expectedProperties.put("property2_new", "value2");
+ expectedProperties.put("property3", "value3");
+ validateCapturedEntities(CATEGORY_NAME, expectedProperties, capturedCreatedEntities);
+
+ expectedProperties = new HashMap<>();
+ expectedProperties.put("property2", "value2");
+ validateCapturedEntities(CATEGORY_NAME, expectedProperties, capturedRemovedEntities);
+
+ expectedProperties = new HashMap<>();
+ expectedProperties.put("property1", "new_value1");
+ validateCapturedEntities(CATEGORY_NAME, expectedProperties, capturedMergedEntities);
+ }
+
+ @Test
+ public void testReconcileCategoryAppendCategory() throws Exception {
+
+ Map<String, String> existingProperties;
+ existingProperties = new HashMap<>();
+ existingProperties.put("property1", "value1");
+ existingProperties.put("property2", "value2");
+
+ Capture<AmbariConfigurationEntity> capturedCreatedEntities = newCapture(CaptureType.ALL);
+
+ AmbariConfigurationDAO dao = createDao();
+
+ expect(dao.findByCategory(CATEGORY_NAME)).andReturn(toEntities(CATEGORY_NAME, existingProperties)).once();
+
+ dao.create(capture(capturedCreatedEntities));
+ expectLastCall().anyTimes();
+
+ replayAll();
+
+ Map<String, String> newProperties;
+ newProperties = new HashMap<>();
+ newProperties.put("property3", "value3");
+ newProperties.put("property4", "value3");
+ dao.reconcileCategory(CATEGORY_NAME, newProperties, false);
+
+ verifyAll();
+
+ validateCapturedEntities(CATEGORY_NAME, newProperties, capturedCreatedEntities);
+ }
+
+ private AmbariConfigurationDAO createDao() throws IllegalAccessException {
+ AmbariConfigurationDAO dao = createMockBuilder(AmbariConfigurationDAO.class)
+ .addMockedMethods(methodMerge, methodRemove, methodCreate, methodFindByCategory)
+ .createMock();
+
+ EntityManager entityManager = createMock(EntityManager.class);
+ entityManager.flush();
+ expectLastCall().anyTimes();
+
+ Provider<EntityManager> entityManagerProvider = createMock(Provider.class);
+ expect(entityManagerProvider.get()).andReturn(entityManager).anyTimes();
+
+ fieldEntityManagerProvider.set(dao, entityManagerProvider);
+
+ return dao;
+ }
+
+ private List<AmbariConfigurationEntity> toEntities(String categoryName, Map<String, String> properties) {
+ List<AmbariConfigurationEntity> entities = new ArrayList<>();
+
+ for (Map.Entry<String, String> property : properties.entrySet()) {
+ AmbariConfigurationEntity entity = new AmbariConfigurationEntity();
+ entity.setCategoryName(categoryName);
+ entity.setPropertyName(property.getKey());
+ entity.setPropertyValue(property.getValue());
+ entities.add(entity);
+ }
+
+ return entities;
+ }
+
+ private void validateCapturedEntities(String expectedCategoryName, Map<String, String> expectedProperties, Capture<AmbariConfigurationEntity> capturedEntities) {
+ Assert.assertTrue(capturedEntities.hasCaptured());
+
+ List<AmbariConfigurationEntity> entities = capturedEntities.getValues();
+ Assert.assertNotNull(entities);
+
+ Map<String, String> capturedProperties = new TreeMap<>();
+ for (AmbariConfigurationEntity entity : entities) {
+ Assert.assertEquals(expectedCategoryName, entity.getCategoryName());
+ capturedProperties.put(entity.getPropertyName(), entity.getPropertyValue());
+ }
+
+ // Convert the Map to a TreeMap to help with comparisons
+ expectedProperties = new TreeMap<>(expectedProperties);
+ Assert.assertEquals(expectedProperties, capturedProperties);
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fa9ac55/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog300Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog300Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog300Test.java
index bd8f5cb..747f99b 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog300Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog300Test.java
@@ -17,6 +17,10 @@
*/
package org.apache.ambari.server.upgrade;
+import static org.apache.ambari.server.upgrade.UpgradeCatalog300.AMBARI_CONFIGURATION_CATEGORY_NAME_COLUMN;
+import static org.apache.ambari.server.upgrade.UpgradeCatalog300.AMBARI_CONFIGURATION_PROPERTY_NAME_COLUMN;
+import static org.apache.ambari.server.upgrade.UpgradeCatalog300.AMBARI_CONFIGURATION_PROPERTY_VALUE_COLUMN;
+import static org.apache.ambari.server.upgrade.UpgradeCatalog300.AMBARI_CONFIGURATION_TABLE;
import static org.apache.ambari.server.upgrade.UpgradeCatalog300.COMPONENT_DESIRED_STATE_TABLE;
import static org.apache.ambari.server.upgrade.UpgradeCatalog300.COMPONENT_STATE_TABLE;
import static org.apache.ambari.server.upgrade.UpgradeCatalog300.SECURITY_STATE_COLUMN;
@@ -42,6 +46,7 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import javax.persistence.EntityManager;
@@ -186,6 +191,15 @@ public class UpgradeCatalog300Test {
dbAccessor.dropColumn(SERVICE_DESIRED_STATE_TABLE, SECURITY_STATE_COLUMN);
expectLastCall().once();
+ // Ambari configuration table addition...
+ Capture<List<DBAccessor.DBColumnInfo>> ambariConfigurationTableColumns = newCapture();
+
+ dbAccessor.createTable(eq(AMBARI_CONFIGURATION_TABLE), capture(ambariConfigurationTableColumns));
+ expectLastCall().once();
+ dbAccessor.addPKConstraint(AMBARI_CONFIGURATION_TABLE, "PK_ambari_configuration", AMBARI_CONFIGURATION_CATEGORY_NAME_COLUMN, AMBARI_CONFIGURATION_PROPERTY_NAME_COLUMN);
+ expectLastCall().once();
+ // Ambari configuration table addition...
+
replay(dbAccessor, configuration);
Injector injector = Guice.createInjector(module);
@@ -197,6 +211,35 @@ public class UpgradeCatalog300Test {
Assert.assertEquals(null, capturedOpsDisplayNameColumn.getDefaultValue());
Assert.assertEquals(String.class, capturedOpsDisplayNameColumn.getType());
+ // Ambari configuration table addition...
+ Assert.assertTrue(ambariConfigurationTableColumns.hasCaptured());
+ List<DBAccessor.DBColumnInfo> columns = ambariConfigurationTableColumns.getValue();
+ Assert.assertEquals(3, columns.size());
+
+ for (DBAccessor.DBColumnInfo column : columns) {
+ String columnName = column.getName();
+
+ if (AMBARI_CONFIGURATION_CATEGORY_NAME_COLUMN.equals(columnName)) {
+ Assert.assertEquals(String.class, column.getType());
+ Assert.assertEquals(Integer.valueOf(100), column.getLength());
+ Assert.assertEquals(null, column.getDefaultValue());
+ Assert.assertFalse(column.isNullable());
+ } else if (AMBARI_CONFIGURATION_PROPERTY_NAME_COLUMN.equals(columnName)) {
+ Assert.assertEquals(String.class, column.getType());
+ Assert.assertEquals(Integer.valueOf(100), column.getLength());
+ Assert.assertEquals(null, column.getDefaultValue());
+ Assert.assertFalse(column.isNullable());
+ } else if (AMBARI_CONFIGURATION_PROPERTY_VALUE_COLUMN.equals(columnName)) {
+ Assert.assertEquals(String.class, column.getType());
+ Assert.assertEquals(Integer.valueOf(255), column.getLength());
+ Assert.assertEquals(null, column.getDefaultValue());
+ Assert.assertTrue(column.isNullable());
+ } else {
+ Assert.fail("Unexpected column name: " + columnName);
+ }
+ }
+ // Ambari configuration table addition...
+
verify(dbAccessor);
}
[17/50] [abbrv] ambari git commit: AMBARI-22411. Restart all required
services failed when running cluster with several patch upgrades applied
(ncole)
Posted by rl...@apache.org.
AMBARI-22411. Restart all required services failed when running cluster with several patch upgrades applied (ncole)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/068d82f7
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/068d82f7
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/068d82f7
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 068d82f700432cf5cfa75d20924443e998d8fe87
Parents: ec02a14
Author: Nate Cole <nc...@hortonworks.com>
Authored: Fri Nov 10 11:23:13 2017 -0500
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Fri Nov 10 12:00:14 2017 -0500
----------------------------------------------------------------------
.../AmbariCustomCommandExecutionHelper.java | 23 ++++----
.../AmbariManagementControllerImpl.java | 60 +++-----------------
.../internal/UpgradeResourceProvider.java | 8 +--
.../HDP/2.0.6/properties/stack_packages.json | 3 +-
.../AmbariManagementControllerImplTest.java | 2 +-
5 files changed, 25 insertions(+), 71 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/068d82f7/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
index e8febbb..dc6bbb7 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
@@ -1425,27 +1425,23 @@ public class AmbariCustomCommandExecutionHelper {
*
* @param actionExecContext the context
* @param cluster the cluster for the command
+ * @param stackId the stack id used to load service metainfo.
*
* @return a wrapper of the important JSON structures to add to a stage
*/
public ExecuteCommandJson getCommandJson(ActionExecutionContext actionExecContext,
- Cluster cluster, RepositoryVersionEntity repositoryVersion, String requestContext) throws AmbariException {
+ Cluster cluster, StackId stackId, String requestContext) throws AmbariException {
Map<String, String> commandParamsStage = StageUtils.getCommandParamsStage(actionExecContext, requestContext);
Map<String, String> hostParamsStage = new HashMap<>();
Map<String, Set<String>> clusterHostInfo;
String clusterHostInfoJson = "{}";
- StackId stackId = null;
- if (null != repositoryVersion) {
- stackId = repositoryVersion.getStackId();
- }
-
if (null != cluster) {
clusterHostInfo = StageUtils.getClusterHostInfo(cluster);
// Important, because this runs during Stack Uprade, it needs to use the effective Stack Id.
- hostParamsStage = createDefaultHostParams(cluster, repositoryVersion);
+ hostParamsStage = createDefaultHostParams(cluster, stackId);
String componentName = null;
String serviceName = null;
@@ -1454,7 +1450,7 @@ public class AmbariCustomCommandExecutionHelper {
serviceName = actionExecContext.getOperationLevel().getServiceName();
}
- if (serviceName != null && componentName != null && null != stackId) {
+ if (serviceName != null && componentName != null) {
Service service = cluster.getService(serviceName);
ServiceComponent component = service.getServiceComponent(componentName);
stackId = component.getDesiredStackId();
@@ -1473,6 +1469,10 @@ public class AmbariCustomCommandExecutionHelper {
clusterHostInfoJson = StageUtils.getGson().toJson(clusterHostInfo);
+ if (null == stackId && null != cluster) {
+ stackId = cluster.getDesiredStackVersion();
+ }
+
//Propogate HCFS service type info to command params
if (null != stackId) {
Map<String, ServiceInfo> serviceInfos = ambariMetaInfo.getServices(stackId.getStackName(),
@@ -1497,11 +1497,10 @@ public class AmbariCustomCommandExecutionHelper {
hostParamsStageJson);
}
- Map<String, String> createDefaultHostParams(Cluster cluster, RepositoryVersionEntity repositoryVersion) throws AmbariException {
- return createDefaultHostParams(cluster, repositoryVersion.getStackId());
- }
-
Map<String, String> createDefaultHostParams(Cluster cluster, StackId stackId) throws AmbariException {
+ if (null == stackId) {
+ stackId = cluster.getDesiredStackVersion();
+ }
TreeMap<String, String> hostLevelParams = new TreeMap<>();
StageUtils.useStackJdkIfExists(hostLevelParams, configs);
http://git-wip-us.apache.org/repos/asf/ambari/blob/068d82f7/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index 380e1b4..4c00f1f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -68,6 +68,8 @@ import java.util.concurrent.TimeUnit;
import javax.persistence.RollbackException;
+import org.apache.ambari.annotations.Experimental;
+import org.apache.ambari.annotations.ExperimentalFeature;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.ClusterNotFoundException;
import org.apache.ambari.server.DuplicateResourceException;
@@ -2838,7 +2840,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
if (StringUtils.isBlank(stage.getHostParamsStage())) {
RepositoryVersionEntity repositoryVersion = serviceComponent.getDesiredRepositoryVersion();
stage.setHostParamsStage(StageUtils.getGson().toJson(
- customCommandExecutionHelper.createDefaultHostParams(cluster, repositoryVersion)));
+ customCommandExecutionHelper.createDefaultHostParams(cluster, repositoryVersion.getStackId())));
}
@@ -3186,7 +3188,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
Map<String, String> hostParamsCmd = customCommandExecutionHelper.createDefaultHostParams(
- cluster, scHost.getServiceComponent().getDesiredRepositoryVersion());
+ cluster, scHost.getServiceComponent().getDesiredStackId());
Stage stage = createNewStage(0, cluster, 1, "", clusterHostInfoJson, "{}", "");
@@ -4154,56 +4156,10 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
actionManager,
actionRequest);
- RepositoryVersionEntity desiredRepositoryVersion = null;
-
- RequestOperationLevel operationLevel = actionExecContext.getOperationLevel();
- if (null != operationLevel && StringUtils.isNotBlank(operationLevel.getServiceName())) {
- Service service = cluster.getService(operationLevel.getServiceName());
- if (null != service) {
- desiredRepositoryVersion = service.getDesiredRepositoryVersion();
- }
- }
-
- if (null == desiredRepositoryVersion && CollectionUtils.isNotEmpty(actionExecContext.getResourceFilters())) {
- Set<RepositoryVersionEntity> versions = new HashSet<>();
-
- for (RequestResourceFilter filter : actionExecContext.getResourceFilters()) {
- RepositoryVersionEntity repoVersion = null;
-
- if (StringUtils.isNotBlank(filter.getServiceName())) {
- Service service = cluster.getService(filter.getServiceName());
-
- if (StringUtils.isNotBlank(filter.getComponentName())) {
- ServiceComponent serviceComponent = service.getServiceComponent(filter.getComponentName());
-
- repoVersion = serviceComponent.getDesiredRepositoryVersion();
- }
-
- if (null == repoVersion) {
- repoVersion = service.getDesiredRepositoryVersion();
- }
- }
-
- if (null != repoVersion) {
- versions.add(repoVersion);
- }
- }
-
- if (1 == versions.size()) {
- desiredRepositoryVersion = versions.iterator().next();
- } else if (versions.size() > 1) {
- Set<String> errors = new HashSet<>();
- for (RepositoryVersionEntity version : versions) {
- errors.add(String.format("%s/%s", version.getStackId(), version.getVersion()));
- }
- throw new IllegalArgumentException(String.format("More than one repository is resolved with this Action: %s",
- StringUtils.join(errors, ';')));
- }
- }
-
-
- ExecuteCommandJson jsons = customCommandExecutionHelper.getCommandJson(actionExecContext,
- cluster, desiredRepositoryVersion, requestContext);
+ @Experimental(feature=ExperimentalFeature.MULTI_SERVICE,
+ comment = "This must change with Multi-Service since the cluster won't have a desired stack version")
+ ExecuteCommandJson jsons = customCommandExecutionHelper.getCommandJson(actionExecContext, cluster,
+ null == cluster ? null : cluster.getDesiredStackVersion(), requestContext);
String commandParamsForStage = jsons.getCommandParamsForStage();
http://git-wip-us.apache.org/repos/asf/ambari/blob/068d82f7/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
index 14b1b86..d4111d6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
@@ -1073,7 +1073,7 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
actionContext.setAutoSkipFailures(context.isComponentFailureAutoSkipped());
ExecuteCommandJson jsons = s_commandExecutionHelper.get().getCommandJson(actionContext,
- cluster, effectiveRepositoryVersion, null);
+ cluster, effectiveRepositoryVersion.getStackId(), null);
Stage stage = s_stageFactory.get().createNew(request.getId().longValue(), "/tmp/ambari",
cluster.getClusterName(), cluster.getClusterId(), entity.getText(), jsons.getCommandParamsForStage(),
@@ -1155,7 +1155,7 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
actionContext.setMaintenanceModeHostExcluded(true);
ExecuteCommandJson jsons = s_commandExecutionHelper.get().getCommandJson(actionContext,
- cluster, effectiveRepositoryVersion, null);
+ cluster, effectiveRepositoryVersion.getStackId(), null);
Stage stage = s_stageFactory.get().createNew(request.getId().longValue(), "/tmp/ambari",
cluster.getClusterName(), cluster.getClusterId(), entity.getText(), jsons.getCommandParamsForStage(),
@@ -1220,7 +1220,7 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
actionContext.setMaintenanceModeHostExcluded(true);
ExecuteCommandJson jsons = s_commandExecutionHelper.get().getCommandJson(actionContext,
- cluster, effectiveRepositoryVersion, null);
+ cluster, effectiveRepositoryVersion.getStackId(), null);
Stage stage = s_stageFactory.get().createNew(request.getId().longValue(), "/tmp/ambari",
cluster.getClusterName(), cluster.getClusterId(), entity.getText(), jsons.getCommandParamsForStage(),
@@ -1361,7 +1361,7 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
actionContext.setMaintenanceModeHostExcluded(true);
ExecuteCommandJson jsons = s_commandExecutionHelper.get().getCommandJson(actionContext,
- cluster, context.getRepositoryVersion(), null);
+ cluster, context.getRepositoryVersion().getStackId(), null);
Stage stage = s_stageFactory.get().createNew(request.getId().longValue(), "/tmp/ambari",
cluster.getClusterName(), cluster.getClusterId(), stageText, jsons.getCommandParamsForStage(),
http://git-wip-us.apache.org/repos/asf/ambari/blob/068d82f7/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json b/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
index 23c6d32..68e6bf8 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
@@ -1277,8 +1277,7 @@
}
},
"upgrade-dependencies" : {
- "YARN": ["TEZ"],
- "TEZ": ["YARN"],
+ "HIVE": ["TEZ"],
"MAHOUT": ["MAPREDUCE2"]
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/068d82f7/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java
index 9547271..94c5ebe 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java
@@ -2138,7 +2138,7 @@ public class AmbariManagementControllerImplTest {
f.setAccessible(true);
f.set(helper, gson);
- Map<String, String> defaultHostParams = helper.createDefaultHostParams(cluster, repositoryVersionEntity);
+ Map<String, String> defaultHostParams = helper.createDefaultHostParams(cluster, repositoryVersionEntity.getStackId());
assertEquals(15, defaultHostParams.size());
assertEquals(MYSQL_JAR, defaultHostParams.get(DB_DRIVER_FILENAME));
[27/50] [abbrv] ambari git commit: AMBARI-22425 Ambari 3.0: Implement
new design for Admin View: fix checkboxes. (atkach)
Posted by rl...@apache.org.
AMBARI-22425 Ambari 3.0: Implement new design for Admin View: fix checkboxes. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d11faab1
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d11faab1
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d11faab1
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: d11faab139761a3e32da773e190951d10d1166f1
Parents: 7428e51
Author: Andrii Tkach <at...@apache.org>
Authored: Mon Nov 13 13:55:43 2017 +0200
Committer: Andrii Tkach <at...@apache.org>
Committed: Tue Nov 14 11:21:46 2017 +0200
----------------------------------------------------------------------
.../resources/ui/admin-web/app/styles/main.css | 15 ++++----
.../ui/admin-web/app/styles/top-nav.css | 3 ++
.../admin-web/app/views/ambariViews/create.html | 20 +++++------
.../admin-web/app/views/ambariViews/edit.html | 37 +++++++++-----------
.../app/views/authentication/main.html | 8 ++---
.../app/views/modals/AddVersionModal.html | 14 ++++----
.../admin-web/app/views/stackVersions/list.html | 11 ++++--
.../views/stackVersions/stackVersionPage.html | 27 +++++++-------
8 files changed, 65 insertions(+), 70 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d11faab1/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css b/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
index 4224f62..9838227 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
@@ -459,6 +459,11 @@ table.no-border tr td{
vertical-align: top;
}
+.table td > .checkbox {
+ margin-bottom: 0;
+ margin-top: 0;
+}
+
.groups-pane table ul{
list-style-type: none;
margin: 0;
@@ -821,15 +826,6 @@ accordion .panel-group .panel{
padding-left: 19px;
}
-.repo-version-inline {
- left: 11%;
-}
-
-.repo-version-inline .repo-version-label {
- text-align: left;
-
-}
-
.repo-version-inline .dot {
padding-right: 15px;
}
@@ -1164,6 +1160,7 @@ thead.view-permission-header > tr > th {
}
.register-version-form .details-panel .control-label {
+ line-height: 20px;
text-align: left;
padding: 7px 2px;
font-weight: normal;
http://git-wip-us.apache.org/repos/asf/ambari/blob/d11faab1/ambari-admin/src/main/resources/ui/admin-web/app/styles/top-nav.css
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/styles/top-nav.css b/ambari-admin/src/main/resources/ui/admin-web/app/styles/top-nav.css
index f93b2e6..327dc7f 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/styles/top-nav.css
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/styles/top-nav.css
@@ -37,6 +37,9 @@
font-size: 16px;
}
+#top-nav .container {
+ background: #fff;
+}
/** Override bootstrap styles **/
@media (min-width: 0) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/d11faab1/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/create.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/create.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/create.html
index 25f1487..81171c1 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/create.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/create.html
@@ -80,9 +80,8 @@
<div class="form-group">
<div class="col-sm-10 col-sm-offset-3">
<div class="checkbox">
- <label>
- <input type="checkbox" ng-model='instance.visible' class="visibilityCheckbox"> {{'views.visible' | translate}}
- </label>
+ <input type="checkbox" ng-model='instance.visible' id="visibility-checkbox" class="visibilityCheckbox">
+ <label for="visibility-checkbox">{{'views.visible' | translate}}</label>
</div>
</div>
</div>
@@ -122,9 +121,8 @@
<div class="panel-body property-form" popover="{{clusterConfigurableErrorMsg}}" popover-trigger="mouseenter">
<div class="checkbox create-checkbox-cluster">
- <label>
- <input type="radio" ng-disabled="!clusterConfigurable || noLocalClusterAvailible" ng-model="instance.clusterType" ng-change="enableLocalCluster()" value="LOCAL_AMBARI" class="visibilityCheckbox"> {{'views.localCluster' | translate}}
- </label>
+ <input type="radio" id="local-cluster" ng-disabled="!clusterConfigurable || noLocalClusterAvailible" ng-model="instance.clusterType" ng-change="enableLocalCluster()" value="LOCAL_AMBARI" class="visibilityCheckbox">
+ <label for="local-cluster">{{'views.localCluster' | translate}}</label>
</div>
<div class="form-horizontal property-form">
@@ -143,9 +141,8 @@
<div class="panel-body property-form" popover="{{clusterConfigurableErrorMsg}}" popover-trigger="mouseenter">
<div class="checkbox create-checkbox-cluster">
- <label>
- <input type="radio" ng-disabled="!clusterConfigurable || noRemoteClusterAvailible" ng-model="instance.clusterType" ng-change="enableLocalCluster()" value="REMOTE_AMBARI" class="visibilityCheckbox"> {{'views.remoteCluster' | translate}}
- </label>
+ <input type="radio" id="remote-cluster" ng-disabled="!clusterConfigurable || noRemoteClusterAvailible" ng-model="instance.clusterType" ng-change="enableLocalCluster()" value="REMOTE_AMBARI" class="visibilityCheckbox">
+ <label for="remote-cluster">{{'views.remoteCluster' | translate}}</label>
</div>
<div class="form-horizontal property-form">
@@ -164,9 +161,8 @@
<div class="panel-body property-form" ng-hide="!numberOfClusterConfigs">
<div class="checkbox">
- <label>
- <input type="radio" ng-model="instance.clusterType" value="NONE" class="visibilityCheckbox"> {{'views.custom' | translate}}
- </label>
+ <input type="radio" id="custom-view" ng-model="instance.clusterType" value="NONE" class="visibilityCheckbox">
+ <label for="custom-view">{{'views.custom' | translate}}</label>
</div>
<div class="alert alert-danger bottom-margin top-margin" ng-show='form.instanceCreateForm.generalValidationError'>
{{form.instanceCreateForm.generalValidationError}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d11faab1/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html
index f91862d..a86e285 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html
@@ -107,9 +107,8 @@
<div class="form-group">
<div class="col-sm-offset-3 col-sm-10">
<div class="checkbox">
- <label>
- <input type="checkbox" ng-model="settings.visible" ng-class="instancevisibility-input"> {{'views.visible' | translate}}
- </label>
+ <input type="checkbox" class="form-control" ng-model="settings.visible" id="visible" ng-class="instancevisibility-input">
+ <label for="visible">{{'views.visible' | translate}}</label>
</div>
</div>
</div>
@@ -173,9 +172,8 @@
</div>
<div class="panel-body property-form" popover="{{clusterConfigurableErrorMsg}}" popover-trigger="mouseenter">
<div class="checkbox">
- <label>
- <input type="radio" ng-model="data.clusterType" ng-change="enableLocalCluster()" ng-disabled="!clusterConfigurable || editConfigurationDisabled || noLocalClusterAvailible" value="LOCAL_AMBARI" class="visibilityCheckbox"> {{'views.localCluster' | translate}}
- </label>
+ <input type="radio" id="local-cluster" ng-model="data.clusterType" ng-change="enableLocalCluster()" ng-disabled="!clusterConfigurable || editConfigurationDisabled || noLocalClusterAvailible" value="LOCAL_AMBARI" class="visibilityCheckbox form-control">
+ <label for="local-cluster">{{'views.localCluster' | translate}}</label>
</div>
<div class="form-horizontal property-form">
<div class="form-group">
@@ -189,9 +187,8 @@
</div>
<p> </p>
<div class="checkbox">
- <label>
- <input type="radio" ng-model="data.clusterType" ng-change="enableLocalCluster()" ng-disabled="!clusterConfigurable || editConfigurationDisabled || noRemoteClusterAvailible" value="REMOTE_AMBARI" class="visibilityCheckbox"> {{'views.remoteCluster' | translate}}
- </label>
+ <input type="radio" id="remote-cluster" ng-model="data.clusterType" ng-change="enableLocalCluster()" ng-disabled="!clusterConfigurable || editConfigurationDisabled || noRemoteClusterAvailible" value="REMOTE_AMBARI" class="visibilityCheckbox form-control">
+ <label for="remote-cluster">{{'views.remoteCluster' | translate}}</label>
</div>
<div class="form-horizontal property-form">
<div class="form-group">
@@ -205,15 +202,14 @@
</div>
<p> </p>
<div class="checkbox" ng-hide="isConfigurationEmpty">
- <label>
- <input type="radio"
- ng-model="data.clusterType"
- ng-disabled="editConfigurationDisabled"
- value="NONE"
- ng-change="disableLocalCluster()"
- class="visibilityCheckbox">
- {{'views.custom' | translate}}
- </label>
+ <input type="radio"
+ id="custom-view"
+ ng-model="data.clusterType"
+ ng-disabled="editConfigurationDisabled"
+ value="NONE"
+ ng-change="disableLocalCluster()"
+ class="visibilityCheckbox">
+ <label for="custom-view">{{'views.custom' | translate}}</label>
</div>
</div>
<div class="panel-body edit-view-custom-wrap">
@@ -289,9 +285,8 @@
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox col-sm-12" ng-repeat="key in permissionRoles">
<div ng-init="i18nKey = 'views.clusterPermissions.' + key.split('.').join('').toLowerCase()">
- <label>
- <input type="checkbox" ng-model="permissionsEdit['VIEW.USER']['ROLE'][key]"> {{i18nKey | translate}}
- </label>
+ <input ng-attr-id="{{i18nKey}}" type="checkbox" class="form-control" ng-model="permissionsEdit['VIEW.USER']['ROLE'][key]">
+ <label ng-attr-for="{{i18nKey}}">{{i18nKey | translate}}</label>
</div>
</div>
<a href ng-click="checkAllRoles()">{{'common.controls.checkAll' | translate}}</a> | <a href ng-click="clearAllRoles()">{{'common.controls.clearAll' | translate}}</a>
http://git-wip-us.apache.org/repos/asf/ambari/blob/d11faab1/ambari-admin/src/main/resources/ui/admin-web/app/views/authentication/main.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/authentication/main.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/authentication/main.html
index fddedb9..0275a21 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/authentication/main.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/authentication/main.html
@@ -58,10 +58,8 @@
</div>
</div>
<div class="form-group">
+ <input type="checkbox" id="ssl" ng-model="connectivity.ssl" class="col-sm-8">
<label for="ssl" class="control-label col-sm-4">{{'authentication.connectivity.ssl' | translate}}</label>
- <div class="col-sm-8">
- <input type="checkbox" id="ssl" ng-model="connectivity.ssl">
- </div>
</div>
<div class="form-group">
<label for="trust-store" class="control-label col-sm-4">{{'authentication.connectivity.trustStore.label' | translate}}</label>
@@ -121,12 +119,12 @@
<form class="form-horizontal" ng-submit="detectAttributes()">
<div class="form-group col-sm-12">{{'authentication.attributes.detection.label' | translate}}</div>
<div class="form-group">
+ <input type="radio" id="manual-detection" name="detection" ng-model="attributes.detection" ng-disabled="isAttributeDetectionRunning" value="manual">
<label for="manual-detection" class="col-sm-12">
- <input type="radio" id="manual-detection" name="detection" ng-model="attributes.detection" ng-disabled="isAttributeDetectionRunning" value="manual">
{{'authentication.attributes.detection.options.manual' | translate}}
</label>
+ <input type="radio" id="auto-detection" name="detection" ng-model="attributes.detection" ng-disabled="isAttributeDetectionRunning" value="auto">
<label for="auto-detection" class="col-sm-12">
- <input type="radio" id="auto-detection" name="detection" ng-model="attributes.detection" ng-disabled="isAttributeDetectionRunning" value="auto">
{{'authentication.attributes.detection.options.auto' | translate}}
</label>
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/d11faab1/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/AddVersionModal.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/AddVersionModal.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/AddVersionModal.html
index 457be7b..be11e1a 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/AddVersionModal.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/AddVersionModal.html
@@ -20,9 +20,10 @@
</div>
<br>
<div class="clearfix register-version-options" ng-click="selectedLocalOption.index=1">
- <div class="option-radio-button">
- <label class="option-label">
- <input type="radio" ng-model="selectedLocalOption.index" value="1"> {{'versions.uploadFile' | translate}}
+ <div class="option-radio-button checkbox">
+ <input type="radio" id="upload-file" ng-model="selectedLocalOption.index" value="1">
+ <label for="upload-file" class="option-label">
+ {{'versions.uploadFile' | translate}}
</label>
</div>
<div class="col-sm-7 choose-file-input">
@@ -31,9 +32,10 @@
</div>
</div>
<div class="clearfix register-version-options bottom-margin" ng-click="selectedLocalOption.index=2">
- <div class="option-radio-button">
- <label class="option-label">
- <input type="radio" ng-model="selectedLocalOption.index" value="2"> {{'versions.enterURL' | translate}}
+ <div class="option-radio-button checkbox">
+ <input type="radio" id="entire-url" ng-model="selectedLocalOption.index" value="2">
+ <label for="entire-url" class="option-label">
+ {{'versions.enterURL' | translate}}
</label>
</div>
<div class="col-sm-9">
http://git-wip-us.apache.org/repos/asf/ambari/blob/d11faab1/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html
index 99f9ac0..a411640 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html
@@ -97,11 +97,11 @@
<span class="label {{'status-' + repo.status}}">{{'versions.installed' | translate}}: {{repo.installedHosts}}/{{repo.totalHosts}}</span>
</div>
<div ng-show="!repo.cluster">
- <div class="btn-group display-inline-block" dropdown is-open="viewsdropdown.isopen" ng-mouseover="viewsdropdown.isopen=true" ng-mouseout="viewsdropdown.isopen=false" ng-init="viewsdropdown.isopen=false">
+ <div class="btn-group" ng-class="{open: viewsdropdown.isopen}" ng-mouseover="viewsdropdown.isopen=true" ng-mouseout="viewsdropdown.isopen=false" ng-init="viewsdropdown.isopen=false">
<a class="btn dropdown-toggle">
<span>{{'versions.installOn' | translate}}</span>
</a>
- <ul class="dropdown-menu" ng-show="viewsdropdown.isopen">
+ <ul class="dropdown-menu">
<li ng-repeat="cluster in dropDownClusters">
<a href="javascript:void(null)" ng-click="goToCluster()">
<span>{{cluster.Clusters.cluster_name}}</span>
@@ -111,7 +111,12 @@
</div>
</div>
</td>
- <td class="text-center"><input type="checkbox" data-ng-model="repo.hidden" data-ng-change="toggleVisibility(repo)" data-ng-disabled="!isHideCheckBoxEnabled(repo)"/></td>
+ <td class="text-center">
+ <div class="checkbox">
+ <input ng-attr-id="{{ 'hidden-' + repo.id }}" type="checkbox" class="form-control" data-ng-model="repo.hidden" data-ng-change="toggleVisibility(repo)" data-ng-disabled="!isHideCheckBoxEnabled(repo)"/>
+ <label ng-attr-for="{{ 'hidden-' + repo.id }}"><span></span></label>
+ </div>
+ </td>
</tr>
</tbody>
</table>
http://git-wip-us.apache.org/repos/asf/ambari/blob/d11faab1/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/stackVersionPage.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/stackVersionPage.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/stackVersionPage.html
index 85d659d..ea30824 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/stackVersionPage.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/stackVersionPage.html
@@ -119,14 +119,14 @@
</div>
<div id="upload-definition-file-panel" ng-if="createController">
- <div class="col-sm-12 big-radio clearfix hide-soft" ng-class="{'disabled' : networkLost || useRedhatSatellite,'visible':stackRepoUpdateLinkExists}">
- <input type="radio" ng-model="selectedOption.index" value="1" ng-change="togglePublicLocalOptionSelect()" ng-disabled="networkLost || useRedhatSatellite">
- <span>{{'versions.usePublic' | translate}}</span>
+ <div class="checkbox col-sm-12 big-radio clearfix hide-soft" ng-class="{'disabled' : networkLost || useRedhatSatellite,'visible':stackRepoUpdateLinkExists}">
+ <input id="use-public" type="radio" ng-model="selectedOption.index" value="1" ng-change="togglePublicLocalOptionSelect()" ng-disabled="networkLost || useRedhatSatellite">
+ <label for="use-public">{{'versions.usePublic' | translate}}</label>
<a id="public-disabled-link" href="javascript:void(0);" ng-if="networkLost" ng-click="showPublicRepoDisabledDialog()">{{'versions.networkIssues.networkLost'| translate}}</a>
</div>
- <div class="col-sm-12 big-radio clearfix">
- <input type="radio" ng-model="selectedOption.index" value="2" ng-change="togglePublicLocalOptionSelect()">
- {{'versions.useLocal' | translate}}
+ <div class="checkbox col-sm-12 big-radio clearfix">
+ <input id="use-local" type="radio" ng-model="selectedOption.index" value="2" ng-change="togglePublicLocalOptionSelect()">
+ <label for="use-local">{{'versions.useLocal' | translate}}</label>
</div>
</div>
@@ -204,22 +204,21 @@
</div>
</div>
<div class="clearfix advanced-radio-buttons">
- <div class="col-sm-9" id="skip-validation">
+ <div class="col-sm-9">
<div class="checkbox">
- <label>
- <input type="checkbox" ng-model="skipValidation" ng-change="clearErrors()"
- ng-disabled="useRedhatSatellite">
+ <input type="checkbox" id="skip-validation" ng-model="skipValidation" ng-change="clearErrors()" ng-disabled="useRedhatSatellite">
+ <label for="skip-validation">
<span ng-class="{'disabled' : useRedhatSatellite}">{{'versions.skipValidation' | translate}}</span>
<i class="fa fa-question-circle"
tooltip-html-unsafe="{{'versions.alerts.skipValidationWarning' | translate}}" aria-hidden="true"></i>
</label>
</div>
</div>
- <div class="col-sm-9" id="use-redhat">
+ <div class="col-sm-9">
<div class="checkbox">
- <label>
- <input type="checkbox" ng-model="useRedhatSatellite" ng-change="clearErrors()"
- ng-disabled="isPublicRepoSelected()">
+ <input type="checkbox" id="use-redhat" ng-model="useRedhatSatellite" ng-change="clearErrors()"
+ ng-disabled="isPublicRepoSelected()">
+ <label for="use-redhat">
<span ng-class="{'disabled' : isPublicRepoSelected()}"
tooltip="{{(isPublicRepoSelected())? ('versions.useRedhatSatellite.disabledMsg' | translate) : ''}}">{{'versions.useRedhatSatellite.title' | translate}}</span>
<i class="fa fa-question-circle"
[22/50] [abbrv] ambari git commit: AMBARI-22387. Create a Pre-Upgrade
Check Warning About LZO. Fix import (dlysnichenko)
Posted by rl...@apache.org.
AMBARI-22387. Create a Pre-Upgrade Check Warning About LZO. Fix import (dlysnichenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6e706d42
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6e706d42
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6e706d42
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 6e706d427f1f9bcfc61f986ea1a1d5f5a28d500f
Parents: 76349ac
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Mon Nov 13 16:35:23 2017 +0200
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Mon Nov 13 16:35:23 2017 +0200
----------------------------------------------------------------------
.../src/main/java/org/apache/ambari/server/checks/LZOCheck.java | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/6e706d42/ambari-server/src/main/java/org/apache/ambari/server/checks/LZOCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/LZOCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/LZOCheck.java
index 3000b79..9c0286b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/LZOCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/LZOCheck.java
@@ -19,7 +19,6 @@ package org.apache.ambari.server.checks;
import java.util.ArrayList;
import java.util.List;
-import java.util.Set;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.controller.PrereqCheckRequest;
[29/50] [abbrv] ambari git commit: AMBARI-22426. Push down Logger
instances (adoroszlai)
Posted by rl...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/FlumeServiceCalculatedState.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/FlumeServiceCalculatedState.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/FlumeServiceCalculatedState.java
index ca4fe6e..0162928 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/FlumeServiceCalculatedState.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/FlumeServiceCalculatedState.java
@@ -27,6 +27,8 @@ import org.apache.ambari.server.controller.ServiceComponentHostRequest;
import org.apache.ambari.server.controller.ServiceComponentHostResponse;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.State;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Determines the service status for Flume. Generically, this means that
@@ -40,6 +42,8 @@ import org.apache.ambari.server.state.State;
public final class FlumeServiceCalculatedState extends DefaultServiceCalculatedState
implements ServiceCalculatedState {
+ private static final Logger LOG = LoggerFactory.getLogger(FlumeServiceCalculatedState.class);
+
@Override
public State getState(String clusterName, String serviceName) {
try {
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/HBaseServiceCalculatedState.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/HBaseServiceCalculatedState.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/HBaseServiceCalculatedState.java
index eac0dce..58d1687 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/HBaseServiceCalculatedState.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/HBaseServiceCalculatedState.java
@@ -32,6 +32,8 @@ import org.apache.ambari.server.state.ComponentInfo;
import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.StackId;
import org.apache.ambari.server.state.State;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Calculator of HBase service state.
@@ -40,6 +42,8 @@ import org.apache.ambari.server.state.State;
public final class HBaseServiceCalculatedState extends DefaultServiceCalculatedState
implements ServiceCalculatedState {
+ private static final Logger LOG = LoggerFactory.getLogger(HBaseServiceCalculatedState.class);
+
@Override
public State getState(String clusterName, String serviceName) {
try {
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/HDFSServiceCalculatedState.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/HDFSServiceCalculatedState.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/HDFSServiceCalculatedState.java
index 7bbad2a..68cb4f1 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/HDFSServiceCalculatedState.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/HDFSServiceCalculatedState.java
@@ -32,6 +32,8 @@ import org.apache.ambari.server.state.ComponentInfo;
import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.StackId;
import org.apache.ambari.server.state.State;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Calculator of HDFS service state.
@@ -40,6 +42,8 @@ import org.apache.ambari.server.state.State;
public final class HDFSServiceCalculatedState extends DefaultServiceCalculatedState
implements ServiceCalculatedState {
+ private static final Logger LOG = LoggerFactory.getLogger(HDFSServiceCalculatedState.class);
+
@Override
public State getState(String clusterName, String serviceName) {
try {
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/HiveServiceCalculatedState.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/HiveServiceCalculatedState.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/HiveServiceCalculatedState.java
index 77e44a5..353cf5f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/HiveServiceCalculatedState.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/HiveServiceCalculatedState.java
@@ -32,6 +32,8 @@ import org.apache.ambari.server.state.ComponentInfo;
import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.StackId;
import org.apache.ambari.server.state.State;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Calculator of HIVE service state.
@@ -40,6 +42,8 @@ import org.apache.ambari.server.state.State;
public final class HiveServiceCalculatedState extends DefaultServiceCalculatedState
implements ServiceCalculatedState {
+ private static final Logger LOG = LoggerFactory.getLogger(HiveServiceCalculatedState.class);
+
@Override
public State getState(String clusterName, String serviceName) {
try {
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/OozieServiceCalculatedState.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/OozieServiceCalculatedState.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/OozieServiceCalculatedState.java
index 1803f70..6c55d0b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/OozieServiceCalculatedState.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/OozieServiceCalculatedState.java
@@ -32,6 +32,8 @@ import org.apache.ambari.server.state.ComponentInfo;
import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.StackId;
import org.apache.ambari.server.state.State;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Calculator of Oozie service state.
@@ -40,6 +42,8 @@ import org.apache.ambari.server.state.State;
public final class OozieServiceCalculatedState extends DefaultServiceCalculatedState
implements ServiceCalculatedState {
+ private static final Logger LOG = LoggerFactory.getLogger(DefaultServiceCalculatedState.class);
+
@Override
public State getState(String clusterName, String serviceName) {
try {
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/YARNServiceCalculatedState.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/YARNServiceCalculatedState.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/YARNServiceCalculatedState.java
index 2f1619f..23f5f4c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/YARNServiceCalculatedState.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/YARNServiceCalculatedState.java
@@ -32,6 +32,8 @@ import org.apache.ambari.server.state.ComponentInfo;
import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.StackId;
import org.apache.ambari.server.state.State;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Calculator of YARN service state.
@@ -40,6 +42,8 @@ import org.apache.ambari.server.state.State;
public final class YARNServiceCalculatedState extends DefaultServiceCalculatedState
implements ServiceCalculatedState {
+ private static final Logger LOG = LoggerFactory.getLogger(YARNServiceCalculatedState.class);
+
@Override
public State getState(String clusterName, String serviceName) {
try {
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConnectionConfigService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConnectionConfigService.java b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConnectionConfigService.java
index 9afcf51..82b527f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConnectionConfigService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConnectionConfigService.java
@@ -35,7 +35,7 @@ import org.slf4j.LoggerFactory;
@Singleton
public class DefaultLdapConnectionConfigService implements LdapConnectionConfigService {
- private static Logger LOG = LoggerFactory.getLogger(DefaultLdapConnectionConfigService.class);
+ private static final Logger LOG = LoggerFactory.getLogger(DefaultLdapConnectionConfigService.class);
@Inject
public DefaultLdapConnectionConfigService() {
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RemoteAmbariClusterEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RemoteAmbariClusterEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RemoteAmbariClusterEntity.java
index 4f10d6f..aad37d8 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RemoteAmbariClusterEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RemoteAmbariClusterEntity.java
@@ -65,7 +65,7 @@ public class RemoteAmbariClusterEntity {
/**
* The logger.
*/
- protected final static Logger LOG = LoggerFactory.getLogger(RemoteAmbariClusterEntity.class);
+ private static final Logger LOG = LoggerFactory.getLogger(RemoteAmbariClusterEntity.class);
@Id
@Column(name = "cluster_id", nullable = false)
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProvider.java
index b7ff297..b2cdb1d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProvider.java
@@ -42,7 +42,7 @@ import com.google.inject.Inject;
* Provides LDAP user authorization logic for Ambari Server
*/
public class AmbariLdapAuthenticationProvider implements AuthenticationProvider {
- Logger LOG = LoggerFactory.getLogger(AmbariLdapAuthenticationProvider.class);
+ static Logger LOG = LoggerFactory.getLogger(AmbariLdapAuthenticationProvider.class); // exposed and mutable for "test"
Configuration configuration;
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialProvider.java
index 1f2f6db..ce0e843 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialProvider.java
@@ -42,7 +42,7 @@ public class CredentialProvider {
'2', '3', '4', '5', '6', '7', '8', '9'};
private CredentialStore keystoreService;
- static final Logger LOG = LoggerFactory.getLogger(CredentialProvider.class);
+ private static final Logger LOG = LoggerFactory.getLogger(CredentialProvider.class);
public CredentialProvider(String masterKey, File masterKeyLocation,
boolean isMasterKeyPersisted, File masterKeyStoreLocation) throws AmbariException {
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/KDCKerberosOperationHandler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/KDCKerberosOperationHandler.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/KDCKerberosOperationHandler.java
index e5696cd..bf3ac22 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/KDCKerberosOperationHandler.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/KDCKerberosOperationHandler.java
@@ -42,7 +42,7 @@ import org.slf4j.LoggerFactory;
* This implementation provides kinit functionality and keytab file caching utilities for classes.
*/
abstract class KDCKerberosOperationHandler extends KerberosOperationHandler {
- private static Logger LOG = LoggerFactory.getLogger(KDCKerberosOperationHandler.class);
+ private static final Logger LOG = LoggerFactory.getLogger(KDCKerberosOperationHandler.class);
/**
* The FQDN of the host where KDC administration server is
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/state/services/MetricsRetrievalService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/services/MetricsRetrievalService.java b/ambari-server/src/main/java/org/apache/ambari/server/state/services/MetricsRetrievalService.java
index 510e706..7e5aad1 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/services/MetricsRetrievalService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/services/MetricsRetrievalService.java
@@ -101,7 +101,7 @@ public class MetricsRetrievalService extends AbstractService {
/**
* Logger.
*/
- protected final static Logger LOG = LoggerFactory.getLogger(MetricsRetrievalService.class);
+ private static final Logger LOG = LoggerFactory.getLogger(MetricsRetrievalService.class);
/**
* The timeout for exceptions which are caught and then cached to prevent log
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/state/stack/OsFamily.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/OsFamily.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/OsFamily.java
index c0483e8..b84de01 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/OsFamily.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/OsFamily.java
@@ -53,7 +53,7 @@ public class OsFamily {
private final String OS_VERSION = "versions";
private final String LOAD_CONFIG_MSG = "Could not load OS family definition from %s file";
private final String FILE_NAME = "os_family.json";
- private final Logger LOG = LoggerFactory.getLogger(OsFamily.class);
+ private static final Logger LOG = LoggerFactory.getLogger(OsFamily.class);
private Map<String, JsonOsFamilyEntry> osMap = null;
private JsonOsFamilyRoot jsonOsFamily = null;
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java
index 7bd377f..740dd91 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java
@@ -51,7 +51,7 @@ import org.slf4j.LoggerFactory;
*/
public class ClusterConfigurationRequest {
- protected final static Logger LOG = LoggerFactory.getLogger(ClusterConfigurationRequest.class);
+ private static final Logger LOG = LoggerFactory.getLogger(ClusterConfigurationRequest.class);
/**
* a regular expression Pattern used to find "clusterHostInfo.(component_name)_host" placeholders in strings
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java
index 12af131..63898ba 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java
@@ -63,7 +63,7 @@ import com.google.inject.persist.Transactional;
@Singleton
public class PersistedStateImpl implements PersistedState {
- protected final static Logger LOG = LoggerFactory.getLogger(PersistedState.class);
+ private static final Logger LOG = LoggerFactory.getLogger(PersistedState.class);
@Inject
private TopologyRequestDAO topologyRequestDAO;
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/utils/RetryHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/utils/RetryHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/utils/RetryHelper.java
index d732edf..14c276c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/utils/RetryHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/utils/RetryHelper.java
@@ -34,7 +34,7 @@ import org.slf4j.LoggerFactory;
* TODO injection as Guice singleon, static for now to avoid major modifications
*/
public class RetryHelper {
- protected final static Logger LOG = LoggerFactory.getLogger(RetryHelper.class);
+ private static final Logger LOG = LoggerFactory.getLogger(RetryHelper.class);
private static Clusters s_clusters;
private static ThreadLocal<Set<Cluster>> affectedClusters = new ThreadLocal<Set<Cluster>>(){
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/view/ViewDataMigrationUtility.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewDataMigrationUtility.java b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewDataMigrationUtility.java
index 55f85a7..9712ca4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewDataMigrationUtility.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewDataMigrationUtility.java
@@ -37,7 +37,7 @@ public class ViewDataMigrationUtility {
/**
* The logger.
*/
- protected final static Logger LOG = LoggerFactory.getLogger(ViewDataMigrationUtility.class);
+ private static final Logger LOG = LoggerFactory.getLogger(ViewDataMigrationUtility.class);
/**
* The View Registry.
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/view/ViewExtractor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewExtractor.java b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewExtractor.java
index ad1cc52..d729942 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewExtractor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewExtractor.java
@@ -52,7 +52,7 @@ public class ViewExtractor {
/**
* The logger.
*/
- protected final static Logger LOG = LoggerFactory.getLogger(ViewExtractor.class);
+ private static final Logger LOG = LoggerFactory.getLogger(ViewExtractor.class);
// ----- ViewExtractor -----------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java
index c50276e..f071262 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java
@@ -205,7 +205,7 @@ public class ViewRegistry {
/**
* The logger.
*/
- protected final static Logger LOG = LoggerFactory.getLogger(ViewRegistry.class);
+ private static final Logger LOG = LoggerFactory.getLogger(ViewRegistry.class);
/**
* View Data Migration Utility
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/view/ViewSubResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewSubResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewSubResourceProvider.java
index 5cceb1e..5f6201a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewSubResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewSubResourceProvider.java
@@ -47,6 +47,8 @@ import org.apache.ambari.server.controller.utilities.PropertyHelper;
import org.apache.ambari.server.orm.entities.ViewEntity;
import org.apache.ambari.server.orm.entities.ViewInstanceEntity;
import org.apache.ambari.view.ReadRequest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* An SPI resource provider implementation used to adapt a
@@ -55,6 +57,8 @@ import org.apache.ambari.view.ReadRequest;
*/
public class ViewSubResourceProvider extends AbstractResourceProvider {
+ private static final Logger LOG = LoggerFactory.getLogger(ViewSubResourceProvider.class);
+
private static final String VIEW_NAME_PROPERTY_ID = "view_name";
private static final String VIEW_VERSION_PROPERTY_ID = "version";
private static final String INSTANCE_NAME_PROPERTY_ID = "instance_name";
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed7e121f/ambari-server/src/main/java/org/apache/ambari/server/view/persistence/DataStoreImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/persistence/DataStoreImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/view/persistence/DataStoreImpl.java
index 5d4c758..aa48315 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/view/persistence/DataStoreImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/view/persistence/DataStoreImpl.java
@@ -119,7 +119,7 @@ public class DataStoreImpl implements DataStore {
/**
* The logger.
*/
- protected final static Logger LOG = LoggerFactory.getLogger(DataStoreImpl.class);
+ private static final Logger LOG = LoggerFactory.getLogger(DataStoreImpl.class);
/**
* Max length of entity string field.
[10/50] [abbrv] ambari git commit: AMBARI-22400 Ambari 3.0: Implement
new design for Admin View: Cluster Information page. (atkach)
Posted by rl...@apache.org.
AMBARI-22400 Ambari 3.0: Implement new design for Admin View: Cluster Information page. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/430dcbf1
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/430dcbf1
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/430dcbf1
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 430dcbf1224996c76276a8c40fb58eb54addd10a
Parents: e968b12
Author: Andrii Tkach <at...@apache.org>
Authored: Thu Nov 9 16:13:29 2017 +0200
Committer: Andrii Tkach <at...@apache.org>
Committed: Thu Nov 9 16:53:02 2017 +0200
----------------------------------------------------------------------
.../main/resources/ui/admin-web/app/index.html | 3 +-
.../app/scripts/controllers/AppCtrl.js | 2 +-
.../controllers/ClusterInformationCtrl.js | 65 +++++++++++
.../controllers/clusters/ExportBlueprintCtrl.js | 58 ----------
.../app/scripts/controllers/mainCtrl.js | 27 -----
.../ui/admin-web/app/scripts/i18n.config.js | 13 +--
.../ui/admin-web/app/scripts/routes.js | 59 +++++-----
.../app/styles/cluster-information.css | 59 ++++++++++
.../resources/ui/admin-web/app/styles/main.css | 98 -----------------
.../admin-web/app/views/clusterInformation.html | 66 ++++++++++++
.../app/views/clusters/exportBlueprint.html | 40 -------
.../ui/admin-web/app/views/groups/list.html | 3 +-
.../resources/ui/admin-web/app/views/main.html | 107 -------------------
.../app/views/remoteClusters/list.html | 3 +-
.../ui/admin-web/app/views/sideNav.html | 19 ++--
.../admin-web/app/views/stackVersions/list.html | 3 +-
.../ui/admin-web/app/views/users/list.html | 3 +-
.../test/unit/services/Utility_test.js | 2 +-
18 files changed, 240 insertions(+), 390 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/430dcbf1/ambari-admin/src/main/resources/ui/admin-web/app/index.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/index.html b/ambari-admin/src/main/resources/ui/admin-web/app/index.html
index 41cc60f..2b350f0 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/index.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/index.html
@@ -121,7 +121,7 @@
<script src="scripts/app.js"></script>
<script src="scripts/routes.js"></script>
<script src="scripts/i18n.config.js"></script>
-<script src="scripts/controllers/mainCtrl.js"></script>
+<script src="scripts/controllers/ClusterInformationCtrl.js"></script>
<script src="scripts/controllers/AppCtrl.js"></script>
<script src="scripts/controllers/SideNavCtrl.js"></script>
<script src="scripts/controllers/authentication/AuthenticationMainCtrl.js"></script>
@@ -142,7 +142,6 @@
<script src="scripts/controllers/ambariViews/CloneViewInstanceCtrl.js"></script>
<script src="scripts/controllers/clusters/ClustersManageAccessCtrl.js"></script>
<script src="scripts/controllers/clusters/UserAccessListCtrl.js"></script>
-<script src="scripts/controllers/clusters/ExportBlueprintCtrl.js"></script>
<script src="scripts/controllers/stackVersions/StackVersionsCreateCtrl.js"></script>
<script src="scripts/controllers/stackVersions/StackVersionsListCtrl.js"></script>
<script src="scripts/controllers/stackVersions/StackVersionsEditCtrl.js"></script>
http://git-wip-us.apache.org/repos/asf/ambari/blob/430dcbf1/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/AppCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/AppCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/AppCtrl.js
index 4ac5b38..eb9a9b0 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/AppCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/AppCtrl.js
@@ -31,7 +31,7 @@ angular.module('ambariAdminConsole')
return $route.current;
}, function (value) {
var breadcrumbs = [$t('common.admin')];
- if (value && value.$$route.label) {
+ if (value && value.$$route && value.$$route.label) {
breadcrumbs.push(value.$$route.label);
}
$scope.breadcrumbs = breadcrumbs;
http://git-wip-us.apache.org/repos/asf/ambari/blob/430dcbf1/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ClusterInformationCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ClusterInformationCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ClusterInformationCtrl.js
new file mode 100644
index 0000000..60a610c
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ClusterInformationCtrl.js
@@ -0,0 +1,65 @@
+/**
+ * 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.
+ */
+'use strict';
+
+angular.module('ambariAdminConsole')
+.controller('ClusterInformationCtrl', ['$scope', '$http', '$location', 'Cluster', '$routeParams', '$translate', '$rootScope',
+function($scope, $http, $location, Cluster, $routeParams, $translate, $rootScope) {
+ var $t = $translate.instant;
+ $scope.isDataLoaded = false;
+
+ $scope.$watch(function() {
+ return $rootScope.cluster;
+ }, function() {
+ $scope.cluster = $rootScope.cluster;
+ if ($scope.cluster) {
+ $scope.getBlueprint();
+ }
+ }, true);
+
+ $scope.getBlueprint = function () {
+ Cluster.getBlueprint({
+ clusterName: $scope.cluster.Clusters.cluster_name
+ }).then(function (data) {
+ console.debug($t('exportBlueprint.dataLoaded'), data);
+ $scope.isDataLoaded = true;
+ var response = JSON.stringify(data, null, 4),
+ lt = /</g,
+ gt = />/g,
+ ap = /'/g,
+ ic = /"/g;
+ $scope.blueprint = response ? response.toString().replace(lt, "<").replace(gt, ">").replace(ap, "'").replace(ic, '"') : "";
+ });
+ };
+
+ $scope.downloadBlueprint = function () {
+ if (window.navigator.msSaveOrOpenBlob) {
+ var blob = new Blob([decodeURIComponent(encodeURI($scope.blueprint))], {
+ type: "text/csv;charset=utf-8;"
+ });
+ navigator.msSaveBlob(blob, 'blueprint.json');
+ } else {
+ var a = document.createElement('a');
+ a.href = 'data:attachment/csv;charset=utf-8,' + encodeURI($scope.blueprint);
+ a.target = '_blank';
+ a.download = 'blueprint.json';
+ document.body.appendChild(a);
+ a.click();
+ }
+ };
+}]);
http://git-wip-us.apache.org/repos/asf/ambari/blob/430dcbf1/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/clusters/ExportBlueprintCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/clusters/ExportBlueprintCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/clusters/ExportBlueprintCtrl.js
deleted file mode 100644
index 6b74b40..0000000
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/clusters/ExportBlueprintCtrl.js
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * 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.
- */
-'use strict';
-
-angular.module('ambariAdminConsole')
-.controller('ExportBlueprintCtrl', ['$scope', '$http', '$location', 'Cluster', '$routeParams', '$translate', function($scope, $http, $location, Cluster, $routeParams, $translate) {
- var $t = $translate.instant;
- $scope.identity = angular.identity;
-
- $scope.isDataLoaded = false;
- $scope.clusterName = $routeParams.id;
-
- $scope.getBlueprint = function() {
- Cluster.getBlueprint({
- clusterName: $scope.clusterName
- }).then(function(data) {
- console.debug($t('exportBlueprint.dataLoaded'), data);
- $scope.isDataLoaded = true;
- var response = JSON.stringify(data, null, 4),
- lt = /</g,
- gt = />/g,
- ap = /'/g,
- ic = /"/g;
- $scope.blueprint = response ? response.toString().replace(lt, "<").replace(gt, ">").replace(ap, "'").replace(ic, '"') : "";
- });
- };
-
- $scope.downloadBlueprint = function() {
- if (window.navigator.msSaveOrOpenBlob) {
- var blob = new Blob([decodeURIComponent(encodeURI($scope.blueprint))], {
- type: "text/csv;charset=utf-8;"
- });
- navigator.msSaveBlob(blob, 'blueprint.json');
- } else {
- var a = document.createElement('a');
- a.href = 'data:attachment/csv;charset=utf-8,' + encodeURI($scope.blueprint);
- a.target = '_blank';
- a.download = 'blueprint.json';
- document.body.appendChild(a);
- a.click();
- }
- };
-}]);
http://git-wip-us.apache.org/repos/asf/ambari/blob/430dcbf1/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/mainCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/mainCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/mainCtrl.js
deleted file mode 100644
index 30f7568..0000000
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/mainCtrl.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * 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.
- */
-'use strict';
-
-angular.module('ambariAdminConsole')
-.controller('MainCtrl',['$scope','$rootScope', function($scope, $rootScope) {
- $scope.$watch(function() {
- return $rootScope.cluster;
- }, function() {
- $scope.cluster = $rootScope.cluster;
- }, true);
-}]);
http://git-wip-us.apache.org/repos/asf/ambari/blob/430dcbf1/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
index 73ab064..4ef3ee9 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
@@ -41,7 +41,6 @@ angular.module('ambariAdminConsole')
'common.dashboard': 'Dashboard',
'common.goToDashboard': 'Go to Dashboard',
'common.exportBlueprint': 'Export Blueprint',
- 'common.blueprint': 'Blueprint',
'common.download': 'Download',
'common.noClusters': 'No Clusters',
'common.noViews': 'No Views',
@@ -168,23 +167,12 @@ angular.module('ambariAdminConsole')
'main.title': 'Welcome to Apache Ambari',
'main.noClusterDescription': 'Provision a cluster, manage who can access the cluster, and customize views for Ambari users.',
- 'main.hasClusterDescription': 'Monitor your cluster resources, manage who can access the cluster, and customize views for Ambari users.',
'main.autoLogOut': 'Automatic Logout',
- 'main.operateCluster.title': 'Operate Your Cluster',
- 'main.operateCluster.description': 'Manage the configuration of your cluster and monitor the health of your services',
- 'main.operateCluster.manageRoles': 'Manage Roles',
-
'main.createCluster.title': 'Create a Cluster',
'main.createCluster.description': 'Use the Install Wizard to select services and configure your cluster',
'main.createCluster.launchInstallWizard': 'Launch Install Wizard',
- 'main.manageUsersAndGroups.title': 'Manage Users + Groups',
- 'main.manageUsersAndGroups.description': 'Manage the users and groups that can access Ambari',
-
- 'main.deployViews.title': 'Deploy Views',
- 'main.deployViews.description': 'Create view instances and grant permissions',
-
'main.controls.remainLoggedIn': 'Remain Logged In',
'main.controls.logOut': 'Log Out Now',
@@ -284,6 +272,7 @@ angular.module('ambariAdminConsole')
'clusters.assignRoles': 'Assign roles to these {{term}}',
'clusters.alerts.cannotLoadClusterData': 'Cannot load cluster data',
+ 'clusters.devBlueprint': 'Dev Blueprint',
'groups.createLocal': 'Add Groups',
'groups.name': 'Group name',
http://git-wip-us.apache.org/repos/asf/ambari/blob/430dcbf1/ambari-admin/src/main/resources/ui/admin-web/app/scripts/routes.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/routes.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/routes.js
index 2cb077a..486e598 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/routes.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/routes.js
@@ -19,12 +19,6 @@
angular.module('ambariAdminConsole')
.constant('ROUTES', {
- root: {
- url: '/',
- templateUrl: 'views/main.html',
- controller: 'MainCtrl',
- label: 'Welcome'
- },
authentication: {
main: {
url: '/authentication',
@@ -33,7 +27,7 @@ angular.module('ambariAdminConsole')
}
},
loginActivities: {
- loginMessage:{
+ loginMessage: {
url: '/loginMessage',
templateUrl: 'views/loginActivities/main.html',
controller: 'LoginActivitiesMainCtrl'
@@ -109,19 +103,19 @@ angular.module('ambariAdminConsole')
controller: 'ViewsEditCtrl',
label: 'Views'
},
- createViewUrl:{
+ createViewUrl: {
url: '/urls/new',
templateUrl: 'views/urls/create.html',
controller: 'ViewUrlCtrl',
label: 'Views'
},
- linkViewUrl:{
+ linkViewUrl: {
url: '/urls/link/:viewName/:viewVersion/:viewInstanceName',
templateUrl: 'views/urls/create.html',
controller: 'ViewUrlCtrl',
label: 'Views'
},
- editViewUrl:{
+ editViewUrl: {
url: '/urls/edit/:urlName',
templateUrl: 'views/urls/edit.html',
controller: 'ViewUrlEditCtrl',
@@ -133,19 +127,19 @@ angular.module('ambariAdminConsole')
url: '/stackVersions',
templateUrl: 'views/stackVersions/list.html',
controller: 'StackVersionsListCtrl',
- label: 'Cluster Information'
+ label: 'Versions'
},
create: {
url: '/stackVersions/create',
templateUrl: 'views/stackVersions/stackVersionPage.html',
controller: 'StackVersionsCreateCtrl',
- label: 'Cluster Information'
+ label: 'Versions'
},
edit: {
url: '/stackVersions/:stackName/:versionId/edit',
templateUrl: 'views/stackVersions/stackVersionPage.html',
controller: 'StackVersionsEditCtrl',
- label: 'Cluster Information'
+ label: 'Versions'
}
},
remoteClusters: {
@@ -161,12 +155,12 @@ angular.module('ambariAdminConsole')
controller: 'RemoteClustersCreateCtrl',
label: 'Remote Clusters'
},
- edit: {
- url: '/remoteClusters/:clusterName/edit',
- templateUrl: 'views/remoteClusters/editRemoteClusterPage.html',
- controller: 'RemoteClustersEditCtrl',
- label: 'Remote Clusters'
- }
+ edit: {
+ url: '/remoteClusters/:clusterName/edit',
+ templateUrl: 'views/remoteClusters/editRemoteClusterPage.html',
+ controller: 'RemoteClustersEditCtrl',
+ label: 'Remote Clusters'
+ }
},
clusters: {
manageAccess: {
@@ -180,31 +174,36 @@ angular.module('ambariAdminConsole')
templateUrl: 'views/clusters/userAccessList.html',
controller: 'UserAccessListCtrl'
},
- exportBlueprint: {
- url: '/clusters/:id/exportBlueprint',
- templateUrl: 'views/clusters/exportBlueprint.html',
- controller: 'ExportBlueprintCtrl'
+ clusterInformation: {
+ url: '/clusterInformation',
+ templateUrl: 'views/clusterInformation.html',
+ controller: 'ClusterInformationCtrl',
+ label: 'Cluster Information'
}
},
- dashboard:{
+ dashboard: {
url: '/dashboard',
- controller: ['$window', function($window) {
+ controller: ['$window', function ($window) {
$window.location.replace('/#/main/dashboard');
}],
template: ''
}
})
-.config(['$routeProvider', '$locationProvider', 'ROUTES', function($routeProvider, $locationProvider, ROUTES) {
- var createRoute = function(routeObj) {
- if(routeObj.url){
+.config(['$routeProvider', '$locationProvider', 'ROUTES', function ($routeProvider, $locationProvider, ROUTES) {
+ var createRoute = function (routeObj) {
+ if (routeObj.url) {
$routeProvider.when(routeObj.url, routeObj);
} else {
angular.forEach(routeObj, createRoute);
}
};
+ var rootUrl = ROUTES['clusters']['clusterInformation'].url;
angular.forEach(ROUTES, createRoute);
+ $routeProvider.otherwise({
+ redirectTo: rootUrl
+ });
}])
-.run(['$rootScope', 'ROUTES', 'Settings', function($rootScope, ROUTES, Settings) {
+.run(['$rootScope', 'ROUTES', 'Settings', function ($rootScope, ROUTES, Settings) {
// Make routes available in every template and controller
$rootScope.ROUTES = ROUTES;
$rootScope.$on('$locationChangeStart', function (e, nextUrl) {
@@ -226,7 +225,7 @@ angular.module('ambariAdminConsole')
* @param {string} url
* @returns {string}
*/
- $rootScope.fromSiteRoot = function(url) {
+ $rootScope.fromSiteRoot = function (url) {
var path = url[0] === '/' ? url.substring(1) : url;
return Settings.siteRoot + path;
};
http://git-wip-us.apache.org/repos/asf/ambari/blob/430dcbf1/ambari-admin/src/main/resources/ui/admin-web/app/styles/cluster-information.css
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/styles/cluster-information.css b/ambari-admin/src/main/resources/ui/admin-web/app/styles/cluster-information.css
new file mode 100644
index 0000000..63f4150
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/styles/cluster-information.css
@@ -0,0 +1,59 @@
+/**
+ * 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.
+ */
+
+#cluster-information .cluster-name label {
+ font-weight: normal;
+}
+
+#cluster-information .dev-blueprint {
+ line-height: 35px;
+}
+
+#cluster-information .dev-blueprint span {
+ vertical-align: text-top;
+}
+
+#cluster-information .cluster-name label {
+ font-weight: normal;
+}
+
+#cluster-information .dev-blueprint {
+ line-height: 35px;
+}
+
+#cluster-information .dev-blueprint span {
+ vertical-align: text-top;
+}
+
+
+#cluster-information .welcome-header {
+ margin: -15px;
+ padding: 15px 15px 40px 15px;
+ background-color: #f0f0f0;
+ text-align: center;
+}
+
+#cluster-information .create-cluster-section {
+ text-align: center;
+ padding: 30px;
+}
+
+#cluster-information .fa-cloud {
+ font-size: 150px;
+ color: #f0f0f0;
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/430dcbf1/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css b/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
index bd06bc0..4224f62 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
@@ -123,14 +123,6 @@
transition: none;
}
-.cluster-installation-progress-label{
- display: block;
- color: #888;
- text-align: center;
- padding: 10px 0;
- cursor: default;
-}
-
.add-item-input span{
display: block;
outline: none;
@@ -236,96 +228,6 @@
.paginator{
margin: 0;
}
-.mainpage .panel-body{
- padding: 20px;
- height: 620px;
-}
-.mainpage h1{
- font-size: 24px;
- margin-top: 10px;
-}
-.mainpage .panel-body #main-operations-boxes {
- padding: 10px;
-}
-.mainpage .panel-body #main-operations-boxes .thumbnail{
- display: block;
- height: 230px;
- padding: 8px;
- background-color: #eeeeee;
- margin-bottom: 20px;
- margin-left: 20px;
- margin-right: 10px;
- border: none;
- border-radius: 0;
-}
-.mainpage .panel-body #main-operations-boxes .thumbnail .title,
-.mainpage .panel-body #main-operations-boxes .thumbnail .description,
-.mainpage .panel-body #main-operations-boxes .thumbnail .buttons {
- text-align: center;
- line-height: 1.5;
-}
-.mainpage .panel-body #main-operations-boxes .thumbnail .buttons .btn{
- width: 200px;
- margin: 5px;
-}
-.mainpage .panel-body #main-operations-boxes .thumbnail .buttons .btn.userslist-button,
-.mainpage .panel-body #main-operations-boxes .thumbnail .buttons .btn.groupslist-button {
- width: 100px;
-}
-.mainpage .panel-body #main-operations-boxes .thumbnail .glyphicon {
- font-size: 50px;
- text-align: center;
- display: block;
- line-height: 1.5;
-}
-.mainpage .panel-body #main-operations-boxes .col-sm-5 {
- width: 43.5%;
-}
-
-.views-list-table .panel{
- border-radius: 0;
- border: none;
- margin-top: 0;
-}
-.views-list-table h4{
- font-size: 14px;
-}
-.views-list-table .panel-group .panel + .panel{
- margin-top: 0;
-}
-.views-list-table .panel-group .panel .panel-heading{
- border-radius: 0;
- border-top: 1px solid #ddd;
-}
-.views-list-table .panel-group .panel .panel-heading{
- background: #f9f9f9;
-}
-.views-list-table .panel-group .panel:nth-child(even) .panel-heading{
- background: none;
-}
-.views-list-table .panel-group .panel .panel-heading .panel-title{
- font-size: 14px;
- font-weight: normal;
- cursor: pointer;
-}
-.views-list-table .panel-group .panel .panel-body{
- padding-top: 0;
- padding-bottom: 0;
-}
-.views-list-table .panel-group .panel .panel-body table tr:first-child td{
- border-top: none;
-}
-.views-list-table .glyphicon.glyphicon-chevron-right{
- -webkit-transition: all 0.3s;
- -o-transition: all 0.3s;
- transition: all 0.3s;
-}
-.views-list-table .glyphicon.glyphicon-chevron-right.opened{
- -webkit-transform: rotateZ(90deg);
- -ms-transform: rotateZ(90deg);
- -o-transform: rotateZ(90deg);
- transform: rotateZ(90deg);
-}
a.gotoinstance{
font-size: 12px;
http://git-wip-us.apache.org/repos/asf/ambari/blob/430dcbf1/ambari-admin/src/main/resources/ui/admin-web/app/views/clusterInformation.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/clusterInformation.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/clusterInformation.html
new file mode 100644
index 0000000..6334d06
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/clusterInformation.html
@@ -0,0 +1,66 @@
+<!--
+* 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.
+-->
+
+<div id="cluster-information">
+ <div ng-show="cluster.Clusters.provisioning_state !== 'INSTALLED'">
+ <div class="welcome-header">
+ <h1>{{'main.title' | translate}}</h1>
+ <span>{{'main.noClusterDescription' | translate}}</span>
+ </div>
+ <div class="create-cluster-section">
+ <h2>{{'main.createCluster.title' | translate}}</h2>
+ <div>
+ <span>
+ {{'main.createCluster.description' | translate}}
+ </span>
+ </div>
+ <div><i class="fa fa-cloud" aria-hidden="true"></i></div>
+ <div>
+ <a href="{{fromSiteRoot('/#/installer/step0')}}" class="btn btn-primary">
+ {{'main.createCluster.launchInstallWizard' | translate}}
+ </a>
+ </div>
+ </div>
+ </div>
+
+ <div ng-show="cluster.Clusters.provisioning_state === 'INSTALLED'">
+ <div class="row">
+ <div class="form-group col-xs-3 cluster-name">
+ <label for="clusterName">{{'views.clusterName' | translate}}*</label>
+ <input type="text" class="form-control" id="clusterName" ng-model="cluster.Clusters.cluster_name">
+ </div>
+ </div>
+ <div>
+ <div class="row dev-blueprint">
+ <div class="col-sm-11"><span>{{'clusters.devBlueprint' | translate}}</span></div>
+ <div class="col-sm-1">
+ <div class="btn btn-default pull-right" ng-click="downloadBlueprint()">{{"common.download" | translate}}
+ </div>
+ </div>
+ </div>
+ <textarea type="text"
+ rows="20"
+ class="form-control"
+ name="blueprint_text"
+ ng-model="blueprint"
+ ng-disabled="true"
+ ng-readonly="true">
+ </textarea>
+ </div>
+ </div>
+</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/430dcbf1/ambari-admin/src/main/resources/ui/admin-web/app/views/clusters/exportBlueprint.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/clusters/exportBlueprint.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/clusters/exportBlueprint.html
deleted file mode 100644
index 6ccbffe..0000000
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/clusters/exportBlueprint.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<!--
-* 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.
--->
-<div class="cluster-manage-access-pane" data-ng-init="getBlueprint()" ng-controller="ExportBlueprintCtrl">
- <div class="clearfix">
- <ol class="breadcrumb pull-left">
- <li class="active">{{clusterName}} {{'common.blueprint' | translate}}</li>
- </ol>
- <div class="pull-right top-margin-4">
- <div class="pull-right top-margin-4">
- <div class="btn btn-default" ng-click="downloadBlueprint()">{{"common.download" | translate}}</div>
- </div>
- </div>
- </div>
- <hr>
- <div>
- <textarea type="text"
- rows="20"
- class="form-control"
- name="blueprint_text"
- ng-model="blueprint"
- ng-disabled="true"
- ng-readonly="true">
- </textarea>
- </div>
-</div>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/430dcbf1/ambari-admin/src/main/resources/ui/admin-web/app/views/groups/list.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/groups/list.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/groups/list.html
index 5271ceb..b39f55d 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/groups/list.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/groups/list.html
@@ -26,7 +26,6 @@
</link-to>
</div>
</div>
- <hr>
<table class="table table-striped table-hover col-sm-12">
<thead>
<tr>
@@ -63,7 +62,7 @@
<div ng-if="isLoading" class="spinner-container">
<i class="fa fa-2x fa-spinner fa-spin" aria-hidden="true"></i>
</div>
- <div class="alert alert-info col-sm-12" ng-show="!groups.length && !isLoading">
+ <div class="alert empty-table-alert col-sm-12" ng-show="!groups.length && !isLoading">
{{'common.alerts.nothingToDisplay' | translate: '{term: constants.groups}'}}
</div>
<div class="col-sm-12 table-bar">
http://git-wip-us.apache.org/repos/asf/ambari/blob/430dcbf1/ambari-admin/src/main/resources/ui/admin-web/app/views/main.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/main.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/main.html
deleted file mode 100644
index 3c382af..0000000
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/main.html
+++ /dev/null
@@ -1,107 +0,0 @@
-<!--
-* 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.
--->
-<div class="panel panel-default mainpage">
- <div class="panel-body">
- <h1>{{'main.title' | translate}}</h1>
-
- <div id="main-operations-boxes" class="row thumbnails">
- <p ng-hide="cluster">{{'main.noClusterDescription' | translate}}</p>
-
- <p ng-show="cluster">{{'main.hasClusterDescription' | translate}}</p>
-
- <!--Clusters-->
- <div ng-show="cluster" class="col-sm-11 thumbnail">
- <h4 class="title">{{'main.operateCluster.title' | translate}}</h4>
-
- <div class="description">{{'main.operateCluster.description' | translate}}</div>
- <div class="glyphicon glyphicon-cloud"></div>
- <div class="buttons">
- <span ng-class="{active: isActive('clusters.manageAccess')}">
- <a ng-show="cluster.Clusters.provisioning_state != 'INSTALLED'" href
- class="btn btn-primary permission-button"
- ng-disabled="cluster.Clusters.provisioning_state != 'INSTALLED' ">
- {{'main.operateCluster.manageRoles' | translate}}
- </a>
- <a ng-show="cluster.Clusters.provisioning_state == 'INSTALLED'"
- href="#/clusters/{{cluster.Clusters.cluster_name}}/userAccessList"
- class="btn btn-primary permission-button"
- ng-disabled="cluster.Clusters.provisioning_state != 'INSTALLED' ">
- {{'main.operateCluster.manageRoles' | translate}}
- </a>
- </span>
- <span>
- <a ng-show="cluster.Clusters.provisioning_state != 'INSTALLED'" href
- class="btn btn-primary go-dashboard-button"
- ng-disabled="cluster.Clusters.provisioning_state != 'INSTALLED' ">
- {{'common.goToDashboard' | translate}}
- </a>
- <a ng-show="cluster.Clusters.provisioning_state == 'INSTALLED'"
- href="{{fromSiteRoot('/#/main/dashboard/metrics')}}" class="btn btn-primary go-dashboard-button"
- ng-disabled="cluster.Clusters.provisioning_state != 'INSTALLED' ">
- {{'common.goToDashboard' | translate}}
- </a>
- </span>
- </div>
- </div>
- <div ng-hide="cluster" class="col-sm-11 thumbnail">
- <h4 class="title">{{'main.createCluster.title' | translate}}</h4>
-
- <div class="description">{{'main.createCluster.description' | translate}}</div>
- <div class="glyphicon glyphicon-cloud"></div>
- <div class="buttons">
- <a href="{{fromSiteRoot('/#/installer/step0')}}" class="btn btn-primary create-cluster-button">
- {{'main.createCluster.launchInstallWizard' | translate}}
- </a>
- </div>
- </div>
-
- <!--Manage Users and groups-->
- <div class="col-sm-5 thumbnail">
- <h4 class="title">{{'main.manageUsersAndGroups.title' | translate}}</h4>
-
- <div class="description">{{'main.manageUsersAndGroups.description' | translate}}</div>
- <div class="glyphicon glyphicon-user"></div>
- <div class="buttons">
- <span ng-class="{active: isActive('users.list')}">
- <link-to route="users.list" class="btn btn-primary userslist-button">
- {{'common.users' | translate}}
- </link-to>
- </span>
- <span ng-class="{active: isActive('groups.list')}">
- <link-to route="groups.list" class="btn btn-primary groupslist-button">
- {{'common.groups' | translate}}
- </link-to>
- </span>
- </div>
- </div>
-
- <!--Deploy Views-->
- <div class="col-sm-5 thumbnail">
- <h4 class="title">{{'main.deployViews.title' | translate}}</h4>
-
- <div class="description">{{'main.deployViews.description' | translate}}</div>
- <div class="glyphicon glyphicon-th"></div>
- <div ng-class="{active: isActive('views.list')}" class="buttons">
- <link-to route="views.list" class="btn btn-primary viewslist-button">
- {{'common.views' | translate}}
- </link-to>
- </div>
- </div>
- </div>
- </div>
-</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/430dcbf1/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/list.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/list.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/list.html
index e3e11d5..8bb6632 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/list.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/list.html
@@ -27,7 +27,6 @@
</a>
</div>
</div>
- <hr>
<table class="table table-striped table-hover">
<thead>
<tr>
@@ -62,7 +61,7 @@
<div ng-if="isLoading" class="spinner-container">
<i class="fa fa-2x fa-spinner fa-spin" aria-hidden="true"></i>
</div>
- <div class="alert alert-info col-sm-12" ng-show="!remoteClusters.length && !isLoading">
+ <div class="alert empty-table-alert col-sm-12" ng-show="!remoteClusters.length && !isLoading">
{{'common.alerts.noRemoteClusterDisplay' | translate}}
</div>
<div class="col-sm-12 table-bar">
http://git-wip-us.apache.org/repos/asf/ambari/blob/430dcbf1/ambari-admin/src/main/resources/ui/admin-web/app/views/sideNav.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/sideNav.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/sideNav.html
index 09b4cd9..97dc5d3 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/sideNav.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/sideNav.html
@@ -33,36 +33,43 @@
</li>
</ul>
<ul class="nav side-nav-menu nav-pills nav-stacked">
- <li class="mainmenu-li active">
+ <li class="mainmenu-li active" ng-show="cluster.Clusters.provisioning_state === 'INSTALLED'">
<a title="{{'common.dashboard' | translate}}" rel="tooltip" data-placement="right" href="{{fromSiteRoot('/#/dashboard')}}" class="gotodashboard">
<i class="navigation-icon fa fa-tachometer" aria-hidden="true"></i>
<span class="navigation-menu-item">{{'common.dashboard' | translate}}</span>
</a>
</li>
- <li class="mainmenu-li dropdown has-sub-menu" ng-show="cluster.Clusters.provisioning_state === 'INSTALLED' ">
+ <li class="mainmenu-li dropdown has-sub-menu">
<a title="{{'common.clusterManagement' | translate}}" data-toggle="collapse-sub-menu" rel="tooltip" data-placement="right">
<span class="toggle-icon glyphicon glyphicon-menu-down pull-right"></span>
<i class="navigation-icon fa fa-cloud" aria-hidden="true"></i>
<span class="navigation-menu-item">{{'common.clusterManagement' | translate}}</span>
</a>
<ul class="sub-menu nav nav-pills nav-stacked">
+ <li class="submenu-li" ng-class="{active: isActive('clusters.clusterInformation')}">
+ <a href="#/clusterInformation" class="clusterInformation">
+ {{'common.clusterInformation' | translate}}
+ </a>
+ </li>
<li class="submenu-li" ng-class="{active: isActive('stackVersions.list')}" ng-show="cluster && totalRepos > 0">
- <a href="#/stackVersions">{{'common.clusterInformation' | translate}}</a>
+ <a href="#/stackVersions">{{'common.versions' | translate}}</a>
</li>
<li class="submenu-li" ng-class="{active: isActive('remoteClusters.list')}">
<a href="#/remoteClusters">{{'common.remoteClusters' | translate}}</a>
</li>
</ul>
</li>
- <li class="mainmenu-li dropdown has-sub-menu" ng-show="cluster.Clusters.provisioning_state === 'INSTALLED' ">
+ <li class="mainmenu-li dropdown has-sub-menu">
<a title="{{'common.userManagement' | translate}}" rel="tooltip" data-placement="right" data-toggle="collapse-sub-menu">
<span class="toggle-icon glyphicon glyphicon-menu-down pull-right"></span>
<i class="navigation-icon fa fa-users" aria-hidden="true"></i>
<span class="navigation-menu-item">{{'common.userManagement' | translate}}</span>
</a>
<ul class="sub-menu nav nav-pills nav-stacked">
- <li class="submenu-li" ng-class="{active: isActive('clusters.manageAccess') || isActive('clusters.userAccessList')}">
- <a href="#/clusters/{{cluster.Clusters.cluster_name}}/manageAccess" class="roles">Roles</a>
+ <li class="submenu-li"
+ ng-class="{active: isActive('clusters.manageAccess') || isActive('clusters.userAccessList')}"
+ ng-show="cluster.Clusters.provisioning_state === 'INSTALLED'">
+ <a href="#/clusters/{{cluster.Clusters.cluster_name}}/manageAccess" class="roles">{{'common.roles' | translate}}</a>
</li>
<li class="submenu-li" ng-class="{active: isActive('users.list')}">
<link-to route="users.list" class="userslist-link">{{'common.users' | translate}}</link-to>
http://git-wip-us.apache.org/repos/asf/ambari/blob/430dcbf1/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html
index f6b6ee9..99f9ac0 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html
@@ -27,7 +27,6 @@
</a>
</div>
</div>
- <hr/>
<table class="table table-striped table-hover">
<thead>
<tr>
@@ -119,7 +118,7 @@
<div ng-if="isLoading" class="spinner-container">
<i class="fa fa-2x fa-spinner fa-spin" aria-hidden="true"></i>
</div>
- <div class="alert alert-info col-sm-12" ng-show="!repos.length && !isLoading">
+ <div class="alert empty-table-alert col-sm-12" ng-show="!repos.length && !isLoading">
{{'common.alerts.nothingToDisplay' | translate: '{term: getConstant("common.version")}'}}
</div>
<div class="col-sm-12 table-bar">
http://git-wip-us.apache.org/repos/asf/ambari/blob/430dcbf1/ambari-admin/src/main/resources/ui/admin-web/app/views/users/list.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/users/list.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/users/list.html
index 7b8e12a..12227c3 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/users/list.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/users/list.html
@@ -27,7 +27,6 @@
</link-to>
</div>
</div>
- <hr>
<table class="table table-striped table-hover">
<thead>
<tr>
@@ -80,7 +79,7 @@
<div ng-if="isLoading" class="spinner-container">
<i class="fa fa-2x fa-spinner fa-spin" aria-hidden="true"></i>
</div>
- <div class="alert alert-info col-sm-12" ng-show="!users.length && !isLoading">
+ <div class="alert empty-table-alert col-sm-12" ng-show="!users.length && !isLoading">
{{'common.alerts.nothingToDisplay' | translate: '{term: constants.users}'}}
</div>
<div class="col-sm-12 table-bar">
http://git-wip-us.apache.org/repos/asf/ambari/blob/430dcbf1/ambari-admin/src/main/resources/ui/admin-web/test/unit/services/Utility_test.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/test/unit/services/Utility_test.js b/ambari-admin/src/main/resources/ui/admin-web/test/unit/services/Utility_test.js
index d17747b..1b76dcf 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/test/unit/services/Utility_test.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/test/unit/services/Utility_test.js
@@ -54,7 +54,7 @@ describe('Utility Service', function () {
httpBackend.whenGET(/\/api\/v1\/views.+/).respond(200, {
items: []
});
- httpBackend.whenGET("views/main.html").respond(200, {});
+ httpBackend.whenGET("views/clusterInformation.html").respond(200, {});
});
});
[16/50] [abbrv] ambari git commit: AMBARI-22415. Blueprint deploys
failing with missing smoke user keytab file (echekanskiy)
Posted by rl...@apache.org.
AMBARI-22415. Blueprint deploys failing with missing smoke user keytab file (echekanskiy)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ec02a14c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ec02a14c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ec02a14c
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: ec02a14c02529ec7fec647e6fed7c8c401f10e6d
Parents: 22b2d55
Author: Eugene Chekanskiy <ec...@gmail.com>
Authored: Fri Nov 10 17:17:34 2017 +0200
Committer: Eugene Chekanskiy <ec...@gmail.com>
Committed: Fri Nov 10 18:29:43 2017 +0200
----------------------------------------------------------------------
.../kerberos/CreateKeytabFilesServerAction.java | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/ec02a14c/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/CreateKeytabFilesServerAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/CreateKeytabFilesServerAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/CreateKeytabFilesServerAction.java
index aa65e61..5ec4c10 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/CreateKeytabFilesServerAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/CreateKeytabFilesServerAction.java
@@ -218,17 +218,18 @@ public class CreateKeytabFilesServerAction extends KerberosServerAction {
}
boolean regenerateKeytabs = getOperationType(getCommandParameters()) == OperationType.RECREATE_ALL;
+
+ KerberosPrincipalEntity principalEntity = kerberosPrincipalDAO.find(evaluatedPrincipal);
+ String cachedKeytabPath = (principalEntity == null) ? null : principalEntity.getCachedKeytabPath();
+
if (password == null) {
if (!regenerateKeytabs && (hostName.equalsIgnoreCase(KerberosHelper.AMBARI_SERVER_HOST_NAME) || kerberosPrincipalHostDAO
- .exists(evaluatedPrincipal, hostEntity.getHostId(), keytabFilePath))) {
+ .exists(evaluatedPrincipal, hostEntity.getHostId(), keytabFilePath)) && cachedKeytabPath == null) {
// There is nothing to do for this since it must already exist and we don't want to
// regenerate the keytab
message = String.format("Skipping keytab file for %s, missing password indicates nothing to do", evaluatedPrincipal);
LOG.debug(message);
} else {
- KerberosPrincipalEntity principalEntity = kerberosPrincipalDAO.find(evaluatedPrincipal);
- String cachedKeytabPath = (principalEntity == null) ? null : principalEntity.getCachedKeytabPath();
-
if (cachedKeytabPath == null) {
message = String.format("Failed to create keytab for %s, missing cached file", evaluatedPrincipal);
actionLog.writeStdErr(message);
[32/50] [abbrv] ambari git commit: AMBARI-22321 : Changed ambari
version from 2.6.0.0 to 2.6.3.0. Addendum patch (mradhakrishnan on behalf of
ydavis)
Posted by rl...@apache.org.
AMBARI-22321 : Changed ambari version from 2.6.0.0 to 2.6.3.0. Addendum patch (mradhakrishnan on behalf of ydavis)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/869e1aae
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/869e1aae
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/869e1aae
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 869e1aaeaaf8a03a374bfe8d7fd992e1a048aaad
Parents: 3297dfa
Author: Madhuvanthi Radhakrishnan <mr...@hortonworks.com>
Authored: Tue Nov 14 11:57:05 2017 -0800
Committer: Madhuvanthi Radhakrishnan <mr...@hortonworks.com>
Committed: Tue Nov 14 11:57:05 2017 -0800
----------------------------------------------------------------------
.../HDP/2.0.6/properties/stack_features.json | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/869e1aae/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_features.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_features.json b/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_features.json
index 702fb13..f79cfe0 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_features.json
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_features.json
@@ -429,9 +429,24 @@
"min_version": "2.6.0.0"
},
{
+ "name": "registry_remove_rootpath",
+ "description": "Registry remove root path setting",
+ "min_version": "2.6.3.0"
+ },
+ {
+ "name": "registry_allowed_resources_support",
+ "description": "Registry allowed resources",
+ "min_version": "2.6.3.0"
+ },
+ {
+ "name": "registry_rewriteuri_filter_support",
+ "description": "Registry RewriteUri servlet filter",
+ "min_version": "2.6.3.0"
+ },
+ {
"name": "sam_storage_core_in_registry",
"description": "Storage core module moved to registry",
- "min_version": "2.6.0.0"
+ "min_version": "2.6.3.0"
}
]
}
[08/50] [abbrv] ambari git commit: AMBARI-22370 - Remove HADOOP_HOME
From Environment For Daemons (jonathanhurley)
Posted by rl...@apache.org.
AMBARI-22370 - Remove HADOOP_HOME From Environment For Daemons (jonathanhurley)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/780e91e6
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/780e91e6
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/780e91e6
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 780e91e6124f39fcd67e58369ed2a42da2a6f247
Parents: 444718a
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Mon Nov 6 16:05:56 2017 -0500
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Thu Nov 9 08:23:15 2017 -0500
----------------------------------------------------------------------
.../libraries/functions/stack_select.py | 3 ++-
.../ATLAS/0.1.0.2.3/package/scripts/params.py | 2 +-
.../ATLAS/0.7.0.3.0/package/scripts/params.py | 2 +-
.../FALCON/0.5.0.2.1/package/scripts/falcon.py | 11 +----------
.../package/scripts/hive_service_interactive.py | 5 ++---
.../package/scripts/webhcat_service.py | 19 ++++---------------
.../package/scripts/hive_service_interactive.py | 5 ++---
.../2.1.0.3.0/package/scripts/params_linux.py | 7 +++----
.../2.1.0.3.0/package/scripts/webhcat_service.py | 19 ++++---------------
.../1.0.0.2.3/package/scripts/service_check.py | 3 +--
.../1.4.4.2.0/package/scripts/params_linux.py | 4 ++--
.../1.4.4.3.0/package/scripts/params_linux.py | 4 ++--
.../0.4.0.2.1/package/scripts/params_linux.py | 2 +-
.../0.9.0.3.0/package/scripts/params_linux.py | 2 +-
.../2.1.0.2.0/package/scripts/params_linux.py | 2 +-
.../3.0.0.3.0/package/scripts/params_linux.py | 2 +-
.../stacks/2.0.6/HIVE/test_webhcat_server.py | 4 ----
.../stacks/2.1/FALCON/test_falcon_server.py | 10 ++--------
.../python/stacks/2.1/TEZ/test_tez_client.py | 2 +-
.../2.3/MAHOUT/test_mahout_service_check.py | 4 +---
.../stacks/2.5/HIVE/test_hive_server_int.py | 15 +++++----------
21 files changed, 38 insertions(+), 89 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/780e91e6/ambari-common/src/main/python/resource_management/libraries/functions/stack_select.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/stack_select.py b/ambari-common/src/main/python/resource_management/libraries/functions/stack_select.py
index 9b7d0eb..b741a33 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/stack_select.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/stack_select.py
@@ -71,7 +71,8 @@ HADOOP_DIR_DEFAULTS = {
"libexec": "/usr/lib/hadoop/libexec",
"sbin": "/usr/lib/hadoop/sbin",
"bin": "/usr/bin",
- "lib": "/usr/lib/hadoop/lib"
+ "lib": "/usr/lib/hadoop/lib",
+ "conf": "/etc/hadoop/conf"
}
PACKAGE_SCOPE_INSTALL = "INSTALL"
http://git-wip-us.apache.org/repos/asf/ambari/blob/780e91e6/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py
index 968ceed..31a866e 100644
--- a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/params.py
@@ -118,7 +118,7 @@ metadata_stop_script = format("{metadata_bin}/atlas_stop.py")
log_dir = config['configurations']['atlas-env']['metadata_log_dir']
# service locations
-hadoop_conf_dir = os.path.join(os.environ["HADOOP_HOME"], "conf") if 'HADOOP_HOME' in os.environ else '/etc/hadoop/conf'
+hadoop_conf_dir = os.path.join(os.environ["HADOOP_HOME"], "conf") if 'HADOOP_HOME' in os.environ else format('{stack_root}/current/hadoop-client/conf')
# some commands may need to supply the JAAS location when running as atlas
atlas_jaas_file = format("{conf_dir}/atlas_jaas.conf")
http://git-wip-us.apache.org/repos/asf/ambari/blob/780e91e6/ambari-server/src/main/resources/common-services/ATLAS/0.7.0.3.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ATLAS/0.7.0.3.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/ATLAS/0.7.0.3.0/package/scripts/params.py
index b01884c..7c1249a 100644
--- a/ambari-server/src/main/resources/common-services/ATLAS/0.7.0.3.0/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/ATLAS/0.7.0.3.0/package/scripts/params.py
@@ -116,7 +116,7 @@ metadata_stop_script = format("{metadata_bin}/atlas_stop.py")
log_dir = config['configurations']['atlas-env']['metadata_log_dir']
# service locations
-hadoop_conf_dir = os.path.join(os.environ["HADOOP_HOME"], "conf") if 'HADOOP_HOME' in os.environ else '/etc/hadoop/conf'
+hadoop_conf_dir = os.path.join(os.environ["HADOOP_HOME"], "conf") if 'HADOOP_HOME' in os.environ else format('{stack_root}/current/hadoop-client/conf')
# some commands may need to supply the JAAS location when running as atlas
atlas_jaas_file = format("{conf_dir}/atlas_jaas.conf")
http://git-wip-us.apache.org/repos/asf/ambari/blob/780e91e6/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon.py b/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon.py
index 933515b..7d8fa13 100644
--- a/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon.py
+++ b/ambari-server/src/main/resources/common-services/FALCON/0.5.0.2.1/package/scripts/falcon.py
@@ -209,12 +209,6 @@ def falcon(type, action = None, upgrade_type=None):
owner = params.falcon_user,
create_parents = True)
- # although Falcon's falcon-config.sh will use 'which hadoop' to figure
- # this out, in an upgraded cluster, it's possible that 'which hadoop'
- # still points to older binaries; it's safer to just pass in the
- # hadoop home directory to use
- environment_dictionary = { "HADOOP_HOME" : params.hadoop_home_dir }
-
pid = get_user_call_output.get_user_call_output(format("cat {server_pid_file}"), user=params.falcon_user, is_checked_call=False)[1]
process_exists = format("ls {server_pid_file} && ps -p {pid}")
@@ -223,7 +217,6 @@ def falcon(type, action = None, upgrade_type=None):
Execute(format('{falcon_home}/bin/falcon-config.sh server falcon'),
user = params.falcon_user,
path = params.hadoop_bin_dir,
- environment=environment_dictionary,
not_if = process_exists,
)
except:
@@ -253,7 +246,6 @@ in the Falcon documentation.
Execute(format('{falcon_home}/bin/falcon-start -port {falcon_port}'),
user = params.falcon_user,
path = params.hadoop_bin_dir,
- environment=environment_dictionary,
not_if = process_exists,
)
except:
@@ -264,8 +256,7 @@ in the Falcon documentation.
try:
Execute(format('{falcon_home}/bin/falcon-stop'),
user = params.falcon_user,
- path = params.hadoop_bin_dir,
- environment=environment_dictionary)
+ path = params.hadoop_bin_dir)
except:
show_logs(params.falcon_log_dir, params.falcon_user)
raise
http://git-wip-us.apache.org/repos/asf/ambari/blob/780e91e6/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_service_interactive.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_service_interactive.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_service_interactive.py
index 703d104..71c22d7 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_service_interactive.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_service_interactive.py
@@ -52,12 +52,11 @@ def hive_service_interactive(name, action='start', upgrade_type=None):
if action == 'start':
check_fs_root(params.hive_server_interactive_conf_dir, params.execute_path_hive_interactive)
daemon_cmd = cmd
- hadoop_home = params.hadoop_home
- hive_interactive_bin = "hive2"
+ hive_interactive_bin = format("{stack_root}/current/hive-server2-hive2/bin/hive2")
Execute(daemon_cmd,
user = params.hive_user,
- environment = { 'HADOOP_HOME': hadoop_home, 'JAVA_HOME': params.java64_home, 'HIVE_BIN': hive_interactive_bin },
+ environment = { 'JAVA_HOME': params.java64_home, 'HIVE_BIN': hive_interactive_bin },
path = params.execute_path,
not_if = process_id_exists_command)
http://git-wip-us.apache.org/repos/asf/ambari/blob/780e91e6/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/webhcat_service.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/webhcat_service.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/webhcat_service.py
index cb4aafd..bddb5b2 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/webhcat_service.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/webhcat_service.py
@@ -40,30 +40,22 @@ def webhcat_service(action='start', rolling_restart=False):
def webhcat_service(action='start', upgrade_type=None):
import params
- environ = {
- 'HADOOP_HOME': params.hadoop_home
- }
-
cmd = format('{webhcat_bin_dir}/webhcat_server.sh')
if action == 'start':
- if upgrade_type is not None and params.version and params.stack_root:
- environ['HADOOP_HOME'] = format("{stack_root}/{version}/hadoop")
-
daemon_cmd = format('cd {hcat_pid_dir} ; {cmd} start')
no_op_test = format('ls {webhcat_pid_file} >/dev/null 2>&1 && ps -p `cat {webhcat_pid_file}` >/dev/null 2>&1')
try:
Execute(daemon_cmd,
user=params.webhcat_user,
- not_if=no_op_test,
- environment = environ)
+ not_if=no_op_test)
except:
show_logs(params.hcat_log_dir, params.webhcat_user)
raise
elif action == 'stop':
try:
# try stopping WebHCat using its own script
- graceful_stop(cmd, environ)
+ graceful_stop(cmd)
except Fail:
show_logs(params.hcat_log_dir, params.webhcat_user)
Logger.info(traceback.format_exc())
@@ -95,17 +87,14 @@ def webhcat_service(action='start', upgrade_type=None):
File(params.webhcat_pid_file, action="delete")
-def graceful_stop(cmd, environ):
+def graceful_stop(cmd):
"""
Attemps to stop WebHCat using its own shell script. On some versions this may not correctly
stop the daemon.
:param cmd: the command to run to stop the daemon
- :param environ: the environment variables to execute the command with
:return:
"""
import params
daemon_cmd = format('{cmd} stop')
- Execute(daemon_cmd,
- user = params.webhcat_user,
- environment = environ)
+ Execute(daemon_cmd, user = params.webhcat_user)
http://git-wip-us.apache.org/repos/asf/ambari/blob/780e91e6/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_service_interactive.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_service_interactive.py b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_service_interactive.py
index 703d104..71c22d7 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_service_interactive.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_service_interactive.py
@@ -52,12 +52,11 @@ def hive_service_interactive(name, action='start', upgrade_type=None):
if action == 'start':
check_fs_root(params.hive_server_interactive_conf_dir, params.execute_path_hive_interactive)
daemon_cmd = cmd
- hadoop_home = params.hadoop_home
- hive_interactive_bin = "hive2"
+ hive_interactive_bin = format("{stack_root}/current/hive-server2-hive2/bin/hive2")
Execute(daemon_cmd,
user = params.hive_user,
- environment = { 'HADOOP_HOME': hadoop_home, 'JAVA_HOME': params.java64_home, 'HIVE_BIN': hive_interactive_bin },
+ environment = { 'JAVA_HOME': params.java64_home, 'HIVE_BIN': hive_interactive_bin },
path = params.execute_path,
not_if = process_id_exists_command)
http://git-wip-us.apache.org/repos/asf/ambari/blob/780e91e6/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/params_linux.py
index 1bd6a1a..088a540 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/params_linux.py
@@ -36,19 +36,17 @@ from resource_management.libraries.functions import get_kinit_path
from resource_management.libraries.functions.get_not_managed_resources import get_not_managed_resources
from resource_management.libraries.script.script import Script
from resource_management.libraries.functions import StackFeature
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.libraries.functions.stack_features import get_stack_feature_version
from resource_management.libraries.functions import upgrade_summary
from resource_management.libraries.functions.get_port_from_url import get_port_from_url
from resource_management.libraries.functions.expect import expect
from resource_management.libraries import functions
-from resource_management.libraries.functions.setup_atlas_hook import has_atlas_in_cluster
-from ambari_commons.ambari_metrics_helper import select_metric_collector_hosts_from_hostnames
from resource_management.libraries.functions.setup_ranger_plugin_xml import get_audit_configs, generate_ranger_service_config
from resource_management.libraries.functions.get_architecture import get_architecture
from resource_management.core.utils import PasswordString
-from resource_management.core.shell import checked_call
from resource_management.core.exceptions import Fail
from ambari_commons.credential_store_helper import get_password_from_credential_store
@@ -107,7 +105,8 @@ stack_supports_hive_interactive_ga = check_stack_feature(StackFeature.HIVE_INTER
component_directory = status_params.component_directory
component_directory_interactive = status_params.component_directory_interactive
-hadoop_home = format('{stack_root}/current/hadoop-client')
+hadoop_home = stack_select.get_hadoop_dir("home")
+
hive_bin = format('{stack_root}/current/{component_directory}/bin')
hive_cmd = os.path.join(hive_bin, "hive")
hive_schematool_ver_bin = format('{stack_root}/{version}/hive/bin')
http://git-wip-us.apache.org/repos/asf/ambari/blob/780e91e6/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/webhcat_service.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/webhcat_service.py b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/webhcat_service.py
index cb4aafd..bddb5b2 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/webhcat_service.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/webhcat_service.py
@@ -40,30 +40,22 @@ def webhcat_service(action='start', rolling_restart=False):
def webhcat_service(action='start', upgrade_type=None):
import params
- environ = {
- 'HADOOP_HOME': params.hadoop_home
- }
-
cmd = format('{webhcat_bin_dir}/webhcat_server.sh')
if action == 'start':
- if upgrade_type is not None and params.version and params.stack_root:
- environ['HADOOP_HOME'] = format("{stack_root}/{version}/hadoop")
-
daemon_cmd = format('cd {hcat_pid_dir} ; {cmd} start')
no_op_test = format('ls {webhcat_pid_file} >/dev/null 2>&1 && ps -p `cat {webhcat_pid_file}` >/dev/null 2>&1')
try:
Execute(daemon_cmd,
user=params.webhcat_user,
- not_if=no_op_test,
- environment = environ)
+ not_if=no_op_test)
except:
show_logs(params.hcat_log_dir, params.webhcat_user)
raise
elif action == 'stop':
try:
# try stopping WebHCat using its own script
- graceful_stop(cmd, environ)
+ graceful_stop(cmd)
except Fail:
show_logs(params.hcat_log_dir, params.webhcat_user)
Logger.info(traceback.format_exc())
@@ -95,17 +87,14 @@ def webhcat_service(action='start', upgrade_type=None):
File(params.webhcat_pid_file, action="delete")
-def graceful_stop(cmd, environ):
+def graceful_stop(cmd):
"""
Attemps to stop WebHCat using its own shell script. On some versions this may not correctly
stop the daemon.
:param cmd: the command to run to stop the daemon
- :param environ: the environment variables to execute the command with
:return:
"""
import params
daemon_cmd = format('{cmd} stop')
- Execute(daemon_cmd,
- user = params.webhcat_user,
- environment = environ)
+ Execute(daemon_cmd, user = params.webhcat_user)
http://git-wip-us.apache.org/repos/asf/ambari/blob/780e91e6/ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/package/scripts/service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/package/scripts/service_check.py b/ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/package/scripts/service_check.py
index c1151fc..b15d158 100644
--- a/ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/package/scripts/service_check.py
+++ b/ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/package/scripts/service_check.py
@@ -71,8 +71,7 @@ class MahoutServiceCheck(Script):
Execute( mahout_command,
tries = 3,
try_sleep = 5,
- environment={'HADOOP_HOME': params.hadoop_home,'HADOOP_CONF_DIR': params.hadoop_conf_dir,
- 'MAHOUT_HOME': params.mahout_home,'JAVA_HOME': params.java64_home},
+ environment={'MAHOUT_HOME': params.mahout_home,'JAVA_HOME': params.java64_home},
path = format('/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'),
user = params.smokeuser
)
http://git-wip-us.apache.org/repos/asf/ambari/blob/780e91e6/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/params_linux.py
index 400c87c..eaf1ee4 100644
--- a/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/params_linux.py
@@ -23,11 +23,11 @@ from resource_management.libraries.functions.version import format_stack_version
from resource_management.libraries.functions.default import default
from resource_management.libraries.functions.get_kinit_path import get_kinit_path
from resource_management.libraries.script import Script
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.format import format
from resource_management.libraries.functions import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.libraries.functions.expect import expect
-from resource_management.libraries.functions.setup_atlas_hook import has_atlas_in_cluster
from resource_management.core.exceptions import Fail
@@ -71,7 +71,7 @@ zoo_conf_dir = "/etc/zookeeper"
if stack_version_formatted and check_stack_feature(StackFeature.ROLLING_UPGRADE, stack_version_formatted):
sqoop_conf_dir = format("{stack_root}/current/sqoop-client/conf")
sqoop_lib = format("{stack_root}/current/sqoop-client/lib")
- hadoop_home = format("{stack_root}/current/hadoop-client")
+ hadoop_home = stack_select.get_hadoop_dir("home")
hbase_home = format("{stack_root}/current/hbase-client")
hive_home = format("{stack_root}/current/hive-client")
sqoop_bin_dir = format("{stack_root}/current/sqoop-client/bin/")
http://git-wip-us.apache.org/repos/asf/ambari/blob/780e91e6/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.3.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.3.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.3.0/package/scripts/params_linux.py
index 400c87c..eaf1ee4 100644
--- a/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.3.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.3.0/package/scripts/params_linux.py
@@ -23,11 +23,11 @@ from resource_management.libraries.functions.version import format_stack_version
from resource_management.libraries.functions.default import default
from resource_management.libraries.functions.get_kinit_path import get_kinit_path
from resource_management.libraries.script import Script
+from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions.format import format
from resource_management.libraries.functions import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.libraries.functions.expect import expect
-from resource_management.libraries.functions.setup_atlas_hook import has_atlas_in_cluster
from resource_management.core.exceptions import Fail
@@ -71,7 +71,7 @@ zoo_conf_dir = "/etc/zookeeper"
if stack_version_formatted and check_stack_feature(StackFeature.ROLLING_UPGRADE, stack_version_formatted):
sqoop_conf_dir = format("{stack_root}/current/sqoop-client/conf")
sqoop_lib = format("{stack_root}/current/sqoop-client/lib")
- hadoop_home = format("{stack_root}/current/hadoop-client")
+ hadoop_home = stack_select.get_hadoop_dir("home")
hbase_home = format("{stack_root}/current/hbase-client")
hive_home = format("{stack_root}/current/hive-client")
sqoop_bin_dir = format("{stack_root}/current/sqoop-client/bin/")
http://git-wip-us.apache.org/repos/asf/ambari/blob/780e91e6/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/params_linux.py
index 4d63685..cef709b 100644
--- a/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/params_linux.py
@@ -50,7 +50,7 @@ version = default("/commandParams/version", None)
hadoop_lib_home = stack_select.get_hadoop_dir("lib")
# default hadoop parameters
-hadoop_home = '/usr'
+hadoop_home = stack_select.get_hadoop_dir("home")
hadoop_bin_dir = stack_select.get_hadoop_dir("bin")
hadoop_conf_dir = conf_select.get_hadoop_conf_dir()
tez_etc_dir = "/etc/tez"
http://git-wip-us.apache.org/repos/asf/ambari/blob/780e91e6/ambari-server/src/main/resources/common-services/TEZ/0.9.0.3.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/TEZ/0.9.0.3.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/TEZ/0.9.0.3.0/package/scripts/params_linux.py
index 5a028bd..2b3fa38 100644
--- a/ambari-server/src/main/resources/common-services/TEZ/0.9.0.3.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/TEZ/0.9.0.3.0/package/scripts/params_linux.py
@@ -48,7 +48,7 @@ stack_version_formatted = format_stack_version(stack_version_unformatted)
version = default("/commandParams/version", None)
# default hadoop parameters
-hadoop_home = '/usr'
+hadoop_home = stack_select.get_hadoop_dir("home")
hadoop_bin_dir = stack_select.get_hadoop_dir("bin")
hadoop_conf_dir = conf_select.get_hadoop_conf_dir()
tez_etc_dir = "/etc/tez"
http://git-wip-us.apache.org/repos/asf/ambari/blob/780e91e6/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py
index 620408b..3e4504d 100644
--- a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py
@@ -65,7 +65,7 @@ stack_name = status_params.stack_name
stack_root = Script.get_stack_root()
tarball_map = default("/configurations/cluster-env/tarball_map", None)
-config_path = os.path.join(stack_root, "current/hadoop-client/conf")
+config_path = stack_select.get_hadoop_dir("conf")
config_dir = os.path.realpath(config_path)
# get the correct version to use for checking stack features
http://git-wip-us.apache.org/repos/asf/ambari/blob/780e91e6/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/params_linux.py
index e4dbe2c..617dc3b 100644
--- a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/params_linux.py
@@ -65,7 +65,7 @@ stack_name = status_params.stack_name
stack_root = Script.get_stack_root()
tarball_map = default("/configurations/cluster-env/tarball_map", None)
-config_path = os.path.join(stack_root, "current/hadoop-client/conf")
+config_path = stack_select.get_hadoop_dir("conf")
config_dir = os.path.realpath(config_path)
# get the correct version to use for checking stack features
http://git-wip-us.apache.org/repos/asf/ambari/blob/780e91e6/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_webhcat_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_webhcat_server.py b/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_webhcat_server.py
index f9480ee..b4652ac 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_webhcat_server.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_webhcat_server.py
@@ -65,7 +65,6 @@ class TestWebHCatServer(RMFTestCase):
self.assert_configure_default()
self.assertResourceCalled('Execute', 'cd /var/run/webhcat ; /usr/hdp/current/hive-webhcat/sbin/webhcat_server.sh start',
- environment = {'HADOOP_HOME': '/usr/hdp/current/hadoop-client'},
not_if = "ls /var/run/webhcat/webhcat.pid >/dev/null 2>&1 && ps -p `cat /var/run/webhcat/webhcat.pid` >/dev/null 2>&1",
user = 'hcat',
)
@@ -82,7 +81,6 @@ class TestWebHCatServer(RMFTestCase):
self.assertResourceCalled('Execute', '/usr/hdp/current/hive-webhcat/sbin/webhcat_server.sh stop',
user = 'hcat',
- environment = {'HADOOP_HOME': '/usr/hdp/current/hadoop-client' }
)
self.assertResourceCalled('Execute', 'ambari-sudo.sh kill -9 `cat /var/run/webhcat/webhcat.pid`',
@@ -148,7 +146,6 @@ class TestWebHCatServer(RMFTestCase):
self.assert_configure_secured()
self.assertResourceCalled('Execute', 'cd /var/run/webhcat ; /usr/hdp/current/hive-webhcat/sbin/webhcat_server.sh start',
- environment = {'HADOOP_HOME': '/usr/hdp/2.1.0.0-1234/hadoop'},
not_if = "ls /var/run/webhcat/webhcat.pid >/dev/null 2>&1 && ps -p `cat /var/run/webhcat/webhcat.pid` >/dev/null 2>&1",
user = 'hcat',
)
@@ -165,7 +162,6 @@ class TestWebHCatServer(RMFTestCase):
self.assertResourceCalled('Execute', '/usr/hdp/current/hive-webhcat/sbin/webhcat_server.sh stop',
user = 'hcat',
- environment = {'HADOOP_HOME': '/usr/hdp/2.1.0.0-1234/hadoop' }
)
self.assertResourceCalled('Execute', 'ambari-sudo.sh kill -9 `cat /var/run/webhcat/webhcat.pid`',
http://git-wip-us.apache.org/repos/asf/ambari/blob/780e91e6/ambari-server/src/test/python/stacks/2.1/FALCON/test_falcon_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1/FALCON/test_falcon_server.py b/ambari-server/src/test/python/stacks/2.1/FALCON/test_falcon_server.py
index 7f2ed46..8c48347 100644
--- a/ambari-server/src/test/python/stacks/2.1/FALCON/test_falcon_server.py
+++ b/ambari-server/src/test/python/stacks/2.1/FALCON/test_falcon_server.py
@@ -49,7 +49,6 @@ class TestFalconServer(RMFTestCase):
self.assertResourceCalled('Execute', '/usr/hdp/current/falcon-server/bin/falcon-config.sh server falcon',
path = ['/usr/bin'],
user = 'falcon',
- environment = {'HADOOP_HOME': '/usr/lib/hadoop'},
not_if = 'ls /var/run/falcon/falcon.pid && ps -p ',
)
@@ -61,7 +60,6 @@ class TestFalconServer(RMFTestCase):
self.assertResourceCalled('Execute', '/usr/hdp/current/falcon-server/bin/falcon-start -port 15000',
path = ['/usr/bin'],
user = 'falcon',
- environment = {'HADOOP_HOME': '/usr/lib/hadoop'},
not_if = 'ls /var/run/falcon/falcon.pid && ps -p ',
)
@@ -78,8 +76,7 @@ class TestFalconServer(RMFTestCase):
self.assertResourceCalled('Execute', '/usr/hdp/current/falcon-server/bin/falcon-stop',
path = ['/usr/bin'],
- user = 'falcon',
- environment = {'HADOOP_HOME': '/usr/lib/hadoop'})
+ user = 'falcon')
self.assertResourceCalled('File', '/var/run/falcon/falcon.pid',
action = ['delete'])
@@ -236,8 +233,7 @@ class TestFalconServer(RMFTestCase):
self.assertResourceCalled('Execute',
'/usr/hdp/current/falcon-server/bin/falcon-stop',
- path = ['/usr/hdp/2.2.1.0-2135/hadoop/bin'], user='falcon',
- environment = {'HADOOP_HOME': '/usr/hdp/2.2.1.0-2135/hadoop'})
+ path = ['/usr/hdp/2.2.1.0-2135/hadoop/bin'], user='falcon')
self.assertResourceCalled('File', '/var/run/falcon/falcon.pid',
action = ['delete'])
@@ -406,14 +402,12 @@ class TestFalconServer(RMFTestCase):
)
self.assertResourceCalled('Execute', '/usr/hdp/current/falcon-server/bin/falcon-config.sh server falcon',
- environment = {'HADOOP_HOME': '/usr/hdp/2.2.1.0-2135/hadoop'},
path = ['/usr/hdp/2.2.1.0-2135/hadoop/bin'],
user = 'falcon',
not_if = 'ls /var/run/falcon/falcon.pid && ps -p ',
)
self.assertResourceCalled('Execute', '/usr/hdp/current/falcon-server/bin/falcon-start -port 15000',
- environment = {'HADOOP_HOME': '/usr/hdp/2.2.1.0-2135/hadoop'},
path = ['/usr/hdp/2.2.1.0-2135/hadoop/bin'],
user = 'falcon',
not_if = 'ls /var/run/falcon/falcon.pid && ps -p ',
http://git-wip-us.apache.org/repos/asf/ambari/blob/780e91e6/ambari-server/src/test/python/stacks/2.1/TEZ/test_tez_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1/TEZ/test_tez_client.py b/ambari-server/src/test/python/stacks/2.1/TEZ/test_tez_client.py
index fad99f6..59b2166 100644
--- a/ambari-server/src/test/python/stacks/2.1/TEZ/test_tez_client.py
+++ b/ambari-server/src/test/python/stacks/2.1/TEZ/test_tez_client.py
@@ -130,6 +130,6 @@ class TestTezClient(RMFTestCase):
config_dict = json_content,
stack_version = self.STACK_VERSION,
target = RMFTestCase.TARGET_COMMON_SERVICES,
- call_mocks = [(0, None, ''), (0, None)],
+ call_mocks = [(0, None, ''),(0, None, ''), (0, None)],
mocks_dict = mocks_dict)
# for now, it's enough to know the method didn't fail
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/780e91e6/ambari-server/src/test/python/stacks/2.3/MAHOUT/test_mahout_service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.3/MAHOUT/test_mahout_service_check.py b/ambari-server/src/test/python/stacks/2.3/MAHOUT/test_mahout_service_check.py
index b80476c..8695653 100644
--- a/ambari-server/src/test/python/stacks/2.3/MAHOUT/test_mahout_service_check.py
+++ b/ambari-server/src/test/python/stacks/2.3/MAHOUT/test_mahout_service_check.py
@@ -109,9 +109,7 @@ class TestMahoutClient(RMFTestCase):
self.assertResourceCalled('Execute', 'mahout seqdirectory --input /user/ambari-qa/mahoutsmokeinput/'
'sample-mahout-test.txt --output /user/ambari-qa/mahoutsmokeoutput/ '
'--charset utf-8',
- environment = {'HADOOP_CONF_DIR': '/usr/hdp/2.2.1.0-2067/hadoop/conf',
- 'HADOOP_HOME': '/usr/hdp/2.2.1.0-2067/hadoop',
- 'JAVA_HOME': u'/usr/jdk64/jdk1.7.0_45',
+ environment = {'JAVA_HOME': u'/usr/jdk64/jdk1.7.0_45',
'MAHOUT_HOME': '/usr/hdp/current/mahout-client'},
path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
tries = 3,
http://git-wip-us.apache.org/repos/asf/ambari/blob/780e91e6/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py b/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py
index 4951c7e..cf79ec7 100644
--- a/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py
+++ b/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py
@@ -115,8 +115,7 @@ class TestHiveServerInteractive(RMFTestCase):
)
self.assertResourceCalled('Execute',
'/tmp/start_hiveserver2_interactive_script /var/run/hive/hive-server2-interactive.out /var/log/hive/hive-server2-interactive.err /var/run/hive/hive-interactive.pid /usr/hdp/current/hive-server2-hive2/conf/conf.server /var/log/hive',
- environment={'HADOOP_HOME': '/usr/hdp/current/hadoop-client',
- 'HIVE_BIN': 'hive2',
+ environment={'HIVE_BIN': '/usr/hdp/current/hive-server2-hive2/bin/hive2',
'JAVA_HOME': u'/usr/jdk64/jdk1.7.0_45'},
not_if="ls /var/run/hive/hive-interactive.pid >/dev/null 2>&1 && ps -p 123 >/dev/null 2>&1",
user='hive',
@@ -178,8 +177,7 @@ class TestHiveServerInteractive(RMFTestCase):
)
self.assertResourceCalled('Execute',
'/tmp/start_hiveserver2_interactive_script /var/run/hive/hive-server2-interactive.out /var/log/hive/hive-server2-interactive.err /var/run/hive/hive-interactive.pid /usr/hdp/current/hive-server2-hive2/conf/conf.server /var/log/hive',
- environment={'HADOOP_HOME': '/usr/hdp/current/hadoop-client',
- 'HIVE_BIN': 'hive2',
+ environment={'HIVE_BIN': '/usr/hdp/current/hive-server2-hive2/bin/hive2',
'JAVA_HOME': u'/usr/jdk64/jdk1.7.0_45'},
not_if="ls /var/run/hive/hive-interactive.pid >/dev/null 2>&1 && ps -p 123 >/dev/null 2>&1",
user='hive',
@@ -227,8 +225,7 @@ class TestHiveServerInteractive(RMFTestCase):
)
self.assertResourceCalled('Execute',
'/tmp/start_hiveserver2_interactive_script /var/run/hive/hive-server2-interactive.out /var/log/hive/hive-server2-interactive.err /var/run/hive/hive-interactive.pid /usr/hdp/current/hive-server2-hive2/conf/conf.server /var/log/hive',
- environment={'HADOOP_HOME': '/usr/hdp/current/hadoop-client',
- 'HIVE_BIN': 'hive2',
+ environment={'HIVE_BIN': '/usr/hdp/current/hive-server2-hive2/bin/hive2',
'JAVA_HOME': u'/usr/jdk64/jdk1.7.0_45'},
not_if="ls /var/run/hive/hive-interactive.pid >/dev/null 2>&1 && ps -p 123 >/dev/null 2>&1",
user='hive',
@@ -305,8 +302,7 @@ class TestHiveServerInteractive(RMFTestCase):
)
self.assertResourceCalled('Execute',
'/tmp/start_hiveserver2_interactive_script /var/run/hive/hive-server2-interactive.out /var/log/hive/hive-server2-interactive.err /var/run/hive/hive-interactive.pid /usr/hdp/current/hive-server2-hive2/conf/conf.server /var/log/hive',
- environment={'HADOOP_HOME': '/usr/hdp/current/hadoop-client',
- 'HIVE_BIN': 'hive2',
+ environment={'HIVE_BIN': '/usr/hdp/current/hive-server2-hive2/bin/hive2',
'JAVA_HOME': u'/usr/jdk64/jdk1.7.0_45'},
not_if="ls /var/run/hive/hive-interactive.pid >/dev/null 2>&1 && ps -p 123 >/dev/null 2>&1",
user='hive',
@@ -364,8 +360,7 @@ class TestHiveServerInteractive(RMFTestCase):
)
self.assertResourceCalled('Execute',
'/tmp/start_hiveserver2_interactive_script /var/run/hive/hive-server2-interactive.out /var/log/hive/hive-server2-interactive.err /var/run/hive/hive-interactive.pid /usr/hdp/current/hive-server2-hive2/conf/conf.server /var/log/hive',
- environment={'HADOOP_HOME': '/usr/hdp/current/hadoop-client',
- 'HIVE_BIN': 'hive2',
+ environment={'HIVE_BIN': '/usr/hdp/current/hive-server2-hive2/bin/hive2',
'JAVA_HOME': u'/usr/jdk64/jdk1.7.0_45'},
not_if="ls /var/run/hive/hive-interactive.pid >/dev/null 2>&1 && ps -p 123 >/dev/null 2>&1",
user='hive',
[31/50] [abbrv] ambari git commit: AMBARI-22438 Disable plugins for
yum on yum list command (dgrinenko)
Posted by rl...@apache.org.
AMBARI-22438 Disable plugins for yum on yum list command (dgrinenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3297dfa6
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3297dfa6
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3297dfa6
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 3297dfa6542f9cffef2ae36ef0e777fe4c3e829c
Parents: ed7e121
Author: Dmytro Grinenko <ha...@apache.org>
Authored: Tue Nov 14 20:12:47 2017 +0200
Committer: Dmytro Grinenko <ha...@apache.org>
Committed: Tue Nov 14 20:12:47 2017 +0200
----------------------------------------------------------------------
.../python/resource_management/core/providers/package/yumrpm.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/3297dfa6/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py b/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py
index 9117510..8426479 100644
--- a/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py
+++ b/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py
@@ -46,8 +46,8 @@ REMOVE_WITHOUT_DEPENDENCIES_CMD = ['rpm', '-e', '--nodeps']
YUM_REPO_LOCATION = "/etc/yum.repos.d"
REPO_UPDATE_CMD = ['/usr/bin/yum', 'clean', 'metadata']
-ALL_INSTALLED_PACKAGES_CMD = [AMBARI_SUDO_BINARY, "yum", "list", "installed"]
-ALL_AVAILABLE_PACKAGES_CMD = [AMBARI_SUDO_BINARY, "yum", "list", "available"]
+ALL_INSTALLED_PACKAGES_CMD = [AMBARI_SUDO_BINARY, "yum", "list", "installed", "--noplugins"]
+ALL_AVAILABLE_PACKAGES_CMD = [AMBARI_SUDO_BINARY, "yum", "list", "available", "--noplugins"]
VERIFY_DEPENDENCY_CMD = ['/usr/bin/yum', '-d', '0', '-e', '0', 'check', 'dependencies']
# base command output sample:
[44/50] [abbrv] ambari git commit: AMBARI-22444 - Add Native
Libraries To Tez Tarball (part2) (jonathanhurley)
Posted by rl...@apache.org.
AMBARI-22444 - Add Native Libraries To Tez Tarball (part2) (jonathanhurley)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0936f463
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0936f463
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0936f463
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 0936f463042cf5ba195b0461479d8c29c88330dd
Parents: 8fe6ac4
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Wed Nov 15 17:37:57 2017 -0500
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Wed Nov 15 17:40:29 2017 -0500
----------------------------------------------------------------------
.../libraries/functions/copy_tarball.py | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/0936f463/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py b/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py
index f62aa3d..7bca967 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py
@@ -33,6 +33,7 @@ from resource_management.core import shell
from resource_management.core import sudo
from resource_management.core.logger import Logger
from resource_management.core.exceptions import Fail
+from resource_management.core.resources.system import Directory
from resource_management.core.resources.system import Execute
from resource_management.libraries.functions import stack_tools, stack_features, stack_select
from resource_management.libraries.functions import tar_archive
@@ -77,7 +78,14 @@ def _prepare_tez_tarball():
Execute(("cp", "-a", hadoop_lib_native_dir, tez_lib_dir), sudo = True)
- tez_tarball_with_native_lib = os.path.join(os.path.dirname(tez_source_file), "tez-native.tar.gz")
+ tez_native_tarball_staging_dir = os.path.join(temp_dir, "tez-native-tarball-staging")
+ if not os.path.exists(tez_native_tarball_staging_dir):
+ Directory(tez_native_tarball_staging_dir,
+ cd_access='a',
+ create_parents = True,
+ recursive_ownership = True)
+
+ tez_tarball_with_native_lib = os.path.join(tez_native_tarball_staging_dir, "tez-native.tar.gz")
Logger.info("Creating a new Tez tarball at {0}".format(tez_tarball_with_native_lib))
# tar up Tez, making sure to specify nothing for the arcname so that it does not include an absolute path
[45/50] [abbrv] ambari git commit: AMBARI-22260. Update Spark2 log4j
default settings to latest. (sai.sai.shao via sshridhar).
Posted by rl...@apache.org.
AMBARI-22260. Update Spark2 log4j default settings to latest. (sai.sai.shao via sshridhar).
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4042f9fd
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4042f9fd
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4042f9fd
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 4042f9fde14548be77a5ed5daf45364df307c08a
Parents: 0936f46
Author: Swapan Shridhar <ss...@hortonworks.com>
Authored: Wed Nov 15 16:21:31 2017 -0800
Committer: Swapan Shridhar <ss...@hortonworks.com>
Committed: Wed Nov 15 16:21:31 2017 -0800
----------------------------------------------------------------------
.../stacks/HDP/2.5/upgrades/config-upgrade.xml | 23 ++++++++
.../HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml | 23 +++++---
.../stacks/HDP/2.5/upgrades/upgrade-2.6.xml | 45 +++++++++-------
.../configuration/spark2-log4j-properties.xml | 56 ++++++++++++++++++++
4 files changed, 122 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/4042f9fd/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/config-upgrade.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/config-upgrade.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/config-upgrade.xml
index b1e5f91..8c2c860 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/config-upgrade.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/config-upgrade.xml
@@ -104,14 +104,37 @@
</service>
<service name="SPARK2">
+ <component name="SPARK2_JOBHISTORYSERVER">
+ <changes>
+ <definition xsi:type="configure" id="hdp_2_5_0_0_spark2_jobhistoryserver_log4j">
+ <type>spark2-log4j-properties</type>
+ <replace key="content" find="log4j.logger.org.eclipse.jetty=WARN" replace-with="log4j.logger.org.spark_project.jetty=WARN"/>
+ <replace key="content" find="log4j.logger.org.eclipse.jetty.util.component.AbstractLifeCycle=ERROR" replace-with="log4j.logger.org.spark_project.jetty.util.component.AbstractLifeCycle=ERROR"/>
+ </definition>
+ </changes>
+ </component>
<component name="SPARK2_CLIENT">
<changes>
+ <definition xsi:type="configure" id="hdp_2_5_0_0_spark2_client_log4j">
+ <type>spark2-log4j-properties</type>
+ <replace key="content" find="log4j.logger.org.eclipse.jetty=WARN" replace-with="log4j.logger.org.spark_project.jetty=WARN"/>
+ <replace key="content" find="log4j.logger.org.eclipse.jetty.util.component.AbstractLifeCycle=ERROR" replace-with="log4j.logger.org.spark_project.jetty.util.component.AbstractLifeCycle=ERROR"/>
+ </definition>
<definition xsi:type="configure" id="hdp_2_5_0_0_spark2_yarn_queue">
<type>spark2-defaults</type>
<set key="spark.yarn.queue" value="default" if-type="spark-defaults" if-key="spark.yarn.queue" if-key-state="absent"/>
</definition>
</changes>
</component>
+ <component name="SPARK2_THRIFTSERVER">
+ <changes>
+ <definition xsi:type="configure" id="hdp_2_5_0_0_spark2_thriftserver_log4j">
+ <type>spark2-log4j-properties</type>
+ <replace key="content" find="log4j.logger.org.eclipse.jetty=WARN" replace-with="log4j.logger.org.spark_project.jetty=WARN"/>
+ <replace key="content" find="log4j.logger.org.eclipse.jetty.util.component.AbstractLifeCycle=ERROR" replace-with="log4j.logger.org.spark_project.jetty.util.component.AbstractLifeCycle=ERROR"/>
+ </definition>
+ </changes>
+ </component>
</service>
<service name="TEZ">
http://git-wip-us.apache.org/repos/asf/ambari/blob/4042f9fd/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
index ace9542..9caa850 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
@@ -77,7 +77,7 @@
<service name="FLUME">
<component>FLUME_HANDLER</component>
</service>
-
+
<service name="ACCUMULO">
<component>ACCUMULO_TRACER</component>
<component>ACCUMULO_GC</component>
@@ -355,7 +355,7 @@
<task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.FixCapacitySchedulerOrderingPolicy">
<summary>Validate Root Queue Ordering Policy</summary>
</task>
- </execute-stage>
+ </execute-stage>
<!--TEZ-->
<execute-stage service="TEZ" component="TEZ_CLIENT" title="Verify LZO codec path for Tez">
@@ -679,6 +679,15 @@
<summary>Add queue customization property</summary>
</task>
</execute-stage>
+ <execute-stage service="SPARK2" component="SPARK2_THRIFTSERVER" title="Apply config changes for Spark2 ThriftServer log4j">
+ <task xsi:type="configure" id="hdp_2_5_0_0_spark2_thriftserver_log4j"/>
+ </execute-stage>
+ <execute-stage service="SPARK2" component="SPARK2_JOBHISTORYSERVER" title="Apply config changes for Spark2 Job HistoryServer log4j">
+ <task xsi:type="configure" id="hdp_2_5_0_0_spark2_jobhistoryserver_log4j"/>
+ </execute-stage>
+ <execute-stage service="SPARK2" component="SPARK2_CLIENT" title="Apply config changes for Spark2 Client log4j">
+ <task xsi:type="configure" id="hdp_2_5_0_0_spark2_client_log4j"/>
+ </execute-stage>
</group>
<!--
@@ -720,7 +729,7 @@
</task>
</execute-stage>
</group>
-
+
<!-- Now, restart all of the services. -->
<group xsi:type="restart" name="ZOOKEEPER" title="ZooKeeper">
<service-check>false</service-check>
@@ -1083,7 +1092,7 @@
<component>FLUME_HANDLER</component>
</service>
</group>
-
+
<group xsi:type="restart" name="ACCUMULO" title="Accumulo">
<service-check>false</service-check>
<skippable>true</skippable>
@@ -1112,7 +1121,7 @@
<group xsi:type="cluster" name="FINALIZE_PRE_CHECK" title="Finalize {{direction.text.proper}} Pre-Check">
<direction>UPGRADE</direction>
-
+
<execute-stage title="Check Component Versions">
<task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.ComponentVersionCheckAction" />
</execute-stage>
@@ -1192,7 +1201,7 @@
<function>setup_ranger_java_patches</function>
</task>
</pre-upgrade>
-
+
<pre-downgrade copy-upgrade="true" />
<upgrade>
@@ -1215,7 +1224,7 @@
<function>configure_atlas_user_for_tagsync</function>
</task>
</pre-upgrade>
-
+
<pre-downgrade copy-upgrade="true" />
<upgrade>
http://git-wip-us.apache.org/repos/asf/ambari/blob/4042f9fd/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml
index df11ae1..4fc9b42 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml
@@ -183,7 +183,7 @@
<component>HBASE_MASTER</component>
</service>
</group>
-
+
<group name="SERVICE_CHECK_1" title="All Service Checks" xsi:type="service-check">
<direction>UPGRADE</direction>
<skippable>true</skippable>
@@ -199,7 +199,7 @@
<service>LOGSEARCH</service>
</exclude>
</group>
-
+
<group name="CORE_SLAVES" title="Core Slaves" xsi:type="colocated">
<service-check>false</service-check>
<skippable>true</skippable>
@@ -207,7 +207,7 @@
<component>DATANODE</component>
<component>NFS_GATEWAY</component>
</service>
-
+
<service name="HBASE">
<component>HBASE_REGIONSERVER</component>
<component>PHOENIX_QUERY_SERVER</component>
@@ -223,7 +223,7 @@
<message>The initial batch of {{components}} hosts have been {{direction.past}}. You are advised to check the hosts and perform cluster/workload-specific tests against your cluster to ensure proper operation before proceeding with {{direction.text}} of the remaining services.</message>
</batch>
</group>
-
+
<group name="SERVICE_CHECK_2" title="All Service Checks" xsi:type="service-check">
<direction>UPGRADE</direction>
<skippable>true</skippable>
@@ -458,7 +458,7 @@
<group xsi:type="cluster" name="FINALIZE_PRE_CHECK" title="Finalize {{direction.text.proper}} Pre-Check">
<direction>UPGRADE</direction>
-
+
<execute-stage title="Check Component Versions">
<task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.ComponentVersionCheckAction" />
</execute-stage>
@@ -467,7 +467,7 @@
<group xsi:type="cluster" name="POST_CLUSTER" title="Finalize {{direction.text.proper}}">
<skippable>true</skippable>
<supports-auto-skip-failure>false</supports-auto-skip-failure>
-
+
<execute-stage title="Confirm Finalize">
<direction>UPGRADE</direction>
<task xsi:type="manual">
@@ -491,7 +491,7 @@
<function>finalize_rolling_upgrade</function>
</task>
</execute-stage>
-
+
<execute-stage title="Save Cluster State">
<task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.FinalizeUpgradeAction">
</task>
@@ -577,7 +577,7 @@
<function>configure_atlas_user_for_tagsync</function>
</task>
</pre-upgrade>
-
+
<pre-downgrade copy-upgrade="true" />
<upgrade>
@@ -668,7 +668,7 @@
</upgrade>
</component>
</service>
-
+
<service name="SLIDER">
<component name="SLIDER">
<upgrade>
@@ -691,7 +691,7 @@
</task>
<task xsi:type="configure" id="hdp_2_6_0_0_mapreduce_job_queuename"/>
</pre-upgrade>
-
+
<pre-downgrade copy-upgrade="true" />
<upgrade>
@@ -722,11 +722,11 @@
<task xsi:type="configure" id="yarn_site_retained_log_count" />
<task xsi:type="configure" id="hdp_2_6_0_0_service_check_queue_name"/>
<task xsi:type="configure" id="hdp_2_6_0_0_ats_scan_interval_default"/>
-
+
<task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.FixCapacitySchedulerOrderingPolicy">
<summary>Validate Root Queue Ordering Policy</summary>
</task>
-
+
</pre-upgrade>
<pre-downgrade />
<upgrade>
@@ -785,9 +785,9 @@
</task>
<task xsi:type="configure" id="hdp_2_5_0_0_tez_queue_name"/>
</pre-upgrade>
-
+
<pre-downgrade copy-upgrade="true" />
-
+
<upgrade>
<task xsi:type="restart-task" />
</upgrade>
@@ -865,9 +865,9 @@
<task xsi:type="configure" id="hdp_2_6_maint_llap_config"/>
<task xsi:type="configure" id="llap_update_tez_shuffle_ssl_enable"/>
</pre-upgrade>
-
+
<pre-downgrade />
-
+
<upgrade>
<task xsi:type="restart-task" />
</upgrade>
@@ -913,9 +913,9 @@
<task xsi:type="configure" id="hdp_2_5_0_0_rename_spark_livy_configs" />
<task xsi:type="configure" id="hdp_2_5_0_0_add_spark_conf_dir_livy_configs" />
</pre-upgrade>
-
+
<pre-downgrade />
-
+
<upgrade>
<task xsi:type="restart-task" />
</upgrade>
@@ -933,11 +933,19 @@
<service name="SPARK2">
<component name="SPARK2_JOBHISTORYSERVER">
+ <pre-upgrade>
+ <task xsi:type="configure" id="hdp_2_5_0_0_spark2_jobhistoryserver_log4j"/>
+ </pre-upgrade>
+ <pre-downgrade />
<upgrade>
<task xsi:type="restart-task" />
</upgrade>
</component>
<component name="SPARK2_THRIFTSERVER">
+ <pre-upgrade>
+ <task xsi:type="configure" id="hdp_2_5_0_0_spark2_thriftserver_log4j"/>
+ </pre-upgrade>
+ <pre-downgrade />
<upgrade>
<task xsi:type="restart-task" />
</upgrade>
@@ -945,6 +953,7 @@
<component name="SPARK2_CLIENT">
<pre-upgrade>
<task xsi:type="configure" id="hdp_2_5_0_0_spark2_yarn_queue"/>
+ <task xsi:type="configure" id="hdp_2_5_0_0_spark2_client_log4j"/>
</pre-upgrade>
<pre-downgrade/>
<upgrade>
http://git-wip-us.apache.org/repos/asf/ambari/blob/4042f9fd/ambari-server/src/main/resources/stacks/HDP/2.6/services/SPARK2/configuration/spark2-log4j-properties.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/SPARK2/configuration/spark2-log4j-properties.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/SPARK2/configuration/spark2-log4j-properties.xml
new file mode 100644
index 0000000..d7479f4
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/SPARK2/configuration/spark2-log4j-properties.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/**
+ * 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.
+ */
+-->
+<configuration supports_final="false" supports_adding_forbidden="true">
+ <property>
+ <name>content</name>
+ <description>Spark2-log4j-Properties</description>
+ <value>
+# Set everything to be logged to the console
+log4j.rootCategory=INFO, console
+log4j.appender.console=org.apache.log4j.ConsoleAppender
+log4j.appender.console.target=System.err
+log4j.appender.console.layout=org.apache.log4j.PatternLayout
+log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{1}: %m%n
+
+# Set the default spark-shell log level to WARN. When running the spark-shell, the
+# log level for this class is used to overwrite the root logger's log level, so that
+# the user can have different defaults for the shell and regular Spark apps.
+log4j.logger.org.apache.spark.repl.Main=WARN
+
+# Settings to quiet third party logs that are too verbose
+log4j.logger.org.spark_project.jetty=WARN
+log4j.logger.org.spark_project.jetty.util.component.AbstractLifeCycle=ERROR
+log4j.logger.org.apache.spark.repl.SparkIMain$exprTyper=INFO
+log4j.logger.org.apache.spark.repl.SparkILoop$SparkILoopInterpreter=INFO
+log4j.logger.org.apache.parquet=ERROR
+log4j.logger.parquet=ERROR
+
+# SPARK-9183: Settings to avoid annoying messages when looking up nonexistent UDFs in SparkSQL with Hive support
+log4j.logger.org.apache.hadoop.hive.metastore.RetryingHMSHandler=FATAL
+log4j.logger.org.apache.hadoop.hive.ql.exec.FunctionRegistry=ERROR
+ </value>
+ <value-attributes>
+ <type>content</type>
+ <show-property-name>false</show-property-name>
+ </value-attributes>
+ <on-ambari-upgrade add="true"/>
+ </property>
+</configuration>
[03/50] [abbrv] ambari git commit: AMBARI-22383. Remove
Auto-Installation of LZO Libraries (ncole)
Posted by rl...@apache.org.
AMBARI-22383. Remove Auto-Installation of LZO Libraries (ncole)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5adcea78
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5adcea78
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5adcea78
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 5adcea78792cf227f15e7c08f5bb3fe2c48883d3
Parents: b04e142
Author: Nate Cole <nc...@hortonworks.com>
Authored: Wed Nov 8 14:28:59 2017 -0500
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Wed Nov 8 14:51:48 2017 -0500
----------------------------------------------------------------------
.../libraries/functions/__init__.py | 1 -
.../libraries/functions/get_lzo_packages.py | 50 --------------------
.../libraries/functions/package_conditions.py | 8 +---
.../DRUID/0.10.1/package/scripts/druid.py | 3 +-
.../DRUID/0.10.1/package/scripts/params.py | 3 +-
.../common-services/HDFS/2.1.0.2.0/metainfo.xml | 30 ------------
.../HDFS/2.1.0.2.0/package/scripts/datanode.py | 1 -
.../HDFS/2.1.0.2.0/package/scripts/hdfs.py | 7 ---
.../2.1.0.2.0/package/scripts/hdfs_client.py | 1 -
.../2.1.0.2.0/package/scripts/install_params.py | 1 +
.../2.1.0.2.0/package/scripts/journalnode.py | 1 -
.../HDFS/2.1.0.2.0/package/scripts/namenode.py | 1 -
.../common-services/HDFS/3.0.0.3.0/metainfo.xml | 30 ------------
.../HDFS/3.0.0.3.0/package/scripts/hdfs.py | 7 ---
.../OOZIE/4.0.0.2.0/package/scripts/oozie.py | 6 +--
.../package/scripts/oozie_server_upgrade.py | 7 ++-
.../4.0.0.2.0/package/scripts/params_linux.py | 1 +
.../OOZIE/4.2.0.3.0/package/scripts/oozie.py | 4 --
.../package/scripts/oozie_server_upgrade.py | 5 ++
.../TEZ/0.4.0.2.1/package/scripts/tez_client.py | 32 -------------
.../TEZ/0.9.0.3.0/package/scripts/tez_client.py | 26 ----------
.../custom_actions/scripts/remove_bits.py | 2 +-
.../BIGTOP/0.8/services/HDFS/metainfo.xml | 16 -------
.../0.8/services/HDFS/package/scripts/params.py | 6 +--
.../stacks/HDP/2.2/services/HDFS/metainfo.xml | 35 --------------
.../2.3.GlusterFS/services/HDFS/metainfo.xml | 10 ----
.../stacks/HDP/2.3/services/HDFS/metainfo.xml | 30 ------------
.../stacks/HDP/3.0/services/HDFS/metainfo.xml | 30 ------------
.../python/custom_actions/TestRemoveBits.py | 5 +-
29 files changed, 20 insertions(+), 339 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/5adcea78/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py b/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py
index f144b2d..1e388ac 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py
@@ -39,7 +39,6 @@ from resource_management.libraries.functions.version import *
from resource_management.libraries.functions.format_jvm_option import *
from resource_management.libraries.functions.constants import *
from resource_management.libraries.functions.get_stack_version import *
-from resource_management.libraries.functions.get_lzo_packages import *
from resource_management.libraries.functions.setup_ranger_plugin import *
from resource_management.libraries.functions.curl_krb_request import *
from resource_management.libraries.functions.get_bare_principal import *
http://git-wip-us.apache.org/repos/asf/ambari/blob/5adcea78/ambari-common/src/main/python/resource_management/libraries/functions/get_lzo_packages.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/get_lzo_packages.py b/ambari-common/src/main/python/resource_management/libraries/functions/get_lzo_packages.py
deleted file mode 100644
index cfbb7d8..0000000
--- a/ambari-common/src/main/python/resource_management/libraries/functions/get_lzo_packages.py
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/env python
-"""
-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.
-
-Ambari Agent
-
-"""
-__all__ = ["get_lzo_packages"]
-
-from ambari_commons.os_check import OSCheck
-from resource_management.libraries.functions.stack_features import check_stack_feature
-from resource_management.libraries.functions import StackFeature
-from resource_management.libraries.script.script import Script
-
-# TODO: Make list of lzo packages stack driven
-def get_lzo_packages(stack_version_unformatted):
- lzo_packages = []
- script_instance = Script.get_instance()
- if OSCheck.is_suse_family() and int(OSCheck.get_os_major_version()) >= 12:
- lzo_packages += ["liblzo2-2", "hadoop-lzo-native"]
- elif OSCheck.is_redhat_family() or OSCheck.is_suse_family():
- lzo_packages += ["lzo", "hadoop-lzo-native"]
- elif OSCheck.is_ubuntu_family():
- lzo_packages += ["liblzo2-2"]
-
- if stack_version_unformatted and check_stack_feature(StackFeature.ROLLING_UPGRADE, stack_version_unformatted):
- if OSCheck.is_ubuntu_family():
- lzo_packages += [script_instance.format_package_name("hadooplzo-${stack_version}") ,
- script_instance.format_package_name("hadooplzo-${stack_version}-native")]
- else:
- lzo_packages += [script_instance.format_package_name("hadooplzo_${stack_version}"),
- script_instance.format_package_name("hadooplzo_${stack_version}-native")]
- else:
- lzo_packages += ["hadoop-lzo"]
-
- return lzo_packages
http://git-wip-us.apache.org/repos/asf/ambari/blob/5adcea78/ambari-common/src/main/python/resource_management/libraries/functions/package_conditions.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/package_conditions.py b/ambari-common/src/main/python/resource_management/libraries/functions/package_conditions.py
index 31e78b9..ded63cf 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/package_conditions.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/package_conditions.py
@@ -19,7 +19,7 @@ limitations under the License.
Ambari Agent
"""
-__all__ = ["is_lzo_enabled", "should_install_phoenix", "should_install_ams_collector", "should_install_ams_grafana",
+__all__ = ["should_install_phoenix", "should_install_ams_collector", "should_install_ams_grafana",
"should_install_mysql", "should_install_ranger_tagsync"]
import os
@@ -44,12 +44,6 @@ def _has_local_components(config, components, indicator_function = any):
def _has_applicable_local_component(config, components):
return _has_local_components(config, components, any)
-def should_install_lzo():
- config = Script.get_config()
- io_compression_codecs = default("/configurations/core-site/io.compression.codecs", None)
- lzo_enabled = io_compression_codecs is not None and "com.hadoop.compression.lzo" in io_compression_codecs.lower()
- return lzo_enabled
-
def should_install_phoenix():
phoenix_hosts = default('/clusterHostInfo/phoenix_query_server_hosts', [])
phoenix_enabled = default('/configurations/hbase-env/phoenix_sql_enabled', False)
http://git-wip-us.apache.org/repos/asf/ambari/blob/5adcea78/ambari-server/src/main/resources/common-services/DRUID/0.10.1/package/scripts/druid.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/DRUID/0.10.1/package/scripts/druid.py b/ambari-server/src/main/resources/common-services/DRUID/0.10.1/package/scripts/druid.py
index ec98c3c..bb872b9 100644
--- a/ambari-server/src/main/resources/common-services/DRUID/0.10.1/package/scripts/druid.py
+++ b/ambari-server/src/main/resources/common-services/DRUID/0.10.1/package/scripts/druid.py
@@ -115,8 +115,7 @@ def druid(upgrade_type=None, nodeType=None):
)
Logger.info(format("Created druid-{node_type_lowercase} jvm.config"))
# Handling hadoop Lzo jars if enable and node type is hadoop related eg Overlords and MMs
- if ['middleManager', 'overlord'].__contains__(node_type_lowercase) and params.lzo_enabled and len(
- params.lzo_packages) > 0:
+ if ['middleManager', 'overlord'].__contains__(node_type_lowercase) and params.lzo_enabled:
try:
Logger.info(
format(
http://git-wip-us.apache.org/repos/asf/ambari/blob/5adcea78/ambari-server/src/main/resources/common-services/DRUID/0.10.1/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/DRUID/0.10.1/package/scripts/params.py b/ambari-server/src/main/resources/common-services/DRUID/0.10.1/package/scripts/params.py
index fd1cde6..141250d 100644
--- a/ambari-server/src/main/resources/common-services/DRUID/0.10.1/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/DRUID/0.10.1/package/scripts/params.py
@@ -18,7 +18,6 @@ limitations under the License.
"""
from ambari_commons import OSCheck
-from resource_management.libraries.functions.get_lzo_packages import get_lzo_packages
from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.resources.hdfs_resource import HdfsResource
@@ -196,5 +195,5 @@ if has_metric_collector:
stack_version_unformatted = str(config['hostLevelParams']['stack_version'])
io_compression_codecs = default("/configurations/core-site/io.compression.codecs", None)
lzo_enabled = io_compression_codecs is not None and "com.hadoop.compression.lzo" in io_compression_codecs.lower()
-lzo_packages = get_lzo_packages(stack_version_unformatted)
+
hadoop_lib_home = stack_root + '/' + stack_version + '/hadoop/lib'
http://git-wip-us.apache.org/repos/asf/ambari/blob/5adcea78/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml
index 9979de4..6bbb583 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml
@@ -244,11 +244,6 @@
<package>
<name>hadoop</name>
</package>
- <package>
- <name>hadoop-lzo</name>
- <skipUpgrade>true</skipUpgrade>
- <condition>should_install_lzo</condition>
- </package>
</packages>
</osSpecific>
@@ -265,16 +260,6 @@
<name>snappy-devel</name>
</package>
<package>
- <name>lzo</name>
- <skipUpgrade>true</skipUpgrade>
- <condition>should_install_lzo</condition>
- </package>
- <package>
- <name>hadoop-lzo-native</name>
- <skipUpgrade>true</skipUpgrade>
- <condition>should_install_lzo</condition>
- </package>
- <package>
<name>hadoop-libhdfs</name>
</package>
<package>
@@ -296,16 +281,6 @@
<name>snappy-devel</name>
</package>
<package>
- <name>liblzo2-2</name>
- <skipUpgrade>true</skipUpgrade>
- <condition>should_install_lzo</condition>
- </package>
- <package>
- <name>hadoop-lzo-native</name>
- <skipUpgrade>true</skipUpgrade>
- <condition>should_install_lzo</condition>
- </package>
- <package>
<name>hadoop-libhdfs</name>
</package>
</packages>
@@ -324,11 +299,6 @@
<name>libsnappy-dev</name>
</package>
<package>
- <name>liblzo2-2</name>
- <skipUpgrade>true</skipUpgrade>
- <condition>should_install_lzo</condition>
- </package>
- <package>
<name>hadoop-hdfs</name>
</package>
<package>
http://git-wip-us.apache.org/repos/asf/ambari/blob/5adcea78/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/datanode.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/datanode.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/datanode.py
index c0abb15..a8b0f48 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/datanode.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/datanode.py
@@ -165,7 +165,6 @@ class DataNodeDefault(DataNode):
@OsFamilyImpl(os_family=OSConst.WINSRV_FAMILY)
class DataNodeWindows(DataNode):
def install(self, env):
- import install_params
self.install_packages(env)
if __name__ == "__main__":
http://git-wip-us.apache.org/repos/asf/ambari/blob/5adcea78/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs.py
index 4022986..1d7fe53 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs.py
@@ -26,7 +26,6 @@ from resource_management.core.source import Template
from resource_management.core.resources.service import ServiceConfig
from resource_management.libraries.resources.xml_config import XmlConfig
-from resource_management.libraries.functions.get_lzo_packages import get_lzo_packages
from resource_management.core.exceptions import Fail
from resource_management.core.logger import Logger
from resource_management.libraries.functions.format import format
@@ -143,12 +142,6 @@ def hdfs(name=None):
content=Template("slaves.j2")
)
- if params.lzo_enabled:
- lzo_packages = get_lzo_packages(params.stack_version_unformatted)
- Package(lzo_packages,
- retry_on_repo_unavailability=params.agent_stack_retry_on_unavailability,
- retry_count=params.agent_stack_retry_count)
-
def install_snappy():
import params
Directory([params.so_target_dir_x86, params.so_target_dir_x64],
http://git-wip-us.apache.org/repos/asf/ambari/blob/5adcea78/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs_client.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs_client.py
index f2e96c3..a802e08 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs_client.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs_client.py
@@ -70,7 +70,6 @@ class HdfsClientDefault(HdfsClient):
@OsFamilyImpl(os_family=OSConst.WINSRV_FAMILY)
class HdfsClientWindows(HdfsClient):
def install(self, env):
- import install_params
self.install_packages(env)
self.configure(env)
http://git-wip-us.apache.org/repos/asf/ambari/blob/5adcea78/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/install_params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/install_params.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/install_params.py
index 235f231..72850b3 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/install_params.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/install_params.py
@@ -18,6 +18,7 @@ limitations under the License.
"""
from ambari_commons import OSCheck
+exclude_packages = []
# These parameters are supposed to be referenced at installation time, before the Hadoop environment variables have been set
if OSCheck.is_windows_family():
exclude_packages = []
http://git-wip-us.apache.org/repos/asf/ambari/blob/5adcea78/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/journalnode.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/journalnode.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/journalnode.py
index 75b2eeb..eaa21e9 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/journalnode.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/journalnode.py
@@ -116,7 +116,6 @@ class JournalNodeDefault(JournalNode):
@OsFamilyImpl(os_family=OSConst.WINSRV_FAMILY)
class JournalNodeWindows(JournalNode):
def install(self, env):
- import install_params
self.install_packages(env)
def start(self, env):
http://git-wip-us.apache.org/repos/asf/ambari/blob/5adcea78/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py
index 291da05..5f4152d 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py
@@ -327,7 +327,6 @@ class NameNodeDefault(NameNode):
@OsFamilyImpl(os_family=OSConst.WINSRV_FAMILY)
class NameNodeWindows(NameNode):
def install(self, env):
- import install_params
self.install_packages(env)
#TODO we need this for HA because of manual steps
self.configure(env)
http://git-wip-us.apache.org/repos/asf/ambari/blob/5adcea78/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/metainfo.xml b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/metainfo.xml
index e6d1166..0c629f3 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/metainfo.xml
@@ -270,11 +270,6 @@
<package>
<name>hadoop</name>
</package>
- <package>
- <name>hadoop-lzo</name>
- <skipUpgrade>true</skipUpgrade>
- <condition>should_install_lzo</condition>
- </package>
</packages>
</osSpecific>
@@ -291,16 +286,6 @@
<name>snappy-devel</name>
</package>
<package>
- <name>lzo</name>
- <skipUpgrade>true</skipUpgrade>
- <condition>should_install_lzo</condition>
- </package>
- <package>
- <name>hadoop-lzo-native</name>
- <skipUpgrade>true</skipUpgrade>
- <condition>should_install_lzo</condition>
- </package>
- <package>
<name>hadoop-libhdfs</name>
</package>
</packages>
@@ -319,16 +304,6 @@
<name>snappy-devel</name>
</package>
<package>
- <name>liblzo2-2</name>
- <skipUpgrade>true</skipUpgrade>
- <condition>should_install_lzo</condition>
- </package>
- <package>
- <name>hadoop-lzo-native</name>
- <skipUpgrade>true</skipUpgrade>
- <condition>should_install_lzo</condition>
- </package>
- <package>
<name>hadoop-libhdfs</name>
</package>
</packages>
@@ -347,11 +322,6 @@
<name>libsnappy-dev</name>
</package>
<package>
- <name>liblzo2-2</name>
- <skipUpgrade>true</skipUpgrade>
- <condition>should_install_lzo</condition>
- </package>
- <package>
<name>hadoop-hdfs</name>
</package>
<package>
http://git-wip-us.apache.org/repos/asf/ambari/blob/5adcea78/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/hdfs.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/hdfs.py b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/hdfs.py
index 4022986..89f9a1c 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/hdfs.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/hdfs.py
@@ -26,7 +26,6 @@ from resource_management.core.source import Template
from resource_management.core.resources.service import ServiceConfig
from resource_management.libraries.resources.xml_config import XmlConfig
-from resource_management.libraries.functions.get_lzo_packages import get_lzo_packages
from resource_management.core.exceptions import Fail
from resource_management.core.logger import Logger
from resource_management.libraries.functions.format import format
@@ -142,12 +141,6 @@ def hdfs(name=None):
owner=tc_owner,
content=Template("slaves.j2")
)
-
- if params.lzo_enabled:
- lzo_packages = get_lzo_packages(params.stack_version_unformatted)
- Package(lzo_packages,
- retry_on_repo_unavailability=params.agent_stack_retry_on_unavailability,
- retry_count=params.agent_stack_retry_count)
def install_snappy():
import params
http://git-wip-us.apache.org/repos/asf/ambari/blob/5adcea78/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie.py b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie.py
index f215a1e..cd94244 100644
--- a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie.py
+++ b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie.py
@@ -37,7 +37,6 @@ from resource_management.libraries.functions.copy_tarball import get_current_ver
from resource_management.libraries.resources.xml_config import XmlConfig
from resource_management.libraries.script.script import Script
from resource_management.libraries.functions.security_commons import update_credential_provider_path
-from resource_management.libraries.functions.get_lzo_packages import get_lzo_packages
from resource_management.core.resources.packaging import Package
from resource_management.core.shell import as_user, as_sudo, call, checked_call
from resource_management.core.exceptions import Fail
@@ -306,11 +305,8 @@ def oozie_server_specific(upgrade_type):
Execute(format('{sudo} chown {oozie_user}:{user_group} {oozie_libext_dir}/falcon-oozie-el-extension-*.jar'),
not_if = no_op_test)
+ # just copying files is ok - we're not making assumptions about installing LZO here
if params.lzo_enabled:
- all_lzo_packages = get_lzo_packages(params.stack_version_unformatted)
- Package(all_lzo_packages,
- retry_on_repo_unavailability=params.agent_stack_retry_on_unavailability,
- retry_count=params.agent_stack_retry_count)
Execute(format('{sudo} cp {hadoop_lib_home}/hadoop-lzo*.jar {oozie_lib_dir}'),
not_if = no_op_test,
)
http://git-wip-us.apache.org/repos/asf/ambari/blob/5adcea78/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_server_upgrade.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_server_upgrade.py b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_server_upgrade.py
index 23b39ef..c9c07d1 100644
--- a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_server_upgrade.py
+++ b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_server_upgrade.py
@@ -61,10 +61,15 @@ class OozieUpgrade(Script):
# <stack-selector-tool> set hadoop-client has not run yet, therefore we cannot use
# <stack-root>/current/hadoop-client ; we must use params.version directly
# however, this only works when upgrading beyond 2.2.0.0; don't do this
- # for downgrade to 2.2.0.0 since hadoop-lzo will not be present
+ # for downgrade to 2.2.0.0 since hadoop-lzo will not be present.
+ #
# This can also be called during a Downgrade.
+ #
# When a version is Installed, it is responsible for downloading the hadoop-lzo packages
# if lzo is enabled.
+ #
+ # This block is just copying around files - there is no assumption about installation
+ #
if params.lzo_enabled and (params.upgrade_direction == Direction.UPGRADE or target_version_needs_compression_libraries):
hadoop_lzo_pattern = 'hadoop-lzo*.jar'
hadoop_client_new_lib_dir = format("{stack_root}/{version}/hadoop/lib")
http://git-wip-us.apache.org/repos/asf/ambari/blob/5adcea78/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/params_linux.py
index a0f0672..40901b6 100644
--- a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/params_linux.py
@@ -387,3 +387,4 @@ is_webhdfs_enabled = config['configurations']['hdfs-site']['dfs.webhdfs.enabled'
# The logic for LZO also exists in HDFS' params.py
io_compression_codecs = default("/configurations/core-site/io.compression.codecs", None)
lzo_enabled = io_compression_codecs is not None and "com.hadoop.compression.lzo" in io_compression_codecs.lower()
+
http://git-wip-us.apache.org/repos/asf/ambari/blob/5adcea78/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie.py b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie.py
index 0771e93..19912fd 100644
--- a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie.py
+++ b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie.py
@@ -276,10 +276,6 @@ def oozie_server_specific():
not_if = no_op_test)
if params.lzo_enabled:
- all_lzo_packages = get_lzo_packages(params.stack_version_unformatted)
- Package(all_lzo_packages,
- retry_on_repo_unavailability=params.agent_stack_retry_on_unavailability,
- retry_count=params.agent_stack_retry_count)
Execute(format('{sudo} cp {hadoop_lib_home}/hadoop-lzo*.jar {oozie_lib_dir}'),
not_if = no_op_test,
)
http://git-wip-us.apache.org/repos/asf/ambari/blob/5adcea78/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie_server_upgrade.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie_server_upgrade.py b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie_server_upgrade.py
index 402c7cb..4fc1a42 100644
--- a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie_server_upgrade.py
+++ b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie_server_upgrade.py
@@ -62,9 +62,14 @@ class OozieUpgrade(Script):
# <stack-root>/current/hadoop-client ; we must use params.version directly
# however, this only works when upgrading beyond 2.2.0.0; don't do this
# for downgrade to 2.2.0.0 since hadoop-lzo will not be present
+ #
# This can also be called during a Downgrade.
+ #
# When a version is Installed, it is responsible for downloading the hadoop-lzo packages
# if lzo is enabled.
+ #
+ # This block is just copying around files - there is no assumption about installation
+ #
if params.lzo_enabled and (params.upgrade_direction == Direction.UPGRADE or target_version_needs_compression_libraries):
hadoop_lzo_pattern = 'hadoop-lzo*.jar'
hadoop_client_new_lib_dir = format("{stack_root}/{version}/hadoop/lib")
http://git-wip-us.apache.org/repos/asf/ambari/blob/5adcea78/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/tez_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/tez_client.py b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/tez_client.py
index ed3f5fd..dcf3e24 100644
--- a/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/tez_client.py
+++ b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/tez_client.py
@@ -19,22 +19,15 @@ Ambari Agent
"""
import os
-import urlparse
from ambari_commons import OSConst
-from ambari_commons.inet_utils import download_file
from ambari_commons.os_family_impl import OsFamilyImpl
-from ambari_commons.os_utils import copy_file, extract_path_component
from resource_management.core.exceptions import ClientComponentHasNoStatus
-from resource_management.core.source import InlineTemplate
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
-from resource_management.libraries.functions.get_stack_version import get_stack_version
from resource_management.libraries.script.script import Script
-from resource_management.libraries.functions.default import default
-from resource_management.core.logger import Logger
from tez import tez
@@ -96,33 +89,8 @@ class TezClientWindows(TezClient):
self.install_packages(env)
params.refresh_tez_state_dependent_params()
env.set_params(params)
- self._install_lzo_support_if_needed(params)
self.configure(env, config_dir=params.tez_conf_dir)
- def _install_lzo_support_if_needed(self, params):
- hadoop_classpath_prefix = self._expand_hadoop_classpath_prefix(params.hadoop_classpath_prefix_template, params.config['configurations']['tez-site'])
-
- hadoop_lzo_dest_path = extract_path_component(hadoop_classpath_prefix, "hadoop-lzo-")
- if hadoop_lzo_dest_path:
- hadoop_lzo_file = os.path.split(hadoop_lzo_dest_path)[1]
-
- config = Script.get_config()
- file_url = urlparse.urljoin(config['hostLevelParams']['jdk_location'], hadoop_lzo_file)
- hadoop_lzo_dl_path = os.path.join(config["hostLevelParams"]["agentCacheDir"], hadoop_lzo_file)
- download_file(file_url, hadoop_lzo_dl_path)
- #This is for protection against configuration changes. It will infect every new destination with the lzo jar,
- # but since the classpath points to the jar directly we're getting away with it.
- if not os.path.exists(hadoop_lzo_dest_path):
- copy_file(hadoop_lzo_dl_path, hadoop_lzo_dest_path)
-
- def _expand_hadoop_classpath_prefix(self, hadoop_classpath_prefix_template, configurations):
- import resource_management
-
- hadoop_classpath_prefix_obj = InlineTemplate(hadoop_classpath_prefix_template, configurations_dict=configurations,
- extra_imports=[resource_management, resource_management.core,
- resource_management.core.source])
- hadoop_classpath_prefix = hadoop_classpath_prefix_obj.get_content()
- return hadoop_classpath_prefix
if __name__ == "__main__":
TezClient().execute()
http://git-wip-us.apache.org/repos/asf/ambari/blob/5adcea78/ambari-server/src/main/resources/common-services/TEZ/0.9.0.3.0/package/scripts/tez_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/TEZ/0.9.0.3.0/package/scripts/tez_client.py b/ambari-server/src/main/resources/common-services/TEZ/0.9.0.3.0/package/scripts/tez_client.py
index b42d14e..0dfab4f 100644
--- a/ambari-server/src/main/resources/common-services/TEZ/0.9.0.3.0/package/scripts/tez_client.py
+++ b/ambari-server/src/main/resources/common-services/TEZ/0.9.0.3.0/package/scripts/tez_client.py
@@ -98,33 +98,7 @@ class TezClientWindows(TezClient):
self.install_packages(env)
params.refresh_tez_state_dependent_params()
env.set_params(params)
- self._install_lzo_support_if_needed(params)
self.configure(env, config_dir=params.tez_conf_dir)
- def _install_lzo_support_if_needed(self, params):
- hadoop_classpath_prefix = self._expand_hadoop_classpath_prefix(params.hadoop_classpath_prefix_template, params.config['configurations']['tez-site'])
-
- hadoop_lzo_dest_path = extract_path_component(hadoop_classpath_prefix, "hadoop-lzo-")
- if hadoop_lzo_dest_path:
- hadoop_lzo_file = os.path.split(hadoop_lzo_dest_path)[1]
-
- config = Script.get_config()
- file_url = urlparse.urljoin(config['hostLevelParams']['jdk_location'], hadoop_lzo_file)
- hadoop_lzo_dl_path = os.path.join(config["hostLevelParams"]["agentCacheDir"], hadoop_lzo_file)
- download_file(file_url, hadoop_lzo_dl_path)
- #This is for protection against configuration changes. It will infect every new destination with the lzo jar,
- # but since the classpath points to the jar directly we're getting away with it.
- if not os.path.exists(hadoop_lzo_dest_path):
- copy_file(hadoop_lzo_dl_path, hadoop_lzo_dest_path)
-
- def _expand_hadoop_classpath_prefix(self, hadoop_classpath_prefix_template, configurations):
- import resource_management
-
- hadoop_classpath_prefix_obj = InlineTemplate(hadoop_classpath_prefix_template, configurations_dict=configurations,
- extra_imports=[resource_management, resource_management.core,
- resource_management.core.source])
- hadoop_classpath_prefix = hadoop_classpath_prefix_obj.get_content()
- return hadoop_classpath_prefix
-
if __name__ == "__main__":
TezClient().execute()
http://git-wip-us.apache.org/repos/asf/ambari/blob/5adcea78/ambari-server/src/main/resources/custom_actions/scripts/remove_bits.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/custom_actions/scripts/remove_bits.py b/ambari-server/src/main/resources/custom_actions/scripts/remove_bits.py
index 0be9a34..078cf32 100644
--- a/ambari-server/src/main/resources/custom_actions/scripts/remove_bits.py
+++ b/ambari-server/src/main/resources/custom_actions/scripts/remove_bits.py
@@ -43,7 +43,7 @@ class RemoveBits(Script):
Logger.info("Attempting to remove bits for HDP 2.1")
config = Script.get_config()
- packages_to_remove = ["zookeeper", "hadoop", "hadoop-lzo", "hadoop-hdfs", "hadoop-libhdfs", "hadoop-yarn", "hadoop-client", "hadoop-mapreduce", "hive", "hive-hcatalog", "hive-jdbc", "hive-webhcat", "hcatalog", "webhcat-tar-hive", "webhcat-tar-pig", "oozie", "oozie-client", "pig", "sqoop", "tez" "falcon", "storm", "flume", "hbase", "phoenix"]
+ packages_to_remove = ["zookeeper", "hadoop", "hadoop-hdfs", "hadoop-libhdfs", "hadoop-yarn", "hadoop-client", "hadoop-mapreduce", "hive", "hive-hcatalog", "hive-jdbc", "hive-webhcat", "hcatalog", "webhcat-tar-hive", "webhcat-tar-pig", "oozie", "oozie-client", "pig", "sqoop", "tez" "falcon", "storm", "flume", "hbase", "phoenix"]
packages_to_remove.reverse()
Logger.info("Packages to remove: {0}".format(" ".join(packages_to_remove)))
http://git-wip-us.apache.org/repos/asf/ambari/blob/5adcea78/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/metainfo.xml b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/metainfo.xml
index 8500839..f473598 100644
--- a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/metainfo.xml
@@ -180,10 +180,6 @@
<package>
<name>hadoop</name>
</package>
- <package>
- <name>hadoop-lzo</name>
- <skipUpgrade>true</skipUpgrade>
- </package>
</packages>
</osSpecific>
@@ -197,14 +193,6 @@
<name>snappy-devel</name>
</package>
<package>
- <name>lzo</name>
- <skipUpgrade>true</skipUpgrade>
- </package>
- <package>
- <name>hadoop-lzo-native</name>
- <skipUpgrade>true</skipUpgrade>
- </package>
- <package>
<name>hadoop-libhdfs</name>
</package>
</packages>
@@ -220,10 +208,6 @@
<name>libsnappy-dev</name>
</package>
<package>
- <name>liblzo2-2</name>
- <skipUpgrade>true</skipUpgrade>
- </package>
- <package>
<name>hadoop-hdfs</name>
</package>
<package>
http://git-wip-us.apache.org/repos/asf/ambari/blob/5adcea78/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/package/scripts/params.py b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/package/scripts/params.py
index 3a711c7..f16242c 100644
--- a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/package/scripts/params.py
+++ b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/package/scripts/params.py
@@ -209,11 +209,7 @@ HdfsDirectory = functools.partial(
bin_dir = hadoop_bin_dir
)
-io_compression_codecs = config['configurations']['core-site']['io.compression.codecs']
-if not "com.hadoop.compression.lzo" in io_compression_codecs:
- exclude_packages = ["lzo", "hadoop-lzo", "hadoop-lzo-native", "liblzo2-2"]
-else:
- exclude_packages = []
+exclude_packages = []
name_node_params = default("/commandParams/namenode", None)
#hadoop params
http://git-wip-us.apache.org/repos/asf/ambari/blob/5adcea78/ambari-server/src/main/resources/stacks/HDP/2.2/services/HDFS/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HDFS/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HDFS/metainfo.xml
index 8c2ec8b..d7221b9 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HDFS/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HDFS/metainfo.xml
@@ -40,19 +40,6 @@
<name>snappy-devel</name>
</package>
<package>
- <name>lzo</name>
- <skipUpgrade>true</skipUpgrade>
- <condition>should_install_lzo</condition>
- </package>
- <package>
- <name>hadooplzo_${stack_version}</name>
- <condition>should_install_lzo</condition>
- </package>
- <package>
- <name>hadooplzo_${stack_version}-native</name>
- <condition>should_install_lzo</condition>
- </package>
- <package>
<name>hadoop_${stack_version}-libhdfs</name>
</package>
<package>
@@ -77,19 +64,6 @@
<name>snappy-devel</name>
</package>
<package>
- <name>liblzo2-2</name>
- <skipUpgrade>true</skipUpgrade>
- <condition>should_install_lzo</condition>
- </package>
- <package>
- <name>hadooplzo_${stack_version}</name>
- <condition>should_install_lzo</condition>
- </package>
- <package>
- <name>hadooplzo_${stack_version}-native</name>
- <condition>should_install_lzo</condition>
- </package>
- <package>
<name>hadoop_${stack_version}-libhdfs</name>
</package>
</packages>
@@ -123,15 +97,6 @@
<name>libsnappy-dev</name>
</package>
<package>
- <name>hadooplzo-${stack_version}</name>
- <condition>should_install_lzo</condition>
- </package>
- <package>
- <name>liblzo2-2</name>
- <skipUpgrade>true</skipUpgrade>
- <condition>should_install_lzo</condition>
- </package>
- <package>
<name>libhdfs0-${stack_version}</name>
</package>
</packages>
http://git-wip-us.apache.org/repos/asf/ambari/blob/5adcea78/ambari-server/src/main/resources/stacks/HDP/2.3.GlusterFS/services/HDFS/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3.GlusterFS/services/HDFS/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.3.GlusterFS/services/HDFS/metainfo.xml
index 15fe931..6a9fab61 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3.GlusterFS/services/HDFS/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3.GlusterFS/services/HDFS/metainfo.xml
@@ -36,13 +36,6 @@
<name>snappy-devel</name>
</package>
<package>
- <name>lzo</name>
- <skipUpgrade>true</skipUpgrade>
- </package>
- <package>
- <name>hadooplzo_2_3_*</name>
- </package>
- <package>
<name>hadoop_2_3_*-libhdfs</name>
</package>
</packages>
@@ -76,9 +69,6 @@
<name>libsnappy-dev</name>
</package>
<package>
- <name>hadooplzo-2-3-.*</name>
- </package>
- <package>
<name>libhdfs0-2-3-.*</name>
</package>
</packages>
http://git-wip-us.apache.org/repos/asf/ambari/blob/5adcea78/ambari-server/src/main/resources/stacks/HDP/2.3/services/HDFS/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/HDFS/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/services/HDFS/metainfo.xml
index ccf9a4e..86531cc 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/HDFS/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/HDFS/metainfo.xml
@@ -72,19 +72,6 @@
<name>snappy-devel</name>
</package>
<package>
- <name>lzo</name>
- <skipUpgrade>true</skipUpgrade>
- <condition>should_install_lzo</condition>
- </package>
- <package>
- <name>hadooplzo_${stack_version}</name>
- <condition>should_install_lzo</condition>
- </package>
- <package>
- <name>hadooplzo_${stack_version}-native</name>
- <condition>should_install_lzo</condition>
- </package>
- <package>
<name>hadoop_${stack_version}-libhdfs</name>
</package>
<package>
@@ -109,19 +96,6 @@
<name>snappy-devel</name>
</package>
<package>
- <name>liblzo2-2</name>
- <skipUpgrade>true</skipUpgrade>
- <condition>should_install_lzo</condition>
- </package>
- <package>
- <name>hadooplzo_${stack_version}</name>
- <condition>should_install_lzo</condition>
- </package>
- <package>
- <name>hadooplzo_${stack_version}-native</name>
- <condition>should_install_lzo</condition>
- </package>
- <package>
<name>hadoop_${stack_version}-libhdfs</name>
</package>
</packages>
@@ -155,10 +129,6 @@
<name>libsnappy-dev</name>
</package>
<package>
- <name>hadooplzo-${stack_version}</name>
- <condition>should_install_lzo</condition>
- </package>
- <package>
<name>libhdfs0-${stack_version}</name>
</package>
</packages>
http://git-wip-us.apache.org/repos/asf/ambari/blob/5adcea78/ambari-server/src/main/resources/stacks/HDP/3.0/services/HDFS/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/3.0/services/HDFS/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/3.0/services/HDFS/metainfo.xml
index 95a5f84..775508e 100644
--- a/ambari-server/src/main/resources/stacks/HDP/3.0/services/HDFS/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/3.0/services/HDFS/metainfo.xml
@@ -50,19 +50,6 @@
<name>snappy-devel</name>
</package>
<package>
- <name>lzo</name>
- <skipUpgrade>true</skipUpgrade>
- <condition>should_install_lzo</condition>
- </package>
- <package>
- <name>hadooplzo_${stack_version}</name>
- <condition>should_install_lzo</condition>
- </package>
- <package>
- <name>hadooplzo_${stack_version}-native</name>
- <condition>should_install_lzo</condition>
- </package>
- <package>
<name>hadoop_${stack_version}-libhdfs</name>
</package>
</packages>
@@ -84,19 +71,6 @@
<name>snappy-devel</name>
</package>
<package>
- <name>liblzo2-2</name>
- <skipUpgrade>true</skipUpgrade>
- <condition>should_install_lzo</condition>
- </package>
- <package>
- <name>hadooplzo_${stack_version}</name>
- <condition>should_install_lzo</condition>
- </package>
- <package>
- <name>hadooplzo_${stack_version}-native</name>
- <condition>should_install_lzo</condition>
- </package>
- <package>
<name>hadoop_${stack_version}-libhdfs</name>
</package>
</packages>
@@ -130,10 +104,6 @@
<name>libsnappy-dev</name>
</package>
<package>
- <name>hadooplzo-${stack_version}</name>
- <condition>should_install_lzo</condition>
- </package>
- <package>
<name>libhdfs0-${stack_version}</name>
</package>
</packages>
http://git-wip-us.apache.org/repos/asf/ambari/blob/5adcea78/ambari-server/src/test/python/custom_actions/TestRemoveBits.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/custom_actions/TestRemoveBits.py b/ambari-server/src/test/python/custom_actions/TestRemoveBits.py
index 6537152..8217ca0 100644
--- a/ambari-server/src/test/python/custom_actions/TestRemoveBits.py
+++ b/ambari-server/src/test/python/custom_actions/TestRemoveBits.py
@@ -105,13 +105,10 @@ class TestRemoveBits(RMFTestCase):
self.assertResourceCalled('Package', 'hadoop-hdfs',
action = ['remove'],
)
- self.assertResourceCalled('Package', 'hadoop-lzo',
- action = ['remove'],
- )
self.assertResourceCalled('Package', 'hadoop',
action = ['remove'],
)
self.assertResourceCalled('Package', 'zookeeper',
action = ['remove'],
)
- self.assertNoMoreResources()
\ No newline at end of file
+ self.assertNoMoreResources()
[15/50] [abbrv] ambari git commit: AMBARI-22412. Remove IPA
integration from experimental status (rlevas)
Posted by rl...@apache.org.
AMBARI-22412. Remove IPA integration from experimental status (rlevas)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/22b2d55f
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/22b2d55f
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/22b2d55f
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 22b2d55f646ebd965834e43536056c5f229e236e
Parents: 98915a1
Author: Robert Levas <rl...@hortonworks.com>
Authored: Fri Nov 10 10:46:01 2017 -0500
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Fri Nov 10 10:46:01 2017 -0500
----------------------------------------------------------------------
ambari-web/app/config.js | 1 -
.../main/admin/kerberos/step1_controller.js | 52 +++++++++-----------
ambari-web/app/messages.js | 2 +-
.../admin/kerberos/step1_controller_test.js | 17 -------
4 files changed, 23 insertions(+), 49 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/22b2d55f/ambari-web/app/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/config.js b/ambari-web/app/config.js
index 0963f70..8dbbde3 100644
--- a/ambari-web/app/config.js
+++ b/ambari-web/app/config.js
@@ -82,7 +82,6 @@ App.supports = {
serviceAutoStart: true,
logSearch: true,
redhatSatellite: false,
- enableIpa: false,
addingNewRepository: false,
kerberosStackAdvisor: true,
logCountVizualization: false,
http://git-wip-us.apache.org/repos/asf/ambari/blob/22b2d55f/ambari-web/app/controllers/main/admin/kerberos/step1_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/kerberos/step1_controller.js b/ambari-web/app/controllers/main/admin/kerberos/step1_controller.js
index 2e41e3d..9c864a8 100644
--- a/ambari-web/app/controllers/main/admin/kerberos/step1_controller.js
+++ b/ambari-web/app/controllers/main/admin/kerberos/step1_controller.js
@@ -25,29 +25,6 @@ App.KerberosWizardStep1Controller = Em.Controller.extend({
isSubmitDisabled: Em.computed.someBy('selectedOption.preConditions', 'checked', false),
- ipaOption: Em.Object.create({
- displayName: Em.I18n.t('admin.kerberos.wizard.step1.option.ipa'),
- value: Em.I18n.t('admin.kerberos.wizard.step1.option.ipa'),
- preConditions: [
- Em.Object.create({
- displayText: Em.I18n.t('admin.kerberos.wizard.step1.option.ipa.condition.1'),
- checked: false
- }),
- Em.Object.create({
- displayText: Em.I18n.t('admin.kerberos.wizard.step1.option.ipa.condition.2'),
- checked: false
- }),
- Em.Object.create({
- displayText: Em.I18n.t('admin.kerberos.wizard.step1.option.ipa.condition.3'),
- checked: false
- }),
- Em.Object.create({
- displayText: Em.I18n.t('admin.kerberos.wizard.step1.option.ipa.condition.4'),
- checked: false
- })
- ]
- }),
-
options: Em.A([
Em.Object.create({
displayName: Em.I18n.t('admin.kerberos.wizard.step1.option.kdc'),
@@ -94,6 +71,28 @@ App.KerberosWizardStep1Controller = Em.Controller.extend({
]
}),
Em.Object.create({
+ displayName: Em.I18n.t('admin.kerberos.wizard.step1.option.ipa'),
+ value: Em.I18n.t('admin.kerberos.wizard.step1.option.ipa'),
+ preConditions: [
+ Em.Object.create({
+ displayText: Em.I18n.t('admin.kerberos.wizard.step1.option.ipa.condition.1'),
+ checked: false
+ }),
+ Em.Object.create({
+ displayText: Em.I18n.t('admin.kerberos.wizard.step1.option.ipa.condition.2'),
+ checked: false
+ }),
+ Em.Object.create({
+ displayText: Em.I18n.t('admin.kerberos.wizard.step1.option.ipa.condition.3'),
+ checked: false
+ }),
+ Em.Object.create({
+ displayText: Em.I18n.t('admin.kerberos.wizard.step1.option.ipa.condition.4'),
+ checked: false
+ })
+ ]
+ }),
+ Em.Object.create({
displayName: Em.I18n.t('admin.kerberos.wizard.step1.option.manual'),
value: Em.I18n.t('admin.kerberos.wizard.step1.option.manual'),
preConditions: [
@@ -135,13 +134,6 @@ App.KerberosWizardStep1Controller = Em.Controller.extend({
loadStep: function () {
- if (App.get('supports.enableIpa')) {
- var ipaOption = this.get('ipaOption');
- var options = this.get('options');
- if (options.indexOf(ipaOption) === -1){
- options.pushObject(ipaOption);
- }
- }
},
submit: function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/22b2d55f/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index bee581a..390f803 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1273,7 +1273,7 @@ Em.I18n.translations = {
'admin.kerberos.wizard.step1.option.ad.condition.5': 'The Java Cryptography Extensions (JCE) have been setup on the Ambari Server host and all hosts in the cluster.',
'admin.kerberos.wizard.step1.option.ipa': 'Existing IPA',
'admin.kerberos.wizard.step1.option.ipa.condition.1': 'Cluster hosts are joined to the IPA domain and hosts are registered in DNS',
- 'admin.kerberos.wizard.step1.option.ipa.condition.2': 'A password policy in place that sets no expiry for created principals or krbPasswordExpiry attribute is writable',
+ 'admin.kerberos.wizard.step1.option.ipa.condition.2': 'A password policy in place that sets no expiry for created principals',
'admin.kerberos.wizard.step1.option.ipa.condition.3': 'The ipa managed krb5.conf sets default_ccache_name = /tmp/krb5cc_%{uid}',
'admin.kerberos.wizard.step1.option.ipa.condition.4': 'The Java Cryptography Extensions (JCE) have been setup on the Ambari Server host and all hosts in the cluster.',
'admin.kerberos.wizard.step1.prerequisites.label': 'Following prerequisites needs to be checked to progress ahead in the wizard.',
http://git-wip-us.apache.org/repos/asf/ambari/blob/22b2d55f/ambari-web/test/controllers/main/admin/kerberos/step1_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/kerberos/step1_controller_test.js b/ambari-web/test/controllers/main/admin/kerberos/step1_controller_test.js
index ca80341..e5a185e 100644
--- a/ambari-web/test/controllers/main/admin/kerberos/step1_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/kerberos/step1_controller_test.js
@@ -46,23 +46,6 @@ describe('App.KerberosWizardStep1Controller', function() {
controller.set('options', []);
});
- it("enableIpa is true", function() {
- App.set('supports.enableIpa', true);
- controller.loadStep();
- expect(controller.get('selectedItem')).to.be.equal(Em.I18n.t('admin.kerberos.wizard.step1.option.kdc'));
- expect(controller.get('options')).to.not.be.empty;
- controller.loadStep();
- var options = controller.get('options');
- expect(options.length).to.be.equal(1);
- });
-
- it("enableIpa is false", function() {
- App.set('supports.enableIpa', false);
- controller.loadStep();
- expect(controller.get('selectedItem')).to.be.equal(Em.I18n.t('admin.kerberos.wizard.step1.option.kdc'));
- expect(controller.get('options')).to.be.empty;
- });
-
it("on load selected item should not change", function() {
controller.set('selectedItem',Em.I18n.t('admin.kerberos.wizard.step3.option.kdc'));
controller.loadStep();
[12/50] [abbrv] ambari git commit: AMBARI-22386 - Patch Upgrades
Broken For Clients Due To Versioned LD Library (jonathanhurley)
Posted by rl...@apache.org.
AMBARI-22386 - Patch Upgrades Broken For Clients Due To Versioned LD Library (jonathanhurley)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/feccebcb
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/feccebcb
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/feccebcb
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: feccebcb9b4cf56d8ea0cc021d5250a711f37596
Parents: c693de3
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Wed Nov 8 16:20:30 2017 -0500
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Thu Nov 9 16:36:49 2017 -0500
----------------------------------------------------------------------
.../TEZ/0.9.0.3.0/configuration/tez-site.xml | 2 +-
.../configuration-mapred/mapred-site.xml | 2 +-
.../configuration-mapred/mapred-site.xml | 2 +-
.../2.2/services/TEZ/configuration/tez-site.xml | 4 ++--
.../YARN/configuration-mapred/mapred-site.xml | 2 +-
.../resources/stacks/HDP/2.6/repos/repoinfo.xml | 2 +-
.../stacks/HDP/2.6/upgrades/config-upgrade.xml | 23 ++++++++++++++++++++
.../HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml | 9 ++++++++
.../stacks/HDP/2.6/upgrades/upgrade-2.6.xml | 4 ++++
.../YARN/configuration-mapred/mapred-site.xml | 2 +-
10 files changed, 44 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/feccebcb/ambari-server/src/main/resources/common-services/TEZ/0.9.0.3.0/configuration/tez-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/TEZ/0.9.0.3.0/configuration/tez-site.xml b/ambari-server/src/main/resources/common-services/TEZ/0.9.0.3.0/configuration/tez-site.xml
index 5c17044..58558af 100644
--- a/ambari-server/src/main/resources/common-services/TEZ/0.9.0.3.0/configuration/tez-site.xml
+++ b/ambari-server/src/main/resources/common-services/TEZ/0.9.0.3.0/configuration/tez-site.xml
@@ -78,7 +78,7 @@
</property>
<property>
<name>tez.am.launch.env</name>
- <value>LD_LIBRARY_PATH=/usr/hdp/${hdp.version}/hadoop/lib/native:/usr/hdp/${hdp.version}/hadoop/lib/native/Linux-{{architecture}}-64</value>
+ <value>LD_LIBRARY_PATH=./tezlib/lib/native:/usr/hdp/${hdp.version}/hadoop/lib/native:/usr/hdp/${hdp.version}/hadoop/lib/native/Linux-{{architecture}}-64</value>
<description>
Additional execution environment entries for tez. This is not an additive property. You must preserve the original value if
you want to have access to native libraries.
http://git-wip-us.apache.org/repos/asf/ambari/blob/feccebcb/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration-mapred/mapred-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration-mapred/mapred-site.xml b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration-mapred/mapred-site.xml
index a7d8cd6..3438c45 100644
--- a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration-mapred/mapred-site.xml
+++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/configuration-mapred/mapred-site.xml
@@ -438,7 +438,7 @@
</property>
<property>
<name>mapreduce.admin.user.env</name>
- <value>LD_LIBRARY_PATH={{hadoop_lib_home}}/native/Linux-{{architecture}}-64</value>
+ <value>LD_LIBRARY_PATH=./mr-framework/hadoop/lib/native:{{hadoop_lib_home}}/native/Linux-{{architecture}}-64</value>
<description>
Additional execution environment entries for map and reduce task processes.
This is not an additive property. You must preserve the original value if
http://git-wip-us.apache.org/repos/asf/ambari/blob/feccebcb/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/configuration-mapred/mapred-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/configuration-mapred/mapred-site.xml b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/configuration-mapred/mapred-site.xml
index 705763f..882cf83 100644
--- a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/configuration-mapred/mapred-site.xml
+++ b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/configuration-mapred/mapred-site.xml
@@ -438,7 +438,7 @@
</property>
<property>
<name>mapreduce.admin.user.env</name>
- <value>LD_LIBRARY_PATH=/usr/lib/hadoop/lib/native:/usr/lib/hadoop/lib/native/Linux-amd64-64</value>
+ <value>LD_LIBRARY_PATH=./mr-framework/hadoop/lib/native:/usr/lib/hadoop/lib/native:/usr/lib/hadoop/lib/native/Linux-amd64-64</value>
<description>
Additional execution environment entries for map and reduce task processes.
This is not an additive property. You must preserve the original value if
http://git-wip-us.apache.org/repos/asf/ambari/blob/feccebcb/ambari-server/src/main/resources/stacks/HDP/2.2/services/TEZ/configuration/tez-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/TEZ/configuration/tez-site.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/services/TEZ/configuration/tez-site.xml
index 1427a6f..4ffb7a4 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/TEZ/configuration/tez-site.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/TEZ/configuration/tez-site.xml
@@ -78,7 +78,7 @@
</property>
<property>
<name>tez.am.launch.env</name>
- <value>LD_LIBRARY_PATH=/usr/hdp/${hdp.version}/hadoop/lib/native:/usr/hdp/${hdp.version}/hadoop/lib/native/Linux-{{architecture}}-64</value>
+ <value>LD_LIBRARY_PATH=./tezlib/lib/native:/usr/hdp/${hdp.version}/hadoop/lib/native:/usr/hdp/${hdp.version}/hadoop/lib/native/Linux-{{architecture}}-64</value>
<description>
Additional execution environment entries for tez. This is not an additive property. You must preserve the original value if
you want to have access to native libraries.
@@ -124,7 +124,7 @@
</property>
<property>
<name>tez.task.launch.env</name>
- <value>LD_LIBRARY_PATH=/usr/hdp/${hdp.version}/hadoop/lib/native:/usr/hdp/${hdp.version}/hadoop/lib/native/Linux-{{architecture}}-64</value>
+ <value>LD_LIBRARY_PATH=./tezlib/lib/native:/usr/hdp/${hdp.version}/hadoop/lib/native:/usr/hdp/${hdp.version}/hadoop/lib/native/Linux-{{architecture}}-64</value>
<description>
Additional execution environment entries for tez. This is not an additive property. You must preserve the original value if
you want to have access to native libraries.
http://git-wip-us.apache.org/repos/asf/ambari/blob/feccebcb/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration-mapred/mapred-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration-mapred/mapred-site.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration-mapred/mapred-site.xml
index 4ad08ce..084e912 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration-mapred/mapred-site.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration-mapred/mapred-site.xml
@@ -20,7 +20,7 @@
<configuration xmlns:xi="http://www.w3.org/2001/XInclude" supports_final="true">
<property>
<name>mapreduce.admin.user.env</name>
- <value>LD_LIBRARY_PATH=/usr/hdp/${hdp.version}/hadoop/lib/native:/usr/hdp/${hdp.version}/hadoop/lib/native/Linux-{{architecture}}-64</value>
+ <value>LD_LIBRARY_PATH=./mr-framework/hadoop/lib/native:/usr/hdp/${hdp.version}/hadoop/lib/native:/usr/hdp/${hdp.version}/hadoop/lib/native/Linux-{{architecture}}-64</value>
<description>
Additional execution environment entries for map and reduce task processes.
This is not an additive property. You must preserve the original value if
http://git-wip-us.apache.org/repos/asf/ambari/blob/feccebcb/ambari-server/src/main/resources/stacks/HDP/2.6/repos/repoinfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/repos/repoinfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/repos/repoinfo.xml
index ff132aa..eb0b0ef 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/repos/repoinfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/repos/repoinfo.xml
@@ -33,7 +33,7 @@
</os>
<os family="redhat-ppc7">
<repo>
- <baseurl>http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.0.3</baseurl>
+ <baseurl>http://public-repo-1.hortonworks.com/HDP/centos7-ppc/2.x/updates/2.6.0.3</baseurl>
<repoid>HDP-2.6</repoid>
<reponame>HDP</reponame>
<unique>true</unique>
http://git-wip-us.apache.org/repos/asf/ambari/blob/feccebcb/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/config-upgrade.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/config-upgrade.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/config-upgrade.xml
index 63624d6..45b1707 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/config-upgrade.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/config-upgrade.xml
@@ -258,5 +258,28 @@
</component>
</service>
+ <service name="TEZ">
+ <component name="TEZ_CLIENT">
+ <changes>
+ <definition xsi:type="configure" id="hdp_2_6_tez_tarball_ld_library">
+ <type>tez-site</type>
+ <set key="tez.am.launch.env" value="LD_LIBRARY_PATH=./tezlib/lib/native:/usr/hdp/${hdp.version}/hadoop/lib/native:/usr/hdp/${hdp.version}/hadoop/lib/native/Linux-{{architecture}}-64"/>
+ <set key="tez.task.launch.env" value="LD_LIBRARY_PATH=./tezlib/lib/native:/usr/hdp/${hdp.version}/hadoop/lib/native:/usr/hdp/${hdp.version}/hadoop/lib/native/Linux-{{architecture}}-64"/>
+ </definition>
+ </changes>
+ </component>
+ </service>
+
+ <service name="MAPREDUCE2">
+ <component name="MAPREDUCE2_CLIENT">
+ <changes>
+ <definition xsi:type="configure" id="hdp_2_6_mapreduce_tarball_ld_library">
+ <type>mapred-site</type>
+ <set key="mapreduce.admin.user.env" value="LD_LIBRARY_PATH=./mr-framework/hadoop/lib/native:{{hadoop_lib_home}}/native/Linux-{{architecture}}-64"/>
+ </definition>
+ </changes>
+ </component>
+ </service>
+
</services>
</upgrade-config-changes>
http://git-wip-us.apache.org/repos/asf/ambari/blob/feccebcb/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
index c9e90a9..ae2a855 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
@@ -409,6 +409,15 @@
</task>
</execute-stage>
+ <!-- TEZ -->
+ <execute-stage service="TEZ" component="TEZ_CLIENT" title="Updating LD Library Classpath for Tarball" >
+ <task xsi:type="configure" id="hdp_2_6_tez_tarball_ld_library" supports-patch="true"/>
+ </execute-stage>
+
+ <!-- MapR -->
+ <execute-stage service="MAPREDUCE2" component="MAPREDUCE2_CLIENT" title="Updating LD Library Classpath for Tarball">
+ <task xsi:type="configure" id="hdp_2_6_mapreduce_tarball_ld_library" supports-patch="true"/>
+ </execute-stage>
</group>
http://git-wip-us.apache.org/repos/asf/ambari/blob/feccebcb/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml
index 176143c..37847a2 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml
@@ -675,6 +675,8 @@
<task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.FixLzoCodecPath">
<summary>Verifying LZO codec path for mapreduce</summary>
</task>
+
+ <task xsi:type="configure" id="hdp_2_6_mapreduce_tarball_ld_library" supports-patch="true"/>
</pre-upgrade>
<pre-downgrade copy-upgrade="true" />
@@ -757,6 +759,8 @@
<task xsi:type="server_action" class="org.apache.ambari.server.serveraction.upgrades.FixLzoCodecPath">
<summary>Verifying LZO codec path for Tez</summary>
</task>
+
+ <task xsi:type="configure" id="hdp_2_6_tez_tarball_ld_library" supports-patch="true"/>
</pre-upgrade>
<pre-downgrade copy-upgrade="true" />
http://git-wip-us.apache.org/repos/asf/ambari/blob/feccebcb/ambari-server/src/main/resources/stacks/HDP/3.0/services/YARN/configuration-mapred/mapred-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/3.0/services/YARN/configuration-mapred/mapred-site.xml b/ambari-server/src/main/resources/stacks/HDP/3.0/services/YARN/configuration-mapred/mapred-site.xml
index 6ce4d72..489754f 100644
--- a/ambari-server/src/main/resources/stacks/HDP/3.0/services/YARN/configuration-mapred/mapred-site.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/3.0/services/YARN/configuration-mapred/mapred-site.xml
@@ -31,7 +31,7 @@
<!-- These configs were inherited from HDP 2.2 -->
<property>
<name>mapreduce.admin.user.env</name>
- <value>LD_LIBRARY_PATH=/usr/hdp/${hdp.version}/hadoop/lib/native:/usr/hdp/${hdp.version}/hadoop/lib/native/Linux-{{architecture}}-64</value>
+ <value>LD_LIBRARY_PATH=./mr-framework/hadoop/lib/native:/usr/hdp/${hdp.version}/hadoop/lib/native:/usr/hdp/${hdp.version}/hadoop/lib/native/Linux-{{architecture}}-64</value>
<description>
Additional execution environment entries for map and reduce task processes.
This is not an additive property. You must preserve the original value if
[05/50] [abbrv] ambari git commit: AMBARI-22373.Disable auto config
of interpreter.json at the time of installation(Prabhjyot Singh via Venkata
Sairam)
Posted by rl...@apache.org.
AMBARI-22373.Disable auto config of interpreter.json at the time of installation(Prabhjyot Singh via Venkata Sairam)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5f714cee
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5f714cee
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5f714cee
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 5f714cee399a1671f73abd8d405049a45d4c743c
Parents: 7074e6e
Author: Venkata Sairam <ve...@gmail.com>
Authored: Thu Nov 9 11:50:06 2017 +0530
Committer: Venkata Sairam <ve...@gmail.com>
Committed: Thu Nov 9 11:50:06 2017 +0530
----------------------------------------------------------------------
.../ZEPPELIN/0.7.0/package/scripts/master.py | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/5f714cee/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
index 6ccdfba..5efc277 100644
--- a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
+++ b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
@@ -257,7 +257,6 @@ class Master(Script):
if not glob.glob(params.conf_dir + "/interpreter.json") and \
not os.path.exists(params.conf_dir + "/interpreter.json"):
self.create_interpreter_json()
- self.update_zeppelin_interpreter()
if params.zeppelin_interpreter_config_upgrade == True:
self.reset_interpreter_settings()
@@ -599,6 +598,16 @@ class Master(Script):
group=params.zeppelin_group,
mode=0664)
+ if params.conf_stored_in_hdfs:
+ params.HdfsResource(self.get_zeppelin_conf_FS(params),
+ type="file",
+ action="create_on_execute",
+ source=format("{params.conf_dir}/interpreter.json"),
+ owner=params.zeppelin_user,
+ recursive_chown=True,
+ recursive_chmod=True,
+ replace_existing_files=True)
+
def get_zeppelin_spark_dependencies(self):
import params
return glob.glob(params.zeppelin_dir + '/interpreter/spark/dep/zeppelin-spark-dependencies*.jar')
[42/50] [abbrv] ambari git commit: AMBARI-22444 - Add Native
Libraries To Tez Tarball (jonathanhurley)
Posted by rl...@apache.org.
AMBARI-22444 - Add Native Libraries To Tez Tarball (jonathanhurley)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c67a3246
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c67a3246
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c67a3246
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: c67a3246e2121c6977094e10cdb1414f45cf1482
Parents: 99152d3
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Tue Nov 14 16:19:30 2017 -0500
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Wed Nov 15 15:30:36 2017 -0500
----------------------------------------------------------------------
.../libraries/functions/copy_tarball.py | 82 +++++++++++++++++---
.../libraries/functions/tar_archive.py | 6 +-
.../stacks/2.1/FALCON/test_falcon_server.py | 6 +-
3 files changed, 80 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/c67a3246/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py b/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py
index 219430a..f62aa3d 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py
@@ -23,18 +23,74 @@ __all__ = ["copy_to_hdfs", "get_sysprep_skip_copy_tarballs_hdfs"]
import os
import tempfile
import re
+import tarfile
+from contextlib import closing
from resource_management.libraries.script.script import Script
from resource_management.libraries.resources.hdfs_resource import HdfsResource
from resource_management.libraries.functions.default import default
from resource_management.core import shell
+from resource_management.core import sudo
from resource_management.core.logger import Logger
+from resource_management.core.exceptions import Fail
+from resource_management.core.resources.system import Execute
from resource_management.libraries.functions import stack_tools, stack_features, stack_select
+from resource_management.libraries.functions import tar_archive
STACK_NAME_PATTERN = "{{ stack_name }}"
STACK_ROOT_PATTERN = "{{ stack_root }}"
STACK_VERSION_PATTERN = "{{ stack_version }}"
+def _prepare_tez_tarball():
+ """
+ Prepares the Tez tarball by adding the Hadoop native libraries found in the mapreduce tarball.
+ :return: the full path of the newly created tez tarball to use
+ """
+ import tempfile
+
+ Logger.info("Preparing the Tez tarball...")
+
+ # get the mapreduce tarball which matches the version of tez
+ # tez installs the mapreduce tar, so it should always be present
+ _, mapreduce_source_file, _, _ = get_tarball_paths("mapreduce")
+ _, tez_source_file, _, _ = get_tarball_paths("tez")
+
+ temp_dir = Script.get_tmp_dir()
+
+ mapreduce_temp_dir = tempfile.mkdtemp(prefix="mapreduce-tarball-", dir=temp_dir)
+ tez_temp_dir = tempfile.mkdtemp(prefix="tez-tarball-", dir=temp_dir)
+
+ Logger.info("Extracting {0} to {1}".format(mapreduce_source_file, mapreduce_temp_dir))
+ tar_archive.extract_archive(mapreduce_source_file, mapreduce_temp_dir)
+
+ Logger.info("Extracting {0} to {1}".format(tez_source_file, tez_temp_dir))
+ tar_archive.untar_archive(tez_source_file, tez_temp_dir)
+
+ hadoop_lib_native_dir = os.path.join(mapreduce_temp_dir, "hadoop", "lib", "native")
+ tez_lib_dir = os.path.join(tez_temp_dir, "lib")
+
+ if not os.path.exists(hadoop_lib_native_dir):
+ raise Fail("Unable to seed the Tez tarball with native libraries since the source Hadoop native lib directory {0} does not exist".format(hadoop_lib_native_dir))
+
+ if not os.path.exists(tez_lib_dir):
+ raise Fail("Unable to seed the Tez tarball with native libraries since the target Tez lib directory {0} does not exist".format(tez_lib_dir))
+
+ Execute(("cp", "-a", hadoop_lib_native_dir, tez_lib_dir), sudo = True)
+
+ tez_tarball_with_native_lib = os.path.join(os.path.dirname(tez_source_file), "tez-native.tar.gz")
+ Logger.info("Creating a new Tez tarball at {0}".format(tez_tarball_with_native_lib))
+
+ # tar up Tez, making sure to specify nothing for the arcname so that it does not include an absolute path
+ with closing(tarfile.open(tez_tarball_with_native_lib, "w:gz")) as new_tez_tarball:
+ new_tez_tarball.add(tez_temp_dir, arcname=os.path.sep)
+
+ # cleanup
+ sudo.rmtree(mapreduce_temp_dir)
+ sudo.rmtree(tez_temp_dir)
+
+ return tez_tarball_with_native_lib
+
+
# TODO, in the future, each stack can define its own mapping of tarballs
# inside the stack definition directory in some sort of xml file.
# PLEASE DO NOT put this in cluster-env since it becomes much harder to change,
@@ -50,7 +106,8 @@ TARBALL_MAP = {
"tez": {
"dirs": ("{0}/{1}/tez/lib/tez.tar.gz".format(STACK_ROOT_PATTERN, STACK_VERSION_PATTERN),
"/{0}/apps/{1}/tez/tez.tar.gz".format(STACK_NAME_PATTERN, STACK_VERSION_PATTERN)),
- "service": "TEZ"
+ "service": "TEZ",
+ "prepare_function": _prepare_tez_tarball
},
"tez_hive2": {
@@ -132,29 +189,29 @@ def get_tarball_paths(name, use_upgrading_version_during_upgrade=True, custom_so
:param use_upgrading_version_during_upgrade:
:param custom_source_file: If specified, use this source path instead of the default one from the map.
:param custom_dest_file: If specified, use this destination path instead of the default one from the map.
- :return: A tuple of (success status, source path, destination path)
+ :return: A tuple of (success status, source path, destination path, optional preparation function which is invoked to setup the tarball)
"""
stack_name = Script.get_stack_name()
if not stack_name:
Logger.error("Cannot copy {0} tarball to HDFS because stack name could not be determined.".format(str(name)))
- return (False, None, None)
+ return False, None, None
if name is None or name.lower() not in TARBALL_MAP:
Logger.error("Cannot copy tarball to HDFS because {0} is not supported in stack {1} for this operation.".format(str(name), str(stack_name)))
- return (False, None, None)
+ return False, None, None
service = TARBALL_MAP[name.lower()]['service']
stack_version = get_current_version(service=service, use_upgrading_version_during_upgrade=use_upgrading_version_during_upgrade)
if not stack_version:
Logger.error("Cannot copy {0} tarball to HDFS because stack version could be be determined.".format(str(name)))
- return (False, None, None)
+ return False, None, None
stack_root = Script.get_stack_root()
if not stack_root:
Logger.error("Cannot copy {0} tarball to HDFS because stack root could be be determined.".format(str(name)))
- return (False, None, None)
+ return False, None, None
(source_file, dest_file) = TARBALL_MAP[name.lower()]['dirs']
@@ -173,7 +230,11 @@ def get_tarball_paths(name, use_upgrading_version_during_upgrade=True, custom_so
source_file = source_file.replace(STACK_VERSION_PATTERN, stack_version)
dest_file = dest_file.replace(STACK_VERSION_PATTERN, stack_version)
- return (True, source_file, dest_file)
+ prepare_function = None
+ if "prepare_function" in TARBALL_MAP[name.lower()]:
+ prepare_function = TARBALL_MAP[name.lower()]['prepare_function']
+
+ return True, source_file, dest_file, prepare_function
def get_current_version(service=None, use_upgrading_version_during_upgrade=True):
@@ -272,8 +333,8 @@ def copy_to_hdfs(name, user_group, owner, file_mode=0444, custom_source_file=Non
import params
Logger.info("Called copy_to_hdfs tarball: {0}".format(name))
- (success, source_file, dest_file) = get_tarball_paths(name, use_upgrading_version_during_upgrade,
- custom_source_file, custom_dest_file)
+ (success, source_file, dest_file, prepare_function) = get_tarball_paths(name, use_upgrading_version_during_upgrade,
+ custom_source_file, custom_dest_file)
if not success:
Logger.error("Could not copy tarball {0} due to a missing or incorrect parameter.".format(str(name)))
@@ -311,6 +372,9 @@ def copy_to_hdfs(name, user_group, owner, file_mode=0444, custom_source_file=Non
# The logic above cannot be used until fast-hdfs-resource.jar supports the mv command, or it switches
# to WebHDFS.
+ # if there is a function which is needed to prepare the tarball, then invoke it first
+ if prepare_function is not None:
+ source_file = prepare_function()
# If the directory already exists, it is a NO-OP
dest_dir = os.path.dirname(dest_file)
http://git-wip-us.apache.org/repos/asf/ambari/blob/c67a3246/ambari-common/src/main/python/resource_management/libraries/functions/tar_archive.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/tar_archive.py b/ambari-common/src/main/python/resource_management/libraries/functions/tar_archive.py
index e6d8924..7976587 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/tar_archive.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/tar_archive.py
@@ -46,11 +46,13 @@ def archive_directory_dereference(archive, directory):
try_sleep = 1,
)
-def untar_archive(archive, directory):
+def untar_archive(archive, directory, silent=True):
"""
:param directory: can be a symlink and is followed
"""
- Execute(('tar','-xvf',archive,'-C',directory+"/"),
+ options = "-xf" if silent else "-xvf"
+
+ Execute(('tar',options,archive,'-C',directory+"/"),
sudo = True,
tries = 3,
try_sleep = 1,
http://git-wip-us.apache.org/repos/asf/ambari/blob/c67a3246/ambari-server/src/test/python/stacks/2.1/FALCON/test_falcon_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1/FALCON/test_falcon_server.py b/ambari-server/src/test/python/stacks/2.1/FALCON/test_falcon_server.py
index 8c48347..e15cfdb 100644
--- a/ambari-server/src/test/python/stacks/2.1/FALCON/test_falcon_server.py
+++ b/ambari-server/src/test/python/stacks/2.1/FALCON/test_falcon_server.py
@@ -248,7 +248,7 @@ class TestFalconServer(RMFTestCase):
sudo = True,
)
self.assertResourceCalled('Execute', ('tar',
- '-xvf',
+ '-xf',
'/tmp/falcon-upgrade-backup/falcon-local-backup.tar',
'-C',
u'/hadoop/falcon/'),
@@ -433,7 +433,7 @@ class TestFalconServer(RMFTestCase):
self.assertResourceCalled('Execute',
('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'falcon-server', version), sudo=True,)
self.assertResourceCalled('Execute', ('tar',
- '-xvf',
+ '-xf',
'/tmp/falcon-upgrade-backup/falcon-local-backup.tar',
'-C',
u'/hadoop/falcon/'),
@@ -473,7 +473,7 @@ class TestFalconServer(RMFTestCase):
('ambari-python-wrap', '/usr/bin/hdp-select', 'set', 'falcon-server', version), sudo=True,)
self.assertResourceCalled('Execute', ('tar',
- '-xvf',
+ '-xf',
'/tmp/falcon-upgrade-backup/falcon-local-backup.tar',
'-C',
u'/hadoop/falcon/'),
[39/50] [abbrv] ambari git commit: AMBARI-22418. Make Ambari
configuration API consistent with existing API. (rlevas)
Posted by rl...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceComponentConfigurationResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceComponentConfigurationResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceComponentConfigurationResourceProvider.java
new file mode 100644
index 0000000..ea9cf4f
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceComponentConfigurationResourceProvider.java
@@ -0,0 +1,476 @@
+/*
+ * 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.
+ */
+
+package org.apache.ambari.server.controller.internal;
+
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.controller.RootComponent;
+import org.apache.ambari.server.controller.RootService;
+import org.apache.ambari.server.controller.spi.NoSuchParentResourceException;
+import org.apache.ambari.server.controller.spi.NoSuchResourceException;
+import org.apache.ambari.server.controller.spi.Predicate;
+import org.apache.ambari.server.controller.spi.Request;
+import org.apache.ambari.server.controller.spi.RequestStatus;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.spi.ResourceAlreadyExistsException;
+import org.apache.ambari.server.controller.spi.SystemException;
+import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
+import org.apache.ambari.server.controller.utilities.PredicateHelper;
+import org.apache.ambari.server.controller.utilities.PropertyHelper;
+import org.apache.ambari.server.events.AmbariConfigurationChangedEvent;
+import org.apache.ambari.server.events.publishers.AmbariEventPublisher;
+import org.apache.ambari.server.orm.dao.AmbariConfigurationDAO;
+import org.apache.ambari.server.orm.entities.AmbariConfigurationEntity;
+import org.apache.ambari.server.security.authorization.RoleAuthorization;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.inject.Inject;
+
+public class RootServiceComponentConfigurationResourceProvider extends AbstractAuthorizedResourceProvider {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(RootServiceComponentConfigurationResourceProvider.class);
+
+ static final String RESOURCE_KEY = "Configuration";
+
+ static final String CONFIGURATION_CATEGORY_PROPERTY_ID = PropertyHelper.getPropertyId(RESOURCE_KEY, "category");
+ static final String CONFIGURATION_PROPERTIES_PROPERTY_ID = PropertyHelper.getPropertyId(RESOURCE_KEY, "properties");
+ static final String CONFIGURATION_COMPONENT_NAME_PROPERTY_ID = PropertyHelper.getPropertyId(RESOURCE_KEY, "component_name");
+ static final String CONFIGURATION_SERVICE_NAME_PROPERTY_ID = PropertyHelper.getPropertyId(RESOURCE_KEY, "service_name");
+
+ private static final Set<String> PROPERTIES;
+
+ private static final Map<Resource.Type, String> PK_PROPERTY_MAP;
+
+ private static final Set<String> PK_PROPERTY_IDS;
+
+ static {
+ Set<String> set = new HashSet<>();
+ set.add(CONFIGURATION_SERVICE_NAME_PROPERTY_ID);
+ set.add(CONFIGURATION_COMPONENT_NAME_PROPERTY_ID);
+ set.add(CONFIGURATION_CATEGORY_PROPERTY_ID);
+ set.add(CONFIGURATION_PROPERTIES_PROPERTY_ID);
+
+ PROPERTIES = Collections.unmodifiableSet(set);
+
+ Map<Resource.Type, String> map = new HashMap<>();
+ map.put(Resource.Type.RootService, CONFIGURATION_SERVICE_NAME_PROPERTY_ID);
+ map.put(Resource.Type.RootServiceComponent, CONFIGURATION_COMPONENT_NAME_PROPERTY_ID);
+ map.put(Resource.Type.RootServiceComponentConfiguration, CONFIGURATION_CATEGORY_PROPERTY_ID);
+
+ PK_PROPERTY_MAP = Collections.unmodifiableMap(map);
+ PK_PROPERTY_IDS = Collections.unmodifiableSet(new HashSet<>(PK_PROPERTY_MAP.values()));
+ }
+
+ @Inject
+ private AmbariConfigurationDAO ambariConfigurationDAO;
+
+ @Inject
+ private AmbariEventPublisher publisher;
+
+ public RootServiceComponentConfigurationResourceProvider() {
+ super(PROPERTIES, PK_PROPERTY_MAP);
+
+ Set<RoleAuthorization> authorizations = EnumSet.of(RoleAuthorization.AMBARI_MANAGE_CONFIGURATION);
+ setRequiredCreateAuthorizations(authorizations);
+ setRequiredDeleteAuthorizations(authorizations);
+ setRequiredUpdateAuthorizations(authorizations);
+ setRequiredGetAuthorizations(authorizations);
+ }
+
+ @Override
+ protected Set<String> getPKPropertyIds() {
+ return PK_PROPERTY_IDS;
+ }
+
+ @Override
+ public RequestStatus createResourcesAuthorized(Request request)
+ throws SystemException, UnsupportedPropertyException, ResourceAlreadyExistsException, NoSuchParentResourceException {
+
+ createOrAddProperties(null, null, null, request.getProperties(), true);
+
+ return getRequestStatus(null);
+ }
+
+ @Override
+ protected Set<Resource> getResourcesAuthorized(Request request, Predicate predicate) throws SystemException,
+ UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {
+
+ return getResources(new Command<Set<Resource>>() {
+ @Override
+ public Set<Resource> invoke() throws AmbariException {
+ Set<Resource> resources = new HashSet<>();
+ Set<String> requestedIds = getRequestPropertyIds(request, predicate);
+
+ if (CollectionUtils.isEmpty(requestedIds)) {
+ requestedIds = PROPERTIES;
+ }
+
+ if (predicate == null) {
+ Set<Resource> _resources;
+ try {
+ _resources = getConfigurationResources(requestedIds, null);
+ } catch (NoSuchResourceException e) {
+ throw new AmbariException(e.getMessage(), e);
+ }
+
+ if (!CollectionUtils.isEmpty(_resources)) {
+ resources.addAll(_resources);
+ }
+ } else {
+ for (Map<String, Object> propertyMap : getPropertyMaps(predicate)) {
+ Set<Resource> _resources;
+ try {
+ _resources = getConfigurationResources(requestedIds, propertyMap);
+ } catch (NoSuchResourceException e) {
+ throw new AmbariException(e.getMessage(), e);
+ }
+
+ if (!CollectionUtils.isEmpty(_resources)) {
+ resources.addAll(_resources);
+ }
+ }
+ }
+
+ return resources;
+ }
+ });
+ }
+
+
+ @Override
+ protected RequestStatus deleteResourcesAuthorized(Request request, Predicate predicate) throws SystemException,
+ UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {
+
+ String serviceName = (String) PredicateHelper.getProperties(predicate).get(CONFIGURATION_SERVICE_NAME_PROPERTY_ID);
+ String componentName = (String) PredicateHelper.getProperties(predicate).get(CONFIGURATION_COMPONENT_NAME_PROPERTY_ID);
+ String categoryName = (String) PredicateHelper.getProperties(predicate).get(CONFIGURATION_CATEGORY_PROPERTY_ID);
+
+ ConfigurationHandler handler = getConfigurationHandler(serviceName, componentName);
+ if (handler != null) {
+ handler.removeConfiguration(categoryName);
+ } else {
+ throw new SystemException(String.format("Configurations may not be updated for the %s component of the root service %s", componentName, serviceName));
+ }
+
+ return getRequestStatus(null);
+ }
+
+ @Override
+ protected RequestStatus updateResourcesAuthorized(Request request, Predicate predicate)
+ throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {
+
+ String serviceName = (String) PredicateHelper.getProperties(predicate).get(CONFIGURATION_SERVICE_NAME_PROPERTY_ID);
+ String componentName = (String) PredicateHelper.getProperties(predicate).get(CONFIGURATION_COMPONENT_NAME_PROPERTY_ID);
+ String categoryName = (String) PredicateHelper.getProperties(predicate).get(CONFIGURATION_CATEGORY_PROPERTY_ID);
+
+ createOrAddProperties(serviceName, componentName, categoryName, request.getProperties(), false);
+
+ return getRequestStatus(null);
+ }
+
+ private Resource toResource(String serviceName, String componentName, String categoryName, Map<String, String> properties, Set<String> requestedIds) {
+ Resource resource = new ResourceImpl(Resource.Type.RootServiceComponentConfiguration);
+ setResourceProperty(resource, CONFIGURATION_SERVICE_NAME_PROPERTY_ID, serviceName, requestedIds);
+ setResourceProperty(resource, CONFIGURATION_COMPONENT_NAME_PROPERTY_ID, componentName, requestedIds);
+ setResourceProperty(resource, CONFIGURATION_CATEGORY_PROPERTY_ID, categoryName, requestedIds);
+ setResourceProperty(resource, CONFIGURATION_PROPERTIES_PROPERTY_ID, properties, requestedIds);
+ return resource;
+ }
+
+ /**
+ * Retrieves groups of properties from the request data and create or updates them as needed.
+ * <p>
+ * Each group of properties is expected to have a category (<code>AmbariConfiguration/category</code>)
+ * value and one or more property (<code>AmbariConfiguration/properties/property.name</code>) values.
+ * If a category cannot be determined from the propery set, the default category value (passed in)
+ * is used. If a default category is set, it is assumed that it was parsed from the request predicate
+ * (if availabe).
+ *
+ * @param defaultServiceName the default service name to use if needed
+ * @param defaultComponentName the default component name to use if needed
+ * @param defaultCategoryName the default category to use if needed
+ * @param requestProperties a collection of property maps parsed from the request
+ * @param removePropertiesIfNotSpecified <code>true</code> to remove existing properties that have not been specifed in the request;
+ * <code>false</code> append or update the existing set of properties with values from the request
+ * @throws SystemException if an error occurs saving the configuration data
+ */
+ private void createOrAddProperties(String defaultServiceName, String defaultComponentName, String defaultCategoryName,
+ Set<Map<String, Object>> requestProperties, boolean removePropertiesIfNotSpecified)
+ throws SystemException {
+ // set of resource properties (each entry in the set belongs to a different resource)
+ if (requestProperties != null) {
+ for (Map<String, Object> resourceProperties : requestProperties) {
+ RequestDetails requestDetails = parseProperties(defaultServiceName, defaultComponentName, defaultCategoryName, resourceProperties);
+
+ ConfigurationHandler handler = getConfigurationHandler(requestDetails.serviceName, requestDetails.componentName);
+
+ if (handler != null) {
+ handler.updateCategory(requestDetails.categoryName, requestDetails.properties, removePropertiesIfNotSpecified);
+ } else {
+ throw new SystemException(String.format("Configurations may not be updated for the %s component of the root service, %s", requestDetails.serviceName, requestDetails.componentName));
+ }
+ }
+ }
+ }
+
+ /**
+ * Parse the property map from a request into a map of services to components to category names to maps of property names and values.
+ *
+ * @param defaultServiceName the default service name to use if one is not found in the map of properties
+ * @param defaultComponentName the default component name to use if one is not found in the map of properties
+ * @param defaultCategoryName the default category name to use if one is not found in the map of properties
+ * @param resourceProperties a map of properties from a request item @return a map of category names to maps of name/value pairs
+ * @throws SystemException if an issue with the data is determined
+ */
+ private RequestDetails parseProperties(String defaultServiceName, String defaultComponentName, String defaultCategoryName, Map<String, Object> resourceProperties) throws SystemException {
+ String serviceName = defaultServiceName;
+ String componentName = defaultComponentName;
+ String categoryName = defaultCategoryName;
+ Map<String, String> properties = new HashMap<>();
+
+ for (Map.Entry<String, Object> entry : resourceProperties.entrySet()) {
+ String propertyName = entry.getKey();
+
+ if (CONFIGURATION_CATEGORY_PROPERTY_ID.equals(propertyName)) {
+ if (entry.getValue() instanceof String) {
+ categoryName = (String) entry.getValue();
+ }
+ } else if (CONFIGURATION_COMPONENT_NAME_PROPERTY_ID.equals(propertyName)) {
+ if (entry.getValue() instanceof String) {
+ componentName = (String) entry.getValue();
+ }
+ } else if (CONFIGURATION_SERVICE_NAME_PROPERTY_ID.equals(propertyName)) {
+ if (entry.getValue() instanceof String) {
+ serviceName = (String) entry.getValue();
+ }
+ } else {
+ String propertyCategory = PropertyHelper.getPropertyCategory(entry.getKey());
+ if ((propertyCategory != null) && propertyCategory.equals(CONFIGURATION_PROPERTIES_PROPERTY_ID)) {
+ String name = PropertyHelper.getPropertyName(entry.getKey());
+ Object value = entry.getValue();
+ properties.put(name, (value == null) ? null : value.toString());
+ }
+ }
+ }
+
+ if (StringUtils.isEmpty(serviceName)) {
+ throw new SystemException("The service name must be set");
+ }
+
+ if (StringUtils.isEmpty(componentName)) {
+ throw new SystemException("The component name must be set");
+ }
+
+ if (StringUtils.isEmpty(categoryName)) {
+ throw new SystemException("The configuration category must be set");
+ }
+
+ if (properties.isEmpty()) {
+ throw new SystemException("The configuration properties must be set");
+ }
+
+ return new RequestDetails(serviceName, componentName, categoryName, properties);
+ }
+
+ /**
+ * Retrieves the requested configration resources
+ *
+ * @param requestedIds the requested properties ids
+ * @param propertyMap the request properties
+ * @return a set of resources built from the found data
+ * @throws NoSuchResourceException if the requested resource was not found
+ */
+ private Set<Resource> getConfigurationResources(Set<String> requestedIds, Map<String, Object> propertyMap) throws NoSuchResourceException {
+ Set<Resource> resources = new HashSet<>();
+
+ String serviceName = getStringProperty(propertyMap, CONFIGURATION_SERVICE_NAME_PROPERTY_ID);
+ String componentName = getStringProperty(propertyMap, CONFIGURATION_COMPONENT_NAME_PROPERTY_ID);
+
+ ConfigurationHandler handler = getConfigurationHandler(serviceName, componentName);
+
+ if (handler != null) {
+ String categoryName = getStringProperty(propertyMap, CONFIGURATION_CATEGORY_PROPERTY_ID);
+ Map<String, Map<String, String>> configurations = handler.getConfigurations(categoryName);
+
+ if (configurations != null) {
+ for (Map.Entry<String, Map<String, String>> entry : configurations.entrySet()) {
+ resources.add(toResource(serviceName, componentName, entry.getKey(), entry.getValue(), requestedIds));
+ }
+ }
+ }
+
+ return resources;
+ }
+
+ /**
+ * Returns the internal configuration handler used to support various configuration storage facilites.
+ *
+ * @param serviceName the service name
+ * @param componentName the component name
+ * @return
+ */
+ private ConfigurationHandler getConfigurationHandler(String serviceName, String componentName) {
+ if (RootService.AMBARI.name().equals(serviceName)) {
+ if (RootComponent.AMBARI_SERVER.name().equals(componentName)) {
+ return new AmbariServerConfigurationHandler();
+ }
+ }
+
+ return null;
+ }
+
+
+ private String getStringProperty(Map<String, Object> propertyMap, String propertyId) {
+ String value = null;
+
+ if (propertyMap != null) {
+ Object o = propertyMap.get(propertyId);
+ if (o instanceof String) {
+ value = (String) o;
+ }
+ }
+
+ return value;
+ }
+
+ /**
+ * ConfigurationHandler is an interface to be implemented to support the relevant types of storage
+ * used to persist root-level component configurations.
+ */
+ private abstract class ConfigurationHandler {
+ /**
+ * Retrieve the request configurations.
+ *
+ * @param categoryName the category name (or <code>null</code> for all)
+ * @return a map of category names to properties (name/value pairs).
+ * @throws NoSuchResourceException if the requested data is not found
+ */
+ public abstract Map<String, Map<String, String>> getConfigurations(String categoryName) throws NoSuchResourceException;
+
+ /**
+ * Delete the requested configuration.
+ *
+ * @param categoryName the category name
+ * @throws NoSuchResourceException if the requested category does not exist
+ */
+ public abstract void removeConfiguration(String categoryName) throws NoSuchResourceException;
+
+ /**
+ * Set or update a configuration category with the specified properties.
+ * <p>
+ * If <code>removePropertiesIfNotSpecified</code> is <code>true</code>, the persisted category is to include only the specified properties.
+ * <p>
+ * If <code>removePropertiesIfNotSpecified</code> is <code>false</code>, the persisted category is to include the union of the existing and specified properties.
+ * <p>
+ * In any case, existing property values will be overwritten by the one specified in the property map.
+ *
+ * @param categoryName the category name
+ * @param properties a map of properties to set
+ * @param removePropertiesIfNotSpecified <code>true</code> to ensure the set of properties are only those that have be explicitly specified;
+ * <code>false</code> to update the set of exising properties with the specified set of properties, adding missing properties but not removing any properties
+ */
+ public abstract void updateCategory(String categoryName, Map<String, String> properties, boolean removePropertiesIfNotSpecified);
+ }
+
+ /**
+ * AmbariServerConfigurationHandler handle Ambari server specific configuration properties.
+ */
+ private class AmbariServerConfigurationHandler extends ConfigurationHandler {
+ @Override
+ public Map<String, Map<String, String>> getConfigurations(String categoryName)
+ throws NoSuchResourceException {
+ Map<String, Map<String, String>> configurations = null;
+
+ List<AmbariConfigurationEntity> entities = (categoryName == null)
+ ? ambariConfigurationDAO.findAll()
+ : ambariConfigurationDAO.findByCategory(categoryName);
+
+ if (entities != null) {
+ configurations = new HashMap<>();
+
+ for (AmbariConfigurationEntity entity : entities) {
+ String category = entity.getCategoryName();
+ Map<String, String> properties = configurations.get(category);
+
+ if (properties == null) {
+ properties = new TreeMap<>();
+ configurations.put(category, properties);
+ }
+
+ properties.put(entity.getPropertyName(), entity.getPropertyValue());
+ }
+ }
+
+ return configurations;
+ }
+
+ @Override
+ public void removeConfiguration(String categoryName) throws NoSuchResourceException {
+ if (null == categoryName) {
+ LOGGER.debug("No resource id provided in the request");
+ } else {
+ LOGGER.debug("Deleting Ambari configuration with id: {}", categoryName);
+ try {
+ if (ambariConfigurationDAO.removeByCategory(categoryName) > 0) {
+ publisher.publish(new AmbariConfigurationChangedEvent(categoryName));
+ }
+ } catch (IllegalStateException e) {
+ throw new NoSuchResourceException(e.getMessage());
+ }
+ }
+ }
+
+ @Override
+ public void updateCategory(String categoryName, Map<String, String> properties, boolean removePropertiesIfNotSpecified) {
+ if (ambariConfigurationDAO.reconcileCategory(categoryName, properties, removePropertiesIfNotSpecified)) {
+ // notify subscribers about the configuration changes
+ publisher.publish(new AmbariConfigurationChangedEvent(categoryName));
+ }
+ }
+ }
+
+ /**
+ * RequestDetails is a container for details parsed from the request.
+ */
+ private class RequestDetails {
+ final String serviceName;
+ final String componentName;
+ final String categoryName;
+ final Map<String, String> properties;
+
+ private RequestDetails(String serviceName, String componentName, String categoryName, Map<String, String> properties) {
+ this.serviceName = serviceName;
+ this.componentName = componentName;
+ this.categoryName = categoryName;
+ this.properties = properties;
+ }
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceComponentPropertyProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceComponentPropertyProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceComponentPropertyProvider.java
index 433c1fa..b5bbc94 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceComponentPropertyProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceComponentPropertyProvider.java
@@ -29,7 +29,7 @@ import java.util.Set;
import javax.crypto.Cipher;
-import org.apache.ambari.server.controller.RootServiceResponseFactory;
+import org.apache.ambari.server.controller.RootComponent;
import org.apache.ambari.server.controller.spi.Predicate;
import org.apache.ambari.server.controller.spi.PropertyProvider;
import org.apache.ambari.server.controller.spi.Request;
@@ -126,7 +126,7 @@ public class RootServiceComponentPropertyProvider extends BaseProvider implement
for (Resource resource : resources) {
// If this resource represents the AMBARI_SERVER component, handle it's specific properties...
- if (RootServiceResponseFactory.Components.AMBARI_SERVER.name().equals(resource.getPropertyValue(RootServiceComponentResourceProvider.COMPONENT_NAME_PROPERTY_ID))) {
+ if (RootComponent.AMBARI_SERVER.name().equals(resource.getPropertyValue(RootServiceComponentResourceProvider.COMPONENT_NAME_PROPERTY_ID))) {
// Attempt to fill in the cipher details only if explicitly asked for.
if (requestedIds.contains(JCE_POLICY_PROPERTY_ID) || requestedIds.contains(CIPHER_PROPERTIES_PROPERTY_ID)) {
setCipherDetails(resource, requestedIds);
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceComponentResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceComponentResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceComponentResourceProvider.java
index 3925aeb..dfca00e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceComponentResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceComponentResourceProvider.java
@@ -25,9 +25,9 @@ import java.util.Set;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.controller.AmbariManagementController;
+import org.apache.ambari.server.controller.RootComponent;
import org.apache.ambari.server.controller.RootServiceComponentRequest;
import org.apache.ambari.server.controller.RootServiceComponentResponse;
-import org.apache.ambari.server.controller.RootServiceResponseFactory.Components;
import org.apache.ambari.server.controller.spi.NoSuchParentResourceException;
import org.apache.ambari.server.controller.spi.NoSuchResourceException;
import org.apache.ambari.server.controller.spi.Predicate;
@@ -99,7 +99,7 @@ public class RootServiceComponentResourceProvider extends ReadOnlyResourceProvid
setResourceProperty(resource, PROPERTIES_PROPERTY_ID, response.getProperties(), requestedIds);
setResourceProperty(resource, COMPONENT_VERSION_PROPERTY_ID, response.getComponentVersion(), requestedIds);
- if (Components.AMBARI_SERVER.name().equals(response.getComponentName())) {
+ if (RootComponent.AMBARI_SERVER.name().equals(response.getComponentName())) {
setResourceProperty(resource, SERVER_CLOCK_PROPERTY_ID, response.getServerClock(), requestedIds);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/controller/spi/Resource.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/spi/Resource.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/spi/Resource.java
index 7835373..90e0315 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/spi/Resource.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/spi/Resource.java
@@ -110,6 +110,7 @@ public interface Resource {
TaskAttempt,
RootService,
RootServiceComponent,
+ RootServiceComponentConfiguration,
RootServiceHostComponent,
View,
ViewURL,
@@ -160,8 +161,7 @@ public interface Resource {
VersionDefinition,
ClusterKerberosDescriptor,
LoggingQuery,
- RemoteCluster,
- AmbariConfiguration;
+ RemoteCluster;
/**
* Get the {@link Type} that corresponds to this InternalType.
@@ -232,6 +232,7 @@ public interface Resource {
public static final Type TaskAttempt = InternalType.TaskAttempt.getType();
public static final Type RootService = InternalType.RootService.getType();
public static final Type RootServiceComponent = InternalType.RootServiceComponent.getType();
+ public static final Type RootServiceComponentConfiguration = InternalType.RootServiceComponentConfiguration.getType();
public static final Type RootServiceHostComponent = InternalType.RootServiceHostComponent.getType();
public static final Type View = InternalType.View.getType();
public static final Type ViewURL = InternalType.ViewURL.getType();
@@ -283,7 +284,6 @@ public interface Resource {
public static final Type ClusterKerberosDescriptor = InternalType.ClusterKerberosDescriptor.getType();
public static final Type LoggingQuery = InternalType.LoggingQuery.getType();
public static final Type RemoteCluster = InternalType.RemoteCluster.getType();
- public static final Type AmbariConfiguration = InternalType.AmbariConfiguration.getType();
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertReceivedListener.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertReceivedListener.java b/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertReceivedListener.java
index 266c7e8..7198814 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertReceivedListener.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertReceivedListener.java
@@ -26,8 +26,8 @@ import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.EagerSingleton;
import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.MaintenanceStateHelper;
-import org.apache.ambari.server.controller.RootServiceResponseFactory.Components;
-import org.apache.ambari.server.controller.RootServiceResponseFactory.Services;
+import org.apache.ambari.server.controller.RootComponent;
+import org.apache.ambari.server.controller.RootService;
import org.apache.ambari.server.events.AlertEvent;
import org.apache.ambari.server.events.AlertReceivedEvent;
import org.apache.ambari.server.events.AlertStateChangeEvent;
@@ -434,9 +434,9 @@ public class AlertReceivedListener {
String hostName = alert.getHostName();
// AMBARI/AMBARI_SERVER is always a valid service/component combination
- String ambariServiceName = Services.AMBARI.name();
- String ambariServerComponentName = Components.AMBARI_SERVER.name();
- String ambariAgentComponentName = Components.AMBARI_AGENT.name();
+ String ambariServiceName = RootService.AMBARI.name();
+ String ambariServerComponentName = RootComponent.AMBARI_SERVER.name();
+ String ambariAgentComponentName = RootComponent.AMBARI_AGENT.name();
if (ambariServiceName.equals(serviceName) && ambariServerComponentName.equals(componentName)) {
return true;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertStateChangedListener.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertStateChangedListener.java b/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertStateChangedListener.java
index d5dc530..8701b6d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertStateChangedListener.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertStateChangedListener.java
@@ -24,7 +24,7 @@ import java.util.UUID;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.EagerSingleton;
-import org.apache.ambari.server.controller.RootServiceResponseFactory.Services;
+import org.apache.ambari.server.controller.RootService;
import org.apache.ambari.server.events.AlertStateChangeEvent;
import org.apache.ambari.server.events.publishers.AlertEventPublisher;
import org.apache.ambari.server.orm.dao.AlertDispatchDAO;
@@ -67,7 +67,7 @@ import com.google.inject.Singleton;
* <ul>
* <li>If {@link AlertTargetEntity#isEnabled()} is {@code false}
* <li>If the cluster is upgrading or the upgrade is suspended, only
- * {@link Services#AMBARI} alerts will be dispatched.
+ * {@link RootService#AMBARI} alerts will be dispatched.
* </ul>
*/
@Singleton
@@ -230,7 +230,7 @@ public class AlertStateChangedListener {
if (null != cluster.getUpgradeInProgress()) {
// only send AMBARI alerts if in an upgrade
String serviceName = definition.getServiceName();
- if (!StringUtils.equals(serviceName, Services.AMBARI.name())) {
+ if (!StringUtils.equals(serviceName, RootService.AMBARI.name())) {
LOG.debug(
"Skipping alert notifications for {} because the cluster is upgrading",
definition.getDefinitionName(), target);
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfiguration.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfiguration.java b/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfiguration.java
index 0c1ec0a..6c466ba 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfiguration.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfiguration.java
@@ -33,7 +33,7 @@ public class AmbariLdapConfiguration {
private static final Logger LOGGER = LoggerFactory.getLogger(AmbariLdapConfiguration.class);
- private final Map<String, Object> configurationMap;
+ private final Map<String, String> configurationMap;
private Object configValue(AmbariLdapConfigKeys ambariLdapConfigKeys) {
Object value = null;
@@ -45,13 +45,13 @@ public class AmbariLdapConfiguration {
return value;
}
- public void setValueFor(AmbariLdapConfigKeys ambariLdapConfigKeys, Object value) {
+ public void setValueFor(AmbariLdapConfigKeys ambariLdapConfigKeys, String value) {
configurationMap.put(ambariLdapConfigKeys.key(), value);
}
// intentionally package private, instances to be created through the factory
@Inject
- AmbariLdapConfiguration(@Assisted Map<String, Object> configuration) {
+ AmbariLdapConfiguration(@Assisted Map<String, String> configuration) {
this.configurationMap = configuration;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfigurationFactory.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfigurationFactory.java b/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfigurationFactory.java
index 2b9f24b..aafd204 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfigurationFactory.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfigurationFactory.java
@@ -30,5 +30,5 @@ public interface AmbariLdapConfigurationFactory {
* @param configuration a map where keys are the configuration properties and values are the configuration values
* @return an AmbariLdapConfiguration instance
*/
- AmbariLdapConfiguration createLdapConfiguration(Map<String, Object> configuration);
+ AmbariLdapConfiguration createLdapConfiguration(Map<String, String> configuration);
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java
index b32d1ed..ac9c1bc 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java
@@ -84,7 +84,7 @@ public class AmbariLdapConfigurationProvider implements Provider<AmbariLdapConfi
configEntities = ambariConfigurationDAOProvider.get().findByCategory("ldap-configuration");
if (configEntities != null) {
- Map<String, Object> properties = toProperties(configEntities);
+ Map<String, String> properties = toProperties(configEntities);
instance = ldapConfigurationFactory.createLdapConfiguration(properties);
}
@@ -93,8 +93,8 @@ public class AmbariLdapConfigurationProvider implements Provider<AmbariLdapConfi
return instance;
}
- private Map<String, Object> toProperties(List<AmbariConfigurationEntity> configEntities) {
- Map<String, Object> map = new HashMap<>();
+ private Map<String, String> toProperties(List<AmbariConfigurationEntity> configEntities) {
+ Map<String, String> map = new HashMap<>();
for (AmbariConfigurationEntity entity : configEntities) {
map.put(entity.getPropertyName(), entity.getPropertyValue());
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/metadata/AmbariServiceAlertDefinitions.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/metadata/AmbariServiceAlertDefinitions.java b/ambari-server/src/main/java/org/apache/ambari/server/metadata/AmbariServiceAlertDefinitions.java
index 1e20571..d6b0c99 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/metadata/AmbariServiceAlertDefinitions.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/metadata/AmbariServiceAlertDefinitions.java
@@ -23,8 +23,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Set;
-import org.apache.ambari.server.controller.RootServiceResponseFactory.Components;
-import org.apache.ambari.server.controller.RootServiceResponseFactory.Services;
+import org.apache.ambari.server.controller.RootComponent;
+import org.apache.ambari.server.controller.RootService;
import org.apache.ambari.server.state.alert.AlertDefinition;
import org.apache.ambari.server.state.alert.AlertDefinitionFactory;
import org.slf4j.Logger;
@@ -36,7 +36,7 @@ import com.google.inject.Singleton;
/**
* The {@link AmbariServiceAlertDefinitions} class is used to represent the
* alerts defined in {@code alerts.json} which are for
- * {@link Components#AMBARI_AGENT} and {@link Components#AMBARI_SERVER}. These
+ * {@link RootComponent#AMBARI_AGENT} and {@link RootComponent#AMBARI_SERVER}. These
* alerts are bound to the host and are not part of a cluster or hadoop service.
*/
@Singleton
@@ -67,7 +67,7 @@ public class AmbariServiceAlertDefinitions {
* Gets all of the {@link AlertDefinition}s that exist on the path for all
* agent hosts.
*
- * @return the alerts with {@link Components#AMBARI_AGENT} as the component
+ * @return the alerts with {@link RootComponent#AMBARI_AGENT} as the component
* and {@code AMBARI} as the service.
*/
public List<AlertDefinition> getAgentDefinitions() {
@@ -75,15 +75,15 @@ public class AmbariServiceAlertDefinitions {
return m_agentDefinitions;
}
- m_agentDefinitions = getDefinitions(Components.AMBARI_AGENT);
+ m_agentDefinitions = getDefinitions(RootComponent.AMBARI_AGENT);
return m_agentDefinitions;
}
/**
* Gets all of the {@link AlertDefinition}s that exist on the path for
- * {@link Components#AMBARI_SERVER}.
+ * {@link RootComponent#AMBARI_SERVER}.
*
- * @return the alerts with {@link Components#AMBARI_SERVER} as the component
+ * @return the alerts with {@link RootComponent#AMBARI_SERVER} as the component
* and {@code AMBARI} as the service.
*/
public List<AlertDefinition> getServerDefinitions() {
@@ -91,7 +91,7 @@ public class AmbariServiceAlertDefinitions {
return m_serverDefinitions;
}
- m_serverDefinitions = getDefinitions(Components.AMBARI_SERVER);
+ m_serverDefinitions = getDefinitions(RootComponent.AMBARI_SERVER);
return m_serverDefinitions;
}
@@ -104,7 +104,7 @@ public class AmbariServiceAlertDefinitions {
* @return the alert definitions for {@code AMBARI} service for the given
* component.
*/
- private List<AlertDefinition> getDefinitions(Components component) {
+ private List<AlertDefinition> getDefinitions(RootComponent component) {
List<AlertDefinition> definitions = new ArrayList<>();
InputStream inputStream = ClassLoader.getSystemResourceAsStream("alerts.json");
@@ -112,7 +112,7 @@ public class AmbariServiceAlertDefinitions {
try {
Set<AlertDefinition> allDefinitions = m_factory.getAlertDefinitions(
- reader, Services.AMBARI.name());
+ reader, RootService.AMBARI.name());
String componentName = component.name();
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertDefinitionDAO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertDefinitionDAO.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertDefinitionDAO.java
index cda03f3..424910b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertDefinitionDAO.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertDefinitionDAO.java
@@ -25,7 +25,8 @@ import javax.persistence.EntityManager;
import javax.persistence.TypedQuery;
import org.apache.ambari.server.AmbariException;
-import org.apache.ambari.server.controller.RootServiceResponseFactory;
+import org.apache.ambari.server.controller.RootComponent;
+import org.apache.ambari.server.controller.RootService;
import org.apache.ambari.server.controller.internal.AlertDefinitionResourceProvider;
import org.apache.ambari.server.events.AlertDefinitionChangedEvent;
import org.apache.ambari.server.events.AlertDefinitionDeleteEvent;
@@ -300,10 +301,10 @@ public class AlertDefinitionDAO {
query.setParameter("clusterId", clusterId);
query.setParameter("serviceName",
- RootServiceResponseFactory.Services.AMBARI.name());
+ RootService.AMBARI.name());
query.setParameter("componentName",
- RootServiceResponseFactory.Components.AMBARI_AGENT.name());
+ RootComponent.AMBARI_AGENT.name());
return daoUtils.selectList(query);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertDispatchDAO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertDispatchDAO.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertDispatchDAO.java
index 5c6a82f..1746048 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertDispatchDAO.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertDispatchDAO.java
@@ -33,7 +33,7 @@ import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.api.query.JpaPredicateVisitor;
import org.apache.ambari.server.api.query.JpaSortBuilder;
import org.apache.ambari.server.controller.AlertNoticeRequest;
-import org.apache.ambari.server.controller.RootServiceResponseFactory.Services;
+import org.apache.ambari.server.controller.RootService;
import org.apache.ambari.server.controller.spi.Predicate;
import org.apache.ambari.server.controller.utilities.PredicateHelper;
import org.apache.ambari.server.orm.RequiresSession;
@@ -452,7 +452,7 @@ public class AlertDispatchDAO {
// AMBARI is a special service that we let through, otherwise we need to
// verify that the service exists before we create the default group
- String ambariServiceName = Services.AMBARI.name();
+ String ambariServiceName = RootService.AMBARI.name();
if (!ambariServiceName.equals(serviceName)) {
Cluster cluster = m_clusters.get().getClusterById(clusterId);
Map<String, Service> services = cluster.getServices();
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AlertDefinitionHash.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AlertDefinitionHash.java b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AlertDefinitionHash.java
index 15f7048..a1c7249 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AlertDefinitionHash.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AlertDefinitionHash.java
@@ -37,8 +37,8 @@ import org.apache.ambari.server.ClusterNotFoundException;
import org.apache.ambari.server.agent.ActionQueue;
import org.apache.ambari.server.agent.AgentCommand.AgentCommandType;
import org.apache.ambari.server.agent.AlertDefinitionCommand;
-import org.apache.ambari.server.controller.RootServiceResponseFactory.Components;
-import org.apache.ambari.server.controller.RootServiceResponseFactory.Services;
+import org.apache.ambari.server.controller.RootComponent;
+import org.apache.ambari.server.controller.RootService;
import org.apache.ambari.server.orm.dao.AlertDefinitionDAO;
import org.apache.ambari.server.orm.entities.AlertDefinitionEntity;
import org.apache.ambari.server.state.Cluster;
@@ -375,8 +375,8 @@ public class AlertDefinitionHash {
return affectedHosts;
}
- String ambariServiceName = Services.AMBARI.name();
- String agentComponentName = Components.AMBARI_AGENT.name();
+ String ambariServiceName = RootService.AMBARI.name();
+ String agentComponentName = RootComponent.AMBARI_AGENT.name();
// intercept host agent alerts; they affect all hosts
if (ambariServiceName.equals(definitionServiceName)
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
index 9c0b0ca..8f5e4f4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
@@ -57,7 +57,7 @@ import org.apache.ambari.server.controller.AmbariSessionManager;
import org.apache.ambari.server.controller.ClusterResponse;
import org.apache.ambari.server.controller.ConfigurationResponse;
import org.apache.ambari.server.controller.MaintenanceStateHelper;
-import org.apache.ambari.server.controller.RootServiceResponseFactory.Services;
+import org.apache.ambari.server.controller.RootService;
import org.apache.ambari.server.controller.ServiceConfigVersionResponse;
import org.apache.ambari.server.events.AmbariEvent.AmbariEventType;
import org.apache.ambari.server.events.ClusterConfigChangedEvent;
@@ -2050,7 +2050,7 @@ public class ClusterImpl implements Cluster {
// server-side events either don't have a service name or are AMBARI;
// either way they are not handled by this method since it expects a
// real service and component
- if (StringUtils.isBlank(serviceName) || Services.AMBARI.name().equals(serviceName)) {
+ if (StringUtils.isBlank(serviceName) || RootService.AMBARI.name().equals(serviceName)) {
continue;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/main/java/org/apache/ambari/server/state/services/AmbariServerAlertService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/services/AmbariServerAlertService.java b/ambari-server/src/main/java/org/apache/ambari/server/state/services/AmbariServerAlertService.java
index d3237a9..305f693 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/services/AmbariServerAlertService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/services/AmbariServerAlertService.java
@@ -29,7 +29,7 @@ import java.util.concurrent.TimeUnit;
import org.apache.ambari.server.AmbariService;
import org.apache.ambari.server.alerts.AlertRunnable;
-import org.apache.ambari.server.controller.RootServiceResponseFactory.Components;
+import org.apache.ambari.server.controller.RootComponent;
import org.apache.ambari.server.orm.dao.AlertDefinitionDAO;
import org.apache.ambari.server.orm.entities.AlertDefinitionEntity;
import org.apache.ambari.server.state.Cluster;
@@ -133,7 +133,7 @@ public class AmbariServerAlertService extends AbstractScheduledService {
/**
* {@inheritDoc}
* <p/>
- * Compares all known {@link Components#AMBARI_SERVER} alerts with those that
+ * Compares all known {@link RootComponent#AMBARI_SERVER} alerts with those that
* are scheduled. If any are not scheduled or have their intervals changed,
* then reschedule those.
*/
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommandTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommandTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommandTest.java
index 959db15..2afbf8a 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommandTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommandTest.java
@@ -301,9 +301,9 @@ public class StackAdvisorCommandTest {
"items",
list(
map(
- "AmbariConfiguration",
+ "Configuration",
map(
- "data", list(ldapConfigData)
+ "properties", ldapConfigData
)
)
)
@@ -380,7 +380,7 @@ public class StackAdvisorCommandTest {
"items",
list(
map(
- "AmbariConfiguration",
+ "Configuration",
map(
"data",
list(ldapConfigData, ldapConfigData)
@@ -417,7 +417,7 @@ public class StackAdvisorCommandTest {
.build();
Map<String, Object> ldapConfig = map(
- "AmbariConfiguration",
+ "Configuration",
map(
"data",
list(
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
index 7094caa..d95dcef 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
@@ -8248,13 +8248,13 @@ public class AmbariManagementControllerTest {
RootServiceRequest request = new RootServiceRequest(null);
Set<RootServiceResponse> responses = controller.getRootServices(Collections.singleton(request));
- Assert.assertEquals(RootServiceResponseFactory.Services.values().length, responses.size());
+ Assert.assertEquals(RootService.values().length, responses.size());
- RootServiceRequest requestWithParams = new RootServiceRequest(RootServiceResponseFactory.Services.AMBARI.toString());
+ RootServiceRequest requestWithParams = new RootServiceRequest(RootService.AMBARI.toString());
Set<RootServiceResponse> responsesWithParams = controller.getRootServices(Collections.singleton(requestWithParams));
Assert.assertEquals(1, responsesWithParams.size());
for (RootServiceResponse responseWithParams: responsesWithParams) {
- Assert.assertEquals(responseWithParams.getServiceName(), RootServiceResponseFactory.Services.AMBARI.toString());
+ Assert.assertEquals(responseWithParams.getServiceName(), RootService.AMBARI.toString());
}
RootServiceRequest invalidRequest = new RootServiceRequest(NON_EXT_VALUE);
@@ -8268,18 +8268,18 @@ public class AmbariManagementControllerTest {
@Test
public void testGetRootServiceComponents() throws Exception {
- RootServiceComponentRequest request = new RootServiceComponentRequest(RootServiceResponseFactory.Services.AMBARI.toString(), null);
+ RootServiceComponentRequest request = new RootServiceComponentRequest(RootService.AMBARI.toString(), null);
Set<RootServiceComponentResponse> responses = controller.getRootServiceComponents(Collections.singleton(request));
- Assert.assertEquals(RootServiceResponseFactory.Services.AMBARI.getComponents().length, responses.size());
+ Assert.assertEquals(RootService.AMBARI.getComponents().length, responses.size());
RootServiceComponentRequest requestWithParams = new RootServiceComponentRequest(
- RootServiceResponseFactory.Services.AMBARI.toString(),
- RootServiceResponseFactory.Services.AMBARI.getComponents()[0].toString());
+ RootService.AMBARI.toString(),
+ RootService.AMBARI.getComponents()[0].toString());
Set<RootServiceComponentResponse> responsesWithParams = controller.getRootServiceComponents(Collections.singleton(requestWithParams));
Assert.assertEquals(1, responsesWithParams.size());
for (RootServiceComponentResponse responseWithParams: responsesWithParams) {
- Assert.assertEquals(responseWithParams.getComponentName(), RootServiceResponseFactory.Services.AMBARI.getComponents()[0].toString());
+ Assert.assertEquals(responseWithParams.getComponentName(), RootService.AMBARI.getComponents()[0].toString());
}
RootServiceComponentRequest invalidRequest = new RootServiceComponentRequest(NON_EXT_VALUE, NON_EXT_VALUE);
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/test/java/org/apache/ambari/server/controller/RootServiceResponseFactoryTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/RootServiceResponseFactoryTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/RootServiceResponseFactoryTest.java
index c27ef7e..e194115 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/RootServiceResponseFactoryTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/RootServiceResponseFactoryTest.java
@@ -29,7 +29,6 @@ import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.H2DatabaseCleaner;
import org.apache.ambari.server.ObjectNotFoundException;
import org.apache.ambari.server.api.services.AmbariMetaInfo;
-import org.apache.ambari.server.controller.RootServiceResponseFactory.Components;
import org.apache.ambari.server.orm.GuiceJpaInitializer;
import org.apache.ambari.server.orm.InMemoryDefaultTestModule;
import org.junit.After;
@@ -66,13 +65,13 @@ public class RootServiceResponseFactoryTest {
// Request a null service name
RootServiceRequest request = new RootServiceRequest(null);
Set<RootServiceResponse> rootServices = responseFactory.getRootServices(request);
- assertEquals(RootServiceResponseFactory.Services.values().length,
+ assertEquals(RootService.values().length,
rootServices.size());
// null request
request = null;
rootServices = responseFactory.getRootServices(request);
- assertEquals(RootServiceResponseFactory.Services.values().length,
+ assertEquals(RootService.values().length,
rootServices.size());
// Request nonexistent service
@@ -85,12 +84,12 @@ public class RootServiceResponseFactoryTest {
// Request existent service
request = new RootServiceRequest(
- RootServiceResponseFactory.Services.AMBARI.name());
+ RootService.AMBARI.name());
rootServices = responseFactory.getRootServices(request);
assertEquals(1, rootServices.size());
assertTrue(rootServices.contains(new RootServiceResponse(
- RootServiceResponseFactory.Services.AMBARI.name())));
+ RootService.AMBARI.name())));
}
@Test
@@ -106,7 +105,7 @@ public class RootServiceResponseFactoryTest {
assertTrue(e instanceof ObjectNotFoundException);
}
- RootServiceResponseFactory.Components ambariServerComponent = RootServiceResponseFactory.Components.AMBARI_SERVER;
+ RootComponent ambariServerComponent = RootComponent.AMBARI_SERVER;
// Request null service name, not-null component name
request = new RootServiceComponentRequest(null, ambariServerComponent.name());
@@ -118,18 +117,18 @@ public class RootServiceResponseFactoryTest {
}
// Request existent service name, null component name
- String serviceName = RootServiceResponseFactory.Services.AMBARI.name();
+ String serviceName = RootService.AMBARI.name();
request = new RootServiceComponentRequest(serviceName, null);
rootServiceComponents = responseFactory.getRootServiceComponents(request);
assertEquals(
- RootServiceResponseFactory.Services.AMBARI.getComponents().length,
+ RootService.AMBARI.getComponents().length,
rootServiceComponents.size());
String ambariVersion = ambariMetaInfo.getServerVersion();
- for (int i = 0; i < RootServiceResponseFactory.Services.AMBARI.getComponents().length; i++) {
- Components component = RootServiceResponseFactory.Services.AMBARI.getComponents()[i];
+ for (int i = 0; i < RootService.AMBARI.getComponents().length; i++) {
+ RootComponent component = RootService.AMBARI.getComponents()[i];
if (component.name().equals(ambariServerComponent.name())) {
for (RootServiceComponentResponse response : rootServiceComponents) {
@@ -148,14 +147,14 @@ public class RootServiceResponseFactoryTest {
// Request existent service name, existent component name
request = new RootServiceComponentRequest(
- RootServiceResponseFactory.Services.AMBARI.name(),
- RootServiceResponseFactory.Services.AMBARI.getComponents()[0].name());
+ RootService.AMBARI.name(),
+ RootService.AMBARI.getComponents()[0].name());
rootServiceComponents = responseFactory.getRootServiceComponents(request);
assertEquals(1, rootServiceComponents.size());
for (RootServiceComponentResponse response : rootServiceComponents) {
if (response.getComponentName().equals(
- RootServiceResponseFactory.Services.AMBARI.getComponents()[0].name())) {
+ RootService.AMBARI.getComponents()[0].name())) {
assertEquals(ambariVersion, response.getComponentVersion());
assertEquals(2, response.getProperties().size());
assertTrue(response.getProperties().containsKey("jdk_location"));
@@ -166,7 +165,7 @@ public class RootServiceResponseFactoryTest {
// Request existent service name, and component, not belongs to requested
// service
request = new RootServiceComponentRequest(
- RootServiceResponseFactory.Services.AMBARI.name(), "XXX");
+ RootService.AMBARI.name(), "XXX");
try {
rootServiceComponents = responseFactory.getRootServiceComponents(request);
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2743b5/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProviderTest.java
deleted file mode 100644
index a2ecb27..0000000
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProviderTest.java
+++ /dev/null
@@ -1,377 +0,0 @@
-/*
- * Licensed 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.
- */
-
-package org.apache.ambari.server.controller.internal;
-
-import static org.apache.ambari.server.controller.internal.AmbariConfigurationResourceProvider.AMBARI_CONFIGURATION_CATEGORY_PROPERTY_ID;
-import static org.apache.ambari.server.controller.internal.AmbariConfigurationResourceProvider.AMBARI_CONFIGURATION_PROPERTIES_PROPERTY_ID;
-import static org.easymock.EasyMock.anyObject;
-import static org.easymock.EasyMock.capture;
-import static org.easymock.EasyMock.eq;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.expectLastCall;
-import static org.easymock.EasyMock.newCapture;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-
-import javax.persistence.EntityManager;
-
-import org.apache.ambari.server.controller.spi.Predicate;
-import org.apache.ambari.server.controller.spi.Request;
-import org.apache.ambari.server.controller.spi.Resource;
-import org.apache.ambari.server.controller.spi.ResourceProvider;
-import org.apache.ambari.server.controller.utilities.PredicateBuilder;
-import org.apache.ambari.server.events.AmbariConfigurationChangedEvent;
-import org.apache.ambari.server.events.publishers.AmbariEventPublisher;
-import org.apache.ambari.server.orm.dao.AmbariConfigurationDAO;
-import org.apache.ambari.server.orm.entities.AmbariConfigurationEntity;
-import org.apache.ambari.server.security.TestAuthenticationFactory;
-import org.apache.ambari.server.security.authorization.AuthorizationException;
-import org.easymock.Capture;
-import org.easymock.EasyMockSupport;
-import org.junit.After;
-import org.junit.Test;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.core.context.SecurityContextHolder;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-public class AmbariConfigurationResourceProviderTest extends EasyMockSupport {
-
- private static final String CATEGORY_NAME_1 = "test-category-1";
- private static final String CATEGORY_NAME_2 = "test-category-2";
-
- @After
- public void clearAuthentication() {
- SecurityContextHolder.getContext().setAuthentication(null);
- }
-
- @Test
- public void testCreateResources_Administrator() throws Exception {
- testCreateResources(TestAuthenticationFactory.createAdministrator());
- }
-
- @Test(expected = AuthorizationException.class)
- public void testCreateResources_ClusterAdministrator() throws Exception {
- testCreateResources(TestAuthenticationFactory.createClusterAdministrator());
- }
-
- @Test(expected = AuthorizationException.class)
- public void testCreateResources_ClusterOperator() throws Exception {
- testCreateResources(TestAuthenticationFactory.createClusterOperator());
- }
-
- @Test(expected = AuthorizationException.class)
- public void testCreateResources_ServiceAdministrator() throws Exception {
- testCreateResources(TestAuthenticationFactory.createServiceAdministrator());
- }
-
- @Test(expected = AuthorizationException.class)
- public void testCreateResources_ServiceOperator() throws Exception {
- testCreateResources(TestAuthenticationFactory.createServiceOperator());
- }
-
- private void testCreateResources(Authentication authentication) throws Exception {
- Injector injector = createInjector();
-
- ResourceProvider resourceProvider = injector.getInstance(AmbariConfigurationResourceProvider.class);
-
- Set<Map<String, Object>> propertySets = new HashSet<>();
-
- Map<String, String> properties1 = new HashMap<>();
- properties1.put("property1a", "value1");
- properties1.put("property2a", "value2");
- propertySets.add(toRequestProperties(CATEGORY_NAME_1, properties1));
-
- Map<String, String> properties2 = new HashMap<>();
- properties2.put("property1b", "value1");
- properties2.put("property2b", "value2");
- propertySets.add(toRequestProperties(CATEGORY_NAME_2, properties2));
-
- Request request = createMock(Request.class);
- expect(request.getProperties()).andReturn(propertySets).once();
-
- Capture<Map<String, String>> capturedProperties1 = newCapture();
- Capture<Map<String, String>> capturedProperties2 = newCapture();
-
- AmbariConfigurationDAO dao = injector.getInstance(AmbariConfigurationDAO.class);
- expect(dao.reconcileCategory(eq(CATEGORY_NAME_1), capture(capturedProperties1), eq(true)))
- .andReturn(true)
- .once();
- expect(dao.reconcileCategory(eq(CATEGORY_NAME_2), capture(capturedProperties2), eq(true)))
- .andReturn(true)
- .once();
-
- AmbariEventPublisher publisher = injector.getInstance(AmbariEventPublisher.class);
- publisher.publish(anyObject(AmbariConfigurationChangedEvent.class));
- expectLastCall().times(2);
-
- replayAll();
-
- SecurityContextHolder.getContext().setAuthentication(authentication);
-
- resourceProvider.createResources(request);
-
- verifyAll();
-
- validateCapturedProperties(properties1, capturedProperties1);
- validateCapturedProperties(properties2, capturedProperties2);
- }
-
- @Test
- public void testDeleteResources_Administrator() throws Exception {
- testDeleteResources(TestAuthenticationFactory.createAdministrator());
- }
-
- @Test(expected = AuthorizationException.class)
- public void testDeleteResources_ClusterAdministrator() throws Exception {
- testDeleteResources(TestAuthenticationFactory.createClusterAdministrator());
- }
-
- @Test(expected = AuthorizationException.class)
- public void testDeleteResources_ClusterOperator() throws Exception {
- testDeleteResources(TestAuthenticationFactory.createClusterOperator());
- }
-
- @Test(expected = AuthorizationException.class)
- public void testDeleteResources_ServiceAdministrator() throws Exception {
- testDeleteResources(TestAuthenticationFactory.createServiceAdministrator());
- }
-
- @Test(expected = AuthorizationException.class)
- public void testDeleteResources_ServiceOperator() throws Exception {
- testDeleteResources(TestAuthenticationFactory.createServiceOperator());
- }
-
- private void testDeleteResources(Authentication authentication) throws Exception {
- Injector injector = createInjector();
-
- ResourceProvider resourceProvider = injector.getInstance(AmbariConfigurationResourceProvider.class);
-
- Predicate predicate = new PredicateBuilder()
- .property(AMBARI_CONFIGURATION_CATEGORY_PROPERTY_ID)
- .equals(CATEGORY_NAME_1)
- .toPredicate();
-
- Request request = createMock(Request.class);
-
- AmbariConfigurationDAO dao = injector.getInstance(AmbariConfigurationDAO.class);
- expect(dao.removeByCategory(CATEGORY_NAME_1)).andReturn(1).once();
-
- AmbariEventPublisher publisher = injector.getInstance(AmbariEventPublisher.class);
- publisher.publish(anyObject(AmbariConfigurationChangedEvent.class));
- expectLastCall().once();
-
- replayAll();
-
- SecurityContextHolder.getContext().setAuthentication(authentication);
-
- resourceProvider.deleteResources(request, predicate);
-
- verifyAll();
- }
-
- @Test
- public void testGetResources_Administrator() throws Exception {
- testGetResources(TestAuthenticationFactory.createAdministrator());
- }
-
- @Test(expected = AuthorizationException.class)
- public void testGetResources_ClusterAdministrator() throws Exception {
- testGetResources(TestAuthenticationFactory.createClusterAdministrator());
- }
-
- @Test(expected = AuthorizationException.class)
- public void testGetResources_ClusterOperator() throws Exception {
- testGetResources(TestAuthenticationFactory.createClusterOperator());
- }
-
- @Test(expected = AuthorizationException.class)
- public void testGetResources_ServiceAdministrator() throws Exception {
- testGetResources(TestAuthenticationFactory.createServiceAdministrator());
- }
-
- @Test(expected = AuthorizationException.class)
- public void testGetResources_ServiceOperator() throws Exception {
- testGetResources(TestAuthenticationFactory.createServiceOperator());
- }
-
- private void testGetResources(Authentication authentication) throws Exception {
- Injector injector = createInjector();
-
- ResourceProvider resourceProvider = injector.getInstance(AmbariConfigurationResourceProvider.class);
-
- Predicate predicate = new PredicateBuilder()
- .property(AMBARI_CONFIGURATION_CATEGORY_PROPERTY_ID)
- .equals(CATEGORY_NAME_1)
- .toPredicate();
-
- Request request = createMock(Request.class);
- expect(request.getPropertyIds()).andReturn(null).anyTimes();
-
- Map<String, String> properties = new HashMap<>();
- properties.put("property1a", "value1");
- properties.put("property2a", "value2");
-
- AmbariConfigurationDAO dao = injector.getInstance(AmbariConfigurationDAO.class);
- expect(dao.findByCategory(CATEGORY_NAME_1)).andReturn(createEntities(CATEGORY_NAME_1, properties)).once();
-
- replayAll();
-
- SecurityContextHolder.getContext().setAuthentication(authentication);
-
- Set<Resource> response = resourceProvider.getResources(request, predicate);
-
- verifyAll();
-
- junit.framework.Assert.assertNotNull(response);
- junit.framework.Assert.assertEquals(1, response.size());
-
- Resource resource = response.iterator().next();
- junit.framework.Assert.assertEquals(Resource.Type.AmbariConfiguration, resource.getType());
-
- Map<String, Map<String, Object>> propertiesMap = resource.getPropertiesMap();
- junit.framework.Assert.assertEquals(2, propertiesMap.size());
-
- junit.framework.Assert.assertEquals(CATEGORY_NAME_1, propertiesMap.get(Resource.Type.AmbariConfiguration.name()).get("category"));
-
- Map<String, Object> retrievedProperties = propertiesMap.get(Resource.Type.AmbariConfiguration.name() + "/properties");
- junit.framework.Assert.assertEquals(2, retrievedProperties.size());
-
- for (Map.Entry<String, String> entry : properties.entrySet()) {
- junit.framework.Assert.assertEquals(entry.getValue(), retrievedProperties.get(entry.getKey()));
- }
- }
-
- @Test
- public void testUpdateResources_Administrator() throws Exception {
- testUpdateResources(TestAuthenticationFactory.createAdministrator());
- }
-
- @Test(expected = AuthorizationException.class)
- public void testUpdateResources_ClusterAdministrator() throws Exception {
- testUpdateResources(TestAuthenticationFactory.createClusterAdministrator());
- }
-
- @Test(expected = AuthorizationException.class)
- public void testUpdateResources_ClusterOperator() throws Exception {
- testUpdateResources(TestAuthenticationFactory.createClusterOperator());
- }
-
- @Test(expected = AuthorizationException.class)
- public void testUpdateResources_ServiceAdministrator() throws Exception {
- testUpdateResources(TestAuthenticationFactory.createServiceAdministrator());
- }
-
- @Test(expected = AuthorizationException.class)
- public void testUpdateResources_ServiceOperator() throws Exception {
- testUpdateResources(TestAuthenticationFactory.createServiceOperator());
- }
-
- private void testUpdateResources(Authentication authentication) throws Exception {
- Injector injector = createInjector();
-
- ResourceProvider resourceProvider = injector.getInstance(AmbariConfigurationResourceProvider.class);
-
- Predicate predicate = new PredicateBuilder()
- .property(AMBARI_CONFIGURATION_CATEGORY_PROPERTY_ID)
- .equals(CATEGORY_NAME_1)
- .toPredicate();
-
- Set<Map<String, Object>> propertySets = new HashSet<>();
-
- Map<String, String> properties1 = new HashMap<>();
- properties1.put("property1a", "value1");
- properties1.put("property2a", "value2");
- propertySets.add(toRequestProperties(CATEGORY_NAME_1, properties1));
-
- Request request = createMock(Request.class);
- expect(request.getProperties()).andReturn(propertySets).once();
-
- Capture<Map<String, String>> capturedProperties1 = newCapture();
-
- AmbariConfigurationDAO dao = injector.getInstance(AmbariConfigurationDAO.class);
- expect(dao.reconcileCategory(eq(CATEGORY_NAME_1), capture(capturedProperties1), eq(false)))
- .andReturn(true)
- .once();
-
- AmbariEventPublisher publisher = injector.getInstance(AmbariEventPublisher.class);
- publisher.publish(anyObject(AmbariConfigurationChangedEvent.class));
- expectLastCall().times(1);
-
- replayAll();
-
- SecurityContextHolder.getContext().setAuthentication(authentication);
-
- resourceProvider.updateResources(request, predicate);
-
- verifyAll();
-
- validateCapturedProperties(properties1, capturedProperties1);
- }
-
- private List<AmbariConfigurationEntity> createEntities(String categoryName, Map<String, String> properties) {
- List<AmbariConfigurationEntity> entities = new ArrayList<>();
-
- for (Map.Entry<String, String> property : properties.entrySet()) {
- AmbariConfigurationEntity entity = new AmbariConfigurationEntity();
- entity.setCategoryName(categoryName);
- entity.setPropertyName(property.getKey());
- entity.setPropertyValue(property.getValue());
- entities.add(entity);
- }
-
- return entities;
- }
-
- private Map<String, Object> toRequestProperties(String categoryName1, Map<String, String> properties) {
- Map<String, Object> requestProperties = new HashMap<>();
- requestProperties.put(AMBARI_CONFIGURATION_CATEGORY_PROPERTY_ID, categoryName1);
- for (Map.Entry<String, String> entry : properties.entrySet()) {
- requestProperties.put(AMBARI_CONFIGURATION_PROPERTIES_PROPERTY_ID + "/" + entry.getKey(), entry.getValue());
- }
- return requestProperties;
- }
-
- private void validateCapturedProperties(Map<String, String> expectedProperties, Capture<Map<String, String>> capturedProperties) {
- junit.framework.Assert.assertTrue(capturedProperties.hasCaptured());
-
- Map<String, String> properties = capturedProperties.getValue();
- junit.framework.Assert.assertNotNull(properties);
-
- // Convert the Map to a TreeMap to help with comparisons
- expectedProperties = new TreeMap<>(expectedProperties);
- properties = new TreeMap<>(properties);
- junit.framework.Assert.assertEquals(expectedProperties, properties);
- }
-
- private Injector createInjector() throws Exception {
- return Guice.createInjector(new AbstractModule() {
- @Override
- protected void configure() {
- bind(EntityManager.class).toInstance(createNiceMock(EntityManager.class));
- bind(AmbariConfigurationDAO.class).toInstance(createMock(AmbariConfigurationDAO.class));
- bind(AmbariEventPublisher.class).toInstance(createMock(AmbariEventPublisher.class));
- }
- });
- }
-}
\ No newline at end of file
[37/50] [abbrv] ambari git commit: AMBARI-22455 Ambari Logsearch Web
unit tests are sometimes failing. (ababiichuk)
Posted by rl...@apache.org.
AMBARI-22455 Ambari Logsearch Web unit tests are sometimes failing. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2d81d49f
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2d81d49f
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2d81d49f
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 2d81d49fb3cc5fefbed079e7994cea7b41c5a125
Parents: 1a99da4
Author: ababiichuk <ab...@hortonworks.com>
Authored: Wed Nov 15 17:37:19 2017 +0200
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Wed Nov 15 18:16:16 2017 +0200
----------------------------------------------------------------------
.../src/app/services/auth.service.spec.ts | 123 ++++++++++---------
1 file changed, 62 insertions(+), 61 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/2d81d49f/ambari-logsearch/ambari-logsearch-web/src/app/services/auth.service.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/services/auth.service.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/services/auth.service.spec.ts
index a465c10..fd5a83e 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/services/auth.service.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/services/auth.service.spec.ts
@@ -16,9 +16,12 @@
* limitations under the License.
*/
-import {TestBed, inject} from '@angular/core/testing';
+import {TestBed, inject, async} from '@angular/core/testing';
import {HttpModule} from '@angular/http';
import {Observable} from 'rxjs/Observable';
+import 'rxjs/add/operator/first';
+import 'rxjs/add/operator/last';
+import 'rxjs/add/operator/take';
import {StoreModule} from '@ngrx/store';
import {AppStateService, appState} from '@app/services/storage/app-state.service';
import {AuthService} from '@app/services/auth.service';
@@ -26,49 +29,37 @@ import {HttpClientService} from '@app/services/http-client.service';
describe('AuthService', () => {
- let successResponse = {
- type: 'default',
- ok: true,
- url: '/',
- status: 200,
- statusText: 'OK',
- bytesLoaded: 100,
- totalBytes: 100,
- headers: null
- };
- let errorResponse = {
- type: 'error',
- ok: false,
- url: '/',
- status: 401,
- statusText: 'ERROR',
- bytesLoaded: 100,
- totalBytes: 100,
- headers: null
+ const successResponse = {
+ type: 'default',
+ ok: true,
+ url: '/',
+ status: 200,
+ statusText: 'OK',
+ bytesLoaded: 100,
+ totalBytes: 100,
+ headers: null
+ },
+ errorResponse = {
+ type: 'error',
+ ok: false,
+ url: '/',
+ status: 401,
+ statusText: 'ERROR',
+ bytesLoaded: 100,
+ totalBytes: 100,
+ headers: null
+ };
+
+ // Note: We add delay to help the isLoginInProgress test case.
+ let httpServiceStub = {
+ isError: false,
+ postFormData: function () {
+ const isError = this.isError;
+ return Observable.create(observer => observer.next(isError ? errorResponse : successResponse)).delay(1000);
+ }
};
- let currentResponse = successResponse;
- let httpServiceStub;
- let authService: AuthService;
beforeEach(() => {
- // Note: We add delay to help the isLoginInProgress test case.
- httpServiceStub = {
- postFormData: function () {
- return Observable.create(observer => {
- observer.next(currentResponse);
- }).delay(1000);
- },
- post: function () {
- return Observable.create(observer => {
- observer.next(currentResponse);
- }).delay(1000);
- },
- get: function () {
- return Observable.create(observer => {
- observer.next(currentResponse);
- }).delay(1000);
- }
- };
TestBed.configureTestingModule({
imports: [
HttpModule,
@@ -82,51 +73,61 @@ describe('AuthService', () => {
{provide: HttpClientService, useValue: httpServiceStub}
]
});
- authService = TestBed.get(AuthService);
});
it('should create service', inject([AuthService], (service: AuthService) => {
expect(service).toBeTruthy();
}));
- it('should set the isAuthorized state to true in appState when the login is success', inject(
- [AppStateService],
- (appStateService: AppStateService) => {
- currentResponse = successResponse;
+ it('should set the isAuthorized state to true in appState when the login is success', async(inject(
+ [AuthService, AppStateService, HttpClientService],
+ (authService: AuthService, appStateService: AppStateService, httpClientService) => {
+ httpClientService.isError = false;
authService.login('test', 'test')
.subscribe(() => {
- appStateService.getParameter('isAuthorized').subscribe((value) => {
+ appStateService.getParameter('isAuthorized').subscribe((value: Boolean): void => {
expect(value).toBe(true);
});
- }, (value) => {
+ }, value => {
throw value;
});
}
- ));
+ )));
- it('should set the isAuthorized state to false in appState when the login is failed', inject(
- [AppStateService],
- (appStateService: AppStateService) => {
- currentResponse = errorResponse;
+ it('should set the isAuthorized state to false in appState when the login is failed', async(inject(
+ [AuthService, AppStateService, HttpClientService],
+ (authService: AuthService, appStateService: AppStateService, httpClientService) => {
+ httpClientService.isError = true;
authService.login('test', 'test')
.subscribe(() => {
- appStateService.getParameter('isAuthorized').subscribe((value) => {
+ appStateService.getParameter('isAuthorized').subscribe((value: Boolean): void => {
expect(value).toBe(false);
});
});
}
- ));
+ )));
- it('should set the isLoginInProgress state to true when the login started.', inject(
- [AppStateService],
- (appStateService: AppStateService) => {
- currentResponse = successResponse;
+ it('should set the isLoginInProgress state to true when the login started', async(inject(
+ [AuthService, AppStateService, HttpClientService],
+ (authService: AuthService, appStateService: AppStateService, httpClientService) => {
+ httpClientService.isError = false;
authService.login('test', 'test');
- appStateService.getParameter('isLoginInProgress').subscribe((value) => {
+ appStateService.getParameter('isLoginInProgress').first().subscribe((value: Boolean): void => {
expect(value).toBe(true);
});
}
- ));
+ )));
+
+ it('should set the isLoginInProgress state to true after the login is success', async(inject(
+ [AuthService, AppStateService, HttpClientService],
+ (authService: AuthService, appStateService: AppStateService, httpClientService) => {
+ httpClientService.isError = false;
+ authService.login('test', 'test');
+ appStateService.getParameter('isLoginInProgress').take(2).last().subscribe((value: Boolean): void => {
+ expect(value).toBe(false);
+ });
+ }
+ )));
});
[19/50] [abbrv] ambari git commit: AMBARI-22416 Log Search UI: fixes
for filtering form. (ababiichuk)
Posted by rl...@apache.org.
AMBARI-22416 Log Search UI: fixes for filtering form. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7c4a7e4c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7c4a7e4c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7c4a7e4c
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 7c4a7e4c52e00282e5b8b901cef14c143fd3da2b
Parents: 068d82f
Author: ababiichuk <ab...@hortonworks.com>
Authored: Fri Nov 10 18:16:45 2017 +0200
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Fri Nov 10 23:53:24 2017 +0200
----------------------------------------------------------------------
.../ambari-logsearch-web/src/app/app.module.ts | 2 -
.../src/app/classes/filtering.ts | 355 +---------
.../src/app/classes/models/app-state.ts | 6 +-
.../src/app/classes/models/node-item.ts | 30 +
.../src/app/classes/models/node.ts | 30 -
.../src/app/classes/models/store.ts | 6 +-
.../src/app/classes/models/tab.ts | 12 +-
.../src/app/components/app.component.ts | 6 +-
.../dropdown-button.component.html | 4 +-
.../dropdown-button.component.spec.ts | 2 -
.../dropdown-button.component.ts | 55 +-
.../dropdown-list/dropdown-list.component.html | 2 +-
.../dropdown-list.component.spec.ts | 6 +-
.../filter-button.component.spec.ts | 2 -
.../filter-button/filter-button.component.ts | 35 +-
.../filter-dropdown.component.spec.ts | 14 +-
.../filter-dropdown.component.ts | 22 +-
.../filters-panel/filters-panel.component.html | 6 +-
.../filters-panel.component.spec.ts | 6 +-
.../filters-panel/filters-panel.component.ts | 18 +-
.../log-context/log-context.component.spec.ts | 4 +-
.../logs-container.component.spec.ts | 2 -
.../logs-container/logs-container.component.ts | 26 +-
.../logs-list/logs-list.component.html | 3 +-
.../logs-list/logs-list.component.spec.ts | 21 +-
.../components/logs-list/logs-list.component.ts | 10 +-
.../menu-button/menu-button.component.spec.ts | 2 -
.../menu-button/menu-button.component.ts | 4 +-
.../pagination-controls.component.ts | 7 +-
.../pagination/pagination.component.html | 2 +-
.../pagination/pagination.component.spec.ts | 9 +-
.../pagination/pagination.component.ts | 10 +-
.../search-box/search-box.component.ts | 12 +-
.../time-range-picker.component.html | 3 +-
.../time-range-picker.component.spec.ts | 29 +-
.../time-range-picker.component.ts | 47 +-
.../timezone-picker.component.spec.ts | 2 -
.../services/component-actions.service.spec.ts | 2 -
.../app/services/component-actions.service.ts | 24 +-
.../component-generator.service.spec.ts | 2 -
.../src/app/services/filtering.service.spec.ts | 97 ---
.../src/app/services/filtering.service.ts | 253 -------
.../app/services/logs-container.service.spec.ts | 31 +-
.../src/app/services/logs-container.service.ts | 678 ++++++++++++++++++-
.../src/app/services/utils.service.spec.ts | 285 +++++++-
.../src/app/services/utils.service.ts | 65 +-
46 files changed, 1257 insertions(+), 992 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/app.module.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/app.module.ts b/ambari-logsearch/ambari-logsearch-web/src/app/app.module.ts
index 56562df..37f3a49 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/app.module.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/app.module.ts
@@ -34,7 +34,6 @@ import {environment} from '@envs/environment';
import {mockApiDataService} from '@app/services/mock-api-data.service'
import {HttpClientService} from '@app/services/http-client.service';
import {ComponentActionsService} from '@app/services/component-actions.service';
-import {FilteringService} from '@app/services/filtering.service';
import {UtilsService} from '@app/services/utils.service';
import {LogsContainerService} from '@app/services/logs-container.service';
import {ComponentGeneratorService} from '@app/services/component-generator.service';
@@ -164,7 +163,6 @@ export function getXHRBackend(injector: Injector, browser: BrowserXhr, xsrf: XSR
providers: [
HttpClientService,
ComponentActionsService,
- FilteringService,
UtilsService,
LogsContainerService,
ComponentGeneratorService,
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/classes/filtering.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/filtering.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/filtering.ts
index dde144b..2a7205f 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/classes/filtering.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/filtering.ts
@@ -16,354 +16,37 @@
* limitations under the License.
*/
-import {FormGroup, FormControl} from '@angular/forms';
+import {Moment, unitOfTime} from 'moment';
import {ListItem} from '@app/classes/list-item';
export interface TimeUnit {
type: 'CURRENT' | 'LAST' | 'PAST';
- unit: 'ms' | 's' | 'm' | 'h' | 'd' | 'w' | 'M' | 'Y';
+ unit: unitOfTime.DurationConstructor;
interval?: number;
}
+export interface CustomTimeRange {
+ type: 'CUSTOM';
+ start?: Moment;
+ end?: Moment;
+}
+
+export interface SortingConditions {
+ key: string;
+ type: 'asc' | 'desc';
+}
+
export interface TimeUnitListItem extends ListItem {
- value: TimeUnit;
+ value: TimeUnit | CustomTimeRange;
+}
+
+export interface SortingListItem extends ListItem {
+ value: SortingConditions;
}
export interface FilterCondition {
label?: string;
options?: (ListItem | TimeUnitListItem[])[];
- defaultValue?: string | number | {[key: string]: any};
- defaultLabel?: string;
+ defaultSelection?: ListItem | ListItem[] | number;
iconClass?: string;
}
-
-const paginationOptions: string[] = ['10', '25', '50', '100'];
-
-export const filters: {[key: string]: FilterCondition} = {
- clusters: {
- label: 'filter.clusters',
- options: [],
- defaultValue: ''
- },
- timeRange: {
- options: [
- [
- {
- label: 'filter.timeRange.7d',
- value: {
- type: 'LAST',
- unit: 'd',
- interval: 7
- }
- },
- {
- label: 'filter.timeRange.30d',
- value: {
- type: 'LAST',
- unit: 'd',
- interval: 30
- }
- },
- {
- label: 'filter.timeRange.60d',
- value: {
- type: 'LAST',
- unit: 'd',
- interval: 60
- }
- },
- {
- label: 'filter.timeRange.90d',
- value: {
- type: 'LAST',
- unit: 'd',
- interval: 90
- }
- },
- {
- label: 'filter.timeRange.6m',
- value: {
- type: 'LAST',
- unit: 'M',
- interval: 6
- }
- },
- {
- label: 'filter.timeRange.1y',
- value: {
- type: 'LAST',
- unit: 'Y',
- interval: 1
- }
- },
- {
- label: 'filter.timeRange.2y',
- value: {
- type: 'LAST',
- unit: 'Y',
- interval: 2
- }
- },
- {
- label: 'filter.timeRange.5y',
- value: {
- type: 'LAST',
- unit: 'Y',
- interval: 5
- }
- }
- ],
- [
- {
- label: 'filter.timeRange.yesterday',
- value: {
- type: 'PAST',
- unit: 'd'
- }
- },
- // TODO implement time range calculation
- /*
- {
- label: 'filter.timeRange.beforeYesterday',
- value: {
- type: 'PAST',
- unit: 'd'
- }
- },
- {
- label: 'filter.timeRange.thisDayLastWeek',
- value: {
- type: 'PAST',
- unit: 'd'
- }
- },
- */
- {
- label: 'filter.timeRange.previousWeek',
- value: {
- type: 'PAST',
- unit: 'w'
- }
- },
- {
- label: 'filter.timeRange.previousMonth',
- value: {
- type: 'PAST',
- unit: 'M'
- }
- },
- {
- label: 'filter.timeRange.previousYear',
- value: {
- type: 'PAST',
- unit: 'Y'
- }
- }
- ],
- [
- {
- label: 'filter.timeRange.today',
- value: {
- type: 'CURRENT',
- unit: 'd'
- }
- },
- {
- label: 'filter.timeRange.thisWeek',
- value: {
- type: 'CURRENT',
- unit: 'w'
- }
- },
- {
- label: 'filter.timeRange.thisMonth',
- value: {
- type: 'CURRENT',
- unit: 'M'
- }
- },
- {
- label: 'filter.timeRange.thisYear',
- value: {
- type: 'CURRENT',
- unit: 'Y'
- }
- }
- ],
- [
- {
- label: 'filter.timeRange.5min',
- value: {
- type: 'LAST',
- unit: 'm',
- interval: 5
- }
- },
- {
- label: 'filter.timeRange.15min',
- value: {
- type: 'LAST',
- unit: 'm',
- interval: 15
- }
- },
- {
- label: 'filter.timeRange.30min',
- value: {
- type: 'LAST',
- unit: 'm',
- interval: 30
- }
- },
- {
- label: 'filter.timeRange.1hr',
- value: {
- type: 'LAST',
- unit: 'h',
- interval: 1
- }
- },
- {
- label: 'filter.timeRange.3hr',
- value: {
- type: 'LAST',
- unit: 'h',
- interval: 3
- }
- },
- {
- label: 'filter.timeRange.6hr',
- value: {
- type: 'LAST',
- unit: 'h',
- interval: 6
- }
- },
- {
- label: 'filter.timeRange.12hr',
- value: {
- type: 'LAST',
- unit: 'h',
- interval: 12
- }
- },
- {
- label: 'filter.timeRange.24hr',
- value: {
- type: 'LAST',
- unit: 'h',
- interval: 24
- }
- },
- ]
- ],
- defaultValue: {
- type: 'LAST',
- unit: 'h',
- interval: 1
- },
- defaultLabel: 'filter.timeRange.1hr'
- },
- components: {
- label: 'filter.components',
- iconClass: 'fa fa-cubes',
- options: [],
- defaultValue: ''
- },
- levels: {
- label: 'filter.levels',
- iconClass: 'fa fa-sort-amount-asc',
- options: [
- {
- label: 'levels.fatal',
- value: 'FATAL'
- },
- {
- label: 'levels.error',
- value: 'ERROR'
- },
- {
- label: 'levels.warn',
- value: 'WARN'
- },
- {
- label: 'levels.info',
- value: 'INFO'
- },
- {
- label: 'levels.debug',
- value: 'DEBUG'
- },
- {
- label: 'levels.trace',
- value: 'TRACE'
- },
- {
- label: 'levels.unknown',
- value: 'UNKNOWN'
- }
- ],
- defaultValue: ''
- },
- hosts: {
- label: 'filter.hosts',
- iconClass: 'fa fa-server',
- options: [],
- defaultValue: ''
- },
- sorting: {
- label: 'sorting.title',
- options: [
- {
- label: 'sorting.time.asc',
- value: {
- key: 'logtime',
- type: 'asc'
- }
- },
- {
- label: 'sorting.time.desc',
- value: {
- key: 'logtime',
- type: 'desc'
- }
- }
- ],
- defaultValue: '',
- defaultLabel: ''
- },
- pageSize: {
- label: 'pagination.title',
- options: paginationOptions.map((option: string): ListItem => {
- return {
- label: option,
- value: option
- }
- }),
- defaultValue: '10',
- defaultLabel: '10'
- },
- page: {
- defaultValue: 0
- },
- query: {}
-};
-
-export const filtersFormItemsMap: {[key: string]: string[]} = {
- serviceLogs: ['clusters', 'timeRange', 'components', 'levels', 'hosts', 'sorting', 'pageSize', 'page', 'query'],
- auditLogs: ['clusters', 'timeRange', 'sorting', 'pageSize', 'page', 'query'] // TODO add all the required fields
-};
-
-export const getFiltersForm = (listType: string): FormGroup => {
- const itemsList = filtersFormItemsMap[listType],
- keys = Object.keys(filters).filter((key: string): boolean => itemsList.indexOf(key) > -1),
- items = keys.reduce((currentObject: any, key: string): any => {
- let formControl = new FormControl(),
- item = {
- [key]: formControl
- };
- formControl.setValue(filters[key].defaultValue);
- return Object.assign(currentObject, item);
- }, {});
- return new FormGroup(items);
-};
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/app-state.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/app-state.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/app-state.ts
index 2c5c083..afed497 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/app-state.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/app-state.ts
@@ -16,9 +16,7 @@
* limitations under the License.
*/
-import {FormGroup} from '@angular/forms';
import {ActiveServiceLogEntry} from '@app/classes/active-service-log-entry';
-import {Tab, initialTabs} from '@app/classes/models/tab';
export interface AppState {
isAuthorized: boolean;
@@ -28,7 +26,7 @@ export interface AppState {
isServiceLogsFileView: boolean;
isServiceLogContextView: boolean;
activeLog: ActiveServiceLogEntry | null;
- activeFiltersForm: FormGroup;
+ activeFilters: object;
}
export const initialState: AppState = {
@@ -39,5 +37,5 @@ export const initialState: AppState = {
isServiceLogsFileView: false,
isServiceLogContextView: false,
activeLog: null,
- activeFiltersForm: initialTabs.find((tab: Tab): boolean => tab.isActive).appState.activeFiltersForm
+ activeFilters: null
};
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/node-item.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/node-item.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/node-item.ts
new file mode 100644
index 0000000..ef5f772
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/node-item.ts
@@ -0,0 +1,30 @@
+/**
+ * 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.
+ */
+
+import {CommonEntry} from '@app/classes/models/common-entry';
+
+export interface NodeItem {
+ name: string;
+ type?: string;
+ value: string;
+ isParent: boolean;
+ isRoot: boolean;
+ childs?: NodeItem[];
+ logLevelCount?: CommonEntry[];
+ vNodeList?: CommonEntry[];
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/node.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/node.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/node.ts
deleted file mode 100644
index a14e51a..0000000
--- a/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/node.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * 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.
- */
-
-import {CommonEntry} from '@app/classes/models/common-entry';
-
-export interface Node {
- name: string;
- type?: string;
- value: string;
- isParent: boolean;
- isRoot: boolean;
- childs?: Node[];
- logLevelCount?: CommonEntry[];
- vNodeList?: CommonEntry[];
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/store.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/store.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/store.ts
index d912b35..f996d92 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/store.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/store.ts
@@ -24,7 +24,7 @@ import {AuditLog} from '@app/classes/models/audit-log';
import {ServiceLog} from '@app/classes/models/service-log';
import {BarGraph} from '@app/classes/models/bar-graph';
import {Graph} from '@app/classes/models/graph';
-import {Node} from '@app/classes/models/node';
+import {NodeItem} from '@app/classes/models/node-item';
import {UserConfig} from '@app/classes/models/user-config';
import {Filter} from '@app/classes/models/filter';
import {AuditLogField} from '@app/classes/models/audit-log-field';
@@ -50,11 +50,11 @@ export interface AppStore {
serviceLogsHistogramData: BarGraph[];
serviceLogsTruncated: ServiceLog[];
graphs: Graph[];
- hosts: Node[];
+ hosts: NodeItem[];
userConfigs: UserConfig[];
filters: Filter[];
clusters: string[];
- components: Node[];
+ components: NodeItem[];
serviceLogsFields: ServiceLogField[];
auditLogsFields: AuditLogField[];
tabs: Tab[];
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/tab.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/tab.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/tab.ts
index bb8028a..05ea59d 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/tab.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/tab.ts
@@ -16,15 +16,13 @@
* limitations under the License.
*/
-import {getFiltersForm} from '@app/classes/filtering';
-
export interface Tab {
id: string;
type: string;
- isActive: boolean;
+ isActive?: boolean;
isCloseable?: boolean;
label: string;
- appState: any;
+ appState?: object;
}
export const initialTabs: Tab[] = [
@@ -35,8 +33,7 @@ export const initialTabs: Tab[] = [
label: 'common.serviceLogs',
appState: {
activeLogsType: 'serviceLogs',
- isServiceLogsFileView: false,
- activeFiltersForm: getFiltersForm('serviceLogs')
+ isServiceLogsFileView: false
}
},
{
@@ -46,8 +43,7 @@ export const initialTabs: Tab[] = [
label: 'common.auditLogs',
appState: {
activeLogsType: 'auditLogs',
- isServiceLogsFileView: false,
- activeFiltersForm: getFiltersForm('auditLogs')
+ isServiceLogsFileView: false
}
}
];
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/components/app.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/app.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/app.component.ts
index 4de47ea..038dd2a 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/app.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/app.component.ts
@@ -30,12 +30,12 @@ import {HttpClientService} from '@app/services/http-client.service';
export class AppComponent {
constructor(private httpClient: HttpClientService, private translate: TranslateService, private appState: AppStateService) {
- appState.getParameter('isAuthorized').subscribe(value => this.isAuthorized = value);
+ appState.getParameter('isAuthorized').subscribe((value: boolean) => this.isAuthorized = value);
appState.setParameter('isInitialLoading', true);
- this.httpClient.get('status').subscribe(() => this.appState.setParameters({
+ httpClient.get('status').subscribe(() => appState.setParameters({
isAuthorized: true,
isInitialLoading: false
- }), () => this.appState.setParameter('isInitialLoading', false));
+ }), () => appState.setParameter('isInitialLoading', false));
translate.setDefaultLang('en');
translate.use('en');
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.html b/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.html
index 798a609..b5f1e56 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.html
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.html
@@ -22,10 +22,10 @@
<span *ngIf="iconClass" [ngClass]="iconClass"></span>
<span *ngIf="label">{{label | translate}}</span>
</span>
- <span *ngIf="showSelectedValue && !isMultipleChoice">{{selectedLabel | translate}}</span>
+ <span *ngIf="showSelectedValue && !isMultipleChoice && selection.length">{{selection[0].label | translate}}</span>
<span *ngIf="!hideCaret" class="caret"></span>
</button>
<ul data-component="dropdown-list" [ngClass]="{'dropdown-menu': true, 'dropdown-menu-right': isRightAlign}"
- [items]="options" [isMultipleChoice]="isMultipleChoice" (selectedItemChange)="updateValue($event)"
+ [items]="options" [isMultipleChoice]="isMultipleChoice" (selectedItemChange)="updateSelection($event)"
[actionArguments]="additionalArgs"></ul>
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.spec.ts
index f11ca09..bd41c04 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.spec.ts
@@ -32,7 +32,6 @@ import {ServiceLogsFieldsService, serviceLogsFields} from '@app/services/storage
import {ServiceLogsHistogramDataService, serviceLogsHistogramData} from '@app/services/storage/service-logs-histogram-data.service';
import {ServiceLogsTruncatedService, serviceLogsTruncated} from '@app/services/storage/service-logs-truncated.service';
import {TabsService, tabs} from '@app/services/storage/tabs.service';
-import {FilteringService} from '@app/services/filtering.service';
import {UtilsService} from '@app/services/utils.service';
import {ComponentActionsService} from '@app/services/component-actions.service';
import {HttpClientService} from '@app/services/http-client.service';
@@ -85,7 +84,6 @@ describe('DropdownButtonComponent', () => {
ServiceLogsHistogramDataService,
ServiceLogsTruncatedService,
TabsService,
- FilteringService,
UtilsService,
ComponentActionsService,
{
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.ts
index 0bf4422..148e1b4 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.ts
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-import {Component, OnInit, Input} from '@angular/core';
+import {Component, Input} from '@angular/core';
import {ListItem} from '@app/classes/list-item';
import {ComponentActionsService} from '@app/services/component-actions.service';
import {UtilsService} from '@app/services/utils.service';
@@ -26,14 +26,10 @@ import {UtilsService} from '@app/services/utils.service';
templateUrl: './dropdown-button.component.html',
styleUrls: ['./dropdown-button.component.less']
})
-export class DropdownButtonComponent implements OnInit {
+export class DropdownButtonComponent {
constructor(protected actions: ComponentActionsService, protected utils: UtilsService) {
}
-
- ngOnInit() {
- this.selectedLabel = this.defaultLabel;
- }
@Input()
label?: string;
@@ -48,13 +44,7 @@ export class DropdownButtonComponent implements OnInit {
showSelectedValue: boolean = true;
@Input()
- options?: ListItem[];
-
- @Input()
- defaultValue?: string;
-
- @Input()
- defaultLabel?: string;
+ options: ListItem[] = [];
@Input()
action?: string;
@@ -71,36 +61,33 @@ export class DropdownButtonComponent implements OnInit {
@Input()
isDropup: boolean = false;
- protected selectedValue?: any;
-
- selectedLabel: string;
+ protected selectedItems?: ListItem[] = [];
- get value(): any {
- return this.selectedValue;
+ get selection(): ListItem[] {
+ return this.selectedItems;
}
- set value(value: any) {
- this.selectedValue = value;
+ set selection(items: ListItem[]) {
+ this.selectedItems = items;
}
- updateValue(eventOptions: ListItem): void {
- const value = eventOptions && eventOptions.value,
- action = this.action && this.actions[this.action];
+ updateSelection(item: ListItem): void {
+ const action = this.action && this.actions[this.action];
if (this.isMultipleChoice) {
- this.value = this.utils.updateMultiSelectValue(this.value, value, eventOptions.isChecked);
- this.options.find(item => item.value === value).isChecked = eventOptions.isChecked;
+ this.options.find((option: ListItem): boolean => {
+ return this.utils.isEqual(option.value, item.value);
+ }).isChecked = item.isChecked;
+ const checkedItems = this.options.filter((option: ListItem): boolean => option.isChecked);
+ this.selection = checkedItems;
if (action) {
- action(this.options.filter(item => item.isChecked).map(item => item.value), ...this.additionalArgs);
+ action(checkedItems.map((option: ListItem): any => option.value), ...this.additionalArgs);
}
- } else {
- if (this.utils.valueHasChanged(this.value, value)) {
- this.value = value;
- this.selectedLabel = eventOptions.label;
- if (action) {
- action(this.value, ...this.additionalArgs);
- }
+ } else if (!this.utils.isEqual(this.selection[0], item)) {
+ this.selection = [item];
+ if (action) {
+ action(item.value, ...this.additionalArgs);
}
}
}
-
+
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.html b/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.html
index 5de78ad..df564e5 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.html
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.html
@@ -17,7 +17,7 @@
<li *ngFor="let item of items">
<label class="list-item-label" *ngIf="isMultipleChoice">
- <input type="checkbox" [attr.id]="item.id || item.value" [attr.checked]="item.isChecked ? 'checked' : null"
+ <input type="checkbox" [attr.id]="item.id || item.value" [(ngModel)]="item.isChecked"
(change)="changeSelectedItem({value: item.value, isChecked: $event.currentTarget.checked})">
<label [attr.for]="item.id || item.value" class="label-container">
<span *ngIf="item.iconClass" [ngClass]="item.iconClass"></span>
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.spec.ts
index 5455e67..ac2fa84 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.spec.ts
@@ -17,6 +17,7 @@
*/
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
+import {FormsModule} from '@angular/forms';
import {StoreModule} from '@ngrx/store';
import {TranslationModules} from '@app/test-config.spec';
import {HostsService, hosts} from '@app/services/storage/hosts.service';
@@ -34,7 +35,6 @@ import {TabsService, tabs} from '@app/services/storage/tabs.service';
import {ComponentGeneratorService} from '@app/services/component-generator.service';
import {LogsContainerService} from '@app/services/logs-container.service';
import {HttpClientService} from '@app/services/http-client.service';
-import {FilteringService} from '@app/services/filtering.service';
import {ComponentActionsService} from '@app/services/component-actions.service';
import {DropdownListComponent} from './dropdown-list.component';
@@ -69,7 +69,8 @@ describe('DropdownListComponent', () => {
components,
serviceLogsTruncated,
tabs
- })
+ }),
+ FormsModule
],
providers: [
ComponentGeneratorService,
@@ -78,7 +79,6 @@ describe('DropdownListComponent', () => {
provide: HttpClientService,
useValue: httpClient
},
- FilteringService,
ComponentActionsService,
HostsService,
AuditLogsService,
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-button/filter-button.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-button/filter-button.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-button/filter-button.component.spec.ts
index 3e40455..f9ae154 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-button/filter-button.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-button/filter-button.component.spec.ts
@@ -33,7 +33,6 @@ import {ServiceLogsHistogramDataService, serviceLogsHistogramData} from '@app/se
import {ServiceLogsTruncatedService, serviceLogsTruncated} from '@app/services/storage/service-logs-truncated.service';
import {TabsService, tabs} from '@app/services/storage/tabs.service';
import {ComponentActionsService} from '@app/services/component-actions.service';
-import {FilteringService} from '@app/services/filtering.service';
import {UtilsService} from '@app/services/utils.service';
import {HttpClientService} from '@app/services/http-client.service';
import {LogsContainerService} from '@app/services/logs-container.service';
@@ -86,7 +85,6 @@ describe('FilterButtonComponent', () => {
ServiceLogsTruncatedService,
TabsService,
ComponentActionsService,
- FilteringService,
UtilsService,
{
provide: HttpClientService,
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-button/filter-button.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-button/filter-button.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-button/filter-button.component.ts
index 2c8ecd7..2dcecd1 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-button/filter-button.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-button/filter-button.component.ts
@@ -41,34 +41,35 @@ export class FilterButtonComponent extends MenuButtonComponent implements Contro
super(actions);
}
- @Input()
- defaultValue?: string;
-
- private selectedValue: any;
+ private selectedItems: ListItem[] = [];
private onChange: (fn: any) => void;
- get value(): any {
- return this.selectedValue;
+ get selection(): ListItem[] {
+ return this.selectedItems;
}
- set value(newValue: any) {
- this.selectedValue = newValue;
- this.onChange(newValue);
+ set selection(items: ListItem[]) {
+ this.selectedItems = items;
+ if (this.onChange) {
+ this.onChange(items);
+ }
}
- updateValue(options: ListItem): void {
- const value = options && options.value;
+ updateSelection(item: ListItem): void {
if (this.isMultipleChoice) {
- this.value = this.utils.updateMultiSelectValue(this.value, value, options.isChecked);
- } else {
- if (this.utils.valueHasChanged(this.selectedValue, value)) {
- this.value = value;
- }
+ this.subItems.find((option: ListItem): boolean => {
+ return this.utils.isEqual(option.value, item.value);
+ }).isChecked = item.isChecked;
+ const checkedItems = this.subItems.filter((option: ListItem): boolean => option.isChecked);
+ this.selection = checkedItems;
+ } else if (!this.utils.isEqual(this.selection[0], item)) {
+ this.selection = [item];
}
}
- writeValue() {
+ writeValue(items: ListItem[]) {
+ this.selection = items;
}
registerOnChange(callback: any): void {
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-dropdown/filter-dropdown.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-dropdown/filter-dropdown.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-dropdown/filter-dropdown.component.spec.ts
index c294e8e..f9192f4 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-dropdown/filter-dropdown.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-dropdown/filter-dropdown.component.spec.ts
@@ -28,7 +28,9 @@ import {ServiceLogsFieldsService, serviceLogsFields} from '@app/services/storage
import {ServiceLogsHistogramDataService, serviceLogsHistogramData} from '@app/services/storage/service-logs-histogram-data.service';
import {ServiceLogsTruncatedService, serviceLogsTruncated} from '@app/services/storage/service-logs-truncated.service';
import {TabsService, tabs} from '@app/services/storage/tabs.service';
-import {FilteringService} from '@app/services/filtering.service';
+import {ClustersService, clusters} from '@app/services/storage/clusters.service';
+import {ComponentsService, components} from '@app/services/storage/components.service';
+import {HostsService, hosts} from '@app/services/storage/hosts.service';
import {UtilsService} from '@app/services/utils.service';
import {ComponentActionsService} from '@app/services/component-actions.service';
import {LogsContainerService} from '@app/services/logs-container.service';
@@ -77,7 +79,10 @@ describe('FilterDropdownComponent', () => {
serviceLogsFields,
serviceLogsHistogramData,
serviceLogsTruncated,
- tabs
+ tabs,
+ clusters,
+ components,
+ hosts
}),
...TranslationModules
],
@@ -91,8 +96,11 @@ describe('FilterDropdownComponent', () => {
ServiceLogsHistogramDataService,
ServiceLogsTruncatedService,
TabsService,
+ ClustersService,
+ ComponentsService,
+ HostsService,
{
- provide: FilteringService,
+ provide: LogsContainerService,
useValue: filtering
},
UtilsService,
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-dropdown/filter-dropdown.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-dropdown/filter-dropdown.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-dropdown/filter-dropdown.component.ts
index 9e5a6f1..d677d81 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-dropdown/filter-dropdown.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-dropdown/filter-dropdown.component.ts
@@ -20,6 +20,7 @@ import {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms';
import {ComponentActionsService} from '@app/services/component-actions.service';
import {UtilsService} from '@app/services/utils.service';
import {DropdownButtonComponent} from '@app/components/dropdown-button/dropdown-button.component';
+import {ListItem} from '@app/classes/list-item';
@Component({
selector: 'filter-dropdown',
@@ -41,16 +42,25 @@ export class FilterDropdownComponent extends DropdownButtonComponent implements
private onChange: (fn: any) => void;
- get value(): any {
- return this.selectedValue;
+ get selection(): ListItem[] {
+ return this.selectedItems;
}
- set value(newValue: any) {
- this.selectedValue = newValue;
- this.onChange(newValue);
+ set selection(items: ListItem[]) {
+ this.selectedItems = items;
+ if (this.isMultipleChoice) {
+ this.options.forEach((option: ListItem): void => {
+ const selectionItem = items.find((item: ListItem): boolean => this.utils.isEqual(item.value, option.value));
+ option.isChecked = Boolean(selectionItem);
+ });
+ }
+ if (this.onChange) {
+ this.onChange(items);
+ }
}
- writeValue() {
+ writeValue(items: ListItem[]) {
+ this.selection = items;
}
registerOnChange(callback: any): void {
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/components/filters-panel/filters-panel.component.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/filters-panel/filters-panel.component.html b/ambari-logsearch/ambari-logsearch-web/src/app/components/filters-panel/filters-panel.component.html
index fa739a4..2d327a6 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/filters-panel/filters-panel.component.html
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/filters-panel/filters-panel.component.html
@@ -17,13 +17,13 @@
<form [formGroup]="filtersForm">
<div class="form-inline filter-input-container col-md-8">
- <filter-dropdown [label]="filters.clusters.label" formControlName="clusters" [options]="filters.clusters.options"
- [defaultLabel]="filters.clusters.defaultLabel" [isMultipleChoice]="true"
+ <filter-dropdown *ngIf="isFilterConditionDisplayed('clusters')" [label]="filters.clusters.label"
+ formControlName="clusters" [options]="filters.clusters.options" [isMultipleChoice]="true"
class="filter-input"></filter-dropdown>
<search-box formControlName="query" [items]="searchBoxItemsTranslated" class="filter-input"
[parameterNameChangeSubject]="queryParameterNameChange"
[parameterAddSubject]="queryParameterAdd"></search-box>
- <time-range-picker formControlName="timeRange" [defaultLabel]="filters.timeRange.defaultLabel"
+ <time-range-picker *ngIf="isFilterConditionDisplayed('timeRange')" formControlName="timeRange"
class="filter-input"></time-range-picker>
<timezone-picker class="filter-input"></timezone-picker>
<!--button class="btn btn-success" type="button">
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/components/filters-panel/filters-panel.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/filters-panel/filters-panel.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/filters-panel/filters-panel.component.spec.ts
index 0bb0204..1f7e8db 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/filters-panel/filters-panel.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/filters-panel/filters-panel.component.spec.ts
@@ -18,6 +18,7 @@
import {NO_ERRORS_SCHEMA} from '@angular/core';
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
+import {FormGroup, FormControl} from '@angular/forms';
import {TranslationModules} from '@app/test-config.spec';
import {StoreModule} from '@ngrx/store';
import {AppSettingsService, appSettings} from '@app/services/storage/app-settings.service';
@@ -32,7 +33,6 @@ import {ServiceLogsHistogramDataService, serviceLogsHistogramData} from '@app/se
import {AppStateService, appState} from '@app/services/storage/app-state.service';
import {ServiceLogsTruncatedService, serviceLogsTruncated} from '@app/services/storage/service-logs-truncated.service';
import {TabsService, tabs} from '@app/services/storage/tabs.service';
-import {FilteringService} from '@app/services/filtering.service';
import {HttpClientService} from '@app/services/http-client.service';
import {UtilsService} from '@app/services/utils.service';
import {LogsContainerService} from '@app/services/logs-container.service';
@@ -88,7 +88,6 @@ describe('FiltersPanelComponent', () => {
AppStateService,
ServiceLogsTruncatedService,
TabsService,
- FilteringService,
LogsContainerService,
{
provide: HttpClientService,
@@ -104,6 +103,9 @@ describe('FiltersPanelComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(FiltersPanelComponent);
component = fixture.componentInstance;
+ component.filtersForm = new FormGroup({
+ control: new FormControl()
+ });
fixture.detectChanges();
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/components/filters-panel/filters-panel.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/filters-panel/filters-panel.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/filters-panel/filters-panel.component.ts
index 9601a0e..3314252 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/filters-panel/filters-panel.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/filters-panel/filters-panel.component.ts
@@ -21,10 +21,8 @@ import {FormGroup} from '@angular/forms';
import {Subject} from 'rxjs/Subject';
import {TranslateService} from '@ngx-translate/core';
import {ListItem} from '@app/classes/list-item';
-import {filtersFormItemsMap} from '@app/classes/filtering';
import {CommonEntry} from '@app/classes/models/common-entry';
import {LogField} from '@app/classes/models/log-field';
-import {FilteringService} from '@app/services/filtering.service';
import {LogsContainerService} from '@app/services/logs-container.service';
import {AppStateService} from '@app/services/storage/app-state.service';
@@ -35,7 +33,10 @@ import {AppStateService} from '@app/services/storage/app-state.service';
})
export class FiltersPanelComponent {
- constructor(private translate: TranslateService, private filtering: FilteringService, private logsContainer: LogsContainerService, private appState: AppStateService) {
+ constructor(
+ private translate: TranslateService, private logsContainer: LogsContainerService,
+ private appState: AppStateService
+ ) {
appState.getParameter('activeLogsType').subscribe(value => {
this.logsType = value;
logsContainer.logsTypeMap[value].fieldsModel.getAll().subscribe((fields: LogField[]): void => {
@@ -80,23 +81,24 @@ export class FiltersPanelComponent {
searchBoxItemsTranslated: CommonEntry[] = [];
get filters(): any {
- return this.filtering.filters;
+ return this.logsContainer.filters;
}
get queryParameterNameChange(): Subject<any> {
- return this.filtering.queryParameterNameChange;
+ return this.logsContainer.queryParameterNameChange;
}
get queryParameterAdd(): Subject<any> {
- return this.filtering.queryParameterAdd;
+ return this.logsContainer.queryParameterAdd;
}
get captureSeconds(): number {
- return this.filtering.captureSeconds;
+ return this.logsContainer.captureSeconds;
}
isFilterConditionDisplayed(key: string): boolean {
- return filtersFormItemsMap[this.logsType].indexOf(key) > -1;
+ return this.logsContainer.filtersFormItemsMap[this.logsType].indexOf(key) > -1
+ && Boolean(this.filtersForm.controls[key]);
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/components/log-context/log-context.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/log-context/log-context.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/log-context/log-context.component.spec.ts
index 4e9bdc9..7bd87ad 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/log-context/log-context.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/log-context/log-context.component.spec.ts
@@ -34,7 +34,6 @@ import {TranslationModules} from '@app/test-config.spec';
import {ModalComponent} from '@app/components/modal/modal.component';
import {LogsContainerService} from '@app/services/logs-container.service';
import {HttpClientService} from '@app/services/http-client.service';
-import {FilteringService} from '@app/services/filtering.service';
import {LogContextComponent} from './log-context.component';
@@ -90,8 +89,7 @@ describe('LogContextComponent', () => {
{
provide: HttpClientService,
useValue: httpClient
- },
- FilteringService
+ }
],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.spec.ts
index 0a9418f..2bb8731 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.spec.ts
@@ -33,7 +33,6 @@ import {HostsService, hosts} from '@app/services/storage/hosts.service';
import {ServiceLogsTruncatedService, serviceLogsTruncated} from '@app/services/storage/service-logs-truncated.service';
import {TabsService, tabs} from '@app/services/storage/tabs.service';
import {HttpClientService} from '@app/services/http-client.service';
-import {FilteringService} from '@app/services/filtering.service';
import {UtilsService} from '@app/services/utils.service';
import {LogsContainerService} from '@app/services/logs-container.service';
import {TabsComponent} from '@app/components/tabs/tabs.component';
@@ -92,7 +91,6 @@ describe('LogsContainerComponent', () => {
HostsService,
ServiceLogsTruncatedService,
TabsService,
- FilteringService,
UtilsService,
LogsContainerService
],
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.ts
index 21949f1..f8acd50 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.ts
@@ -22,7 +22,6 @@ import {Observable} from 'rxjs/Observable';
import {Subject} from 'rxjs/Subject';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/takeUntil';
-import {FilteringService} from '@app/services/filtering.service';
import {LogsContainerService} from '@app/services/logs-container.service';
import {ServiceLogsHistogramDataService} from '@app/services/storage/service-logs-histogram-data.service';
import {AppStateService} from '@app/services/storage/app-state.service';
@@ -43,9 +42,11 @@ import {ListItem} from '@app/classes/list-item';
})
export class LogsContainerComponent {
- constructor(private serviceLogsHistogramStorage: ServiceLogsHistogramDataService, private appState: AppStateService, private tabsStorage: TabsService, private filtering: FilteringService, private logsContainer: LogsContainerService) {
+ constructor(
+ private serviceLogsHistogramStorage: ServiceLogsHistogramDataService, private appState: AppStateService,
+ private tabsStorage: TabsService, private logsContainer: LogsContainerService
+ ) {
this.logsContainer.loadColumnsNames();
- this.logsTypeChange.first().subscribe(() => this.logsContainer.loadLogs());
appState.getParameter('activeLogsType').subscribe((value: string): void => {
this.logsType = value;
this.logsTypeChange.next();
@@ -75,11 +76,6 @@ export class LogsContainerComponent {
this.displayedColumns = columns.filter((column: LogField): boolean => column.isAvailable && column.isDisplayed);
});
});
- appState.getParameter('activeFiltersForm').subscribe((form: FormGroup): void => {
- this.filtersFormChange.next();
- form.valueChanges.takeUntil(this.filtersFormChange).subscribe(() => this.logsContainer.loadLogs());
- this.filtersForm = form;
- });
serviceLogsHistogramStorage.getAll().subscribe((data: BarGraph[]): void => {
this.histogramData = this.logsContainer.getHistogramData(data);
});
@@ -88,12 +84,12 @@ export class LogsContainerComponent {
tabs: Observable<Tab[]> = this.tabsStorage.getAll();
- filtersForm: FormGroup;
+ get filtersForm(): FormGroup {
+ return this.logsContainer.filtersForm;
+ };
private logsType: string;
- private filtersFormChange: Subject<any> = new Subject();
-
private logsTypeChange: Subject<any> = new Subject();
get logsTypeMapObject(): any {
@@ -117,10 +113,10 @@ export class LogsContainerComponent {
};
get autoRefreshRemainingSeconds(): number {
- return this.filtering.autoRefreshRemainingSeconds;
+ return this.logsContainer.autoRefreshRemainingSeconds;
}
- get autoRefreshMessageParams(): any {
+ get autoRefreshMessageParams(): object {
return {
remainingSeconds: this.autoRefreshRemainingSeconds
};
@@ -133,7 +129,7 @@ export class LogsContainerComponent {
get totalEventsFoundMessageParams(): object {
return {
totalCount: this.totalCount
- }
+ };
}
isServiceLogContextView: boolean = false;
@@ -147,7 +143,7 @@ export class LogsContainerComponent {
}
setCustomTimeRange(startTime: number, endTime: number): void {
- this.filtering.setCustomTimeRange(startTime, endTime);
+ this.logsContainer.setCustomTimeRange(startTime, endTime);
}
onSwitchTab(activeTab: Tab): void {
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.html b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.html
index 10f4af1..7de0b96 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.html
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.html
@@ -17,8 +17,7 @@
<form *ngIf="logs && logs.length" [formGroup]="filtersForm" class="row pull-right">
<filter-dropdown [label]="filters.sorting.label" formControlName="sorting" [options]="filters.sorting.options"
- [defaultLabel]="filters.sorting.defaultLabel" [isRightAlign]="true"
- class="col-md-12"></filter-dropdown>
+ [isRightAlign]="true" class="col-md-12"></filter-dropdown>
</form>
<div class="panel panel-default">
<div class="panel-body">
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.spec.ts
index 8ee4ca3..21c4f02 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.spec.ts
@@ -28,8 +28,13 @@ import {AppStateService, appState} from '@app/services/storage/app-state.service
import {ClustersService, clusters} from '@app/services/storage/clusters.service';
import {ComponentsService, components} from '@app/services/storage/components.service';
import {HostsService, hosts} from '@app/services/storage/hosts.service';
+import {AuditLogsFieldsService, auditLogsFields} from '@app/services/storage/audit-logs-fields.service';
+import {ServiceLogsFieldsService, serviceLogsFields} from '@app/services/storage/service-logs-fields.service';
+import {ServiceLogsHistogramDataService, serviceLogsHistogramData} from '@app/services/storage/service-logs-histogram-data.service';
+import {ServiceLogsTruncatedService, serviceLogsTruncated} from '@app/services/storage/service-logs-truncated.service';
+import {TabsService, tabs} from '@app/services/storage/tabs.service';
import {HttpClientService} from '@app/services/http-client.service';
-import {FilteringService} from '@app/services/filtering.service';
+import {LogsContainerService} from '@app/services/logs-container.service';
import {UtilsService} from '@app/services/utils.service';
import {LogsListComponent} from './logs-list.component';
@@ -57,7 +62,12 @@ describe('LogsListComponent', () => {
appState,
clusters,
components,
- hosts
+ hosts,
+ auditLogsFields,
+ serviceLogsFields,
+ serviceLogsHistogramData,
+ serviceLogsTruncated,
+ tabs
}),
MomentModule,
MomentTimezoneModule,
@@ -75,7 +85,12 @@ describe('LogsListComponent', () => {
ClustersService,
ComponentsService,
HostsService,
- FilteringService,
+ AuditLogsFieldsService,
+ ServiceLogsFieldsService,
+ ServiceLogsHistogramDataService,
+ ServiceLogsTruncatedService,
+ TabsService,
+ LogsContainerService,
UtilsService
],
schemas: [NO_ERRORS_SCHEMA]
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.ts
index 017bc82..3a56fca 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.ts
@@ -18,7 +18,7 @@
import {Component, AfterViewInit, Input, ViewChild, ElementRef} from '@angular/core';
import {FormGroup} from '@angular/forms';
import 'rxjs/add/operator/map';
-import {FilteringService} from '@app/services/filtering.service';
+import {LogsContainerService} from '@app/services/logs-container.service';
import {UtilsService} from '@app/services/utils.service';
import {AuditLog} from '@app/classes/models/audit-log';
import {ServiceLog} from '@app/classes/models/service-log';
@@ -31,7 +31,7 @@ import {LogField} from '@app/classes/models/log-field';
})
export class LogsListComponent implements AfterViewInit {
- constructor(private filtering: FilteringService, private utils: UtilsService) {
+ constructor(private logsContainer: LogsContainerService, private utils: UtilsService) {
}
ngAfterViewInit() {
@@ -104,11 +104,11 @@ export class LogsListComponent implements AfterViewInit {
readonly timeFormat: string = 'h:mm:ss A';
get timeZone(): string {
- return this.filtering.timeZone;
+ return this.logsContainer.timeZone;
}
get filters(): any {
- return this.filtering.filters;
+ return this.logsContainer.filters;
}
isDifferentDates(dateA, dateB): boolean {
@@ -135,7 +135,7 @@ export class LogsListComponent implements AfterViewInit {
}
updateQuery(event: any) {
- this.filtering.queryParameterAdd.next({
+ this.logsContainer.queryParameterAdd.next({
name: this.messageFilterParameterName,
value: this.selectedText,
isExclude: event.value
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.spec.ts
index 261e213..71bbf67 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.spec.ts
@@ -33,7 +33,6 @@ import {ServiceLogsHistogramDataService, serviceLogsHistogramData} from '@app/se
import {ServiceLogsTruncatedService, serviceLogsTruncated} from '@app/services/storage/service-logs-truncated.service';
import {TabsService, tabs} from '@app/services/storage/tabs.service';
import {ComponentActionsService} from '@app/services/component-actions.service';
-import {FilteringService} from '@app/services/filtering.service';
import {HttpClientService} from '@app/services/http-client.service';
import {LogsContainerService} from '@app/services/logs-container.service';
@@ -85,7 +84,6 @@ describe('MenuButtonComponent', () => {
ServiceLogsTruncatedService,
TabsService,
ComponentActionsService,
- FilteringService,
{
provide: HttpClientService,
useValue: httpClient
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.ts
index 5932e1b..ca89935 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.ts
@@ -202,11 +202,11 @@ export class MenuButtonComponent {
* @param {ListItem} options The selected item(s) from the dropdown list.
*/
onDropdownItemChange(options: ListItem) {
- this.updateValue(options);
+ this.updateSelection(options);
!this.isMultipleChoice && this.closeDropdown();
}
- updateValue(options: ListItem) {
+ updateSelection(options: ListItem) {
// TODO implement value change behaviour
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination-controls/pagination-controls.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination-controls/pagination-controls.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination-controls/pagination-controls.component.ts
index 81676a9..5f85da7 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination-controls/pagination-controls.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination-controls/pagination-controls.component.ts
@@ -54,7 +54,9 @@ export class PaginationControlsComponent implements ControlValueAccessor {
if (this.isValidValue(newValue)) { // this is the last validation check
this.currentPage = newValue;
this.currentPageChange.emit(newValue);
- this.onChange(newValue);
+ if (this.onChange) {
+ this.onChange(newValue);
+ }
} else {
throw new Error(`Invalid value ${newValue}. The currentPage should be between 0 and ${this.pagesCount}.`);
}
@@ -121,7 +123,8 @@ export class PaginationControlsComponent implements ControlValueAccessor {
return this.pagesCount > 0 && this.value > 0;
}
- writeValue() {
+ writeValue(value: number) {
+ this.value = value;
}
registerOnChange(callback: any): void {
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination/pagination.component.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination/pagination.component.html b/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination/pagination.component.html
index 679a7e5..4be0a47 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination/pagination.component.html
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination/pagination.component.html
@@ -17,7 +17,7 @@
<form class="pagination-form" [formGroup]="filtersForm">
<filter-dropdown [label]="filterInstance.label" formControlName="pageSize" [options]="filterInstance.options"
- [defaultLabel]="filterInstance.defaultLabel" [isRightAlign]="true" isDropup="true"></filter-dropdown>
+ [isRightAlign]="true" [isDropup]="true"></filter-dropdown>
<span>{{'pagination.numbers' | translate: numbersTranslateParams}}</span>
<pagination-controls formControlName="page" [totalCount]="totalCount" [pagesCount]="pagesCount"
(currentPageChange)="setCurrentPage($event)"></pagination-controls>
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination/pagination.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination/pagination.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination/pagination.component.spec.ts
index ff8675d..c820027 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination/pagination.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination/pagination.component.spec.ts
@@ -39,7 +39,14 @@ describe('PaginationComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(PaginationComponent);
component = fixture.componentInstance;
- component.filterInstance = {};
+ component.filterInstance = {
+ defaultSelection: [
+ {
+ label: '10',
+ value: '10'
+ }
+ ]
+ };
component.filtersForm = new FormGroup({
pageSize: new FormControl()
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination/pagination.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination/pagination.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination/pagination.component.ts
index cc5589f..890c2ee 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination/pagination.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination/pagination.component.ts
@@ -18,6 +18,8 @@
import {Component, OnInit, Input} from '@angular/core';
import {FormGroup} from '@angular/forms';
+import {ListItem} from '@app/classes/list-item';
+import {FilterCondition} from '@app/classes/filtering';
@Component({
selector: 'pagination',
@@ -27,9 +29,9 @@ import {FormGroup} from '@angular/forms';
export class PaginationComponent implements OnInit {
ngOnInit() {
- this.setPageSizeFromString(this.filterInstance.defaultValue);
- this.filtersForm.controls.pageSize.valueChanges.subscribe((value: string): void => {
- this.setPageSizeFromString(value);
+ this.setPageSizeFromString(this.filterInstance.defaultSelection[0].value);
+ this.filtersForm.controls.pageSize.valueChanges.subscribe((selection: ListItem): void => {
+ this.setPageSizeFromString(selection[0].value);
});
}
@@ -37,7 +39,7 @@ export class PaginationComponent implements OnInit {
filtersForm: FormGroup;
@Input()
- filterInstance: any;
+ filterInstance: FilterCondition;
@Input()
currentCount?: number;
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.ts
index 5520310..18ff715 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.ts
@@ -159,7 +159,7 @@ export class SearchBoxComponent implements OnInit, OnDestroy, ControlValueAccess
this.isValueInput = true;
this.currentValue = '';
setTimeout(() => this.valueInput.focus(), 0);
- }
+ };
onParameterValueChange(event: KeyboardEvent): void {
if (this.utils.isEnterPressed(event) && this.currentValue) {
@@ -187,7 +187,7 @@ export class SearchBoxComponent implements OnInit, OnDestroy, ControlValueAccess
isExclude: options.isExclude
});
this.updateValue();
- }
+ };
removeParameter(event: MouseEvent, id: number): void {
this.parameters = this.parameters.filter(parameter => parameter.id !== id);
@@ -196,10 +196,14 @@ export class SearchBoxComponent implements OnInit, OnDestroy, ControlValueAccess
}
updateValue() {
- this.onChange(this.parameters);
+ if (this.onChange) {
+ this.onChange(this.parameters);
+ }
}
- writeValue() {
+ writeValue(parameters: any [] = []) {
+ this.parameters = parameters;
+ this.updateValue();
}
registerOnChange(callback: any): void {
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/components/time-range-picker/time-range-picker.component.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/time-range-picker/time-range-picker.component.html b/ambari-logsearch/ambari-logsearch-web/src/app/components/time-range-picker/time-range-picker.component.html
index 973db61..621f995 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/time-range-picker/time-range-picker.component.html
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/time-range-picker/time-range-picker.component.html
@@ -16,7 +16,8 @@
-->
<button class="btn btn-link dropdown-toggle" data-toggle="dropdown">
- {{selectedLabel | translate}} <span class="caret"></span>
+ <span *ngIf="selection">{{selection.label | translate}}</span>
+ <span class="caret"></span>
</button>
<div class="dropdown-menu row col-md-12">
<div class="col-md-4" (click)="$event.stopPropagation()">
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/components/time-range-picker/time-range-picker.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/time-range-picker/time-range-picker.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/time-range-picker/time-range-picker.component.spec.ts
index 7612cc3..43e4bd5 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/time-range-picker/time-range-picker.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/time-range-picker/time-range-picker.component.spec.ts
@@ -25,8 +25,15 @@ import {AppStateService, appState} from '@app/services/storage/app-state.service
import {ClustersService, clusters} from '@app/services/storage/clusters.service';
import {ComponentsService, components} from '@app/services/storage/components.service';
import {HostsService, hosts} from '@app/services/storage/hosts.service';
+import {AuditLogsService, auditLogs} from '@app/services/storage/audit-logs.service';
+import {AuditLogsFieldsService, auditLogsFields} from '@app/services/storage/audit-logs-fields.service';
+import {ServiceLogsService, serviceLogs} from '@app/services/storage/service-logs.service';
+import {ServiceLogsFieldsService, serviceLogsFields} from '@app/services/storage/service-logs-fields.service';
+import {ServiceLogsHistogramDataService, serviceLogsHistogramData} from '@app/services/storage/service-logs-histogram-data.service';
+import {ServiceLogsTruncatedService, serviceLogsTruncated} from '@app/services/storage/service-logs-truncated.service';
+import {TabsService, tabs} from '@app/services/storage/tabs.service';
import {HttpClientService} from '@app/services/http-client.service';
-import {FilteringService} from '@app/services/filtering.service';
+import {LogsContainerService} from '@app/services/logs-container.service';
import {TimeRangePickerComponent} from './time-range-picker.component';
@@ -51,7 +58,14 @@ describe('TimeRangePickerComponent', () => {
appState,
clusters,
components,
- hosts
+ hosts,
+ auditLogs,
+ auditLogsFields,
+ serviceLogs,
+ serviceLogsFields,
+ serviceLogsHistogramData,
+ serviceLogsTruncated,
+ tabs
}),
...TranslationModules
],
@@ -60,12 +74,19 @@ describe('TimeRangePickerComponent', () => {
provide: HttpClientService,
useValue: httpClient
},
- FilteringService,
+ LogsContainerService,
AppSettingsService,
AppStateService,
ClustersService,
ComponentsService,
- HostsService
+ HostsService,
+ AuditLogsService,
+ AuditLogsFieldsService,
+ ServiceLogsService,
+ ServiceLogsFieldsService,
+ ServiceLogsHistogramDataService,
+ ServiceLogsTruncatedService,
+ TabsService
],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/components/time-range-picker/time-range-picker.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/time-range-picker/time-range-picker.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/time-range-picker/time-range-picker.component.ts
index af4933a..cacabc3 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/time-range-picker/time-range-picker.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/time-range-picker/time-range-picker.component.ts
@@ -16,10 +16,10 @@
* limitations under the License.
*/
-import {Component, OnInit, Input, forwardRef} from '@angular/core';
+import {Component, forwardRef} from '@angular/core';
import {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms';
import {Moment} from 'moment';
-import {FilteringService} from '@app/services/filtering.service';
+import {LogsContainerService} from '@app/services/logs-container.service';
import {ListItem} from '@app/classes/list-item';
import {TimeUnitListItem} from '@app/classes/filtering';
@@ -35,20 +35,11 @@ import {TimeUnitListItem} from '@app/classes/filtering';
}
]
})
-export class TimeRangePickerComponent implements OnInit, ControlValueAccessor {
+export class TimeRangePickerComponent implements ControlValueAccessor {
- constructor(private filtering: FilteringService) {
+ constructor(private logsContainer: LogsContainerService) {
}
- ngOnInit() {
- this.selectedLabel = this.defaultLabel;
- }
-
- @Input()
- defaultLabel?: string;
-
- selectedLabel: string;
-
startTime: Moment;
endTime: Moment;
@@ -56,18 +47,20 @@ export class TimeRangePickerComponent implements OnInit, ControlValueAccessor {
private onChange: (fn: any) => void;
get quickRanges(): (ListItem | TimeUnitListItem[])[] {
- return this.filtering.filters.timeRange.options;
+ return this.logsContainer.filters.timeRange.options;
}
- private timeRange?: any;
+ private timeRange?: TimeUnitListItem;
- get value(): any {
+ get selection(): TimeUnitListItem {
return this.timeRange;
}
- set value(newValue: any) {
+ set selection(newValue: TimeUnitListItem) {
this.timeRange = newValue;
- this.onChange(newValue);
+ if (this.onChange) {
+ this.onChange(newValue);
+ }
}
setStartTime(timeObject: Moment): void {
@@ -79,20 +72,22 @@ export class TimeRangePickerComponent implements OnInit, ControlValueAccessor {
}
setTimeRange(value: any, label: string) {
- this.value = value;
- this.selectedLabel = label;
+ this.selection = {label, value};
}
setCustomTimeRange() {
- this.value = {
- type: 'CUSTOM',
- start: this.startTime,
- end: this.endTime
+ this.selection = {
+ label: 'filter.timeRange.custom',
+ value: {
+ type: 'CUSTOM',
+ start: this.startTime,
+ end: this.endTime
+ }
};
- this.selectedLabel = 'filter.timeRange.custom';
}
- writeValue() {
+ writeValue(selection: TimeUnitListItem) {
+ this.selection = selection;
}
registerOnChange(callback: any): void {
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/components/timezone-picker/timezone-picker.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/timezone-picker/timezone-picker.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/timezone-picker/timezone-picker.component.spec.ts
index 53afc47..0e4c8a8 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/timezone-picker/timezone-picker.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/timezone-picker/timezone-picker.component.spec.ts
@@ -32,7 +32,6 @@ import {ServiceLogsHistogramDataService, serviceLogsHistogramData} from '@app/se
import {ServiceLogsTruncatedService, serviceLogsTruncated} from '@app/services/storage/service-logs-truncated.service';
import {TabsService, tabs} from '@app/services/storage/tabs.service';
import {ComponentActionsService} from '@app/services/component-actions.service';
-import {FilteringService} from '@app/services/filtering.service';
import {HttpClientService} from '@app/services/http-client.service';
import {LogsContainerService} from '@app/services/logs-container.service';
import {TimeZoneAbbrPipe} from '@app/pipes/timezone-abbr.pipe';
@@ -90,7 +89,6 @@ describe('TimeZonePickerComponent', () => {
ServiceLogsTruncatedService,
TabsService,
ComponentActionsService,
- FilteringService,
{
provide: HttpClientService,
useValue: httpClient
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/services/component-actions.service.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/services/component-actions.service.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/services/component-actions.service.spec.ts
index e6a02c0..6f54e65 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/services/component-actions.service.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/services/component-actions.service.spec.ts
@@ -30,7 +30,6 @@ import {ServiceLogsFieldsService, serviceLogsFields} from '@app/services/storage
import {ServiceLogsHistogramDataService, serviceLogsHistogramData} from '@app/services/storage/service-logs-histogram-data.service';
import {ServiceLogsTruncatedService, serviceLogsTruncated} from '@app/services/storage/service-logs-truncated.service';
import {TabsService, tabs} from '@app/services/storage/tabs.service';
-import {FilteringService} from '@app/services/filtering.service';
import {HttpClientService} from '@app/services/http-client.service';
import {LogsContainerService} from '@app/services/logs-container.service';
@@ -78,7 +77,6 @@ describe('ComponentActionsService', () => {
ServiceLogsHistogramDataService,
ServiceLogsTruncatedService,
TabsService,
- FilteringService,
{
provide: HttpClientService,
useValue: httpClient
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/services/component-actions.service.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/services/component-actions.service.ts b/ambari-logsearch/ambari-logsearch-web/src/app/services/component-actions.service.ts
index c483cd8..73fc94c 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/services/component-actions.service.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/services/component-actions.service.ts
@@ -20,15 +20,17 @@ import {Injectable} from '@angular/core';
import {AppSettingsService} from '@app/services/storage/app-settings.service';
import {TabsService} from '@app/services/storage/tabs.service';
import {CollectionModelService} from '@app/classes/models/store';
-import {FilteringService} from '@app/services/filtering.service';
import {LogsContainerService} from '@app/services/logs-container.service';
import {ServiceLog} from '@app/classes/models/service-log';
-import {getFiltersForm} from '@app/classes/filtering';
+import {ListItem} from '@app/classes/list-item';
@Injectable()
export class ComponentActionsService {
- constructor(private appSettings: AppSettingsService, private tabsStorage: TabsService, private filtering: FilteringService, private logsContainer: LogsContainerService) {
+ constructor(
+ private appSettings: AppSettingsService, private tabsStorage: TabsService,
+ private logsContainer: LogsContainerService
+ ) {
}
//TODO implement actions
@@ -81,7 +83,6 @@ export class ComponentActionsService {
const tab = {
id: log.id,
type: 'serviceLogs',
- isActive: true,
isCloseable: true,
label: `${log.host} >> ${log.type}`,
appState: {
@@ -92,7 +93,14 @@ export class ComponentActionsService {
host_name: log.host,
component_name: log.type
},
- activeFiltersForm: getFiltersForm('serviceLogs')
+ activeFilters: Object.assign(this.logsContainer.getFiltersData('serviceLogs'), {
+ components: this.logsContainer.filters.components.options.find((option: ListItem): boolean => {
+ return option.value === log.type;
+ }),
+ hosts: this.logsContainer.filters.hosts.options.find((option: ListItem): boolean => {
+ return option.value === log.host;
+ })
+ })
}
};
this.tabsStorage.addInstance(tab);
@@ -104,11 +112,11 @@ export class ComponentActionsService {
}
startCapture(): void {
- this.filtering.startCaptureTimer();
+ this.logsContainer.startCaptureTimer();
}
stopCapture(): void {
- this.filtering.stopCaptureTimer();
+ this.logsContainer.stopCaptureTimer();
}
setTimeZone(timeZone: string): void {
@@ -121,7 +129,7 @@ export class ComponentActionsService {
}));
}
- proceedWithExclude = (item: string): void => this.filtering.queryParameterNameChange.next({
+ proceedWithExclude = (item: string): void => this.logsContainer.queryParameterNameChange.next({
item: item,
isExclude: true
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/services/component-generator.service.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/services/component-generator.service.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/services/component-generator.service.spec.ts
index 5dc38b4..a161190 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/services/component-generator.service.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/services/component-generator.service.spec.ts
@@ -32,7 +32,6 @@ import {ServiceLogsTruncatedService, serviceLogsTruncated} from '@app/services/s
import {TabsService, tabs} from '@app/services/storage/tabs.service';
import {LogsContainerService} from '@app/services/logs-container.service';
import {HttpClientService} from '@app/services/http-client.service';
-import {FilteringService} from '@app/services/filtering.service';
import {ComponentGeneratorService} from './component-generator.service';
@@ -70,7 +69,6 @@ describe('ComponentGeneratorService', () => {
provide: HttpClientService,
useValue: httpClient
},
- FilteringService,
HostsService,
AuditLogsService,
ServiceLogsService,
[04/50] [abbrv] ambari git commit: AMBARI-22384. Disable HDP 2.3
stack. (swagle)
Posted by rl...@apache.org.
AMBARI-22384. Disable HDP 2.3 stack. (swagle)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7074e6e8
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7074e6e8
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7074e6e8
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 7074e6e8a736fbdc1bb3afb86480c6cd349611b0
Parents: 5adcea7
Author: Siddharth Wagle <sw...@hortonworks.com>
Authored: Wed Nov 8 13:07:11 2017 -0800
Committer: Siddharth Wagle <sw...@hortonworks.com>
Committed: Wed Nov 8 13:07:11 2017 -0800
----------------------------------------------------------------------
ambari-server/src/main/resources/stacks/HDP/2.3/metainfo.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/7074e6e8/ambari-server/src/main/resources/stacks/HDP/2.3/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/metainfo.xml
index f98b24b..9fa9b90 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/metainfo.xml
@@ -17,7 +17,7 @@
-->
<metainfo>
<versions>
- <active>true</active>
+ <active>false</active>
</versions>
<extends>2.2</extends>
<minJdk>1.7</minJdk>
[18/50] [abbrv] ambari git commit: AMBARI-22416 Log Search UI: fixes
for filtering form. (ababiichuk)
Posted by rl...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/services/filtering.service.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/services/filtering.service.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/services/filtering.service.spec.ts
deleted file mode 100644
index 2b3e326..0000000
--- a/ambari-logsearch/ambari-logsearch-web/src/app/services/filtering.service.spec.ts
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * 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.
- */
-
-import {TestBed, inject} from '@angular/core/testing';
-import {StoreModule} from '@ngrx/store';
-import {AppSettingsService, appSettings} from '@app/services/storage/app-settings.service';
-import {AppStateService, appState} from '@app/services/storage/app-state.service';
-import {ClustersService, clusters} from '@app/services/storage/clusters.service';
-import {ComponentsService, components} from '@app/services/storage/components.service';
-import {HostsService, hosts} from '@app/services/storage/hosts.service';
-import {UtilsService} from '@app/services/utils.service';
-import {HttpClientService} from '@app/services/http-client.service';
-import {ListItem} from '@app/classes/list-item';
-import {Node} from '@app/classes/models/node';
-
-import {FilteringService} from './filtering.service';
-
-describe('FilteringService', () => {
- beforeEach(() => {
- const httpClient = {
- get: () => {
- return {
- subscribe: () => {
- }
- }
- }
- };
- TestBed.configureTestingModule({
- imports: [
- StoreModule.provideStore({
- appSettings,
- appState,
- clusters,
- components,
- hosts
- })
- ],
- providers: [
- FilteringService,
- AppSettingsService,
- AppStateService,
- ClustersService,
- ComponentsService,
- HostsService,
- UtilsService,
- {
- provide: HttpClientService,
- useValue: httpClient
- }
- ]
- });
- });
-
- it('should create service', inject([FilteringService], (service: FilteringService) => {
- expect(service).toBeTruthy();
- }));
-
- describe('#getListItemFromString()', () => {
- it('should convert string to ListItem', inject([FilteringService], (service: FilteringService) => {
- const getListItemFromString: (name: string) => ListItem = service['getListItemFromString'];
- expect(getListItemFromString('customName')).toEqual({
- label: 'customName',
- value: 'customName'
- });
- }));
- });
-
- describe('#getListItemFromNode()', () => {
- it('should convert Node to ListItem', inject([FilteringService], (service: FilteringService) => {
- const getListItemFromNode: (node: Node) => ListItem = service['getListItemFromNode'];
- expect(getListItemFromNode({
- name: 'customName',
- value: '1',
- isParent: true,
- isRoot: true
- })).toEqual({
- label: 'customName (1)',
- value: 'customName'
- });
- }));
- });
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/services/filtering.service.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/services/filtering.service.ts b/ambari-logsearch/ambari-logsearch-web/src/app/services/filtering.service.ts
deleted file mode 100644
index 85dc408..0000000
--- a/ambari-logsearch/ambari-logsearch-web/src/app/services/filtering.service.ts
+++ /dev/null
@@ -1,253 +0,0 @@
-/**
- * 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.
- */
-
-import {Injectable, Input} from '@angular/core';
-import {FormGroup} from '@angular/forms';
-import {Response} from '@angular/http';
-import {Subject} from 'rxjs/Subject';
-import {Observable} from 'rxjs/Observable';
-import 'rxjs/add/observable/timer';
-import 'rxjs/add/operator/takeUntil';
-import * as moment from 'moment-timezone';
-import {ListItem} from '@app/classes/list-item';
-import {FilterCondition, filters} from '@app/classes/filtering';
-import {Node} from '@app/classes/models/node';
-import {AppSettingsService} from '@app/services/storage/app-settings.service';
-import {ClustersService} from '@app/services/storage/clusters.service';
-import {ComponentsService} from '@app/services/storage/components.service';
-import {HostsService} from '@app/services/storage/hosts.service';
-import {AppStateService} from '@app/services/storage/app-state.service';
-import {HttpClientService} from '@app/services/http-client.service';
-
-@Injectable()
-export class FilteringService {
-
- constructor(private httpClient: HttpClientService, private appSettings: AppSettingsService, private clustersStorage: ClustersService, private componentsStorage: ComponentsService, private hostsStorage: HostsService, private appState: AppStateService) {
- this.loadClusters();
- this.loadComponents();
- this.loadHosts();
- appSettings.getParameter('timeZone').subscribe(value => this.timeZone = value || this.defaultTimeZone);
- clustersStorage.getAll().subscribe((clusters: string[]): void => {
- this.filters.clusters.options = [...this.filters.clusters.options, ...clusters.map(this.getListItemFromString)];
- });
- componentsStorage.getAll().subscribe((components: Node[]): void => {
- this.filters.components.options = [...this.filters.components.options, ...components.map(this.getListItemFromNode)];
- });
- hostsStorage.getAll().subscribe((hosts: Node[]): void => {
- this.filters.hosts.options = [...this.filters.hosts.options, ...hosts.map(this.getListItemFromNode)];
- });
- appState.getParameter('activeFiltersForm').subscribe((form: FormGroup) => this.activeFiltersForm = form);
- }
-
- /**
- * Get instance for dropdown list from string
- * @param name {string}
- * @returns {ListItem}
- */
- private getListItemFromString(name: string): ListItem {
- return {
- label: name,
- value: name
- };
- }
-
- /**
- * Get instance for dropdown list from Node object
- * @param node {Node}
- * @returns {ListItem}
- */
- private getListItemFromNode(node: Node): ListItem {
- return {
- label: `${node.name} (${node.value})`,
- value: node.name
- };
- }
-
- private readonly defaultTimeZone = moment.tz.guess();
-
- timeZone: string = this.defaultTimeZone;
-
- /**
- * A configurable property to indicate the maximum capture time in milliseconds.
- * @type {number}
- * @default 600000 (10 minutes)
- */
- @Input()
- maximumCaptureTimeLimit: number = 600000;
-
- filters: {[key: string]: FilterCondition} = Object.assign({}, filters);
-
- activeFiltersForm: FormGroup;
-
- queryParameterNameChange: Subject<any> = new Subject();
-
- queryParameterAdd: Subject<any> = new Subject();
-
- private stopTimer: Subject<any> = new Subject();
-
- private stopAutoRefreshCountdown: Subject<any> = new Subject();
-
- captureSeconds: number = 0;
-
- private readonly autoRefreshInterval: number = 30000;
-
- autoRefreshRemainingSeconds: number = 0;
-
- private startCaptureTime: number;
-
- private stopCaptureTime: number;
-
- startCaptureTimer(): void {
- this.startCaptureTime = new Date().valueOf();
- const maxCaptureTimeInSeconds = this.maximumCaptureTimeLimit / 1000;
- Observable.timer(0, 1000).takeUntil(this.stopTimer).subscribe((seconds: number): void => {
- this.captureSeconds = seconds;
- if (this.captureSeconds >= maxCaptureTimeInSeconds) {
- this.stopCaptureTimer();
- }
- });
- }
-
- stopCaptureTimer(): void {
- const autoRefreshIntervalSeconds = this.autoRefreshInterval / 1000;
- this.stopCaptureTime = new Date().valueOf();
- this.captureSeconds = 0;
- this.stopTimer.next();
- this.setCustomTimeRange(this.startCaptureTime, this.stopCaptureTime);
- Observable.timer(0, 1000).takeUntil(this.stopAutoRefreshCountdown).subscribe((seconds: number): void => {
- this.autoRefreshRemainingSeconds = autoRefreshIntervalSeconds - seconds;
- if (!this.autoRefreshRemainingSeconds) {
- this.stopAutoRefreshCountdown.next();
- this.setCustomTimeRange(this.startCaptureTime, this.stopCaptureTime);
- }
- });
- }
-
- loadClusters(): void {
- this.httpClient.get('clusters').subscribe((response: Response): void => {
- const clusterNames = response.json();
- if (clusterNames) {
- this.clustersStorage.addInstances(clusterNames);
- }
- });
- }
-
- loadComponents(): void {
- this.httpClient.get('components').subscribe((response: Response): void => {
- const jsonResponse = response.json(),
- components = jsonResponse && jsonResponse.vNodeList.map((item): Node => Object.assign(item, {
- value: item.logLevelCount.reduce((currentValue: number, currentItem): number => {
- return currentValue + Number(currentItem.value);
- }, 0)
- }));
- if (components) {
- this.componentsStorage.addInstances(components);
- }
- });
- }
-
- loadHosts(): void {
- this.httpClient.get('hosts').subscribe((response: Response): void => {
- const jsonResponse = response.json(),
- hosts = jsonResponse && jsonResponse.vNodeList;
- if (hosts) {
- this.hostsStorage.addInstances(hosts);
- }
- });
- }
-
- setCustomTimeRange(startTime: number, endTime: number): void {
- this.activeFiltersForm.controls.timeRange.setValue({
- type: 'CUSTOM',
- start: moment(startTime),
- end: moment(endTime)
- });
- }
-
- private getStartTime = (value: any, current: string): string => {
- let time;
- if (value) {
- const endTime = moment(moment(current).valueOf());
- switch (value.type) {
- case 'LAST':
- time = endTime.subtract(value.interval, value.unit);
- break;
- case 'CURRENT':
- time = moment().tz(this.timeZone).startOf(value.unit);
- break;
- case 'PAST':
- time = endTime.startOf(value.unit);
- break;
- case 'CUSTOM':
- time = value.start;
- break;
- default:
- break;
- }
- }
- return time ? time.toISOString() : '';
- };
-
- private getEndTime = (value: any): string => {
- let time;
- if (value) {
- switch (value.type) {
- case 'LAST':
- time = moment();
- break;
- case 'CURRENT':
- time = moment().tz(this.timeZone).endOf(value.unit);
- break;
- case 'PAST':
- time = moment().tz(this.timeZone).startOf(value.unit).millisecond(-1);
- break;
- case 'CUSTOM':
- time = value.end;
- break;
- default:
- break;
- }
- }
- return time ? time.toISOString() : '';
- };
-
- private getQuery(isExclude: boolean): (value: any[]) => string {
- return (value: any[]): string => {
- let parameters;
- if (value && value.length) {
- parameters = value.filter(item => item.isExclude === isExclude).map(parameter => {
- return {
- [parameter.name]: parameter.value.replace(/\s/g, '+')
- };
- });
- }
- return parameters && parameters.length ? JSON.stringify(parameters) : '';
- }
- }
-
- readonly valueGetters = {
- to: this.getEndTime,
- from: this.getStartTime,
- sortType: value => value && value.type,
- sortBy: value => value && value.key,
- page: value => value == null ? value : value.toString(),
- includeQuery: this.getQuery(false),
- excludeQuery: this.getQuery(true)
- };
-
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/services/logs-container.service.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/services/logs-container.service.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/services/logs-container.service.spec.ts
index ee0e1e7..47cb25d 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/services/logs-container.service.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/services/logs-container.service.spec.ts
@@ -31,7 +31,8 @@ import {HostsService, hosts} from '@app/services/storage/hosts.service';
import {ServiceLogsTruncatedService, serviceLogsTruncated} from '@app/services/storage/service-logs-truncated.service';
import {TabsService, tabs} from '@app/services/storage/tabs.service';
import {HttpClientService} from '@app/services/http-client.service';
-import {FilteringService} from '@app/services/filtering.service';
+import {ListItem} from '@app/classes/list-item';
+import {NodeItem} from '@app/classes/models/node-item';
import {LogsContainerService} from './logs-container.service';
@@ -79,8 +80,7 @@ describe('LogsContainerService', () => {
{
provide: HttpClientService,
useValue: httpClient
- },
- FilteringService
+ }
]
});
});
@@ -88,4 +88,29 @@ describe('LogsContainerService', () => {
it('should create service', inject([LogsContainerService], (service: LogsContainerService) => {
expect(service).toBeTruthy();
}));
+
+ describe('#getListItemFromString()', () => {
+ it('should convert string to ListItem', inject([LogsContainerService], (service: LogsContainerService) => {
+ const getListItemFromString: (name: string) => ListItem = service['getListItemFromString'];
+ expect(getListItemFromString('customName')).toEqual({
+ label: 'customName',
+ value: 'customName'
+ });
+ }));
+ });
+
+ describe('#getListItemFromNode()', () => {
+ it('should convert NodeItem to ListItem', inject([LogsContainerService], (service: LogsContainerService) => {
+ const getListItemFromNode: (node: NodeItem) => ListItem = service['getListItemFromNode'];
+ expect(getListItemFromNode({
+ name: 'customName',
+ value: '1',
+ isParent: true,
+ isRoot: true
+ })).toEqual({
+ label: 'customName (1)',
+ value: 'customName'
+ });
+ }));
+ });
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/services/logs-container.service.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/services/logs-container.service.ts b/ambari-logsearch/ambari-logsearch-web/src/app/services/logs-container.service.ts
index e187b00..f45887b 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/services/logs-container.service.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/services/logs-container.service.ts
@@ -17,9 +17,14 @@
*/
import {Injectable} from '@angular/core';
+import {FormGroup, FormControl} from '@angular/forms';
import {Response} from '@angular/http';
+import {Subject} from 'rxjs/Subject';
+import {Observable} from 'rxjs/Observable';
+import 'rxjs/add/observable/timer';
+import 'rxjs/add/operator/takeUntil';
+import * as moment from 'moment-timezone';
import {HttpClientService} from '@app/services/http-client.service';
-import {FilteringService} from '@app/services/filtering.service';
import {AuditLogsService} from '@app/services/storage/audit-logs.service';
import {AuditLogsFieldsService} from '@app/services/storage/audit-logs-fields.service';
import {ServiceLogsService} from '@app/services/storage/service-logs.service';
@@ -27,30 +32,411 @@ import {ServiceLogsFieldsService} from '@app/services/storage/service-logs-field
import {ServiceLogsHistogramDataService} from '@app/services/storage/service-logs-histogram-data.service';
import {ServiceLogsTruncatedService} from '@app/services/storage/service-logs-truncated.service';
import {AppStateService} from '@app/services/storage/app-state.service';
+import {AppSettingsService} from '@app/services/storage/app-settings.service';
import {TabsService} from '@app/services/storage/tabs.service';
+import {ClustersService} from '@app/services/storage/clusters.service';
+import {ComponentsService} from '@app/services/storage/components.service';
+import {HostsService} from '@app/services/storage/hosts.service';
import {ActiveServiceLogEntry} from '@app/classes/active-service-log-entry';
+import {FilterCondition, TimeUnitListItem, SortingListItem} from '@app/classes/filtering';
+import {ListItem} from '@app/classes/list-item';
import {Tab} from '@app/classes/models/tab';
import {AuditLogField} from '@app/classes/models/audit-log-field';
import {ServiceLogField} from '@app/classes/models/service-log-field';
import {BarGraph} from '@app/classes/models/bar-graph';
+import {NodeItem} from '@app/classes/models/node-item';
@Injectable()
export class LogsContainerService {
- constructor(private httpClient: HttpClientService, private auditLogsStorage: AuditLogsService, private auditLogsFieldsStorage: AuditLogsFieldsService, private serviceLogsStorage: ServiceLogsService, private serviceLogsFieldsStorage: ServiceLogsFieldsService, private serviceLogsHistogramStorage: ServiceLogsHistogramDataService, private serviceLogsTruncatedStorage: ServiceLogsTruncatedService, private appState: AppStateService, private tabsStorage: TabsService, private filtering: FilteringService) {
+ constructor(
+ private httpClient: HttpClientService, private auditLogsStorage: AuditLogsService,
+ private auditLogsFieldsStorage: AuditLogsFieldsService, private serviceLogsStorage: ServiceLogsService,
+ private serviceLogsFieldsStorage: ServiceLogsFieldsService,
+ private serviceLogsHistogramStorage: ServiceLogsHistogramDataService,
+ private serviceLogsTruncatedStorage: ServiceLogsTruncatedService, private appState: AppStateService,
+ private appSettings: AppSettingsService, private tabsStorage: TabsService, private clustersStorage: ClustersService,
+ private componentsStorage: ComponentsService, private hostsStorage: HostsService
+ ) {
+ const formItems = Object.keys(this.filters).reduce((currentObject: any, key: string): {[key: string]: FormControl} => {
+ let formControl = new FormControl(),
+ item = {
+ [key]: formControl
+ };
+ formControl.setValue(this.filters[key].defaultSelection);
+ return Object.assign(currentObject, item);
+ }, {});
+ this.filtersForm = new FormGroup(formItems);
+ this.loadClusters();
+ this.loadComponents();
+ this.loadHosts();
appState.getParameter('activeLog').subscribe((value: ActiveServiceLogEntry | null) => this.activeLog = value);
- appState.getParameter('isServiceLogsFileView').subscribe((value: boolean): void => {
- const activeLog = this.activeLog,
- filtersForm = this.filtering.activeFiltersForm;
- if (value && activeLog) {
- filtersForm.controls.hosts.setValue(activeLog.host_name);
- filtersForm.controls.components.setValue(activeLog.component_name);
- }
- this.isServiceLogsFileView = value;
- });
+ appState.getParameter('isServiceLogsFileView').subscribe((value: boolean) => this.isServiceLogsFileView = value);
appState.getParameter('activeLogsType').subscribe((value: string) => this.activeLogsType = value);
+ appSettings.getParameter('timeZone').subscribe((value: string) => this.timeZone = value || this.defaultTimeZone);
+ tabsStorage.mapCollection((tab: Tab): Tab => {
+ let currentAppState = tab.appState || {};
+ const appState = Object.assign({}, currentAppState, {
+ activeFilters: this.getFiltersData(tab.type)
+ });
+ return Object.assign({}, tab, {
+ appState
+ });
+ });
+ appState.getParameter('activeFilters').subscribe((filters: object): void => {
+ this.filtersFormChange.next();
+ if (filters) {
+ const controls = this.filtersForm.controls;
+ Object.keys(controls).forEach((key: string): void => {
+ controls[key].setValue(filters.hasOwnProperty(key) ? filters[key] : null);
+ });
+ }
+ this.loadLogs();
+ this.filtersForm.valueChanges.takeUntil(this.filtersFormChange).subscribe((value: object): void => {
+ this.tabsStorage.mapCollection((tab: Tab): Tab => {
+ const currentAppState = tab.appState || {},
+ appState = Object.assign({}, currentAppState, tab.isActive ? {
+ activeFilters: value
+ } : null);
+ return Object.assign({}, tab, {
+ appState
+ });
+ });
+ this.loadLogs();
+ });
+ });
}
+ private readonly paginationOptions: string[] = ['10', '25', '50', '100'];
+
+ filters: {[key: string]: FilterCondition} = {
+ clusters: {
+ label: 'filter.clusters',
+ options: [],
+ defaultSelection: []
+ },
+ timeRange: {
+ options: [
+ [
+ {
+ label: 'filter.timeRange.7d',
+ value: {
+ type: 'LAST',
+ unit: 'd',
+ interval: 7
+ }
+ },
+ {
+ label: 'filter.timeRange.30d',
+ value: {
+ type: 'LAST',
+ unit: 'd',
+ interval: 30
+ }
+ },
+ {
+ label: 'filter.timeRange.60d',
+ value: {
+ type: 'LAST',
+ unit: 'd',
+ interval: 60
+ }
+ },
+ {
+ label: 'filter.timeRange.90d',
+ value: {
+ type: 'LAST',
+ unit: 'd',
+ interval: 90
+ }
+ },
+ {
+ label: 'filter.timeRange.6m',
+ value: {
+ type: 'LAST',
+ unit: 'M',
+ interval: 6
+ }
+ },
+ {
+ label: 'filter.timeRange.1y',
+ value: {
+ type: 'LAST',
+ unit: 'y',
+ interval: 1
+ }
+ },
+ {
+ label: 'filter.timeRange.2y',
+ value: {
+ type: 'LAST',
+ unit: 'y',
+ interval: 2
+ }
+ },
+ {
+ label: 'filter.timeRange.5y',
+ value: {
+ type: 'LAST',
+ unit: 'y',
+ interval: 5
+ }
+ }
+ ],
+ [
+ {
+ label: 'filter.timeRange.yesterday',
+ value: {
+ type: 'PAST',
+ unit: 'd'
+ }
+ },
+ // TODO implement time range calculation
+ /*
+ {
+ label: 'filter.timeRange.beforeYesterday',
+ value: {
+ type: 'PAST',
+ unit: 'd'
+ }
+ },
+ {
+ label: 'filter.timeRange.thisDayLastWeek',
+ value: {
+ type: 'PAST',
+ unit: 'd'
+ }
+ },
+ */
+ {
+ label: 'filter.timeRange.previousWeek',
+ value: {
+ type: 'PAST',
+ unit: 'w'
+ }
+ },
+ {
+ label: 'filter.timeRange.previousMonth',
+ value: {
+ type: 'PAST',
+ unit: 'M'
+ }
+ },
+ {
+ label: 'filter.timeRange.previousYear',
+ value: {
+ type: 'PAST',
+ unit: 'y'
+ }
+ }
+ ],
+ [
+ {
+ label: 'filter.timeRange.today',
+ value: {
+ type: 'CURRENT',
+ unit: 'd'
+ }
+ },
+ {
+ label: 'filter.timeRange.thisWeek',
+ value: {
+ type: 'CURRENT',
+ unit: 'w'
+ }
+ },
+ {
+ label: 'filter.timeRange.thisMonth',
+ value: {
+ type: 'CURRENT',
+ unit: 'M'
+ }
+ },
+ {
+ label: 'filter.timeRange.thisYear',
+ value: {
+ type: 'CURRENT',
+ unit: 'y'
+ }
+ }
+ ],
+ [
+ {
+ label: 'filter.timeRange.5min',
+ value: {
+ type: 'LAST',
+ unit: 'm',
+ interval: 5
+ }
+ },
+ {
+ label: 'filter.timeRange.15min',
+ value: {
+ type: 'LAST',
+ unit: 'm',
+ interval: 15
+ }
+ },
+ {
+ label: 'filter.timeRange.30min',
+ value: {
+ type: 'LAST',
+ unit: 'm',
+ interval: 30
+ }
+ },
+ {
+ label: 'filter.timeRange.1hr',
+ value: {
+ type: 'LAST',
+ unit: 'h',
+ interval: 1
+ }
+ },
+ {
+ label: 'filter.timeRange.3hr',
+ value: {
+ type: 'LAST',
+ unit: 'h',
+ interval: 3
+ }
+ },
+ {
+ label: 'filter.timeRange.6hr',
+ value: {
+ type: 'LAST',
+ unit: 'h',
+ interval: 6
+ }
+ },
+ {
+ label: 'filter.timeRange.12hr',
+ value: {
+ type: 'LAST',
+ unit: 'h',
+ interval: 12
+ }
+ },
+ {
+ label: 'filter.timeRange.24hr',
+ value: {
+ type: 'LAST',
+ unit: 'h',
+ interval: 24
+ }
+ },
+ ]
+ ],
+ defaultSelection: {
+ value: {
+ type: 'LAST',
+ unit: 'h',
+ interval: 1
+ },
+ label: 'filter.timeRange.1hr'
+ }
+ },
+ components: {
+ label: 'filter.components',
+ iconClass: 'fa fa-cubes',
+ options: [],
+ defaultSelection: []
+ },
+ levels: {
+ label: 'filter.levels',
+ iconClass: 'fa fa-sort-amount-asc',
+ options: [
+ {
+ label: 'levels.fatal',
+ value: 'FATAL'
+ },
+ {
+ label: 'levels.error',
+ value: 'ERROR'
+ },
+ {
+ label: 'levels.warn',
+ value: 'WARN'
+ },
+ {
+ label: 'levels.info',
+ value: 'INFO'
+ },
+ {
+ label: 'levels.debug',
+ value: 'DEBUG'
+ },
+ {
+ label: 'levels.trace',
+ value: 'TRACE'
+ },
+ {
+ label: 'levels.unknown',
+ value: 'UNKNOWN'
+ }
+ ],
+ defaultSelection: []
+ },
+ hosts: {
+ label: 'filter.hosts',
+ iconClass: 'fa fa-server',
+ options: [],
+ defaultSelection: []
+ },
+ sorting: {
+ label: 'sorting.title',
+ options: [
+ {
+ label: 'sorting.time.asc',
+ value: {
+ key: 'logtime',
+ type: 'asc'
+ }
+ },
+ {
+ label: 'sorting.time.desc',
+ value: {
+ key: 'logtime',
+ type: 'desc'
+ }
+ }
+ ],
+ defaultSelection: [
+ {
+ label: 'sorting.time.desc',
+ value: {
+ key: 'logtime',
+ type: 'desc'
+ }
+ }
+ ]
+ },
+ pageSize: {
+ label: 'pagination.title',
+ options: this.paginationOptions.map((option: string): ListItem => {
+ return {
+ label: option,
+ value: option
+ }
+ }),
+ defaultSelection: [
+ {
+ label: '10',
+ value: '10'
+ }
+ ]
+ },
+ page: {
+ defaultSelection: 0
+ },
+ query: {}
+ };
+
+ readonly filtersFormItemsMap: {[key: string]: string[]} = {
+ serviceLogs: ['clusters', 'timeRange', 'components', 'levels', 'hosts', 'sorting', 'pageSize', 'page', 'query'],
+ auditLogs: ['clusters', 'timeRange', 'sorting', 'pageSize', 'page', 'query'] // TODO add all the required fields
+ };
+
readonly colors = {
WARN: '#FF8916',
ERROR: '#E81D1D',
@@ -93,14 +479,71 @@ export class LogsContainerService {
}
};
+ private readonly defaultTimeZone = moment.tz.guess();
+
+ timeZone: string = this.defaultTimeZone;
+
totalCount: number = 0;
+ /**
+ * A configurable property to indicate the maximum capture time in milliseconds.
+ * @type {number}
+ * @default 600000 (10 minutes)
+ */
+ private readonly maximumCaptureTimeLimit: number = 600000;
+
isServiceLogsFileView: boolean = false;
+ filtersForm: FormGroup;
+
activeLog: ActiveServiceLogEntry | null = null;
activeLogsType: string;
+ private filtersFormChange: Subject<any> = new Subject();
+
+ /**
+ * Get instance for dropdown list from string
+ * @param name {string}
+ * @returns {ListItem}
+ */
+ private getListItemFromString(name: string): ListItem {
+ return {
+ label: name,
+ value: name
+ };
+ }
+
+ /**
+ * Get instance for dropdown list from NodeItem object
+ * @param node {NodeItem}
+ * @returns {ListItem}
+ */
+ private getListItemFromNode(node: NodeItem): ListItem {
+ return {
+ label: `${node.name} (${node.value})`,
+ value: node.name
+ };
+ }
+
+ queryParameterNameChange: Subject<any> = new Subject();
+
+ queryParameterAdd: Subject<any> = new Subject();
+
+ private stopTimer: Subject<any> = new Subject();
+
+ private stopAutoRefreshCountdown: Subject<any> = new Subject();
+
+ captureSeconds: number = 0;
+
+ private readonly autoRefreshInterval: number = 30000;
+
+ autoRefreshRemainingSeconds: number = 0;
+
+ private startCaptureTime: number;
+
+ private stopCaptureTime: number;
+
loadLogs = (logsType: string = this.activeLogsType): void => {
this.httpClient.get(logsType, this.getParams('listFilters')).subscribe((response: Response): void => {
const jsonResponse = response.json(),
@@ -128,7 +571,7 @@ export class LogsContainerService {
}
});
}
- }
+ };
loadLogContext(id: string, hostName: string, componentName: string, scrollType: 'before' | 'after' | '' = ''): void {
const params = {
@@ -161,22 +604,18 @@ export class LogsContainerService {
});
}
- private getParams(filtersMapName: string): any {
+ private getParams(filtersMapName: string): {[key: string]: string} {
let params = {};
Object.keys(this[filtersMapName]).forEach((key: string): void => {
- const inputValue = this.filtering.activeFiltersForm.getRawValue()[key],
+ const inputValue = this.filtersForm.getRawValue()[key],
paramNames = this[filtersMapName][key];
- paramNames.forEach(paramName => {
+ paramNames.forEach((paramName: string): void => {
let value;
- const valueGetter = this.filtering.valueGetters[paramName];
- if (valueGetter) {
- if (paramName === 'from') {
- value = valueGetter(inputValue, params['to']);
- } else {
- value = valueGetter(inputValue);
- }
+ const valueGetter = this.valueGetters[paramName] || this.defaultValueGetter;
+ if (paramName === 'from') {
+ value = valueGetter(inputValue, params['to']);
} else {
- value = inputValue;
+ value = valueGetter(inputValue);
}
if (value != null && value !== '') {
params[paramName] = value;
@@ -222,12 +661,197 @@ export class LogsContainerService {
return Object.keys(keysObject).map((key: string): {fieldClass} => new fieldClass(key));
}
+ private getStartTime = (selection: TimeUnitListItem, current: string): string => {
+ let time;
+ const value = selection && selection.value;
+ if (value) {
+ const endTime = moment(moment(current).valueOf());
+ switch (value.type) {
+ case 'LAST':
+ time = endTime.subtract(value.interval, value.unit);
+ break;
+ case 'CURRENT':
+ time = moment().tz(this.timeZone).startOf(value.unit);
+ break;
+ case 'PAST':
+ time = endTime.startOf(value.unit);
+ break;
+ case 'CUSTOM':
+ time = value.start;
+ break;
+ default:
+ break;
+ }
+ }
+ return time ? time.toISOString() : '';
+ };
+
+ private getEndTime = (selection: TimeUnitListItem): string => {
+ let time;
+ const value = selection && selection.value;
+ if (value) {
+ switch (value.type) {
+ case 'LAST':
+ time = moment();
+ break;
+ case 'CURRENT':
+ time = moment().tz(this.timeZone).endOf(value.unit);
+ break;
+ case 'PAST':
+ time = moment().tz(this.timeZone).startOf(value.unit).millisecond(-1);
+ break;
+ case 'CUSTOM':
+ time = value.end;
+ break;
+ default:
+ break;
+ }
+ }
+ return time ? time.toISOString() : '';
+ };
+
+ private getQuery(isExclude: boolean): (value: any[]) => string {
+ return (value: any[]): string => {
+ let parameters;
+ if (value && value.length) {
+ parameters = value.filter(item => item.isExclude === isExclude).map(parameter => {
+ return {
+ [parameter.name]: parameter.value.replace(/\s/g, '+')
+ };
+ });
+ }
+ return parameters && parameters.length ? JSON.stringify(parameters) : '';
+ }
+ }
+
+ private getSortType(selection: SortingListItem[] = []): 'asc' | 'desc' {
+ return selection[0] && selection[0].value ? selection[0].value.type : 'desc';
+ }
+
+ private getSortKey(selection: SortingListItem[] = []): string {
+ return selection[0] && selection[0].value ? selection[0].value.key : '';
+ }
+
+ private getPage(value: number | undefined): string | undefined {
+ return typeof value === 'undefined' ? value : value.toString();
+ }
+
+ private defaultValueGetter(selection: ListItem | ListItem[] | null): string {
+ if (Array.isArray(selection)) {
+ return selection.map((item: ListItem): any => item.value).join(',');
+ } else if (selection) {
+ return selection.value;
+ } else {
+ return '';
+ }
+ }
+
+ private readonly valueGetters = {
+ to: this.getEndTime,
+ from: this.getStartTime,
+ sortType: this.getSortType,
+ sortBy: this.getSortKey,
+ page: this.getPage,
+ includeQuery: this.getQuery(false),
+ excludeQuery: this.getQuery(true)
+ };
+
switchTab(activeTab: Tab): void {
+ this.tabsStorage.mapCollection((tab: Tab): Tab => {
+ return Object.assign({}, tab, {
+ isActive: tab.id === activeTab.id
+ });
+ });
this.appState.setParameters(activeTab.appState);
- this.tabsStorage.mapCollection((tab: Tab): Tab => Object.assign({}, tab, {
- isActive: tab.id === activeTab.id
- }));
- this.loadLogs();
+ }
+
+ startCaptureTimer(): void {
+ this.startCaptureTime = new Date().valueOf();
+ const maxCaptureTimeInSeconds = this.maximumCaptureTimeLimit / 1000;
+ Observable.timer(0, 1000).takeUntil(this.stopTimer).subscribe((seconds: number): void => {
+ this.captureSeconds = seconds;
+ if (this.captureSeconds >= maxCaptureTimeInSeconds) {
+ this.stopCaptureTimer();
+ }
+ });
+ }
+
+ stopCaptureTimer(): void {
+ const autoRefreshIntervalSeconds = this.autoRefreshInterval / 1000;
+ this.stopCaptureTime = new Date().valueOf();
+ this.captureSeconds = 0;
+ this.stopTimer.next();
+ this.setCustomTimeRange(this.startCaptureTime, this.stopCaptureTime);
+ Observable.timer(0, 1000).takeUntil(this.stopAutoRefreshCountdown).subscribe((seconds: number): void => {
+ this.autoRefreshRemainingSeconds = autoRefreshIntervalSeconds - seconds;
+ if (!this.autoRefreshRemainingSeconds) {
+ this.stopAutoRefreshCountdown.next();
+ this.setCustomTimeRange(this.startCaptureTime, this.stopCaptureTime);
+ }
+ });
+ }
+
+ loadClusters(): Observable<Response> {
+ const request = this.httpClient.get('clusters');
+ request.subscribe((response: Response): void => {
+ const clusterNames = response.json();
+ if (clusterNames) {
+ this.filters.clusters.options.push(...clusterNames.map(this.getListItemFromString));
+ this.clustersStorage.addInstances(clusterNames);
+ }
+ });
+ return request;
+ }
+
+ loadComponents(): Observable<Response> {
+ const request = this.httpClient.get('components');
+ request.subscribe((response: Response): void => {
+ const jsonResponse = response.json(),
+ components = jsonResponse && jsonResponse.vNodeList.map((item): NodeItem => Object.assign(item, {
+ value: item.logLevelCount.reduce((currentValue: number, currentItem): number => {
+ return currentValue + Number(currentItem.value);
+ }, 0)
+ }));
+ if (components) {
+ this.filters.components.options.push(...components.map(this.getListItemFromNode));
+ this.componentsStorage.addInstances(components);
+ }
+ });
+ return request;
+ }
+
+ loadHosts(): Observable<Response> {
+ const request = this.httpClient.get('hosts');
+ request.subscribe((response: Response): void => {
+ const jsonResponse = response.json(),
+ hosts = jsonResponse && jsonResponse.vNodeList;
+ if (hosts) {
+ this.filters.hosts.options.push(...hosts.map(this.getListItemFromNode));
+ this.hostsStorage.addInstances(hosts);
+ }
+ });
+ return request;
+ }
+
+ setCustomTimeRange(startTime: number, endTime: number): void {
+ this.filtersForm.controls.timeRange.setValue({
+ label: 'filter.timeRange.custom',
+ value: {
+ type: 'CUSTOM',
+ start: moment(startTime),
+ end: moment(endTime)
+ }
+ });
+ }
+
+ getFiltersData(listType: string): object {
+ const itemsList = this.filtersFormItemsMap[listType],
+ keys = Object.keys(this.filters).filter((key: string): boolean => itemsList.indexOf(key) > -1);
+ return keys.reduce((currentObject: object, key: string): object => {
+ return Object.assign(currentObject, {
+ [key]: this.filters[key].defaultSelection
+ });
+ }, {});
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/services/utils.service.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/services/utils.service.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/services/utils.service.spec.ts
index a4a0cf8..23d3726 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/services/utils.service.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/services/utils.service.spec.ts
@@ -31,56 +31,273 @@ describe('UtilsService', () => {
expect(service).toBeTruthy();
}));
- describe('#updateMultiSelectValue()', () => {
+ describe('#isEqual()', () => {
const cases = [
{
- currentValue: '',
- value: 'v0',
- isChecked: true,
- result: 'v0',
- title: 'check; no checked items before'
+ valueA: 1,
+ valueB: 1,
+ result: true,
+ title: 'same numbers'
},
{
- currentValue: 'v1,v2',
- value: 'v3',
- isChecked: true,
- result: 'v1,v2,v3',
- title: 'check'
+ valueA: 1,
+ valueB: 2,
+ result: false,
+ title: 'different numbers'
},
{
- currentValue: 'v4,v5',
- value: 'v4',
- isChecked: false,
- result: 'v5',
- title: 'uncheck'
+ valueA: 'a',
+ valueB: 'a',
+ result: true,
+ title: 'same strings'
},
{
- currentValue: 'v6,v7',
- value: 'v6',
- isChecked: true,
- result: 'v6,v7',
- title: 'avoid repeating check action'
+ valueA: 'a',
+ valueB: 'b',
+ result: false,
+ title: 'different strings'
},
{
- currentValue: 'v8,v9',
- value: 'v10',
- isChecked: false,
- result: 'v8,v9',
- title: 'avoid repeating uncheck action'
+ valueA: '1',
+ valueB: 1,
+ result: false,
+ title: 'different types'
},
{
- currentValue: 'v11',
- value: 'v11',
- isChecked: false,
- result: '',
- title: 'uncheck last item'
+ valueA: true,
+ valueB: true,
+ result: true,
+ title: 'same booleans'
+ },
+ {
+ valueA: false,
+ valueB: true,
+ result: false,
+ title: 'different booleans'
+ },
+ {
+ valueA: {},
+ valueB: {},
+ result: true,
+ title: 'empty objects'
+ },
+ {
+ valueA: {
+ p0: 'v0'
+ },
+ valueB: {
+ p0: 'v0'
+ },
+ result: true,
+ title: 'same objects'
+ },
+ {
+ valueA: {
+ p0: 'v0'
+ },
+ valueB: {
+ p0: 'v1'
+ },
+ result: false,
+ title: 'different objects'
+ },
+ {
+ valueA: {
+ p0: {
+ p1: 'v1'
+ }
+ },
+ valueB: {
+ p0: {
+ p1: 'v1'
+ }
+ },
+ result: true,
+ title: 'same objects in depth'
+ },
+ {
+ valueA: {
+ p0: {
+ p1: 'v1'
+ }
+ },
+ valueB: {
+ p0: {
+ p1: 'v2'
+ }
+ },
+ result: false,
+ title: 'different objects in depth'
+ },
+ {
+ valueA: [],
+ valueB: [],
+ result: true,
+ title: 'empty arrays'
+ },
+ {
+ valueA: [1, 'a'],
+ valueB: [1, 'a'],
+ result: true,
+ title: 'same arrays'
+ },
+ {
+ valueA: [1, 'a'],
+ valueB: [1, 'b'],
+ result: false,
+ title: 'different arrays'
+ },
+ {
+ valueA: [1, 1],
+ valueB: [1, 1, 1],
+ result: false,
+ title: 'arrays of different length'
+ },
+ {
+ valueA: [{}],
+ valueB: [{}],
+ result: true,
+ title: 'arrays of empty objects'
+ },
+ {
+ valueA: [
+ {
+ p0: 'v0'
+ }
+ ],
+ valueB: [
+ {
+ p0: 'v0'
+ }
+ ],
+ result: true,
+ title: 'arrays of same objects'
+ },
+ {
+ valueA: [
+ {
+ p0: 'v0'
+ }
+ ],
+ valueB: [
+ {
+ p0: 'v1'
+ }
+ ],
+ result: false,
+ title: 'arrays of different objects'
+ },
+ {
+ valueA: function() {},
+ valueB: function() {},
+ result: true,
+ title: 'same functions'
+ },
+ {
+ valueA: function(a) {
+ return a;
+ },
+ valueB: function(b) {
+ return !b;
+ },
+ result: false,
+ title: 'different functions'
+ },
+ {
+ valueA: new Date(1),
+ valueB: new Date(1),
+ result: true,
+ title: 'same dates'
+ },
+ {
+ valueA: new Date(1),
+ valueB: new Date(2),
+ result: false,
+ title: 'different dates'
+ },
+ {
+ valueA: new RegExp('a'),
+ valueB: new RegExp('a'),
+ result: true,
+ title: 'same regexps'
+ },
+ {
+ valueA: new RegExp('a', 'i'),
+ valueB: new RegExp('a', 'g'),
+ result: false,
+ title: 'same regexps with different flags'
+ },
+ {
+ valueA: new RegExp('a'),
+ valueB: new RegExp('b'),
+ result: false,
+ title: 'different regexps'
+ },
+ {
+ valueA: new Number(1),
+ valueB: new Number(1),
+ result: true,
+ title: 'same number objects'
+ },
+ {
+ valueA: new Number(1),
+ valueB: new Number(2),
+ result: false,
+ title: 'different number objects'
+ },
+ {
+ valueA: new String('a'),
+ valueB: new String('a'),
+ result: true,
+ title: 'same string objects'
+ },
+ {
+ valueA: new String('a'),
+ valueB: new String('b'),
+ result: false,
+ title: 'different string objects'
+ },
+ {
+ valueA: new Boolean(true),
+ valueB: new Boolean(true),
+ result: true,
+ title: 'same boolean objects'
+ },
+ {
+ valueA: new Boolean(true),
+ valueB: new Boolean(false),
+ result: false,
+ title: 'different boolean objects'
+ },
+ {
+ valueA: null,
+ valueB: null,
+ result: true,
+ title: 'null values'
+ },
+ {
+ valueA: undefined,
+ valueB: undefined,
+ result: true,
+ title: 'undefined values'
+ },
+ {
+ valueA: undefined,
+ valueB: null,
+ result: false,
+ title: 'undefined vs null'
}
];
cases.forEach(test => {
- it(test.title, inject([UtilsService], (service: UtilsService) => {
- expect(service.updateMultiSelectValue(test.currentValue, test.value, test.isChecked)).toEqual(test.result);
- }));
+ describe(test.title, () => {
+ it('equality', inject([UtilsService], (service: UtilsService) => {
+ expect(service.isEqual(test.valueA, test.valueB)).toEqual(test.result);
+ }));
+ it('symmetry', inject([UtilsService], (service: UtilsService) => {
+ expect(service.isEqual(test.valueA, test.valueB)).toEqual(service.isEqual(test.valueB, test.valueA));
+ }));
+ });
});
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/7c4a7e4c/ambari-logsearch/ambari-logsearch-web/src/app/services/utils.service.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/services/utils.service.ts b/ambari-logsearch/ambari-logsearch-web/src/app/services/utils.service.ts
index 3448dd4..175b585 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/services/utils.service.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/services/utils.service.ts
@@ -22,27 +22,56 @@ import * as moment from 'moment-timezone';
@Injectable()
export class UtilsService {
- valueHasChanged(currentValue: any, newValue: any): boolean {
- if (newValue == null) {
+ /**
+ * Comparison of two instances of any data type be value instead of reference
+ * @param valueA
+ * @param valueB
+ * @returns {boolean}
+ */
+ isEqual = (valueA: any, valueB: any): boolean => {
+ if (valueA === valueB) {
+ return true;
+ }
+ if (valueA instanceof Date && valueB instanceof Date) {
+ return valueA.valueOf() === valueB.valueOf();
+ }
+ if ((typeof valueA === 'function' && typeof valueB === 'function') ||
+ (valueA instanceof RegExp && valueB instanceof RegExp) ||
+ (valueA instanceof String && valueB instanceof String) ||
+ (valueA instanceof Number && valueB instanceof Number) ||
+ (valueA instanceof Boolean && valueB instanceof Boolean)) {
+ return valueA.toString() === valueB.toString();
+ }
+ if (!(valueA instanceof Object) || !(valueB instanceof Object)) {
return false;
}
- if (typeof newValue === 'object') {
- return JSON.stringify(currentValue) !== JSON.stringify(newValue);
- } else {
- return currentValue !== newValue;
+ if (valueA.constructor !== valueB.constructor) {
+ return false;
}
- }
-
- updateMultiSelectValue(currentValue: string, value: string, isChecked: boolean): string {
- let valuesArray = currentValue ? currentValue.split(',') : [],
- valuePosition = valuesArray.indexOf(value);
- if (isChecked && valuePosition === -1) {
- valuesArray.push(value);
- } else if (!isChecked && valuePosition > -1) {
- valuesArray.splice(valuePosition, 1);
- }
- return valuesArray.join(',');
- }
+ if (valueA.isPrototypeOf(valueB) || valueB.isPrototypeOf(valueA)) {
+ return false;
+ }
+ for (const key in valueA) {
+ if (!valueA.hasOwnProperty(key)) {
+ continue;
+ }
+ if (!valueB.hasOwnProperty(key)) {
+ return false;
+ }
+ if (valueA[key] === valueB[key]) {
+ continue;
+ }
+ if (typeof valueA[key] !== 'object' || !this.isEqual(valueA[key], valueB[key])) {
+ return false;
+ }
+ }
+ for (const key in valueB) {
+ if (valueB.hasOwnProperty(key) && !valueA.hasOwnProperty(key)) {
+ return false;
+ }
+ }
+ return true;
+ };
isEnterPressed(event: KeyboardEvent): boolean {
return event.keyCode === 13;
[48/50] [abbrv] ambari git commit: AMBARI-22431 Able to add config
type if EU/RU of the same stack (minor version upgrade) (dili)
Posted by rl...@apache.org.
AMBARI-22431 Able to add config type if EU/RU of the same stack (minor version upgrade) (dili)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f51b1cca
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f51b1cca
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f51b1cca
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: f51b1ccabbd952316979a35f398561e962164aab
Parents: a393926
Author: Di Li <di...@apache.org>
Authored: Thu Nov 16 13:47:56 2017 -0500
Committer: Di Li <di...@apache.org>
Committed: Thu Nov 16 13:47:56 2017 -0500
----------------------------------------------------------------------
.../internal/UpgradeResourceProvider.java | 36 ++
.../upgrades/CreateAndConfigureAction.java | 164 +++++++++
.../ambari/server/state/stack/UpgradePack.java | 3 +
.../state/stack/upgrade/ClusterGrouping.java | 2 +
.../stack/upgrade/CreateAndConfigureTask.java | 57 +++
.../ambari/server/state/stack/upgrade/Task.java | 6 +-
.../src/main/resources/upgrade-pack.xsd | 9 +-
.../upgrades/CreateAndConfigureActionTest.java | 357 +++++++++++++++++++
8 files changed, 632 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/f51b1cca/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
index d4111d6..e4dd441 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
@@ -93,6 +93,7 @@ import org.apache.ambari.server.state.UpgradeHelper.UpgradeGroupHolder;
import org.apache.ambari.server.state.stack.ConfigUpgradePack;
import org.apache.ambari.server.state.stack.UpgradePack;
import org.apache.ambari.server.state.stack.upgrade.ConfigureTask;
+import org.apache.ambari.server.state.stack.upgrade.CreateAndConfigureTask;
import org.apache.ambari.server.state.stack.upgrade.Direction;
import org.apache.ambari.server.state.stack.upgrade.ManualTask;
import org.apache.ambari.server.state.stack.upgrade.ServerSideActionTask;
@@ -1341,6 +1342,41 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
break;
}
+ case CREATE_AND_CONFIGURE: {
+ CreateAndConfigureTask ct = (CreateAndConfigureTask) task;
+
+ // !!! would prefer to do this in the sequence generator, but there's too many
+ // places to miss
+ if (context.getOrchestrationType().isRevertable() && !ct.supportsPatch) {
+ process = false;
+ }
+
+ Map<String, String> configurationChanges =
+ ct.getConfigurationChanges(cluster, configUpgradePack);
+
+ // add all configuration changes to the command params
+ commandParams.putAll(configurationChanges);
+
+ // extract the config type to build the summary
+ String configType = configurationChanges.get(CreateAndConfigureTask.PARAMETER_CONFIG_TYPE);
+ if (null != configType) {
+ itemDetail = String.format("Updating configuration %s", configType);
+ } else {
+ itemDetail = "Skipping Configuration Task "
+ + StringUtils.defaultString(ct.id, "(missing id)");
+ }
+
+ entity.setText(itemDetail);
+
+ String configureTaskSummary = ct.getSummary(configUpgradePack);
+ if (null != configureTaskSummary) {
+ stageText = configureTaskSummary;
+ } else {
+ stageText = itemDetail;
+ }
+
+ break;
+ }
default:
break;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/f51b1cca/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/CreateAndConfigureAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/CreateAndConfigureAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/CreateAndConfigureAction.java
new file mode 100644
index 0000000..e60938a
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/CreateAndConfigureAction.java
@@ -0,0 +1,164 @@
+/*
+ * 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.
+ */
+package org.apache.ambari.server.serveraction.upgrades;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.concurrent.ConcurrentMap;
+
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.actionmanager.HostRoleStatus;
+import org.apache.ambari.server.agent.CommandReport;
+import org.apache.ambari.server.controller.AmbariManagementController;
+import org.apache.ambari.server.controller.ConfigurationRequest;
+import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
+import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.ConfigHelper;
+import org.apache.ambari.server.state.DesiredConfig;
+import org.apache.ambari.server.state.StackId;
+import org.apache.ambari.server.state.UpgradeContext;
+import org.apache.ambari.server.state.stack.upgrade.CreateAndConfigureTask;
+import org.apache.ambari.server.state.stack.upgrade.Direction;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.inject.Inject;
+
+/**
+ * The {@link CreateAndConfigureAction} is used to alter a configuration property during
+ * an upgrade. It also creates the config type if it does not exist as a desired config for the cluster.
+ * It will only produce a new configuration if an actual change is
+ * occuring. For some configure tasks, the value is already at the desired
+ * property or the conditions of the task are not met. In these cases, a new
+ * configuration will not be created. This task can perform any of the following
+ * actions in a single declaration:
+ * <ul>
+ * <li>Copy a configuration to a new property key, optionally setting a default
+ * if the original property did not exist</li>
+ * <li>Copy a configuration to a new property key from one configuration type to
+ * another, optionally setting a default if the original property did not exist</li>
+ * <li>Rename a configuration, optionally setting a default if the original
+ * property did not exist</li>
+ * <li>Delete a configuration property</li>
+ * <li>Set a configuration property</li>
+ * <li>Conditionally set a configuration property based on another configuration
+ * property value</li>
+ * </ul>
+ */
+public class CreateAndConfigureAction extends ConfigureAction {
+
+ private static final Logger LOG = LoggerFactory.getLogger(CreateAndConfigureAction.class);
+
+ /**
+ * Used to lookup the cluster.
+ */
+ @Inject
+ private Clusters m_clusters;
+
+ /**
+ * Used to update the configuration properties.
+ */
+ @Inject
+ private AmbariManagementController m_controller;
+
+ /**
+ * Used to assist in the creation of a {@link ConfigurationRequest} to update
+ * configuration values.
+ */
+ @Inject
+ private ConfigHelper m_configHelper;
+
+
+ @Override
+ public CommandReport execute(
+ ConcurrentMap<String, Object> requestSharedDataContext)
+ throws AmbariException, InterruptedException {
+
+ LOG.info("Create and Configure...");
+
+ Map<String,String> commandParameters = getCommandParameters();
+ if( null == commandParameters || commandParameters.isEmpty() ){
+ return createCommandReport(0, HostRoleStatus.FAILED, "{}", "",
+ "Unable to change configuration values without command parameters");
+ }
+
+ String clusterName = commandParameters.get("clusterName");
+ Cluster cluster = m_clusters.getCluster(clusterName);
+ UpgradeContext upgradeContext = getUpgradeContext(cluster);
+
+ Direction direction = upgradeContext.getDirection();
+ if (direction == Direction.DOWNGRADE) {
+ return createCommandReport(0, HostRoleStatus.COMPLETED, "{}", "", "Skip changing configuration values for downgrade");
+ }
+
+ String configType = commandParameters.get(CreateAndConfigureTask.PARAMETER_CONFIG_TYPE);
+ String serviceName = cluster.getServiceByConfigType(configType);
+
+ if (StringUtils.isBlank(serviceName)) {
+ serviceName = commandParameters.get(CreateAndConfigureTask.PARAMETER_ASSOCIATED_SERVICE);
+ }
+
+ RepositoryVersionEntity sourceRepoVersion = upgradeContext.getSourceRepositoryVersion(serviceName);
+ RepositoryVersionEntity targetRepoVersion = upgradeContext.getTargetRepositoryVersion(serviceName);
+ StackId sourceStackId = sourceRepoVersion.getStackId();
+ StackId targetStackId = targetRepoVersion.getStackId();
+
+ if (!sourceStackId.equals(targetStackId)){
+ return createCommandReport(0, HostRoleStatus.FAILED, "{}", "",
+ "Unable to change configuration values across stacks. Use regular config task type instead.");
+ }
+
+ Map<String, DesiredConfig> desiredConfigs = cluster.getDesiredConfigs();
+ DesiredConfig desiredConfig = desiredConfigs.get(configType);
+ if (desiredConfig == null) {
+ LOG.info(String.format("Could not find desired config type with name %s. Create it with default values.", configType));
+
+ // populate a map with default configurations from the new stack
+ Map<String, Map<String, String>> newServiceDefaultConfigsByType = m_configHelper.getDefaultProperties(
+ targetStackId, serviceName);
+
+ if (!newServiceDefaultConfigsByType.containsKey(configType)){
+ String error = String.format("%s in %s does not contain configuration type %s", serviceName, targetStackId.getStackId(), configType);
+ LOG.error(error);
+ return createCommandReport(0, HostRoleStatus.FAILED, "{}", "", error);
+ }
+
+ Map<String, String> defaultConfigsForType = newServiceDefaultConfigsByType.get(configType);
+ // Remove any property for the new config type whose value is NULL
+ Iterator<Map.Entry<String, String>> iter = defaultConfigsForType.entrySet().iterator();
+ while (iter.hasNext()) {
+ Map.Entry<String, String> entry = iter.next();
+ if (entry.getValue() == null) {
+ iter.remove();
+ }
+ }
+
+ String serviceVersionNote = String.format("%s %s %s", direction.getText(true),
+ direction.getPreposition(), upgradeContext.getRepositoryVersion().getVersion());
+
+ m_configHelper.createConfigType(cluster, targetStackId,
+ m_controller,
+ configType, defaultConfigsForType,
+ m_controller.getAuthName(), serviceVersionNote);
+ }
+
+ return super.execute(requestSharedDataContext);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/f51b1cca/ambari-server/src/main/java/org/apache/ambari/server/state/stack/UpgradePack.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/UpgradePack.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/UpgradePack.java
index 7c32f37..7fb04f5 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/UpgradePack.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/UpgradePack.java
@@ -38,6 +38,7 @@ import javax.xml.bind.annotation.XmlValue;
import org.apache.ambari.server.api.services.AmbariMetaInfo;
import org.apache.ambari.server.state.stack.upgrade.ClusterGrouping;
import org.apache.ambari.server.state.stack.upgrade.ConfigureTask;
+import org.apache.ambari.server.state.stack.upgrade.CreateAndConfigureTask;
import org.apache.ambari.server.state.stack.upgrade.Direction;
import org.apache.ambari.server.state.stack.upgrade.Grouping;
import org.apache.ambari.server.state.stack.upgrade.ServiceCheckGrouping;
@@ -600,6 +601,8 @@ public class UpgradePack {
for (Task task : tasks) {
if (Task.Type.CONFIGURE == task.getType()) {
((ConfigureTask) task).associatedService = service;
+ } else if (Task.Type.CREATE_AND_CONFIGURE == task.getType()) {
+ ((CreateAndConfigureTask) task).associatedService = service;
}
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/f51b1cca/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ClusterGrouping.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ClusterGrouping.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ClusterGrouping.java
index 5bc3d8f..c9219d3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ClusterGrouping.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/ClusterGrouping.java
@@ -135,6 +135,8 @@ public class ClusterGrouping extends Grouping {
void afterUnmarshal(Unmarshaller unmarshaller, Object parent) {
if (task.getType().equals(Task.Type.CONFIGURE) && StringUtils.isNotEmpty(service)) {
((ConfigureTask) task).associatedService = service;
+ } else if (task.getType().equals(Task.Type.CREATE_AND_CONFIGURE) && StringUtils.isNotEmpty(service)) {
+ ((CreateAndConfigureTask) task).associatedService = service;
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/f51b1cca/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/CreateAndConfigureTask.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/CreateAndConfigureTask.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/CreateAndConfigureTask.java
new file mode 100644
index 0000000..d89840f
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/CreateAndConfigureTask.java
@@ -0,0 +1,57 @@
+/**
+ * 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.
+ */
+package org.apache.ambari.server.state.stack.upgrade;
+
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.apache.ambari.server.serveraction.upgrades.CreateAndConfigureAction;
+
+/**
+ * The {@link CreateAndConfigureTask} represents a two step change where the create is for creating a config type if it does not exist
+ * followed by the configuration change.
+ * This task contains id of change. Change definitions are located in a separate file (config
+ * upgrade pack). IDs of change definitions share the same namespace within all stacks.
+ *
+ *
+ * <p/>
+ *
+ * <pre>
+ * {@code
+ * <task xsi:type="create_and_configure" id="hdp_2_3_0_0-UpdateHiveConfig"/>
+ * }
+ * </pre>
+ *
+ */
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name="create_and_configure")
+public class CreateAndConfigureTask extends ConfigureTask {
+
+ public static final String actionVerb = "CreateAndConfiguring";
+
+ /**
+ * Constructor.
+ */
+ public CreateAndConfigureTask() {
+ implClass = CreateAndConfigureAction.class.getName();
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/f51b1cca/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/Task.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/Task.java b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/Task.java
index 6ab2fd2..2167b7b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/Task.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/Task.java
@@ -25,7 +25,7 @@ import javax.xml.bind.annotation.XmlSeeAlso;
/**
* Base class to identify the items that could possibly occur during an upgrade
*/
-@XmlSeeAlso(value={ExecuteTask.class, ConfigureTask.class, ManualTask.class, RestartTask.class, StartTask.class, StopTask.class, ServerActionTask.class, ConfigureFunction.class})
+@XmlSeeAlso(value={ExecuteTask.class, CreateAndConfigureTask.class, ConfigureTask.class, ManualTask.class, RestartTask.class, StartTask.class, StopTask.class, ServerActionTask.class, ConfigureFunction.class})
public abstract class Task {
/**
@@ -96,6 +96,10 @@ public abstract class Task {
*/
CONFIGURE,
/**
+ * Task that create a config type if it does not, and alters a configuration.
+ */
+ CREATE_AND_CONFIGURE,
+ /**
* Task that sets up the configuration for subsequent task
*/
CONFIGURE_FUNCTION,
http://git-wip-us.apache.org/repos/asf/ambari/blob/f51b1cca/ambari-server/src/main/resources/upgrade-pack.xsd
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/upgrade-pack.xsd b/ambari-server/src/main/resources/upgrade-pack.xsd
index 79c50a7..9e50a08 100644
--- a/ambari-server/src/main/resources/upgrade-pack.xsd
+++ b/ambari-server/src/main/resources/upgrade-pack.xsd
@@ -87,7 +87,7 @@
</xs:extension>
</xs:complexContent>
</xs:complexType>
-
+
<xs:complexType name="security">
<xs:complexContent>
<xs:extension base="abstract-condition-type">
@@ -345,6 +345,13 @@
</xs:complexContent>
</xs:complexType>
+ <xs:complexType name="create_and_configure">
+ <xs:complexContent>
+ <xs:extension base="configure">
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+
<xs:complexType name="configure_function">
<xs:complexContent>
<xs:extension base="abstract-task-type">
http://git-wip-us.apache.org/repos/asf/ambari/blob/f51b1cca/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/CreateAndConfigureActionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/CreateAndConfigureActionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/CreateAndConfigureActionTest.java
new file mode 100644
index 0000000..43b5bd0
--- /dev/null
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/CreateAndConfigureActionTest.java
@@ -0,0 +1,357 @@
+/*
+ * 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.
+ */
+package org.apache.ambari.server.serveraction.upgrades;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.H2DatabaseCleaner;
+import org.apache.ambari.server.ServiceComponentNotFoundException;
+import org.apache.ambari.server.ServiceNotFoundException;
+import org.apache.ambari.server.actionmanager.ExecutionCommandWrapper;
+import org.apache.ambari.server.actionmanager.HostRoleCommand;
+import org.apache.ambari.server.actionmanager.HostRoleCommandFactory;
+import org.apache.ambari.server.agent.CommandReport;
+import org.apache.ambari.server.agent.ExecutionCommand;
+import org.apache.ambari.server.orm.GuiceJpaInitializer;
+import org.apache.ambari.server.orm.InMemoryDefaultTestModule;
+import org.apache.ambari.server.orm.OrmTestHelper;
+import org.apache.ambari.server.orm.dao.RequestDAO;
+import org.apache.ambari.server.orm.dao.UpgradeDAO;
+import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
+import org.apache.ambari.server.orm.entities.RequestEntity;
+import org.apache.ambari.server.orm.entities.UpgradeEntity;
+import org.apache.ambari.server.orm.entities.UpgradeHistoryEntity;
+import org.apache.ambari.server.serveraction.ServerAction;
+import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.Config;
+import org.apache.ambari.server.state.ConfigFactory;
+import org.apache.ambari.server.state.ConfigHelper;
+import org.apache.ambari.server.state.Host;
+import org.apache.ambari.server.state.Service;
+import org.apache.ambari.server.state.ServiceComponent;
+import org.apache.ambari.server.state.ServiceComponentFactory;
+import org.apache.ambari.server.state.ServiceComponentHost;
+import org.apache.ambari.server.state.ServiceComponentHostFactory;
+import org.apache.ambari.server.state.ServiceFactory;
+import org.apache.ambari.server.state.StackId;
+import org.apache.ambari.server.state.State;
+import org.apache.ambari.server.state.stack.upgrade.ConfigUpgradeChangeDefinition.ConfigurationKeyValue;
+import org.apache.ambari.server.state.stack.upgrade.CreateAndConfigureTask;
+import org.apache.ambari.server.state.stack.upgrade.UpgradeType;
+import org.apache.commons.lang.StringUtils;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.google.gson.Gson;
+import com.google.inject.Guice;
+import com.google.inject.Inject;
+import com.google.inject.Injector;
+
+/**
+ * Tests upgrade-related server side actions
+ */
+public class CreateAndConfigureActionTest {
+
+ @Inject
+ private Injector m_injector;
+
+ @Inject
+ private OrmTestHelper m_helper;
+
+ @Inject
+ private HostRoleCommandFactory hostRoleCommandFactory;
+
+ @Inject
+ private ServiceFactory serviceFactory;
+
+ @Inject
+ private ConfigHelper m_configHelper;
+
+ @Inject
+ private Clusters clusters;
+
+ @Inject
+ private ConfigFactory configFactory;
+
+ @Inject
+ private CreateAndConfigureAction action;
+
+ @Inject
+ private RequestDAO requestDAO;
+
+ @Inject
+ private UpgradeDAO upgradeDAO;
+
+ @Inject
+ private ServiceComponentFactory serviceComponentFactory;
+
+ @Inject
+ private ServiceComponentHostFactory serviceComponentHostFactory;
+
+ private RepositoryVersionEntity repoVersion2110;
+ private RepositoryVersionEntity repoVersion2111;
+ private RepositoryVersionEntity repoVersion2200;
+
+ private final Map<String, Map<String, String>> NO_ATTRIBUTES = new HashMap<>();
+
+ @Before
+ public void setup() throws Exception {
+ m_injector = Guice.createInjector(new InMemoryDefaultTestModule());
+ m_injector.getInstance(GuiceJpaInitializer.class);
+ m_injector.injectMembers(this);
+
+ repoVersion2110 = m_helper.getOrCreateRepositoryVersion(new StackId("HDP-2.1.1"), "2.1.1.0-1234");
+ repoVersion2111 = m_helper.getOrCreateRepositoryVersion(new StackId("HDP-2.1.1"), "2.1.1.1-5678");
+ repoVersion2200 = m_helper.getOrCreateRepositoryVersion(new StackId("HDP-2.2.0"), "2.2.0.0-1234");
+
+ makeUpgradeCluster();
+ }
+
+ @After
+ public void teardown() throws Exception {
+ H2DatabaseCleaner.clearDatabase(m_injector.getProvider(EntityManager.class).get());
+ }
+
+
+ /**
+ * Tests that a new configuration is created when upgrading across stack when
+ * there is no existing configuration with the correct target stack.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testNewConfigCreatedWhenUpgradingWithoutChaningStack() throws Exception {
+ Cluster c = clusters.getCluster("c1");
+ assertEquals(1, c.getConfigsByType("zoo.cfg").size());
+
+ Map<String, String> properties = new HashMap<String, String>() {
+ {
+ put("initLimit", "10");
+ }
+ };
+
+ Config config = createConfig(c, "zoo.cfg", "version2", properties);
+
+ c.addDesiredConfig("user", Collections.singleton(config));
+ assertEquals(2, c.getConfigsByType("zoo.cfg").size());
+
+ List<ConfigurationKeyValue> configurations = new ArrayList<>();
+ ConfigurationKeyValue keyValue = new ConfigurationKeyValue();
+ configurations.add(keyValue);
+ keyValue.key = "initLimit";
+ keyValue.value = "11";
+ c.setCurrentStackVersion(repoVersion2110.getStackId());
+ c.setDesiredStackVersion(repoVersion2111.getStackId());
+
+ createUpgrade(c, repoVersion2111);
+
+ Map<String, String> commandParams = new HashMap<>();
+ commandParams.put("clusterName", "c1");
+ commandParams.put(CreateAndConfigureTask.PARAMETER_CONFIG_TYPE, "zoo.cfg");
+ commandParams.put(CreateAndConfigureTask.PARAMETER_KEY_VALUE_PAIRS, new Gson().toJson(configurations));
+
+ ExecutionCommand executionCommand = getExecutionCommand(commandParams);
+ HostRoleCommand hostRoleCommand = hostRoleCommandFactory.create(null, null,
+ null, null);
+
+ hostRoleCommand.setExecutionCommandWrapper(new ExecutionCommandWrapper(
+ executionCommand));
+
+ action.setExecutionCommand(executionCommand);
+ action.setHostRoleCommand(hostRoleCommand);
+
+ CommandReport report = action.execute(null);
+ assertNotNull(report);
+
+ assertEquals(3, c.getConfigsByType("zoo.cfg").size());
+
+ config = c.getDesiredConfigByType("zoo.cfg");
+ assertNotNull(config);
+ assertFalse(StringUtils.equals("version2", config.getTag()));
+ assertEquals("11", config.getProperties().get("initLimit"));
+ }
+
+ /**
+ * Creates a cluster using {@link #repoVersion2110} with ZooKeeper installed.
+ *
+ * @throws Exception
+ */
+ private void makeUpgradeCluster() throws Exception {
+ String clusterName = "c1";
+ String hostName = "h1";
+
+ clusters.addCluster(clusterName, repoVersion2110.getStackId());
+
+ Cluster c = clusters.getCluster(clusterName);
+
+ // add a host component
+ clusters.addHost(hostName);
+ Host host = clusters.getHost(hostName);
+ Map<String, String> hostAttributes = new HashMap<>();
+ hostAttributes.put("os_family", "redhat");
+ hostAttributes.put("os_release_version", "6");
+ host.setHostAttributes(hostAttributes);
+
+ clusters.mapHostToCluster(hostName, clusterName);
+
+ // !!! very important, otherwise the loops that walk the list of installed
+ // service properties will not run!
+ Service zk = installService(c, "ZOOKEEPER", repoVersion2110);
+ addServiceComponent(c, zk, "ZOOKEEPER_SERVER");
+ addServiceComponent(c, zk, "ZOOKEEPER_CLIENT");
+ createNewServiceComponentHost(c, "ZOOKEEPER", "ZOOKEEPER_SERVER", hostName);
+ createNewServiceComponentHost(c, "ZOOKEEPER", "ZOOKEEPER_CLIENT", hostName);
+
+ Map<String, String> properties = new HashMap<String, String>() {
+ {
+ put("initLimit", "10");
+ }
+ };
+
+ Config config = createConfig(c, "zoo.cfg", "version1", properties);
+
+ c.addDesiredConfig("user", Collections.singleton(config));
+
+ // verify that our configs are there
+ String tickTime = m_configHelper.getPropertyValueFromStackDefinitions(c, "zoo.cfg", "tickTime");
+ assertNotNull(tickTime);
+ }
+
+ /**
+ * Installs a service in the cluster.
+ *
+ * @param cluster
+ * @param serviceName
+ * @return
+ * @throws AmbariException
+ */
+ private Service installService(Cluster cluster, String serviceName,
+ RepositoryVersionEntity repositoryVersion) throws AmbariException {
+ Service service = null;
+
+ try {
+ service = cluster.getService(serviceName);
+ } catch (ServiceNotFoundException e) {
+ service = serviceFactory.createNew(cluster, serviceName, repositoryVersion);
+ cluster.addService(service);
+ }
+
+ return service;
+ }
+
+ private ServiceComponent addServiceComponent(Cluster cluster, Service service,
+ String componentName) throws AmbariException {
+ ServiceComponent serviceComponent = null;
+ try {
+ serviceComponent = service.getServiceComponent(componentName);
+ } catch (ServiceComponentNotFoundException e) {
+ serviceComponent = serviceComponentFactory.createNew(service, componentName);
+ service.addServiceComponent(serviceComponent);
+ serviceComponent.setDesiredState(State.INSTALLED);
+ }
+
+ return serviceComponent;
+ }
+
+ private ServiceComponentHost createNewServiceComponentHost(Cluster cluster, String serviceName,
+ String svcComponent, String hostName) throws AmbariException {
+ Assert.assertNotNull(cluster.getConfigGroups());
+ Service s = cluster.getService(serviceName);
+ ServiceComponent sc = addServiceComponent(cluster, s, svcComponent);
+
+ ServiceComponentHost sch = serviceComponentHostFactory.createNew(sc, hostName);
+
+ sc.addServiceComponentHost(sch);
+ sch.setDesiredState(State.INSTALLED);
+ sch.setState(State.INSTALLED);
+ return sch;
+ }
+
+ /**
+ * Creates an upgrade and associates it with the cluster.
+ */
+ private UpgradeEntity createUpgrade(Cluster cluster, RepositoryVersionEntity repositoryVersion)
+ throws Exception {
+
+ // create some entities for the finalize action to work with for patch
+ // history
+ RequestEntity requestEntity = new RequestEntity();
+ requestEntity.setClusterId(cluster.getClusterId());
+ requestEntity.setRequestId(1L);
+ requestEntity.setStartTime(System.currentTimeMillis());
+ requestEntity.setCreateTime(System.currentTimeMillis());
+ requestDAO.create(requestEntity);
+
+ UpgradeEntity upgradeEntity = new UpgradeEntity();
+ upgradeEntity.setId(1L);
+ upgradeEntity.setClusterId(cluster.getClusterId());
+ upgradeEntity.setRequestEntity(requestEntity);
+ upgradeEntity.setUpgradePackage("");
+ upgradeEntity.setRepositoryVersion(repositoryVersion);
+ upgradeEntity.setUpgradeType(UpgradeType.NON_ROLLING);
+
+ Map<String, Service> services = cluster.getServices();
+ for (String serviceName : services.keySet()) {
+ Service service = services.get(serviceName);
+ Map<String, ServiceComponent> components = service.getServiceComponents();
+ for (String componentName : components.keySet()) {
+ UpgradeHistoryEntity history = new UpgradeHistoryEntity();
+ history.setUpgrade(upgradeEntity);
+ history.setServiceName(serviceName);
+ history.setComponentName(componentName);
+ history.setFromRepositoryVersion(service.getDesiredRepositoryVersion());
+ history.setTargetRepositoryVersion(repositoryVersion);
+ upgradeEntity.addHistory(history);
+ }
+ }
+
+ upgradeDAO.create(upgradeEntity);
+ cluster.setUpgradeEntity(upgradeEntity);
+ return upgradeEntity;
+ }
+
+ private ExecutionCommand getExecutionCommand(Map<String, String> commandParams) {
+ ExecutionCommand executionCommand = new ExecutionCommand();
+ executionCommand.setClusterName("c1");
+ executionCommand.setCommandParams(commandParams);
+ executionCommand.setRoleParams(new HashMap<String, String>());
+ executionCommand.getRoleParams().put(ServerAction.ACTION_USER_NAME, "username");
+
+ return executionCommand;
+ }
+
+ private Config createConfig(Cluster cluster, String type, String tag,
+ Map<String, String> properties) {
+ return configFactory.createNew(cluster, type, tag, properties,
+ NO_ATTRIBUTES);
+ }
+}
\ No newline at end of file
[34/50] [abbrv] ambari git commit: AMBARI-22443. Log Feeder: do not
try to connect AMS, when it is disabled (oleewere)
Posted by rl...@apache.org.
AMBARI-22443. Log Feeder: do not try to connect AMS, when it is disabled (oleewere)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2b917f49
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2b917f49
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2b917f49
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 2b917f491f5577a85ec88380d7f3f93397cececf
Parents: ba00ed9
Author: Oliver Szabo <ol...@gmail.com>
Authored: Tue Nov 14 19:15:57 2017 +0100
Committer: Oliver Szabo <ol...@gmail.com>
Committed: Wed Nov 15 11:43:00 2017 +0100
----------------------------------------------------------------------
.../ambari/logfeeder/metrics/LogFeederAMSClient.java | 3 +++
.../apache/ambari/logfeeder/metrics/MetricsManager.java | 8 +++++++-
.../ambari/logfeeder/metrics/MetricsManagerTest.java | 10 ++++++----
3 files changed, 16 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/2b917f49/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/LogFeederAMSClient.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/LogFeederAMSClient.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/LogFeederAMSClient.java
index f446446..c832358 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/LogFeederAMSClient.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/LogFeederAMSClient.java
@@ -64,6 +64,9 @@ public class LogFeederAMSClient extends AbstractTimelineMetricsSink {
@Override
public String getCollectorUri(String host) {
+ if (collectorProtocol == null || host == null || collectorPort == null || collectorPath == null) {
+ return null;
+ }
return String.format("%s://%s:%s%s", collectorProtocol, host, collectorPort, collectorPath);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/2b917f49/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/MetricsManager.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/MetricsManager.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/MetricsManager.java
index 1094852..6e8ac04 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/MetricsManager.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/MetricsManager.java
@@ -45,7 +45,9 @@ public class MetricsManager {
public void init() {
LOG.info("Initializing MetricsManager()");
- amsClient = new LogFeederAMSClient();
+ if (amsClient == null) {
+ amsClient = new LogFeederAMSClient();
+ }
if (amsClient.getCollectorUri(null) != null) {
if (LogFeederUtil.hostName == null) {
@@ -144,4 +146,8 @@ public class MetricsManager {
(currMS - lastPublishTimeMS) / 1000 + " seconds ago, intervalConfigured=" + publishIntervalMS / 1000);
}
}
+
+ public void setAmsClient(LogFeederAMSClient amsClient) {
+ this.amsClient = amsClient;
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/2b917f49/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/metrics/MetricsManagerTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/metrics/MetricsManagerTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/metrics/MetricsManagerTest.java
index 24042a7..f74a80e 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/metrics/MetricsManagerTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/metrics/MetricsManagerTest.java
@@ -50,18 +50,20 @@ public class MetricsManagerTest {
@Before
public void init() throws Exception {
manager = new MetricsManager();
- manager.init();
-
+
mockClient = strictMock(LogFeederAMSClient.class);
Field f = MetricsManager.class.getDeclaredField("amsClient");
f.setAccessible(true);
f.set(manager, mockClient);
-
+
+ EasyMock.expect(mockClient.getCollectorUri(null)).andReturn("null://null:null/null").anyTimes();
capture = EasyMock.newCapture(CaptureType.FIRST);
mockClient.emitMetrics(EasyMock.capture(capture));
EasyMock.expectLastCall().andReturn(true).once();
-
+
replay(mockClient);
+ manager.setAmsClient(mockClient);
+ manager.init();
}
@Test
[47/50] [abbrv] ambari git commit: AMBARI-22444 - Add Native
Libraries To Tez Tarball (part3) (jonathanhurley)
Posted by rl...@apache.org.
AMBARI-22444 - Add Native Libraries To Tez Tarball (part3) (jonathanhurley)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a393926c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a393926c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a393926c
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: a393926c5cdae85b567349c89098712d21a5e1ec
Parents: f087874
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Thu Nov 16 09:43:24 2017 -0500
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Thu Nov 16 11:46:27 2017 -0500
----------------------------------------------------------------------
.../resource_management/libraries/functions/copy_tarball.py | 9 +++++++++
1 file changed, 9 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/a393926c/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py b/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py
index 7bca967..9b6fb98 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py
@@ -58,8 +58,11 @@ def _prepare_tez_tarball():
temp_dir = Script.get_tmp_dir()
+ # create the temp staging directories ensuring that non-root agents using tarfile can work with them
mapreduce_temp_dir = tempfile.mkdtemp(prefix="mapreduce-tarball-", dir=temp_dir)
tez_temp_dir = tempfile.mkdtemp(prefix="tez-tarball-", dir=temp_dir)
+ sudo.chmod(mapreduce_temp_dir, 0777)
+ sudo.chmod(tez_temp_dir, 0777)
Logger.info("Extracting {0} to {1}".format(mapreduce_source_file, mapreduce_temp_dir))
tar_archive.extract_archive(mapreduce_source_file, mapreduce_temp_dir)
@@ -76,11 +79,17 @@ def _prepare_tez_tarball():
if not os.path.exists(tez_lib_dir):
raise Fail("Unable to seed the Tez tarball with native libraries since the target Tez lib directory {0} does not exist".format(tez_lib_dir))
+ # ensure that the tez/lib directory is readable by non-root (which it typically is not)
+ sudo.chmod(tez_lib_dir, 0755)
+
+ # copy native libraries from hadoop to tez
Execute(("cp", "-a", hadoop_lib_native_dir, tez_lib_dir), sudo = True)
+ # create the staging directory so that non-root agents can write to it
tez_native_tarball_staging_dir = os.path.join(temp_dir, "tez-native-tarball-staging")
if not os.path.exists(tez_native_tarball_staging_dir):
Directory(tez_native_tarball_staging_dir,
+ mode = 0777,
cd_access='a',
create_parents = True,
recursive_ownership = True)
[21/50] [abbrv] ambari git commit: AMBARI-22387. Create a Pre-Upgrade
Check Warning About LZO (dlysnichenko)
Posted by rl...@apache.org.
AMBARI-22387. Create a Pre-Upgrade Check Warning About LZO (dlysnichenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/76349ac2
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/76349ac2
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/76349ac2
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 76349ac20d8955b3f25383b6f4f209a690b38bef
Parents: 5122671
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Mon Nov 13 13:29:52 2017 +0200
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Mon Nov 13 13:30:26 2017 +0200
----------------------------------------------------------------------
.../ambari/server/checks/CheckDescription.java | 9 ++
.../apache/ambari/server/checks/LZOCheck.java | 77 ++++++++++
.../HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml | 1 +
.../stacks/HDP/2.3/upgrades/upgrade-2.6.xml | 1 +
.../HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml | 1 +
.../stacks/HDP/2.4/upgrades/upgrade-2.6.xml | 1 +
.../HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml | 1 +
.../stacks/HDP/2.5/upgrades/upgrade-2.6.xml | 1 +
.../HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml | 1 +
.../stacks/HDP/2.6/upgrades/upgrade-2.6.xml | 1 +
.../ambari/server/checks/LZOCheckTest.java | 145 +++++++++++++++++++
11 files changed, 239 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/76349ac2/ambari-server/src/main/java/org/apache/ambari/server/checks/CheckDescription.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/CheckDescription.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/CheckDescription.java
index 3caac14..20bb1b0 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/CheckDescription.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/CheckDescription.java
@@ -327,6 +327,15 @@ public class CheckDescription {
"As Ranger is SSL enabled, Ranger SSL configurations will need to be changed from default value of /etc/ranger/*/conf folder to /etc/ranger/security. " +
"Since the certificates/keystores/truststores in this path may affect the upgrade/downgrade process, it is recommended to manually move the certificates/keystores/truststores out of the conf folders and change the appropriate config values before proceeding.").build());
+ public static CheckDescription LZO_CONFIG_CHECK = new CheckDescription("LZO_CONFIG_CHECK",
+ PrereqCheckType.CLUSTER,
+ "LZO Codec Check",
+ new ImmutableMap.Builder<String, String>()
+ .put(AbstractCheckDescriptor.DEFAULT,
+ "You have LZO codec enabled in the core-site config of your cluster. LZO is no longer installed automatically. " +
+ "If any hosts require LZO, it should be installed before starting the upgrade. " +
+ "Consult Ambari documentation for instructions on how to do this.").build());
+
public static CheckDescription JAVA_VERSION = new CheckDescription("JAVA_VERSION",
PrereqCheckType.CLUSTER,
"Verify Java version requirement",
http://git-wip-us.apache.org/repos/asf/ambari/blob/76349ac2/ambari-server/src/main/java/org/apache/ambari/server/checks/LZOCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/LZOCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/LZOCheck.java
new file mode 100644
index 0000000..3000b79
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/LZOCheck.java
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ */
+package org.apache.ambari.server.checks;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.controller.PrereqCheckRequest;
+import org.apache.ambari.server.state.stack.PrereqCheckStatus;
+import org.apache.ambari.server.state.stack.PrerequisiteCheck;
+import org.apache.commons.lang.StringUtils;
+
+import com.google.inject.Singleton;
+
+/**
+ * The {@link LZOCheck}
+ * is used to check that the LZO codec enabled in the core-site config fnd warning if any hosts require LZO, it should be installed before starting the upgrade.
+ */
+@Singleton
+@UpgradeCheck(group = UpgradeCheckGroup.INFORMATIONAL_WARNING)
+public class LZOCheck extends AbstractCheckDescriptor {
+
+ final static String IO_COMPRESSION_CODECS = "io.compression.codecs";
+ final static String LZO_ENABLE_KEY = "io.compression.codec.lzo.class";
+ final static String LZO_ENABLE_VALUE = "com.hadoop.compression.lzo.LzoCodec";
+
+ /**
+ * Constructor.
+ */
+ public LZOCheck() {
+ super(CheckDescription.LZO_CONFIG_CHECK);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException {
+ List<String> errorMessages = new ArrayList<>();
+ PrereqCheckStatus checkStatus = PrereqCheckStatus.WARNING;
+
+ String codecs = getProperty(request, "core-site", IO_COMPRESSION_CODECS);
+ if (codecs!= null && codecs.contains(LZO_ENABLE_VALUE)) {
+ errorMessages.add(getFailReason(IO_COMPRESSION_CODECS, prerequisiteCheck, request));
+ }
+ String classValue = getProperty(request, "core-site", LZO_ENABLE_KEY);
+
+ if (LZO_ENABLE_VALUE.equals(classValue)) {
+ errorMessages.add(getFailReason(LZO_ENABLE_KEY, prerequisiteCheck, request));
+ }
+
+ if (!errorMessages.isEmpty()) {
+ prerequisiteCheck.setFailReason(StringUtils.join(errorMessages, "You have LZO codec enabled in the core-site config of your cluster. LZO is no longer installed automatically. " +
+ "If any hosts require LZO, it should be installed before starting the upgrade. " +
+ "Consult Ambari documentation for instructions on how to do this."));
+ prerequisiteCheck.getFailedOn().add("LZO");
+ prerequisiteCheck.setStatus(checkStatus);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/76349ac2/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
index 907626d..bb22c1e 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
@@ -24,6 +24,7 @@
<check>org.apache.ambari.server.checks.RangerAuditDbCheck</check>
<check>org.apache.ambari.server.checks.ServicePresenceCheck</check>
<check>org.apache.ambari.server.checks.RangerSSLConfigCheck</check>
+ <check>org.apache.ambari.server.checks.LZOCheck</check>
<configuration>
<!-- Configuration properties for all pre-reqs including required pre-reqs -->
<check-properties name="org.apache.ambari.server.checks.HiveDynamicServiceDiscoveryCheck">
http://git-wip-us.apache.org/repos/asf/ambari/blob/76349ac2/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml
index 567e6e1..faf8cbc 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml
@@ -36,6 +36,7 @@
<check>org.apache.ambari.server.checks.ServicePresenceCheck</check>
<check>org.apache.ambari.server.checks.RangerAuditDbCheck</check>
<check>org.apache.ambari.server.checks.RangerSSLConfigCheck</check>
+ <check>org.apache.ambari.server.checks.LZOCheck</check>
<!-- Specific to HDP 2.5, Storm is not rolling -->
<check>org.apache.ambari.server.checks.StormShutdownWarning</check>
http://git-wip-us.apache.org/repos/asf/ambari/blob/76349ac2/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
index faf5b76..97824f2 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
@@ -24,6 +24,7 @@
<check>org.apache.ambari.server.checks.RangerAuditDbCheck</check>
<check>org.apache.ambari.server.checks.ServicePresenceCheck</check>
<check>org.apache.ambari.server.checks.RangerSSLConfigCheck</check>
+ <check>org.apache.ambari.server.checks.LZOCheck</check>
<configuration>
<!-- Configuration properties for all pre-reqs including required pre-reqs -->
http://git-wip-us.apache.org/repos/asf/ambari/blob/76349ac2/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml
index 572a259..9e56d97 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml
@@ -37,6 +37,7 @@
<check>org.apache.ambari.server.checks.ServicePresenceCheck</check>
<check>org.apache.ambari.server.checks.RangerAuditDbCheck</check>
<check>org.apache.ambari.server.checks.RangerSSLConfigCheck</check>
+ <check>org.apache.ambari.server.checks.LZOCheck</check>
<!-- Specific to HDP 2.5, Storm is not rolling -->
<check>org.apache.ambari.server.checks.StormShutdownWarning</check>
http://git-wip-us.apache.org/repos/asf/ambari/blob/76349ac2/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
index 8012c90..ace9542 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
@@ -22,6 +22,7 @@
<type>NON_ROLLING</type>
<prerequisite-checks>
<check>org.apache.ambari.server.checks.RangerSSLConfigCheck</check>
+ <check>org.apache.ambari.server.checks.LZOCheck</check>
<configuration>
<!-- Configuration properties for all pre-reqs including required pre-reqs -->
<check-properties name="org.apache.ambari.server.checks.HiveDynamicServiceDiscoveryCheck">
http://git-wip-us.apache.org/repos/asf/ambari/blob/76349ac2/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml
index 7c43948..df11ae1 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml
@@ -35,6 +35,7 @@
<check>org.apache.ambari.server.checks.YarnTimelineServerStatePreservingCheck</check>
<check>org.apache.ambari.server.checks.RangerSSLConfigCheck</check>
<check>org.apache.ambari.server.checks.DruidHighAvailabilityCheck</check>
+ <check>org.apache.ambari.server.checks.LZOCheck</check>
<configuration>
<!-- Configuration properties for all pre-reqs including required pre-reqs -->
http://git-wip-us.apache.org/repos/asf/ambari/blob/76349ac2/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
index ae2a855..0355362 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml
@@ -21,6 +21,7 @@
<target-stack>HDP-2.6</target-stack>
<type>NON_ROLLING</type>
<prerequisite-checks>
+ <check>org.apache.ambari.server.checks.LZOCheck</check>
<configuration>
<!-- Configuration properties for all pre-reqs including required pre-reqs -->
<check-properties name="org.apache.ambari.server.checks.HiveDynamicServiceDiscoveryCheck">
http://git-wip-us.apache.org/repos/asf/ambari/blob/76349ac2/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml
index 37847a2..5aa2d20 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml
@@ -34,6 +34,7 @@
<check>org.apache.ambari.server.checks.YarnRMHighAvailabilityCheck</check>
<check>org.apache.ambari.server.checks.YarnTimelineServerStatePreservingCheck</check>
<check>org.apache.ambari.server.checks.DruidHighAvailabilityCheck</check>
+ <check>org.apache.ambari.server.checks.LZOCheck</check>
<configuration>
<!-- Configuration properties for all pre-reqs including required pre-reqs -->
http://git-wip-us.apache.org/repos/asf/ambari/blob/76349ac2/ambari-server/src/test/java/org/apache/ambari/server/checks/LZOCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/LZOCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/LZOCheckTest.java
new file mode 100644
index 0000000..e50e936
--- /dev/null
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/LZOCheckTest.java
@@ -0,0 +1,145 @@
+/*
+ * 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.
+ */
+package org.apache.ambari.server.checks;
+
+ import java.util.HashMap;
+ import java.util.Map;
+
+ import org.apache.ambari.server.configuration.Configuration;
+ import org.apache.ambari.server.controller.PrereqCheckRequest;
+ import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
+ import org.apache.ambari.server.state.Cluster;
+ import org.apache.ambari.server.state.Clusters;
+ import org.apache.ambari.server.state.Config;
+ import org.apache.ambari.server.state.DesiredConfig;
+ import org.apache.ambari.server.state.RepositoryType;
+ import org.apache.ambari.server.state.Service;
+ import org.apache.ambari.server.state.repository.ClusterVersionSummary;
+ import org.apache.ambari.server.state.repository.VersionDefinitionXml;
+ import org.apache.ambari.server.state.stack.PrereqCheckStatus;
+ import org.apache.ambari.server.state.stack.PrerequisiteCheck;
+ import org.junit.Assert;
+ import org.junit.Before;
+ import org.junit.Test;
+ import org.junit.runner.RunWith;
+ import org.mockito.Mock;
+ import org.mockito.Mockito;
+ import org.mockito.runners.MockitoJUnitRunner;
+
+ import com.google.inject.Provider;
+
+
+/* Test for LZOCheck */
+@RunWith(MockitoJUnitRunner.class)
+public class LZOCheckTest {
+
+ private final Clusters clusters = Mockito.mock(Clusters.class);
+ private final LZOCheck lZOCheck = new LZOCheck();
+
+ @Mock
+ private ClusterVersionSummary m_clusterVersionSummary;
+
+ @Mock
+ private VersionDefinitionXml m_vdfXml;
+
+ @Mock
+ private RepositoryVersionEntity m_repositoryVersion;
+
+ final Map<String, Service> m_services = new HashMap<>();
+
+ @Before
+ public void setup() throws Exception {
+ lZOCheck.clustersProvider = new Provider<Clusters>() {
+ @Override
+ public Clusters get() {
+ return clusters;
+ }
+ };
+ Configuration config = Mockito.mock(Configuration.class);
+ lZOCheck.config = config;
+
+ m_services.clear();
+
+ Mockito.when(m_repositoryVersion.getType()).thenReturn(RepositoryType.STANDARD);
+ Mockito.when(m_repositoryVersion.getRepositoryXml()).thenReturn(m_vdfXml);
+ Mockito.when(m_vdfXml.getClusterSummary(Mockito.any(Cluster.class))).thenReturn(m_clusterVersionSummary);
+ Mockito.when(m_clusterVersionSummary.getAvailableServiceNames()).thenReturn(m_services.keySet());
+ }
+
+ @Test
+ public void testIsApplicable() throws Exception {
+ final Cluster cluster = Mockito.mock(Cluster.class);
+
+ Mockito.when(cluster.getServices()).thenReturn(m_services);
+ Mockito.when(cluster.getClusterId()).thenReturn(1L);
+ Mockito.when(clusters.getCluster("cluster")).thenReturn(cluster);
+
+ PrereqCheckRequest request = new PrereqCheckRequest("cluster");
+ request.setTargetRepositoryVersion(m_repositoryVersion);
+
+ Assert.assertTrue(lZOCheck.isApplicable(request));
+ }
+
+ @Test
+ public void testPerform() throws Exception {
+ final Cluster cluster = Mockito.mock(Cluster.class);
+ final Map<String, Service> services = new HashMap<>();
+ final Service service = Mockito.mock(Service.class);
+
+ Mockito.when(cluster.getServices()).thenReturn(services);
+ Mockito.when(cluster.getClusterId()).thenReturn(1L);
+ Mockito.when(clusters.getCluster("cluster")).thenReturn(cluster);
+
+ final DesiredConfig desiredConfig = Mockito.mock(DesiredConfig.class);
+ Mockito.when(desiredConfig.getTag()).thenReturn("tag");
+ Map<String, DesiredConfig> configMap = new HashMap<>();
+ configMap.put("core-site", desiredConfig);
+
+ Mockito.when(cluster.getDesiredConfigs()).thenReturn(configMap);
+ final Config config = Mockito.mock(Config.class);
+ Mockito.when(cluster.getConfig(Mockito.anyString(), Mockito.anyString())).thenReturn(config);
+ final Map<String, String> properties = new HashMap<>();
+ Mockito.when(config.getProperties()).thenReturn(properties);
+
+ PrerequisiteCheck check = new PrerequisiteCheck(null, null);
+ lZOCheck.perform(check, new PrereqCheckRequest("cluster"));
+ Assert.assertEquals(PrereqCheckStatus.PASS, check.getStatus());
+
+
+ properties.put(LZOCheck.IO_COMPRESSION_CODECS,"test," + LZOCheck.LZO_ENABLE_VALUE);
+ check = new PrerequisiteCheck(null, null);
+ lZOCheck.perform(check, new PrereqCheckRequest("cluster"));
+ Assert.assertEquals(PrereqCheckStatus.WARNING, check.getStatus());
+
+ properties.put(LZOCheck.IO_COMPRESSION_CODECS,"test");
+ check = new PrerequisiteCheck(null, null);
+ lZOCheck.perform(check, new PrereqCheckRequest("cluster"));
+ Assert.assertEquals(PrereqCheckStatus.PASS, check.getStatus());
+
+ properties.put(LZOCheck.LZO_ENABLE_KEY, LZOCheck.LZO_ENABLE_VALUE);
+ check = new PrerequisiteCheck(null, null);
+ lZOCheck.perform(check, new PrereqCheckRequest("cluster"));
+ Assert.assertEquals(PrereqCheckStatus.WARNING, check.getStatus());
+
+ properties.put(LZOCheck.LZO_ENABLE_KEY, LZOCheck.LZO_ENABLE_VALUE);
+ properties.put(LZOCheck.IO_COMPRESSION_CODECS,"test," + LZOCheck.LZO_ENABLE_VALUE);
+ check = new PrerequisiteCheck(null, null);
+ lZOCheck.perform(check, new PrereqCheckRequest("cluster"));
+ Assert.assertEquals(PrereqCheckStatus.WARNING, check.getStatus());
+ }
+}
[02/50] [abbrv] ambari git commit: AMBARI-22379 :
get_phoenix_query_server_hosts is undefined in hbase service_advisor. (Ted Yu
via avijayan)
Posted by rl...@apache.org.
AMBARI-22379 : get_phoenix_query_server_hosts is undefined in hbase service_advisor. (Ted Yu via avijayan)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b04e142b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b04e142b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b04e142b
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: b04e142b3f80d4713ed154e17c0ab877d46500a4
Parents: 08d3826
Author: Aravindan Vijayan <av...@hortonworks.com>
Authored: Wed Nov 8 11:14:54 2017 -0800
Committer: Aravindan Vijayan <av...@hortonworks.com>
Committed: Wed Nov 8 11:14:54 2017 -0800
----------------------------------------------------------------------
.../common-services/HBASE/2.0.0.3.0/service_advisor.py | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/b04e142b/ambari-server/src/main/resources/common-services/HBASE/2.0.0.3.0/service_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HBASE/2.0.0.3.0/service_advisor.py b/ambari-server/src/main/resources/common-services/HBASE/2.0.0.3.0/service_advisor.py
index f9d1a59..9dc5708 100644
--- a/ambari-server/src/main/resources/common-services/HBASE/2.0.0.3.0/service_advisor.py
+++ b/ambari-server/src/main/resources/common-services/HBASE/2.0.0.3.0/service_advisor.py
@@ -461,6 +461,16 @@ class HBASERecommender(service_advisor.ServiceAdvisor):
else:
putHbaseSiteProperty('hbase.master.ui.readonly', 'false')
+ """
+ Returns the list of Phoenix Query Server host names, or None.
+ """
+ def get_phoenix_query_server_hosts(self, services, hosts):
+ if len(hosts['items']) > 0:
+ phoenix_query_server_hosts = self.getHostsWithComponent("HBASE", "PHOENIX_QUERY_SERVER", services, hosts)
+ if phoenix_query_server_hosts is None:
+ return []
+ return [host['Hosts']['host_name'] for host in phoenix_query_server_hosts]
+
def recommendHBASEConfigurationsFromHDP26(self, configurations, clusterData, services, hosts):
if 'hbase-env' in services['configurations'] and 'hbase_user' in services['configurations']['hbase-env']['properties']:
@@ -672,4 +682,4 @@ class HBASEValidator(service_advisor.ServiceAdvisor):
" {0} needs to contain {1} instead of {2}".format(prop_name,prop_val,exclude_val))})
validationProblems = self.toConfigurationValidationProblems(validationItems, "hbase-site")
- return validationProblems
\ No newline at end of file
+ return validationProblems
[33/50] [abbrv] ambari git commit: Revert "AMBARI-22383. Remove
Auto-Installation of LZO Libraries (ncole)"
Posted by rl...@apache.org.
Revert "AMBARI-22383. Remove Auto-Installation of LZO Libraries (ncole)"
This reverts commit 5adcea78792cf227f15e7c08f5bb3fe2c48883d3.
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ba00ed95
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ba00ed95
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ba00ed95
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: ba00ed956706cc80deff58f22799ed54a8bcadd8
Parents: 869e1aa
Author: Nate Cole <nc...@hortonworks.com>
Authored: Tue Nov 14 18:39:14 2017 -0500
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Tue Nov 14 18:39:14 2017 -0500
----------------------------------------------------------------------
.../libraries/functions/__init__.py | 1 +
.../libraries/functions/get_lzo_packages.py | 50 ++++++++++++++++++++
.../libraries/functions/package_conditions.py | 8 +++-
.../DRUID/0.10.1/package/scripts/druid.py | 3 +-
.../DRUID/0.10.1/package/scripts/params.py | 3 +-
.../common-services/HDFS/2.1.0.2.0/metainfo.xml | 30 ++++++++++++
.../HDFS/2.1.0.2.0/package/scripts/datanode.py | 1 +
.../HDFS/2.1.0.2.0/package/scripts/hdfs.py | 7 +++
.../2.1.0.2.0/package/scripts/hdfs_client.py | 1 +
.../2.1.0.2.0/package/scripts/install_params.py | 1 -
.../2.1.0.2.0/package/scripts/journalnode.py | 1 +
.../HDFS/2.1.0.2.0/package/scripts/namenode.py | 1 +
.../common-services/HDFS/3.0.0.3.0/metainfo.xml | 30 ++++++++++++
.../HDFS/3.0.0.3.0/package/scripts/hdfs.py | 7 +++
.../OOZIE/4.0.0.2.0/package/scripts/oozie.py | 6 ++-
.../package/scripts/oozie_server_upgrade.py | 7 +--
.../4.0.0.2.0/package/scripts/params_linux.py | 1 -
.../OOZIE/4.2.0.3.0/package/scripts/oozie.py | 4 ++
.../package/scripts/oozie_server_upgrade.py | 5 --
.../TEZ/0.4.0.2.1/package/scripts/tez_client.py | 32 +++++++++++++
.../TEZ/0.9.0.3.0/package/scripts/tez_client.py | 26 ++++++++++
.../custom_actions/scripts/remove_bits.py | 2 +-
.../BIGTOP/0.8/services/HDFS/metainfo.xml | 16 +++++++
.../0.8/services/HDFS/package/scripts/params.py | 6 ++-
.../stacks/HDP/2.2/services/HDFS/metainfo.xml | 35 ++++++++++++++
.../2.3.GlusterFS/services/HDFS/metainfo.xml | 10 ++++
.../stacks/HDP/2.3/services/HDFS/metainfo.xml | 30 ++++++++++++
.../stacks/HDP/3.0/services/HDFS/metainfo.xml | 30 ++++++++++++
.../python/custom_actions/TestRemoveBits.py | 5 +-
29 files changed, 339 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba00ed95/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py b/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py
index 1e388ac..f144b2d 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py
@@ -39,6 +39,7 @@ from resource_management.libraries.functions.version import *
from resource_management.libraries.functions.format_jvm_option import *
from resource_management.libraries.functions.constants import *
from resource_management.libraries.functions.get_stack_version import *
+from resource_management.libraries.functions.get_lzo_packages import *
from resource_management.libraries.functions.setup_ranger_plugin import *
from resource_management.libraries.functions.curl_krb_request import *
from resource_management.libraries.functions.get_bare_principal import *
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba00ed95/ambari-common/src/main/python/resource_management/libraries/functions/get_lzo_packages.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/get_lzo_packages.py b/ambari-common/src/main/python/resource_management/libraries/functions/get_lzo_packages.py
new file mode 100644
index 0000000..cfbb7d8
--- /dev/null
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/get_lzo_packages.py
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+"""
+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.
+
+Ambari Agent
+
+"""
+__all__ = ["get_lzo_packages"]
+
+from ambari_commons.os_check import OSCheck
+from resource_management.libraries.functions.stack_features import check_stack_feature
+from resource_management.libraries.functions import StackFeature
+from resource_management.libraries.script.script import Script
+
+# TODO: Make list of lzo packages stack driven
+def get_lzo_packages(stack_version_unformatted):
+ lzo_packages = []
+ script_instance = Script.get_instance()
+ if OSCheck.is_suse_family() and int(OSCheck.get_os_major_version()) >= 12:
+ lzo_packages += ["liblzo2-2", "hadoop-lzo-native"]
+ elif OSCheck.is_redhat_family() or OSCheck.is_suse_family():
+ lzo_packages += ["lzo", "hadoop-lzo-native"]
+ elif OSCheck.is_ubuntu_family():
+ lzo_packages += ["liblzo2-2"]
+
+ if stack_version_unformatted and check_stack_feature(StackFeature.ROLLING_UPGRADE, stack_version_unformatted):
+ if OSCheck.is_ubuntu_family():
+ lzo_packages += [script_instance.format_package_name("hadooplzo-${stack_version}") ,
+ script_instance.format_package_name("hadooplzo-${stack_version}-native")]
+ else:
+ lzo_packages += [script_instance.format_package_name("hadooplzo_${stack_version}"),
+ script_instance.format_package_name("hadooplzo_${stack_version}-native")]
+ else:
+ lzo_packages += ["hadoop-lzo"]
+
+ return lzo_packages
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba00ed95/ambari-common/src/main/python/resource_management/libraries/functions/package_conditions.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/package_conditions.py b/ambari-common/src/main/python/resource_management/libraries/functions/package_conditions.py
index ded63cf..31e78b9 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/package_conditions.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/package_conditions.py
@@ -19,7 +19,7 @@ limitations under the License.
Ambari Agent
"""
-__all__ = ["should_install_phoenix", "should_install_ams_collector", "should_install_ams_grafana",
+__all__ = ["is_lzo_enabled", "should_install_phoenix", "should_install_ams_collector", "should_install_ams_grafana",
"should_install_mysql", "should_install_ranger_tagsync"]
import os
@@ -44,6 +44,12 @@ def _has_local_components(config, components, indicator_function = any):
def _has_applicable_local_component(config, components):
return _has_local_components(config, components, any)
+def should_install_lzo():
+ config = Script.get_config()
+ io_compression_codecs = default("/configurations/core-site/io.compression.codecs", None)
+ lzo_enabled = io_compression_codecs is not None and "com.hadoop.compression.lzo" in io_compression_codecs.lower()
+ return lzo_enabled
+
def should_install_phoenix():
phoenix_hosts = default('/clusterHostInfo/phoenix_query_server_hosts', [])
phoenix_enabled = default('/configurations/hbase-env/phoenix_sql_enabled', False)
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba00ed95/ambari-server/src/main/resources/common-services/DRUID/0.10.1/package/scripts/druid.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/DRUID/0.10.1/package/scripts/druid.py b/ambari-server/src/main/resources/common-services/DRUID/0.10.1/package/scripts/druid.py
index bb872b9..ec98c3c 100644
--- a/ambari-server/src/main/resources/common-services/DRUID/0.10.1/package/scripts/druid.py
+++ b/ambari-server/src/main/resources/common-services/DRUID/0.10.1/package/scripts/druid.py
@@ -115,7 +115,8 @@ def druid(upgrade_type=None, nodeType=None):
)
Logger.info(format("Created druid-{node_type_lowercase} jvm.config"))
# Handling hadoop Lzo jars if enable and node type is hadoop related eg Overlords and MMs
- if ['middleManager', 'overlord'].__contains__(node_type_lowercase) and params.lzo_enabled:
+ if ['middleManager', 'overlord'].__contains__(node_type_lowercase) and params.lzo_enabled and len(
+ params.lzo_packages) > 0:
try:
Logger.info(
format(
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba00ed95/ambari-server/src/main/resources/common-services/DRUID/0.10.1/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/DRUID/0.10.1/package/scripts/params.py b/ambari-server/src/main/resources/common-services/DRUID/0.10.1/package/scripts/params.py
index 141250d..fd1cde6 100644
--- a/ambari-server/src/main/resources/common-services/DRUID/0.10.1/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/DRUID/0.10.1/package/scripts/params.py
@@ -18,6 +18,7 @@ limitations under the License.
"""
from ambari_commons import OSCheck
+from resource_management.libraries.functions.get_lzo_packages import get_lzo_packages
from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.resources.hdfs_resource import HdfsResource
@@ -195,5 +196,5 @@ if has_metric_collector:
stack_version_unformatted = str(config['hostLevelParams']['stack_version'])
io_compression_codecs = default("/configurations/core-site/io.compression.codecs", None)
lzo_enabled = io_compression_codecs is not None and "com.hadoop.compression.lzo" in io_compression_codecs.lower()
-
+lzo_packages = get_lzo_packages(stack_version_unformatted)
hadoop_lib_home = stack_root + '/' + stack_version + '/hadoop/lib'
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba00ed95/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml
index 6bbb583..9979de4 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml
@@ -244,6 +244,11 @@
<package>
<name>hadoop</name>
</package>
+ <package>
+ <name>hadoop-lzo</name>
+ <skipUpgrade>true</skipUpgrade>
+ <condition>should_install_lzo</condition>
+ </package>
</packages>
</osSpecific>
@@ -260,6 +265,16 @@
<name>snappy-devel</name>
</package>
<package>
+ <name>lzo</name>
+ <skipUpgrade>true</skipUpgrade>
+ <condition>should_install_lzo</condition>
+ </package>
+ <package>
+ <name>hadoop-lzo-native</name>
+ <skipUpgrade>true</skipUpgrade>
+ <condition>should_install_lzo</condition>
+ </package>
+ <package>
<name>hadoop-libhdfs</name>
</package>
<package>
@@ -281,6 +296,16 @@
<name>snappy-devel</name>
</package>
<package>
+ <name>liblzo2-2</name>
+ <skipUpgrade>true</skipUpgrade>
+ <condition>should_install_lzo</condition>
+ </package>
+ <package>
+ <name>hadoop-lzo-native</name>
+ <skipUpgrade>true</skipUpgrade>
+ <condition>should_install_lzo</condition>
+ </package>
+ <package>
<name>hadoop-libhdfs</name>
</package>
</packages>
@@ -299,6 +324,11 @@
<name>libsnappy-dev</name>
</package>
<package>
+ <name>liblzo2-2</name>
+ <skipUpgrade>true</skipUpgrade>
+ <condition>should_install_lzo</condition>
+ </package>
+ <package>
<name>hadoop-hdfs</name>
</package>
<package>
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba00ed95/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/datanode.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/datanode.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/datanode.py
index a8b0f48..c0abb15 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/datanode.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/datanode.py
@@ -165,6 +165,7 @@ class DataNodeDefault(DataNode):
@OsFamilyImpl(os_family=OSConst.WINSRV_FAMILY)
class DataNodeWindows(DataNode):
def install(self, env):
+ import install_params
self.install_packages(env)
if __name__ == "__main__":
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba00ed95/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs.py
index 1d7fe53..4022986 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs.py
@@ -26,6 +26,7 @@ from resource_management.core.source import Template
from resource_management.core.resources.service import ServiceConfig
from resource_management.libraries.resources.xml_config import XmlConfig
+from resource_management.libraries.functions.get_lzo_packages import get_lzo_packages
from resource_management.core.exceptions import Fail
from resource_management.core.logger import Logger
from resource_management.libraries.functions.format import format
@@ -142,6 +143,12 @@ def hdfs(name=None):
content=Template("slaves.j2")
)
+ if params.lzo_enabled:
+ lzo_packages = get_lzo_packages(params.stack_version_unformatted)
+ Package(lzo_packages,
+ retry_on_repo_unavailability=params.agent_stack_retry_on_unavailability,
+ retry_count=params.agent_stack_retry_count)
+
def install_snappy():
import params
Directory([params.so_target_dir_x86, params.so_target_dir_x64],
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba00ed95/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs_client.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs_client.py
index a802e08..f2e96c3 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs_client.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/hdfs_client.py
@@ -70,6 +70,7 @@ class HdfsClientDefault(HdfsClient):
@OsFamilyImpl(os_family=OSConst.WINSRV_FAMILY)
class HdfsClientWindows(HdfsClient):
def install(self, env):
+ import install_params
self.install_packages(env)
self.configure(env)
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba00ed95/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/install_params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/install_params.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/install_params.py
index 72850b3..235f231 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/install_params.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/install_params.py
@@ -18,7 +18,6 @@ limitations under the License.
"""
from ambari_commons import OSCheck
-exclude_packages = []
# These parameters are supposed to be referenced at installation time, before the Hadoop environment variables have been set
if OSCheck.is_windows_family():
exclude_packages = []
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba00ed95/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/journalnode.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/journalnode.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/journalnode.py
index eaa21e9..75b2eeb 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/journalnode.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/journalnode.py
@@ -116,6 +116,7 @@ class JournalNodeDefault(JournalNode):
@OsFamilyImpl(os_family=OSConst.WINSRV_FAMILY)
class JournalNodeWindows(JournalNode):
def install(self, env):
+ import install_params
self.install_packages(env)
def start(self, env):
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba00ed95/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py
index 5f4152d..291da05 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode.py
@@ -327,6 +327,7 @@ class NameNodeDefault(NameNode):
@OsFamilyImpl(os_family=OSConst.WINSRV_FAMILY)
class NameNodeWindows(NameNode):
def install(self, env):
+ import install_params
self.install_packages(env)
#TODO we need this for HA because of manual steps
self.configure(env)
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba00ed95/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/metainfo.xml b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/metainfo.xml
index 0c629f3..e6d1166 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/metainfo.xml
@@ -270,6 +270,11 @@
<package>
<name>hadoop</name>
</package>
+ <package>
+ <name>hadoop-lzo</name>
+ <skipUpgrade>true</skipUpgrade>
+ <condition>should_install_lzo</condition>
+ </package>
</packages>
</osSpecific>
@@ -286,6 +291,16 @@
<name>snappy-devel</name>
</package>
<package>
+ <name>lzo</name>
+ <skipUpgrade>true</skipUpgrade>
+ <condition>should_install_lzo</condition>
+ </package>
+ <package>
+ <name>hadoop-lzo-native</name>
+ <skipUpgrade>true</skipUpgrade>
+ <condition>should_install_lzo</condition>
+ </package>
+ <package>
<name>hadoop-libhdfs</name>
</package>
</packages>
@@ -304,6 +319,16 @@
<name>snappy-devel</name>
</package>
<package>
+ <name>liblzo2-2</name>
+ <skipUpgrade>true</skipUpgrade>
+ <condition>should_install_lzo</condition>
+ </package>
+ <package>
+ <name>hadoop-lzo-native</name>
+ <skipUpgrade>true</skipUpgrade>
+ <condition>should_install_lzo</condition>
+ </package>
+ <package>
<name>hadoop-libhdfs</name>
</package>
</packages>
@@ -322,6 +347,11 @@
<name>libsnappy-dev</name>
</package>
<package>
+ <name>liblzo2-2</name>
+ <skipUpgrade>true</skipUpgrade>
+ <condition>should_install_lzo</condition>
+ </package>
+ <package>
<name>hadoop-hdfs</name>
</package>
<package>
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba00ed95/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/hdfs.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/hdfs.py b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/hdfs.py
index 89f9a1c..4022986 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/hdfs.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/hdfs.py
@@ -26,6 +26,7 @@ from resource_management.core.source import Template
from resource_management.core.resources.service import ServiceConfig
from resource_management.libraries.resources.xml_config import XmlConfig
+from resource_management.libraries.functions.get_lzo_packages import get_lzo_packages
from resource_management.core.exceptions import Fail
from resource_management.core.logger import Logger
from resource_management.libraries.functions.format import format
@@ -141,6 +142,12 @@ def hdfs(name=None):
owner=tc_owner,
content=Template("slaves.j2")
)
+
+ if params.lzo_enabled:
+ lzo_packages = get_lzo_packages(params.stack_version_unformatted)
+ Package(lzo_packages,
+ retry_on_repo_unavailability=params.agent_stack_retry_on_unavailability,
+ retry_count=params.agent_stack_retry_count)
def install_snappy():
import params
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba00ed95/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie.py b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie.py
index cd94244..f215a1e 100644
--- a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie.py
+++ b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie.py
@@ -37,6 +37,7 @@ from resource_management.libraries.functions.copy_tarball import get_current_ver
from resource_management.libraries.resources.xml_config import XmlConfig
from resource_management.libraries.script.script import Script
from resource_management.libraries.functions.security_commons import update_credential_provider_path
+from resource_management.libraries.functions.get_lzo_packages import get_lzo_packages
from resource_management.core.resources.packaging import Package
from resource_management.core.shell import as_user, as_sudo, call, checked_call
from resource_management.core.exceptions import Fail
@@ -305,8 +306,11 @@ def oozie_server_specific(upgrade_type):
Execute(format('{sudo} chown {oozie_user}:{user_group} {oozie_libext_dir}/falcon-oozie-el-extension-*.jar'),
not_if = no_op_test)
- # just copying files is ok - we're not making assumptions about installing LZO here
if params.lzo_enabled:
+ all_lzo_packages = get_lzo_packages(params.stack_version_unformatted)
+ Package(all_lzo_packages,
+ retry_on_repo_unavailability=params.agent_stack_retry_on_unavailability,
+ retry_count=params.agent_stack_retry_count)
Execute(format('{sudo} cp {hadoop_lib_home}/hadoop-lzo*.jar {oozie_lib_dir}'),
not_if = no_op_test,
)
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba00ed95/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_server_upgrade.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_server_upgrade.py b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_server_upgrade.py
index c9c07d1..23b39ef 100644
--- a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_server_upgrade.py
+++ b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_server_upgrade.py
@@ -61,15 +61,10 @@ class OozieUpgrade(Script):
# <stack-selector-tool> set hadoop-client has not run yet, therefore we cannot use
# <stack-root>/current/hadoop-client ; we must use params.version directly
# however, this only works when upgrading beyond 2.2.0.0; don't do this
- # for downgrade to 2.2.0.0 since hadoop-lzo will not be present.
- #
+ # for downgrade to 2.2.0.0 since hadoop-lzo will not be present
# This can also be called during a Downgrade.
- #
# When a version is Installed, it is responsible for downloading the hadoop-lzo packages
# if lzo is enabled.
- #
- # This block is just copying around files - there is no assumption about installation
- #
if params.lzo_enabled and (params.upgrade_direction == Direction.UPGRADE or target_version_needs_compression_libraries):
hadoop_lzo_pattern = 'hadoop-lzo*.jar'
hadoop_client_new_lib_dir = format("{stack_root}/{version}/hadoop/lib")
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba00ed95/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/params_linux.py
index 40901b6..a0f0672 100644
--- a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/params_linux.py
@@ -387,4 +387,3 @@ is_webhdfs_enabled = config['configurations']['hdfs-site']['dfs.webhdfs.enabled'
# The logic for LZO also exists in HDFS' params.py
io_compression_codecs = default("/configurations/core-site/io.compression.codecs", None)
lzo_enabled = io_compression_codecs is not None and "com.hadoop.compression.lzo" in io_compression_codecs.lower()
-
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba00ed95/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie.py b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie.py
index 19912fd..0771e93 100644
--- a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie.py
+++ b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie.py
@@ -276,6 +276,10 @@ def oozie_server_specific():
not_if = no_op_test)
if params.lzo_enabled:
+ all_lzo_packages = get_lzo_packages(params.stack_version_unformatted)
+ Package(all_lzo_packages,
+ retry_on_repo_unavailability=params.agent_stack_retry_on_unavailability,
+ retry_count=params.agent_stack_retry_count)
Execute(format('{sudo} cp {hadoop_lib_home}/hadoop-lzo*.jar {oozie_lib_dir}'),
not_if = no_op_test,
)
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba00ed95/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie_server_upgrade.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie_server_upgrade.py b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie_server_upgrade.py
index 4fc1a42..402c7cb 100644
--- a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie_server_upgrade.py
+++ b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/package/scripts/oozie_server_upgrade.py
@@ -62,14 +62,9 @@ class OozieUpgrade(Script):
# <stack-root>/current/hadoop-client ; we must use params.version directly
# however, this only works when upgrading beyond 2.2.0.0; don't do this
# for downgrade to 2.2.0.0 since hadoop-lzo will not be present
- #
# This can also be called during a Downgrade.
- #
# When a version is Installed, it is responsible for downloading the hadoop-lzo packages
# if lzo is enabled.
- #
- # This block is just copying around files - there is no assumption about installation
- #
if params.lzo_enabled and (params.upgrade_direction == Direction.UPGRADE or target_version_needs_compression_libraries):
hadoop_lzo_pattern = 'hadoop-lzo*.jar'
hadoop_client_new_lib_dir = format("{stack_root}/{version}/hadoop/lib")
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba00ed95/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/tez_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/tez_client.py b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/tez_client.py
index dcf3e24..ed3f5fd 100644
--- a/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/tez_client.py
+++ b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/tez_client.py
@@ -19,15 +19,22 @@ Ambari Agent
"""
import os
+import urlparse
from ambari_commons import OSConst
+from ambari_commons.inet_utils import download_file
from ambari_commons.os_family_impl import OsFamilyImpl
+from ambari_commons.os_utils import copy_file, extract_path_component
from resource_management.core.exceptions import ClientComponentHasNoStatus
+from resource_management.core.source import InlineTemplate
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
+from resource_management.libraries.functions.get_stack_version import get_stack_version
from resource_management.libraries.script.script import Script
+from resource_management.libraries.functions.default import default
+from resource_management.core.logger import Logger
from tez import tez
@@ -89,8 +96,33 @@ class TezClientWindows(TezClient):
self.install_packages(env)
params.refresh_tez_state_dependent_params()
env.set_params(params)
+ self._install_lzo_support_if_needed(params)
self.configure(env, config_dir=params.tez_conf_dir)
+ def _install_lzo_support_if_needed(self, params):
+ hadoop_classpath_prefix = self._expand_hadoop_classpath_prefix(params.hadoop_classpath_prefix_template, params.config['configurations']['tez-site'])
+
+ hadoop_lzo_dest_path = extract_path_component(hadoop_classpath_prefix, "hadoop-lzo-")
+ if hadoop_lzo_dest_path:
+ hadoop_lzo_file = os.path.split(hadoop_lzo_dest_path)[1]
+
+ config = Script.get_config()
+ file_url = urlparse.urljoin(config['hostLevelParams']['jdk_location'], hadoop_lzo_file)
+ hadoop_lzo_dl_path = os.path.join(config["hostLevelParams"]["agentCacheDir"], hadoop_lzo_file)
+ download_file(file_url, hadoop_lzo_dl_path)
+ #This is for protection against configuration changes. It will infect every new destination with the lzo jar,
+ # but since the classpath points to the jar directly we're getting away with it.
+ if not os.path.exists(hadoop_lzo_dest_path):
+ copy_file(hadoop_lzo_dl_path, hadoop_lzo_dest_path)
+
+ def _expand_hadoop_classpath_prefix(self, hadoop_classpath_prefix_template, configurations):
+ import resource_management
+
+ hadoop_classpath_prefix_obj = InlineTemplate(hadoop_classpath_prefix_template, configurations_dict=configurations,
+ extra_imports=[resource_management, resource_management.core,
+ resource_management.core.source])
+ hadoop_classpath_prefix = hadoop_classpath_prefix_obj.get_content()
+ return hadoop_classpath_prefix
if __name__ == "__main__":
TezClient().execute()
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba00ed95/ambari-server/src/main/resources/common-services/TEZ/0.9.0.3.0/package/scripts/tez_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/TEZ/0.9.0.3.0/package/scripts/tez_client.py b/ambari-server/src/main/resources/common-services/TEZ/0.9.0.3.0/package/scripts/tez_client.py
index 0dfab4f..b42d14e 100644
--- a/ambari-server/src/main/resources/common-services/TEZ/0.9.0.3.0/package/scripts/tez_client.py
+++ b/ambari-server/src/main/resources/common-services/TEZ/0.9.0.3.0/package/scripts/tez_client.py
@@ -98,7 +98,33 @@ class TezClientWindows(TezClient):
self.install_packages(env)
params.refresh_tez_state_dependent_params()
env.set_params(params)
+ self._install_lzo_support_if_needed(params)
self.configure(env, config_dir=params.tez_conf_dir)
+ def _install_lzo_support_if_needed(self, params):
+ hadoop_classpath_prefix = self._expand_hadoop_classpath_prefix(params.hadoop_classpath_prefix_template, params.config['configurations']['tez-site'])
+
+ hadoop_lzo_dest_path = extract_path_component(hadoop_classpath_prefix, "hadoop-lzo-")
+ if hadoop_lzo_dest_path:
+ hadoop_lzo_file = os.path.split(hadoop_lzo_dest_path)[1]
+
+ config = Script.get_config()
+ file_url = urlparse.urljoin(config['hostLevelParams']['jdk_location'], hadoop_lzo_file)
+ hadoop_lzo_dl_path = os.path.join(config["hostLevelParams"]["agentCacheDir"], hadoop_lzo_file)
+ download_file(file_url, hadoop_lzo_dl_path)
+ #This is for protection against configuration changes. It will infect every new destination with the lzo jar,
+ # but since the classpath points to the jar directly we're getting away with it.
+ if not os.path.exists(hadoop_lzo_dest_path):
+ copy_file(hadoop_lzo_dl_path, hadoop_lzo_dest_path)
+
+ def _expand_hadoop_classpath_prefix(self, hadoop_classpath_prefix_template, configurations):
+ import resource_management
+
+ hadoop_classpath_prefix_obj = InlineTemplate(hadoop_classpath_prefix_template, configurations_dict=configurations,
+ extra_imports=[resource_management, resource_management.core,
+ resource_management.core.source])
+ hadoop_classpath_prefix = hadoop_classpath_prefix_obj.get_content()
+ return hadoop_classpath_prefix
+
if __name__ == "__main__":
TezClient().execute()
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba00ed95/ambari-server/src/main/resources/custom_actions/scripts/remove_bits.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/custom_actions/scripts/remove_bits.py b/ambari-server/src/main/resources/custom_actions/scripts/remove_bits.py
index 078cf32..0be9a34 100644
--- a/ambari-server/src/main/resources/custom_actions/scripts/remove_bits.py
+++ b/ambari-server/src/main/resources/custom_actions/scripts/remove_bits.py
@@ -43,7 +43,7 @@ class RemoveBits(Script):
Logger.info("Attempting to remove bits for HDP 2.1")
config = Script.get_config()
- packages_to_remove = ["zookeeper", "hadoop", "hadoop-hdfs", "hadoop-libhdfs", "hadoop-yarn", "hadoop-client", "hadoop-mapreduce", "hive", "hive-hcatalog", "hive-jdbc", "hive-webhcat", "hcatalog", "webhcat-tar-hive", "webhcat-tar-pig", "oozie", "oozie-client", "pig", "sqoop", "tez" "falcon", "storm", "flume", "hbase", "phoenix"]
+ packages_to_remove = ["zookeeper", "hadoop", "hadoop-lzo", "hadoop-hdfs", "hadoop-libhdfs", "hadoop-yarn", "hadoop-client", "hadoop-mapreduce", "hive", "hive-hcatalog", "hive-jdbc", "hive-webhcat", "hcatalog", "webhcat-tar-hive", "webhcat-tar-pig", "oozie", "oozie-client", "pig", "sqoop", "tez" "falcon", "storm", "flume", "hbase", "phoenix"]
packages_to_remove.reverse()
Logger.info("Packages to remove: {0}".format(" ".join(packages_to_remove)))
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba00ed95/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/metainfo.xml b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/metainfo.xml
index f473598..8500839 100644
--- a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/metainfo.xml
@@ -180,6 +180,10 @@
<package>
<name>hadoop</name>
</package>
+ <package>
+ <name>hadoop-lzo</name>
+ <skipUpgrade>true</skipUpgrade>
+ </package>
</packages>
</osSpecific>
@@ -193,6 +197,14 @@
<name>snappy-devel</name>
</package>
<package>
+ <name>lzo</name>
+ <skipUpgrade>true</skipUpgrade>
+ </package>
+ <package>
+ <name>hadoop-lzo-native</name>
+ <skipUpgrade>true</skipUpgrade>
+ </package>
+ <package>
<name>hadoop-libhdfs</name>
</package>
</packages>
@@ -208,6 +220,10 @@
<name>libsnappy-dev</name>
</package>
<package>
+ <name>liblzo2-2</name>
+ <skipUpgrade>true</skipUpgrade>
+ </package>
+ <package>
<name>hadoop-hdfs</name>
</package>
<package>
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba00ed95/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/package/scripts/params.py b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/package/scripts/params.py
index f16242c..3a711c7 100644
--- a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/package/scripts/params.py
+++ b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/package/scripts/params.py
@@ -209,7 +209,11 @@ HdfsDirectory = functools.partial(
bin_dir = hadoop_bin_dir
)
-exclude_packages = []
+io_compression_codecs = config['configurations']['core-site']['io.compression.codecs']
+if not "com.hadoop.compression.lzo" in io_compression_codecs:
+ exclude_packages = ["lzo", "hadoop-lzo", "hadoop-lzo-native", "liblzo2-2"]
+else:
+ exclude_packages = []
name_node_params = default("/commandParams/namenode", None)
#hadoop params
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba00ed95/ambari-server/src/main/resources/stacks/HDP/2.2/services/HDFS/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HDFS/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HDFS/metainfo.xml
index d7221b9..8c2ec8b 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HDFS/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HDFS/metainfo.xml
@@ -40,6 +40,19 @@
<name>snappy-devel</name>
</package>
<package>
+ <name>lzo</name>
+ <skipUpgrade>true</skipUpgrade>
+ <condition>should_install_lzo</condition>
+ </package>
+ <package>
+ <name>hadooplzo_${stack_version}</name>
+ <condition>should_install_lzo</condition>
+ </package>
+ <package>
+ <name>hadooplzo_${stack_version}-native</name>
+ <condition>should_install_lzo</condition>
+ </package>
+ <package>
<name>hadoop_${stack_version}-libhdfs</name>
</package>
<package>
@@ -64,6 +77,19 @@
<name>snappy-devel</name>
</package>
<package>
+ <name>liblzo2-2</name>
+ <skipUpgrade>true</skipUpgrade>
+ <condition>should_install_lzo</condition>
+ </package>
+ <package>
+ <name>hadooplzo_${stack_version}</name>
+ <condition>should_install_lzo</condition>
+ </package>
+ <package>
+ <name>hadooplzo_${stack_version}-native</name>
+ <condition>should_install_lzo</condition>
+ </package>
+ <package>
<name>hadoop_${stack_version}-libhdfs</name>
</package>
</packages>
@@ -97,6 +123,15 @@
<name>libsnappy-dev</name>
</package>
<package>
+ <name>hadooplzo-${stack_version}</name>
+ <condition>should_install_lzo</condition>
+ </package>
+ <package>
+ <name>liblzo2-2</name>
+ <skipUpgrade>true</skipUpgrade>
+ <condition>should_install_lzo</condition>
+ </package>
+ <package>
<name>libhdfs0-${stack_version}</name>
</package>
</packages>
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba00ed95/ambari-server/src/main/resources/stacks/HDP/2.3.GlusterFS/services/HDFS/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3.GlusterFS/services/HDFS/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.3.GlusterFS/services/HDFS/metainfo.xml
index 6a9fab61..15fe931 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3.GlusterFS/services/HDFS/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3.GlusterFS/services/HDFS/metainfo.xml
@@ -36,6 +36,13 @@
<name>snappy-devel</name>
</package>
<package>
+ <name>lzo</name>
+ <skipUpgrade>true</skipUpgrade>
+ </package>
+ <package>
+ <name>hadooplzo_2_3_*</name>
+ </package>
+ <package>
<name>hadoop_2_3_*-libhdfs</name>
</package>
</packages>
@@ -69,6 +76,9 @@
<name>libsnappy-dev</name>
</package>
<package>
+ <name>hadooplzo-2-3-.*</name>
+ </package>
+ <package>
<name>libhdfs0-2-3-.*</name>
</package>
</packages>
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba00ed95/ambari-server/src/main/resources/stacks/HDP/2.3/services/HDFS/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/HDFS/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/services/HDFS/metainfo.xml
index 86531cc..ccf9a4e 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/HDFS/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/HDFS/metainfo.xml
@@ -72,6 +72,19 @@
<name>snappy-devel</name>
</package>
<package>
+ <name>lzo</name>
+ <skipUpgrade>true</skipUpgrade>
+ <condition>should_install_lzo</condition>
+ </package>
+ <package>
+ <name>hadooplzo_${stack_version}</name>
+ <condition>should_install_lzo</condition>
+ </package>
+ <package>
+ <name>hadooplzo_${stack_version}-native</name>
+ <condition>should_install_lzo</condition>
+ </package>
+ <package>
<name>hadoop_${stack_version}-libhdfs</name>
</package>
<package>
@@ -96,6 +109,19 @@
<name>snappy-devel</name>
</package>
<package>
+ <name>liblzo2-2</name>
+ <skipUpgrade>true</skipUpgrade>
+ <condition>should_install_lzo</condition>
+ </package>
+ <package>
+ <name>hadooplzo_${stack_version}</name>
+ <condition>should_install_lzo</condition>
+ </package>
+ <package>
+ <name>hadooplzo_${stack_version}-native</name>
+ <condition>should_install_lzo</condition>
+ </package>
+ <package>
<name>hadoop_${stack_version}-libhdfs</name>
</package>
</packages>
@@ -129,6 +155,10 @@
<name>libsnappy-dev</name>
</package>
<package>
+ <name>hadooplzo-${stack_version}</name>
+ <condition>should_install_lzo</condition>
+ </package>
+ <package>
<name>libhdfs0-${stack_version}</name>
</package>
</packages>
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba00ed95/ambari-server/src/main/resources/stacks/HDP/3.0/services/HDFS/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/3.0/services/HDFS/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/3.0/services/HDFS/metainfo.xml
index 775508e..95a5f84 100644
--- a/ambari-server/src/main/resources/stacks/HDP/3.0/services/HDFS/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/3.0/services/HDFS/metainfo.xml
@@ -50,6 +50,19 @@
<name>snappy-devel</name>
</package>
<package>
+ <name>lzo</name>
+ <skipUpgrade>true</skipUpgrade>
+ <condition>should_install_lzo</condition>
+ </package>
+ <package>
+ <name>hadooplzo_${stack_version}</name>
+ <condition>should_install_lzo</condition>
+ </package>
+ <package>
+ <name>hadooplzo_${stack_version}-native</name>
+ <condition>should_install_lzo</condition>
+ </package>
+ <package>
<name>hadoop_${stack_version}-libhdfs</name>
</package>
</packages>
@@ -71,6 +84,19 @@
<name>snappy-devel</name>
</package>
<package>
+ <name>liblzo2-2</name>
+ <skipUpgrade>true</skipUpgrade>
+ <condition>should_install_lzo</condition>
+ </package>
+ <package>
+ <name>hadooplzo_${stack_version}</name>
+ <condition>should_install_lzo</condition>
+ </package>
+ <package>
+ <name>hadooplzo_${stack_version}-native</name>
+ <condition>should_install_lzo</condition>
+ </package>
+ <package>
<name>hadoop_${stack_version}-libhdfs</name>
</package>
</packages>
@@ -104,6 +130,10 @@
<name>libsnappy-dev</name>
</package>
<package>
+ <name>hadooplzo-${stack_version}</name>
+ <condition>should_install_lzo</condition>
+ </package>
+ <package>
<name>libhdfs0-${stack_version}</name>
</package>
</packages>
http://git-wip-us.apache.org/repos/asf/ambari/blob/ba00ed95/ambari-server/src/test/python/custom_actions/TestRemoveBits.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/custom_actions/TestRemoveBits.py b/ambari-server/src/test/python/custom_actions/TestRemoveBits.py
index 8217ca0..6537152 100644
--- a/ambari-server/src/test/python/custom_actions/TestRemoveBits.py
+++ b/ambari-server/src/test/python/custom_actions/TestRemoveBits.py
@@ -105,10 +105,13 @@ class TestRemoveBits(RMFTestCase):
self.assertResourceCalled('Package', 'hadoop-hdfs',
action = ['remove'],
)
+ self.assertResourceCalled('Package', 'hadoop-lzo',
+ action = ['remove'],
+ )
self.assertResourceCalled('Package', 'hadoop',
action = ['remove'],
)
self.assertResourceCalled('Package', 'zookeeper',
action = ['remove'],
)
- self.assertNoMoreResources()
+ self.assertNoMoreResources()
\ No newline at end of file
[50/50] [abbrv] ambari git commit: Merge branch 'trunk' into
branch-feature-AMBARI-20859
Posted by rl...@apache.org.
Merge branch 'trunk' into branch-feature-AMBARI-20859
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d173011c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d173011c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d173011c
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: d173011c8b52d99708c842a6d6263b09695b128c
Parents: ceead22 365c91e
Author: Robert Levas <rl...@hortonworks.com>
Authored: Thu Nov 16 14:44:35 2017 -0500
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Thu Nov 16 14:45:02 2017 -0500
----------------------------------------------------------------------
.gitignore | 3 +
ambari-admin/pom.xml | 2 +-
.../app/assets/fonts/Roboto-Regular-webfont.eot | Bin 0 -> 79547 bytes
.../app/assets/fonts/Roboto-Regular-webfont.svg | 7606 ++++++
.../app/assets/fonts/Roboto-Regular-webfont.ttf | Bin 0 -> 234464 bytes
.../assets/fonts/Roboto-Regular-webfont.woff | Bin 0 -> 105700 bytes
.../main/resources/ui/admin-web/app/index.html | 82 +-
.../app/scripts/controllers/AppCtrl.js | 177 +
.../controllers/ClusterInformationCtrl.js | 65 +
.../app/scripts/controllers/NavbarCtrl.js | 106 -
.../app/scripts/controllers/SideNavCtrl.js | 68 +
.../ambariViews/CloneViewInstanceCtrl.js | 274 +
.../ambariViews/CreateViewInstanceCtrl.js | 353 +-
.../controllers/ambariViews/ViewsListCtrl.js | 360 +-
.../controllers/clusters/ExportBlueprintCtrl.js | 58 -
.../app/scripts/controllers/mainCtrl.js | 183 -
.../ui/admin-web/app/scripts/i18n.config.js | 38 +-
.../ui/admin-web/app/scripts/routes.js | 134 +-
.../ui/admin-web/app/scripts/services/View.js | 32 +-
.../app/scripts/theme/bootstrap-ambari.js | 269 +
.../app/styles/cluster-information.css | 59 +
.../resources/ui/admin-web/app/styles/main.css | 581 +-
.../app/styles/theme/bootstrap-ambari.css | 1518 ++
.../ui/admin-web/app/styles/top-nav.css | 200 +
.../resources/ui/admin-web/app/styles/views.css | 49 +
.../admin-web/app/views/ambariViews/create.html | 20 +-
.../admin-web/app/views/ambariViews/edit.html | 37 +-
.../app/views/ambariViews/listTable.html | 110 -
.../app/views/ambariViews/listUrls.html | 117 -
.../app/views/ambariViews/modals/create.html | 238 +-
.../app/views/ambariViews/modals/edit.html | 138 -
.../app/views/ambariViews/viewsList.html | 134 +
.../app/views/authentication/main.html | 8 +-
.../admin-web/app/views/clusterInformation.html | 66 +
.../app/views/clusters/exportBlueprint.html | 40 -
.../ui/admin-web/app/views/groups/list.html | 7 +-
.../ui/admin-web/app/views/leftNavbar.html | 126 -
.../resources/ui/admin-web/app/views/main.html | 96 -
.../app/views/modals/AddVersionModal.html | 14 +-
.../app/views/remoteClusters/list.html | 6 +-
.../ui/admin-web/app/views/sideNav.html | 113 +
.../admin-web/app/views/stackVersions/list.html | 19 +-
.../views/stackVersions/stackVersionPage.html | 27 +-
.../ui/admin-web/app/views/urls/create.html | 4 +-
.../ui/admin-web/app/views/urls/edit.html | 4 +-
.../ui/admin-web/app/views/users/list.html | 7 +-
.../src/main/resources/ui/admin-web/bower.json | 2 +-
.../src/main/resources/ui/admin-web/gulpfile.js | 10 +-
.../main/resources/ui/admin-web/package.json | 6 +-
.../test/unit/controllers/AppCtrl_test.js | 211 +
.../unit/controllers/CloneViewInstanceCtrl.js | 135 +
.../unit/controllers/CreateViewInstanceCtrl.js | 135 -
.../test/unit/controllers/mainCtrl_test.js | 215 -
.../test/unit/services/Utility_test.js | 3 +-
.../src/main/python/ambari_agent/ActionQueue.py | 5 +-
.../src/main/python/ambari_agent/AmbariAgent.py | 3 -
.../python/ambari_agent/alerts/base_alert.py | 2 +-
.../test/python/ambari_agent/TestAmbariAgent.py | 4 +-
.../core/providers/package/__init__.py | 2 +-
.../core/providers/package/apt.py | 23 +-
.../core/providers/package/yumrpm.py | 83 +-
.../core/providers/package/zypper.py | 37 +-
.../libraries/functions/conf_select.py | 58 +
.../libraries/functions/copy_tarball.py | 102 +-
.../libraries/functions/curl_krb_request.py | 22 +-
.../libraries/functions/package_conditions.py | 6 +-
.../libraries/functions/repository_util.py | 79 +-
.../libraries/functions/stack_select.py | 3 +-
.../libraries/functions/tar_archive.py | 6 +-
.../libraries/script/script.py | 4 +-
ambari-funtest/pom.xml | 67 -
.../solr/AmbariSolrCloudClientBuilder.java | 4 +-
.../solr/commands/CreateCollectionCommand.java | 12 +-
.../infra/solr/commands/CreateShardCommand.java | 5 +-
.../infra/solr/commands/GetShardsCommand.java | 2 +-
ambari-infra/pom.xml | 2 +-
ambari-logsearch/README.md | 27 +-
.../ambari-logsearch-logfeeder/README.md | 17 +-
.../ambari-logsearch-logfeeder/pom.xml | 6 +-
.../ambari/logfeeder/input/InputFile.java | 4 +-
.../logfeeder/metrics/LogFeederAMSClient.java | 3 +
.../logfeeder/metrics/MetricsManager.java | 8 +-
.../src/main/resources/log-samples/.gitignore | 4 +
.../log-samples/logs/service_sample.txt | 3 +
.../log-samples/shipper-conf/global.config.json | 10 +
.../shipper-conf/input.config-sample.json | 31 +
.../shipper-conf/output.config-sample.json | 34 +
.../src/main/resources/log4j.xml | 4 +-
.../src/main/resources/logfeeder.properties | 31 +-
.../logfeeder/metrics/MetricsManagerTest.java | 10 +-
.../ambari-logsearch-server/.gitignore | 1 +
.../ambari-logsearch-server/README.md | 44 +-
.../ambari-logsearch-server/pom.xml | 2 +-
ambari-logsearch/ambari-logsearch-server/run.sh | 2 +-
.../ambari/logsearch/conf/AuthPropsConfig.java | 18 +
.../ambari/logsearch/conf/SecurityConfig.java | 6 +-
.../LogsearchAuthenticationEntryPoint.java | 2 +-
.../src/main/resources/logsearch.properties | 54 +-
.../ambari-logsearch-web/src/app/app.module.ts | 12 +-
.../src/app/classes/filtering.ts | 355 +-
.../src/app/classes/models/app-state.ts | 6 +-
.../src/app/classes/models/node-item.ts | 30 +
.../src/app/classes/models/node.ts | 30 -
.../src/app/classes/models/store.ts | 6 +-
.../src/app/classes/models/tab.ts | 12 +-
.../action-menu/action-menu.component.html | 20 +
.../action-menu/action-menu.component.less | 27 +
.../action-menu/action-menu.component.spec.ts | 47 +
.../action-menu/action-menu.component.ts | 105 +
.../src/app/components/app.component.html | 4 +-
.../src/app/components/app.component.less | 5 +-
.../src/app/components/app.component.spec.ts | 4 +-
.../src/app/components/app.component.ts | 6 +-
.../dropdown-button.component.html | 4 +-
.../dropdown-button.component.spec.ts | 6 +-
.../dropdown-button.component.ts | 55 +-
.../dropdown-list/dropdown-list.component.html | 2 +-
.../dropdown-list.component.spec.ts | 10 +-
.../filter-button.component.spec.ts | 6 +-
.../filter-button/filter-button.component.ts | 35 +-
.../filter-dropdown.component.spec.ts | 18 +-
.../filter-dropdown.component.ts | 22 +-
.../filters-panel/filters-panel.component.html | 6 +-
.../filters-panel.component.spec.ts | 6 +-
.../filters-panel/filters-panel.component.ts | 18 +-
.../log-context/log-context.component.spec.ts | 4 +-
.../log-level/log-level.component.html | 18 +
.../log-level/log-level.component.spec.ts | 73 +
.../components/log-level/log-level.component.ts | 52 +
.../log-message/log-message.component.html | 24 +
.../log-message/log-message.component.less | 69 +
.../log-message/log-message.component.spec.ts | 64 +
.../log-message/log-message.component.ts | 129 +
.../login-form/login-form.component.spec.ts | 7 +-
.../login-form/login-form.component.ts | 34 +-
.../logs-container.component.html | 58 +-
.../logs-container.component.less | 3 +
.../logs-container.component.spec.ts | 2 -
.../logs-container/logs-container.component.ts | 26 +-
.../logs-list/logs-list.component.html | 95 +-
.../logs-list/logs-list.component.less | 130 +-
.../logs-list/logs-list.component.spec.ts | 21 +-
.../components/logs-list/logs-list.component.ts | 10 +-
.../main-container.component.html | 2 +-
.../menu-button/menu-button.component.html | 17 +-
.../menu-button/menu-button.component.less | 22 +-
.../menu-button/menu-button.component.spec.ts | 6 +-
.../menu-button/menu-button.component.ts | 146 +-
.../src/app/components/mixins.less | 5 +
.../pagination-controls.component.html | 15 +-
.../pagination-controls.component.spec.ts | 101 +
.../pagination-controls.component.ts | 76 +-
.../pagination/pagination.component.html | 2 +-
.../pagination/pagination.component.spec.ts | 9 +-
.../pagination/pagination.component.ts | 10 +-
.../search-box/search-box.component.ts | 12 +-
.../time-range-picker.component.html | 3 +-
.../time-range-picker.component.spec.ts | 29 +-
.../time-range-picker.component.ts | 47 +-
.../timezone-picker.component.spec.ts | 6 +-
.../components/top-menu/top-menu.component.html | 10 +-
.../components/top-menu/top-menu.component.less | 1 +
.../components/top-menu/top-menu.component.ts | 86 +-
.../src/app/components/variables.less | 3 +
.../ambari-logsearch-web/src/app/mock-data.ts | 3 +-
.../src/app/services/auth.service.spec.ts | 133 +
.../src/app/services/auth.service.ts | 123 +
.../services/component-actions.service.spec.ts | 6 +-
.../app/services/component-actions.service.ts | 42 +-
.../component-generator.service.spec.ts | 2 -
.../src/app/services/filtering.service.spec.ts | 97 -
.../src/app/services/filtering.service.ts | 253 -
.../app/services/logs-container.service.spec.ts | 31 +-
.../src/app/services/logs-container.service.ts | 678 +-
.../src/app/services/utils.service.spec.ts | 285 +-
.../src/app/services/utils.service.ts | 65 +-
.../src/assets/i18n/en.json | 1 +
.../ambari-logsearch-web/webpack.config.js | 15 +-
ambari-logsearch/docker/.gitignore | 1 +
ambari-logsearch/docker/Dockerfile | 19 +-
ambari-logsearch/docker/all.yml | 40 +
ambari-logsearch/docker/bin/start.sh | 92 +-
ambari-logsearch/docker/docker-compose.yml | 89 +
ambari-logsearch/docker/logsearch-docker.sh | 51 +-
ambari-logsearch/docker/logsearch-logfeeder.yml | 35 +
ambari-logsearch/docker/logsearch-server.yml | 35 +
ambari-logsearch/docker/solr.yml | 34 +
ambari-logsearch/docker/zookeeper.yml | 52 +
ambari-logsearch/pom.xml | 3 +-
ambari-project/pom.xml | 52 +-
.../docs/security/kerberos/kerberos_service.md | 22 +-
ambari-server/pom.xml | 95 +-
.../ambari/server/agent/CommandRepository.java | 85 +
.../ambari/server/agent/ExecutionCommand.java | 35 +-
.../ambari/server/agent/HeartbeatProcessor.java | 72 +-
.../api/handlers/BaseManagementHandler.java | 8 -
.../server/api/handlers/CreateHandler.java | 4 +
.../resources/ResourceInstanceFactoryImpl.java | 5 +
.../RootServiceComponentResourceDefinition.java | 9 +-
.../server/api/services/AmbariMetaInfo.java | 4 +-
.../ambari/server/api/services/BaseService.java | 5 +-
.../server/api/services/LoggingService.java | 4 +
...iceComponentConfigurationRequestSwagger.java | 43 +
...ceComponentConfigurationResponseSwagger.java | 43 +
...ootServiceComponentConfigurationService.java | 226 +
.../server/api/services/RootServiceService.java | 7 +
.../api/services/ldap/AmbariConfiguration.java | 46 +
.../api/services/ldap/LdapConfigOperation.java | 43 +
.../services/ldap/LdapConfigurationRequest.java | 49 +
.../services/ldap/LdapConfigurationService.java | 185 +
.../api/services/ldap/LdapRequestInfo.java | 61 +
.../stackadvisor/StackAdvisorRequest.java | 12 +
.../commands/StackAdvisorCommand.java | 68 +-
.../ambari/server/checks/CheckDescription.java | 9 +
.../checks/DatabaseConsistencyCheckHelper.java | 2 +-
.../apache/ambari/server/checks/LZOCheck.java | 76 +
.../server/configuration/Configuration.java | 13 +
.../controller/AmbariActionExecutionHelper.java | 1 -
.../AmbariCustomCommandExecutionHelper.java | 41 +-
.../server/controller/AmbariHandlerList.java | 5 +-
.../AmbariManagementControllerImpl.java | 73 +-
.../ambari/server/controller/AmbariServer.java | 3 +-
.../server/controller/ControllerModule.java | 3 +
.../controller/DeleteIdentityHandler.java | 3 +-
.../server/controller/KerberosHelper.java | 21 +-
.../server/controller/KerberosHelperImpl.java | 165 +-
.../controller/MaintenanceStateHelper.java | 3 +-
.../controller/ResourceProviderFactory.java | 24 +-
.../ambari/server/controller/RootComponent.java | 27 +
.../ambari/server/controller/RootService.java | 36 +
.../controller/RootServiceResponseFactory.java | 44 +-
.../AbstractControllerResourceProvider.java | 2 +
.../internal/AbstractPropertyProvider.java | 4 +
.../internal/AbstractProviderModule.java | 4 +-
.../internal/AbstractResourceProvider.java | 2 +-
.../internal/ActionResourceProvider.java | 4 +
.../AlertDefinitionResourceProvider.java | 4 +
.../internal/AlertGroupResourceProvider.java | 4 +
.../internal/AlertResourceProvider.java | 4 +
.../internal/AlertTargetResourceProvider.java | 4 +
.../internal/ArtifactResourceProvider.java | 4 +
.../controller/internal/BaseProvider.java | 6 +-
.../BlueprintConfigurationProcessor.java | 2 +-
.../internal/BlueprintResourceProvider.java | 4 +
.../internal/ClusterResourceProvider.java | 4 +
.../ClusterStackVersionResourceProvider.java | 45 +-
...atibleRepositoryVersionResourceProvider.java | 4 +
.../internal/ComponentResourceProvider.java | 4 +
.../internal/CredentialResourceProvider.java | 4 +
.../internal/DefaultProviderModule.java | 24 +-
.../internal/GroupResourceProvider.java | 4 +
.../internal/HostComponentResourceProvider.java | 4 +
.../HostKerberosIdentityResourceProvider.java | 16 +-
.../internal/HostResourceProvider.java | 2 +
.../HostStackVersionResourceProvider.java | 6 +-
.../controller/internal/HostStatusHelper.java | 2 +-
.../internal/HttpPropertyProvider.java | 2 +-
.../internal/JsonHttpPropertyRequest.java | 2 +-
.../internal/LdapSyncEventResourceProvider.java | 2 +-
.../internal/MemberResourceProvider.java | 4 +
.../QuickLinkArtifactResourceProvider.java | 4 +
.../RecommendationResourceProvider.java | 4 +
.../internal/RequestResourceProvider.java | 4 +
.../RoleAuthorizationResourceProvider.java | 4 +
...eComponentConfigurationResourceProvider.java | 476 +
.../RootServiceComponentPropertyProvider.java | 4 +-
.../RootServiceComponentResourceProvider.java | 4 +-
.../internal/ServiceResourceProvider.java | 7 +-
.../internal/StackAdvisorResourceProvider.java | 4 +
.../internal/StackArtifactResourceProvider.java | 5 +
.../internal/StageResourceProvider.java | 4 +
.../internal/TaskResourceProvider.java | 4 +
.../internal/ThemeArtifactResourceProvider.java | 4 +
.../internal/UpgradeItemResourceProvider.java | 4 +
.../internal/UpgradeResourceProvider.java | 48 +-
.../internal/UserResourceProvider.java | 4 +
.../internal/ValidationResourceProvider.java | 4 +
.../VersionDefinitionResourceProvider.java | 4 +
.../controller/jdbc/JDBCResourceProvider.java | 2 +-
.../controller/jmx/JMXPropertyProvider.java | 2 +-
.../metrics/MetricsCollectorHAClusterState.java | 2 +-
.../metrics/MetricsCollectorHAManager.java | 2 +-
.../metrics/MetricsDownsamplingMethod.java | 2 +-
.../metrics/MetricsPropertyProvider.java | 2 +-
.../metrics/MetricsReportPropertyProvider.java | 2 +-
.../metrics/RestMetricsPropertyProvider.java | 2 +-
.../ThreadPoolEnabledPropertyProvider.java | 4 +
.../ganglia/GangliaPropertyProvider.java | 2 +-
.../ganglia/GangliaReportPropertyProvider.java | 2 +-
.../metrics/timeline/AMSPropertyProvider.java | 3 +
.../timeline/AMSReportPropertyProvider.java | 3 +
.../ambari/server/controller/spi/Resource.java | 3 +
.../controller/utilities/DatabaseChecker.java | 2 +-
.../state/DefaultServiceCalculatedState.java | 2 +-
.../state/FlumeServiceCalculatedState.java | 4 +
.../state/HBaseServiceCalculatedState.java | 4 +
.../state/HDFSServiceCalculatedState.java | 4 +
.../state/HiveServiceCalculatedState.java | 4 +
.../state/OozieServiceCalculatedState.java | 4 +
.../state/YARNServiceCalculatedState.java | 4 +
.../events/AmbariConfigurationChangedEvent.java | 36 +
.../ambari/server/events/AmbariEvent.java | 11 +-
.../ServiceComponentUninstalledEvent.java | 11 +-
.../listeners/alerts/AlertReceivedListener.java | 10 +-
.../alerts/AlertStateChangedListener.java | 6 +-
.../apache/ambari/server/ldap/LdapModule.java | 82 +
.../ldap/domain/AmbariLdapConfigKeys.java | 83 +
.../ldap/domain/AmbariLdapConfiguration.java | 203 +
.../domain/AmbariLdapConfigurationFactory.java | 34 +
.../AmbariLdapConfigurationProvider.java | 113 +
.../ldap/service/AmbariLdapException.java | 33 +
.../server/ldap/service/AmbariLdapFacade.java | 140 +
.../server/ldap/service/AttributeDetector.java | 41 +
.../service/LdapAttributeDetectionService.java | 40 +
.../ldap/service/LdapConfigurationService.java | 60 +
.../service/LdapConnectionConfigService.java | 36 +
.../ambari/server/ldap/service/LdapFacade.java | 58 +
.../DefaultLdapAttributeDetectionService.java | 200 +
.../ads/DefaultLdapConfigurationService.java | 213 +
.../ads/DefaultLdapConnectionConfigService.java | 113 +
.../ads/LdapConnectionTemplateFactory.java | 111 +
.../ads/detectors/AttributeDetectorFactory.java | 75 +
.../ads/detectors/ChainedAttributeDetector.java | 73 +
.../ads/detectors/GroupMemberAttrDetector.java | 65 +
.../ads/detectors/GroupNameAttrDetector.java | 70 +
.../ads/detectors/GroupObjectClassDetector.java | 73 +
.../OccurrenceAndWeightBasedDetector.java | 143 +
.../detectors/UserGroupMemberAttrDetector.java | 64 +
.../ads/detectors/UserNameAttrDetector.java | 71 +
.../ads/detectors/UserObjectClassDetector.java | 69 +
.../metadata/AmbariServiceAlertDefinitions.java | 20 +-
.../server/orm/dao/AlertDefinitionDAO.java | 7 +-
.../ambari/server/orm/dao/AlertDispatchDAO.java | 4 +-
.../server/orm/dao/AmbariConfigurationDAO.java | 179 +
.../apache/ambari/server/orm/dao/DaoUtils.java | 13 +-
.../server/orm/dao/KerberosKeytabDAO.java | 110 +
.../server/orm/dao/KerberosPrincipalDAO.java | 7 +
.../orm/dao/KerberosPrincipalHostDAO.java | 40 +-
.../orm/entities/AmbariConfigurationEntity.java | 112 +
.../entities/AmbariConfigurationEntityPK.java | 88 +
.../orm/entities/KerberosKeytabEntity.java | 86 +
.../entities/KerberosPrincipalHostEntity.java | 57 +-
.../entities/KerberosPrincipalHostEntityPK.java | 19 +-
.../orm/entities/RemoteAmbariClusterEntity.java | 2 +-
.../orm/entities/RepositoryVersionEntity.java | 27 +
.../AmbariLdapAuthenticationProvider.java | 2 +-
.../authorization/RoleAuthorization.java | 95 +-
.../security/encryption/CredentialProvider.java | 2 +-
.../serveraction/ServerActionExecutor.java | 147 +-
.../kerberos/ADKerberosOperationHandler.java | 22 +-
.../AbstractPrepareKerberosServerAction.java | 50 +-
.../kerberos/CleanupServerAction.java | 14 +-
.../server/serveraction/kerberos/Component.java | 13 +-
.../ConfigureAmbariIdentitiesServerAction.java | 31 +-
.../kerberos/CreateKeytabFilesServerAction.java | 65 +-
.../kerberos/CreatePrincipalsServerAction.java | 56 +-
.../kerberos/DestroyPrincipalsServerAction.java | 3 +-
.../kerberos/IPAKerberosOperationHandler.java | 1067 +-
.../kerberos/KDCKerberosOperationHandler.java | 391 +
.../kerberos/KerberosIdentityDataFile.java | 2 -
.../KerberosIdentityDataFileWriter.java | 9 +-
.../kerberos/KerberosOperationHandler.java | 64 +-
.../kerberos/KerberosServerAction.java | 48 +-
.../kerberos/MITKerberosOperationHandler.java | 406 +-
.../PrepareDisableKerberosServerAction.java | 2 +-
.../PrepareEnableKerberosServerAction.java | 2 +-
.../PrepareKerberosIdentitiesServerAction.java | 3 +-
.../stageutils/ResolvedKerberosKeytab.java | 257 +
.../upgrades/CreateAndConfigureAction.java | 164 +
.../upgrades/FinalizeUpgradeAction.java | 54 +-
.../upgrades/PreconfigureKerberosAction.java | 48 +-
.../ambari/server/stack/MasterHostResolver.java | 2 +-
.../ambari/server/stack/ServiceDirectory.java | 29 +
.../ambari/server/stack/ServiceModule.java | 8 +
.../apache/ambari/server/state/ServiceImpl.java | 2 +-
.../apache/ambari/server/state/ServiceInfo.java | 14 +
.../ambari/server/state/UpgradeContext.java | 2 +-
.../server/state/alert/AlertDefinitionHash.java | 8 +-
.../server/state/cluster/ClusterImpl.java | 4 +-
.../state/repository/ClusterVersionSummary.java | 3 +
.../state/repository/ServiceVersionSummary.java | 11 +-
.../state/repository/VersionDefinitionXml.java | 25 +-
.../services/AmbariServerAlertService.java | 4 +-
.../state/services/MetricsRetrievalService.java | 2 +-
.../ambari/server/state/stack/OsFamily.java | 2 +-
.../ambari/server/state/stack/UpgradePack.java | 3 +
.../state/stack/upgrade/ClusterGrouping.java | 2 +
.../stack/upgrade/CreateAndConfigureTask.java | 57 +
.../stack/upgrade/RepositoryVersionHelper.java | 49 +-
.../ambari/server/state/stack/upgrade/Task.java | 6 +-
.../svccomphost/ServiceComponentHostImpl.java | 2 +-
.../topology/ClusterConfigurationRequest.java | 2 +-
.../server/topology/PersistedStateImpl.java | 2 +-
.../server/upgrade/SchemaUpgradeHelper.java | 3 +-
.../server/upgrade/UpgradeCatalog260.java | 13 +
.../server/upgrade/UpgradeCatalog300.java | 51 +-
.../apache/ambari/server/utils/RetryHelper.java | 2 +-
.../ambari/server/utils/VersionUtils.java | 46 +-
.../server/view/ViewDataMigrationUtility.java | 2 +-
.../ambari/server/view/ViewExtractor.java | 2 +-
.../apache/ambari/server/view/ViewRegistry.java | 2 +-
.../server/view/ViewSubResourceProvider.java | 4 +
.../server/view/persistence/DataStoreImpl.java | 2 +-
.../main/resources/Ambari-DDL-Derby-CREATE.sql | 24 +-
.../main/resources/Ambari-DDL-MySQL-CREATE.sql | 22 +-
.../main/resources/Ambari-DDL-Oracle-CREATE.sql | 22 +-
.../resources/Ambari-DDL-Postgres-CREATE.sql | 26 +-
.../resources/Ambari-DDL-SQLAnywhere-CREATE.sql | 22 +-
.../resources/Ambari-DDL-SQLServer-CREATE.sql | 23 +-
.../src/main/resources/META-INF/persistence.xml | 2 +
.../ATLAS/0.1.0.2.3/package/scripts/params.py | 2 +-
.../ATLAS/0.7.0.3.0/package/scripts/params.py | 2 +-
.../FALCON/0.5.0.2.1/package/scripts/falcon.py | 11 +-
.../HBASE/2.0.0.3.0/service_advisor.py | 12 +-
.../HIVE/0.12.0.2.0/configuration/hive-site.xml | 38 +
.../HIVE/0.12.0.2.0/metainfo.xml | 5 -
.../package/alerts/alert_hive_thrift_port.py | 3 +-
.../0.12.0.2.0/package/files/startMetastore.sh | 4 +-
.../0.12.0.2.0/package/scripts/hive_service.py | 10 +-
.../package/scripts/hive_service_interactive.py | 5 +-
.../0.12.0.2.0/package/scripts/params_linux.py | 3 +-
.../0.12.0.2.0/package/scripts/service_check.py | 6 +-
.../package/scripts/webhcat_service.py | 19 +-
.../common-services/HIVE/2.1.0.3.0/metainfo.xml | 10 -
.../2.1.0.3.0/package/files/startMetastore.sh | 4 +-
.../2.1.0.3.0/package/scripts/hive_service.py | 8 +-
.../package/scripts/hive_service_interactive.py | 5 +-
.../2.1.0.3.0/package/scripts/params_linux.py | 10 +-
.../2.1.0.3.0/package/scripts/service_check.py | 6 +-
.../package/scripts/webhcat_service.py | 19 +-
.../1.10.3-10/configuration/kerberos-env.xml | 36 +-
.../package/scripts/kerberos_common.py | 7 +-
.../1.10.3-30/configuration/kerberos-env.xml | 36 +-
.../package/scripts/kerberos_common.py | 7 +-
.../LOGSEARCH/0.5.0/metainfo.xml | 6 +-
.../1.0.0.2.3/package/scripts/service_check.py | 3 +-
.../OOZIE/4.2.0.2.3/metainfo.xml | 5 -
.../OOZIE/4.2.0.3.0/metainfo.xml | 5 -
.../scripts/alerts/alert_spark_thrift_port.py | 8 +-
.../SPARK/1.2.1/package/scripts/setup_spark.py | 3 +-
.../scripts/alerts/alert_spark2_thrift_port.py | 8 +-
.../SPARK2/2.0.0/package/scripts/setup_spark.py | 3 +-
.../SQOOP/1.4.4.2.0/metainfo.xml | 5 -
.../1.4.4.2.0/package/scripts/params_linux.py | 4 +-
.../SQOOP/1.4.4.3.0/metainfo.xml | 10 -
.../1.4.4.3.0/package/scripts/params_linux.py | 4 +-
.../0.4.0.2.1/package/scripts/params_linux.py | 2 +-
.../TEZ/0.9.0.3.0/configuration/tez-site.xml | 2 +-
.../0.9.0.3.0/package/scripts/params_linux.py | 2 +-
.../configuration-mapred/mapred-site.xml | 2 +-
.../2.1.0.2.0/package/scripts/params_linux.py | 2 +-
.../configuration-mapred/mapred-site.xml | 2 +-
.../3.0.0.3.0/package/scripts/params_linux.py | 2 +-
.../ZEPPELIN/0.7.0/package/scripts/master.py | 11 +-
.../ZOOKEEPER/3.4.5/metainfo.xml | 1 +
.../custom_actions/scripts/install_packages.py | 17 +-
.../before-ANY/files/changeToSecureUid.sh | 2 +-
.../BIGTOP/0.8/services/HIVE/metainfo.xml | 4 -
.../BIGTOP/0.8/services/OOZIE/metainfo.xml | 4 -
.../2.0.6.GlusterFS/services/HIVE/metainfo.xml | 4 -
.../2.0.6.GlusterFS/services/OOZIE/metainfo.xml | 4 -
.../HDP/2.0.6/properties/stack_features.json | 20 +
.../HDP/2.0.6/properties/stack_packages.json | 107 +-
.../stacks/HDP/2.0.6/role_command_order.json | 1 +
.../2.1.GlusterFS/services/HIVE/metainfo.xml | 4 -
.../2.1.GlusterFS/services/OOZIE/metainfo.xml | 4 -
.../stacks/HDP/2.1/services/HIVE/metainfo.xml | 5 -
.../stacks/HDP/2.2/services/HIVE/metainfo.xml | 10 -
.../stacks/HDP/2.2/services/OOZIE/metainfo.xml | 5 -
.../stacks/HDP/2.2/services/SQOOP/metainfo.xml | 10 -
.../2.2/services/TEZ/configuration/tez-site.xml | 4 +-
.../YARN/configuration-mapred/mapred-site.xml | 2 +-
.../2.3.GlusterFS/services/HIVE/metainfo.xml | 9 -
.../2.3.GlusterFS/services/SQOOP/metainfo.xml | 9 -
.../main/resources/stacks/HDP/2.3/metainfo.xml | 2 +-
.../stacks/HDP/2.3/services/HIVE/metainfo.xml | 10 -
.../HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml | 1 +
.../stacks/HDP/2.3/upgrades/upgrade-2.6.xml | 1 +
.../HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml | 1 +
.../stacks/HDP/2.4/upgrades/upgrade-2.6.xml | 1 +
.../stacks/HDP/2.5/services/FALCON/metainfo.xml | 4 +-
.../stacks/HDP/2.5/services/HIVE/metainfo.xml | 10 -
.../stacks/HDP/2.5/upgrades/config-upgrade.xml | 23 +
.../HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml | 24 +-
.../stacks/HDP/2.5/upgrades/upgrade-2.6.xml | 46 +-
.../resources/stacks/HDP/2.6/repos/repoinfo.xml | 2 +-
.../configuration/spark2-log4j-properties.xml | 56 +
.../stacks/HDP/2.6/upgrades/config-upgrade.xml | 23 +
.../HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml | 10 +
.../stacks/HDP/2.6/upgrades/upgrade-2.6.xml | 5 +
.../HDP/3.0/properties/stack_packages.json | 108 +-
.../YARN/configuration-mapred/mapred-site.xml | 2 +-
.../resources/stacks/PERF/1.0/hdp_urlinfo.json | 12 +
.../stacks/PERF/1.0/repos/repoinfo.xml | 1 +
.../KERBEROS/configuration/kerberos-env.xml | 36 +-
.../src/main/resources/stacks/PERF/1.0/vdf.xml | 73 +
.../resources/stacks/PERF/2.0/hdp_urlinfo.json | 12 +
.../stacks/PERF/2.0/repos/repoinfo.xml | 1 +
.../src/main/resources/stacks/PERF/2.0/vdf.xml | 74 +
.../src/main/resources/upgrade-pack.xsd | 9 +-
.../server/agent/TestHeartbeatHandler.java | 2 +-
.../commands/StackAdvisorCommandTest.java | 212 +
.../ambari/server/checks/LZOCheckTest.java | 145 +
.../server/checks/UpgradeCheckOrderTest.java | 3 +-
.../AmbariManagementControllerImplTest.java | 2 +-
.../AmbariManagementControllerTest.java | 16 +-
.../server/controller/KerberosHelperTest.java | 12 +-
.../RootServiceResponseFactoryTest.java | 27 +-
...ClusterStackVersionResourceProviderTest.java | 241 +
...ostKerberosIdentityResourceProviderTest.java | 12 +-
...ponentConfigurationResourceProviderTest.java | 393 +
...ootServiceComponentPropertyProviderTest.java | 15 +-
...ootServiceComponentResourceProviderTest.java | 9 +-
.../StackAdvisorResourceProviderTest.java | 97 +-
.../internal/UpgradeResourceProviderTest.java | 8 +
.../utilities/KerberosIdentityCleanerTest.java | 10 +-
.../HostVersionOutOfSyncListenerTest.java | 2 +-
.../server/ldap/LdapModuleFunctionalTest.java | 149 +
.../TestAmbariLdapConfigurationFactory.java | 29 +
.../ldap/service/AmbariLdapFacadeTest.java | 215 +
...efaultLdapAttributeDetectionServiceTest.java | 188 +
.../DefaultLdapConfigurationServiceTest.java | 221 +
.../detectors/GroupMemberAttrDetectorTest.java | 107 +
.../metadata/AgentAlertDefinitionsTest.java | 6 +-
.../notifications/DispatchFactoryTest.java | 3 +-
.../server/orm/InMemoryDefaultTestModule.java | 2 +
.../ambari/server/orm/JdbcPropertyTest.java | 5 +-
.../server/orm/dao/AlertDefinitionDAOTest.java | 7 +-
.../orm/dao/AmbariConfigurationDAOTest.java | 298 +
...uthenticationProviderForDNWithSpaceTest.java | 35 +-
.../AmbariLdapAuthenticationProviderTest.java | 3 +-
.../authorization/LdapServerPropertiesTest.java | 5 +-
.../ADKerberosOperationHandlerTest.java | 261 +-
...AbstractPrepareKerberosServerActionTest.java | 11 +-
...nfigureAmbariIdentitiesServerActionTest.java | 11 +-
.../FinalizeKerberosServerActionTest.java | 5 +
.../IPAKerberosOperationHandlerTest.java | 147 +-
.../KDCKerberosOperationHandlerTest.java | 168 +
.../kerberos/KerberosIdentityDataFileTest.java | 8 +-
.../kerberos/KerberosOperationHandlerTest.java | 152 +-
.../kerberos/KerberosServerActionTest.java | 137 +-
.../MITKerberosOperationHandlerTest.java | 633 +-
.../upgrades/CreateAndConfigureActionTest.java | 357 +
.../PreconfigureKerberosActionTest.java | 10 +
.../ambari/server/stack/ServiceModuleTest.java | 30 +
.../server/stack/StackManagerExtensionTest.java | 6 +
.../state/alerts/AlertReceivedListenerTest.java | 16 +-
.../alerts/AlertStateChangedEventTest.java | 4 +-
.../state/repository/VersionDefinitionTest.java | 42 +
.../server/upgrade/UpgradeCatalog300Test.java | 195 +-
.../ambari/server/utils/TestVersionUtils.java | 4 +
.../configs/install_packages_config.json | 1 +
.../install_packages_repository_file.json | 1 +
.../stacks/2.0.6/HIVE/test_hive_metastore.py | 8 +-
.../stacks/2.0.6/HIVE/test_hive_server.py | 18 +-
.../2.0.6/HIVE/test_hive_service_check.py | 2 +-
.../stacks/2.0.6/HIVE/test_webhcat_server.py | 4 -
.../stacks/2.0.6/configs/repository_file.json | 1 +
.../stacks/2.1/FALCON/test_falcon_server.py | 16 +-
.../stacks/2.1/HIVE/test_hive_metastore.py | 9 +-
.../python/stacks/2.1/TEZ/test_tez_client.py | 2 +-
.../stacks/2.2/SPARK/test_job_history_server.py | 12 +-
.../stacks/2.2/SPARK/test_spark_client.py | 12 +-
.../stacks/2.2/common/test_conf_select.py | 14 +-
.../2.3/MAHOUT/test_mahout_service_check.py | 4 +-
.../2.3/SPARK/test_spark_thrift_server.py | 6 +-
.../stacks/2.5/HIVE/test_hive_server_int.py | 15 +-
.../2.5/configs/ranger-admin-secured.json | 2 -
.../stacks/2.5/configs/ranger-kms-secured.json | 2 -
.../2.6/configs/ranger-admin-secured.json | 2 -
.../PreconfigureActionTest_cluster_config.json | 4 +-
ambari-web/app/assets/test/tests.js | 2 +
ambari-web/app/config.js | 1 -
.../app/controllers/global/update_controller.js | 2 +-
.../main/admin/kerberos/step1_controller.js | 52 +-
.../main/admin/kerberos/step2_controller.js | 2 +-
.../main/dashboard/config_history_controller.js | 92 +-
.../main/host/bulk_operations_controller.js | 14 +-
ambari-web/app/controllers/main/service/item.js | 13 +-
.../app/mappers/components_state_mapper.js | 1 +
ambari-web/app/messages.js | 26 +-
.../main/host/details/actions/check_host.js | 6 +-
ambari-web/app/models/client_component.js | 1 +
ambari-web/app/routes/main.js | 2 -
ambari-web/app/styles/application.less | 8 +-
.../app/styles/theme/bootstrap-ambari.css | 35 +-
ambari-web/app/templates/main/alerts.hbs | 2 +-
.../templates/main/dashboard/config_history.hbs | 23 +-
ambari-web/app/templates/main/host.hbs | 2 +-
.../templates/main/service/services/hdfs.hbs | 116 +-
.../templates/main/service/services/yarn.hbs | 184 +-
ambari-web/app/utils/ajax/ajax.js | 4 +
ambari-web/app/views.js | 2 +
ambari-web/app/views/common/controls_view.js | 9 +-
ambari-web/app/views/common/search_box_view.js | 165 +
.../upgrade_version_column_view.js | 1 -
.../app/views/main/alerts/alert_search_box.js | 161 +-
.../main/dashboard/config_history_search_box.js | 221 +
.../views/main/dashboard/config_history_view.js | 101 -
.../app/views/main/host/combo_search_box.js | 44 +-
.../app/views/main/service/services/yarn.js | 21 +-
.../admin/kerberos/step1_controller_test.js | 17 -
.../admin/kerberos/step2_controller_test.js | 2 +-
.../test/controllers/main/service/item_test.js | 49 +-
.../test/views/common/controls_view_test.js | 2 +-
.../test/views/common/search_box_view_test.js | 240 +
.../views/main/alerts/alert_search_box_test.js | 74 +-
.../dashboard/config_history_search_box_test.js | 207 +
.../main/dashboard/config_history_view_test.js | 188 +-
.../views/main/host/combo_search_box_test.js | 66 +-
.../views/main/service/services/yarn_test.js | 22 -
.../vendor/scripts/theme/bootstrap-ambari.js | 7 -
.../stacks/ODPi/2.0/services/HIVE/metainfo.xml | 10 -
contrib/views/storm/pom.xml | 103 +-
.../src/main/resources/images/icon-bolt.png | Bin 2157 -> 0 bytes
.../src/main/resources/images/icon-spout.png | Bin 2620 -> 0 bytes
.../storm/src/main/resources/images/loader.gif | Bin 15017 -> 0 bytes
.../views/storm/src/main/resources/index.html | 45 -
.../js/backbone-paginator.min.js | 1325 --
.../main/resources/libs/Backbone/js/Backbone.js | 1920 --
.../libs/Bootstrap/css/bootstrap-editable.css | 663 -
.../libs/Bootstrap/css/bootstrap-slider.min.css | 28 -
.../libs/Bootstrap/css/bootstrap-switch.min.css | 22 -
.../resources/libs/Bootstrap/css/bootstrap.css | 5959 -----
.../fonts/glyphicons-halflings-regular.eot | Bin 20127 -> 0 bytes
.../fonts/glyphicons-halflings-regular.svg | 288 -
.../fonts/glyphicons-halflings-regular.ttf | Bin 45404 -> 0 bytes
.../fonts/glyphicons-halflings-regular.woff | Bin 23424 -> 0 bytes
.../fonts/glyphicons-halflings-regular.woff2 | Bin 18028 -> 0 bytes
.../resources/libs/Bootstrap/images/clear.png | Bin 509 -> 0 bytes
.../resources/libs/Bootstrap/images/loading.gif | Bin 1849 -> 0 bytes
.../libs/Bootstrap/js/bootstrap-editable.min.js | 7 -
.../libs/Bootstrap/js/bootstrap-notify.min.js | 1 -
.../libs/Bootstrap/js/bootstrap-slider.min.js | 29 -
.../libs/Bootstrap/js/bootstrap-switch.min.js | 22 -
.../libs/Bootstrap/js/bootstrap.min.js | 7 -
.../libs/Font-Awesome/css/font-awesome.min.css | 4 -
.../libs/Font-Awesome/fonts/FontAwesome.otf | Bin 109688 -> 0 bytes
.../Font-Awesome/fonts/fontawesome-webfont.eot | Bin 70807 -> 0 bytes
.../Font-Awesome/fonts/fontawesome-webfont.svg | 655 -
.../Font-Awesome/fonts/fontawesome-webfont.ttf | Bin 142072 -> 0 bytes
.../Font-Awesome/fonts/fontawesome-webfont.woff | Bin 83588 -> 0 bytes
.../fonts/fontawesome-webfont.woff2 | Bin 66624 -> 0 bytes
.../resources/libs/Underscore/js/Underscore.js | 1548 --
.../resources/libs/bootbox/js/bootbox.min.js | 6 -
.../src/main/resources/libs/d3/js/d3-tip.min.js | 1 -
.../src/main/resources/libs/d3/js/d3.min.js | 5 -
.../resources/libs/dagre-d3/dagre-d3.min.js | 28 -
.../libs/jQuery/js/jquery-2.2.3.min.js | 4 -
.../main/resources/libs/jsx/JSXTransformer.js | 15201 ------------
.../storm/src/main/resources/libs/jsx/jsx.js | 75 -
.../main/resources/libs/react/js/react-dom.js | 42 -
.../libs/react/js/react-with-addons.js | 20775 -----------------
.../resources/libs/require-js/js/require.min.js | 36 -
.../main/resources/libs/require-text/js/text.js | 390 -
.../scripts/collections/BaseCollection.js | 197 -
.../scripts/collections/VNimbusConfigList.js | 52 -
.../scripts/collections/VNimbusList.js | 52 -
.../scripts/collections/VSupervisorList.js | 52 -
.../scripts/collections/VTopologyConfigList.js | 49 -
.../scripts/collections/VTopologyList.js | 52 -
.../resources/scripts/components/BarChart.jsx | 402 -
.../scripts/components/Breadcrumbs.jsx | 50 -
.../main/resources/scripts/components/Modal.jsx | 60 -
.../scripts/components/RadialChart.jsx | 127 -
.../resources/scripts/components/SearchLogs.jsx | 89 -
.../main/resources/scripts/components/Table.jsx | 101 -
.../scripts/components/TopologyGraph.jsx | 199 -
.../scripts/containers/ClusterSummary.jsx | 122 -
.../scripts/containers/NimbusConfigSummary.jsx | 103 -
.../scripts/containers/NimbusSummary.jsx | 139 -
.../scripts/containers/SupervisorSummary.jsx | 155 -
.../containers/TopologyConfiguration.jsx | 93 -
.../scripts/containers/TopologyDetailGraph.jsx | 66 -
.../scripts/containers/TopologyListing.jsx | 188 -
.../storm/src/main/resources/scripts/main.js | 98 -
.../main/resources/scripts/models/BaseModel.js | 83 -
.../main/resources/scripts/models/VCluster.js | 42 -
.../main/resources/scripts/models/VNimbus.js | 42 -
.../resources/scripts/models/VNimbusConfig.js | 42 -
.../resources/scripts/models/VSupervisor.js | 42 -
.../main/resources/scripts/models/VTopology.js | 90 -
.../resources/scripts/models/VTopologyConfig.js | 34 -
.../scripts/modules/Table/PageableTable.jsx | 47 -
.../scripts/modules/Table/Pagination.jsx | 161 -
.../src/main/resources/scripts/router/Router.js | 123 -
.../src/main/resources/scripts/utils/Globals.js | 30 -
.../main/resources/scripts/utils/Overrides.js | 30 -
.../src/main/resources/scripts/utils/Utils.js | 113 -
.../scripts/views/ComponentDetailView.jsx | 534 -
.../main/resources/scripts/views/Dashboard.jsx | 65 -
.../src/main/resources/scripts/views/Footer.jsx | 48 -
.../scripts/views/NimbusSummaryView.jsx | 65 -
.../resources/scripts/views/ProfilingView.jsx | 214 -
.../resources/scripts/views/RebalanceView.jsx | 223 -
.../scripts/views/SupervisorSummaryView.jsx | 65 -
.../scripts/views/TopologyDetailView.jsx | 1039 -
.../scripts/views/TopologyListingView.jsx | 65 -
.../storm/src/main/resources/styles/style.css | 579 -
.../views/storm/src/main/resources/ui/.babelrc | 25 +
.../src/main/resources/ui/.eslintignore.js | 3 +
.../storm/src/main/resources/ui/.eslintrc.js | 58 +
.../src/main/resources/ui/app/scripts/app.js | 40 +
.../ui/app/scripts/components/BarChart.jsx | 429 +
.../ui/app/scripts/components/Breadcrumbs.jsx | 45 +
.../app/scripts/components/CommonExpanded.jsx | 30 +
.../scripts/components/CommonNotification.jsx | 69 +
.../app/scripts/components/CommonPagination.jsx | 56 +
.../components/CommonSwitchComponent.jsx | 41 +
.../scripts/components/CommonWindowPanel.jsx | 99 +
.../scripts/components/CustomToastContainer.jsx | 41 +
.../ui/app/scripts/components/Editable.jsx | 127 +
.../ui/app/scripts/components/FSModel.jsx | 149 +
.../ui/app/scripts/components/FSReactToastr.jsx | 37 +
.../ui/app/scripts/components/Footer.jsx | 28 +
.../scripts/components/LogLevelComponent.jsx | 236 +
.../ui/app/scripts/components/ProfilingView.jsx | 168 +
.../ui/app/scripts/components/RadialChart.jsx | 134 +
.../scripts/components/RebalanceTopology.jsx | 152 +
.../ui/app/scripts/components/SearchLogs.jsx | 84 +
.../ui/app/scripts/components/TopologyGraph.jsx | 208 +
.../ui/app/scripts/containers/BaseContainer.jsx | 50 +
.../app/scripts/containers/ClusterSummary.jsx | 125 +
.../scripts/containers/ComponentDetailView.jsx | 714 +
.../ui/app/scripts/containers/Dashboard.jsx | 52 +
.../scripts/containers/NimbusConfigSummary.jsx | 126 +
.../ui/app/scripts/containers/NimbusSummary.jsx | 150 +
.../scripts/containers/SupervisorSummary.jsx | 165 +
.../scripts/containers/TopologyDetailView.jsx | 862 +
.../app/scripts/containers/TopologyListing.jsx | 222 +
.../src/main/resources/ui/app/scripts/main.js | 46 +
.../ui/app/scripts/rest/TopologyREST.js | 118 +
.../resources/ui/app/scripts/routers/routes.jsx | 68 +
.../resources/ui/app/scripts/utils/Constants.js | 45 +
.../resources/ui/app/scripts/utils/Utils.js | 51 +
.../resources/ui/app/styles/css/bootstrap.css | 6757 ++++++
.../ui/app/styles/css/font-awesome.min.css | 4 +
.../main/resources/ui/app/styles/css/style.css | 836 +
.../resources/ui/app/styles/css/toastr.min.css | 1 +
.../ui/app/styles/fonts/fontawesome-webfont.eot | Bin 0 -> 76518 bytes
.../ui/app/styles/fonts/fontawesome-webfont.svg | 685 +
.../ui/app/styles/fonts/fontawesome-webfont.ttf | Bin 0 -> 152796 bytes
.../app/styles/fonts/fontawesome-webfont.woff | Bin 0 -> 90412 bytes
.../app/styles/fonts/fontawesome-webfont.woff2 | Bin 0 -> 71896 bytes
.../fonts/glyphicons-halflings-regular.eot | Bin 0 -> 20127 bytes
.../fonts/glyphicons-halflings-regular.svg | 288 +
.../fonts/glyphicons-halflings-regular.ttf | Bin 0 -> 45404 bytes
.../fonts/glyphicons-halflings-regular.woff | Bin 0 -> 23424 bytes
.../fonts/glyphicons-halflings-regular.woff2 | Bin 0 -> 18028 bytes
.../resources/ui/app/styles/img/icon-bolt.png | Bin 0 -> 2157 bytes
.../resources/ui/app/styles/img/icon-spout.png | Bin 0 -> 2620 bytes
.../main/resources/ui/app/styles/img/loader.gif | Bin 0 -> 15017 bytes
.../resources/ui/config/webpack.config.base.js | 101 +
.../ui/config/webpack.config.development.js | 64 +
.../ui/config/webpack.config.production.js | 131 +
.../storm/src/main/resources/ui/dev-server.js | 101 +
.../storm/src/main/resources/ui/index.html | 47 +
.../storm/src/main/resources/ui/package.json | 110 +
docs/pom.xml | 22 +-
pom.xml | 7 +-
760 files changed, 42655 insertions(+), 63881 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d173011c/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d173011c/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ResourceInstanceFactoryImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d173011c/ambari-server/src/main/java/org/apache/ambari/server/api/services/BaseService.java
----------------------------------------------------------------------
diff --cc ambari-server/src/main/java/org/apache/ambari/server/api/services/BaseService.java
index d9b8577,17155a4..b14ffa7
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/BaseService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/BaseService.java
@@@ -49,51 -49,48 +49,48 @@@ import org.slf4j.LoggerFactory
public abstract class BaseService {
public final static MediaType MEDIA_TYPE_TEXT_CSV_TYPE = new MediaType("text", "csv");
- static final String MSG_SUCCESSFUL_OPERATION = "Successful operation";
- static final String MSG_REQUEST_ACCEPTED = "Request is accepted, but not completely processed yet";
- static final String MSG_INVALID_ARGUMENTS = "Invalid arguments";
- static final String MSG_INVALID_REQUEST = "Invalid request";
- static final String MSG_CLUSTER_NOT_FOUND = "Cluster not found";
- static final String MSG_CLUSTER_OR_HOST_NOT_FOUND = "Cluster or host not found";
- static final String MSG_NOT_AUTHENTICATED = "Not authenticated";
- static final String MSG_PERMISSION_DENIED = "Not permitted to perform the operation";
- static final String MSG_SERVER_ERROR = "Internal server error";
- static final String MSG_RESOURCE_ALREADY_EXISTS = "The requested resource already exists.";
- static final String MSG_RESOURCE_NOT_FOUND = "The requested resource doesn't exist.";
-
- static final String QUERY_FIELDS = "fields";
- static final String QUERY_FILTER_DESCRIPTION = "Filter fields in the response (identifier fields are mandatory)";
- static final String QUERY_SORT = "sortBy";
- static final String QUERY_SORT_DESCRIPTION = "Sort resources in result by (asc | desc)";
- static final String QUERY_PAGE_SIZE = "page_size";
- static final String QUERY_PAGE_SIZE_DESCRIPTION = "The number of resources to be returned for the paged response.";
- static final String DEFAULT_PAGE_SIZE = "10";
- static final String QUERY_FROM = "from";
- static final String QUERY_FROM_DESCRIPTION = "The starting page resource (inclusive). \"start\" is also accepted.";
- static final String QUERY_FROM_VALUES = "range[0, infinity]";
- static final String DEFAULT_FROM = "0";
- static final String QUERY_TO = "to";
- static final String QUERY_TO_DESCRIPTION = "The ending page resource (inclusive). \"end\" is also accepted.";
- static final String QUERY_TO_TYPE = "integer";
- static final String QUERY_TO_VALUES = "range[1, infinity]";
- static final String QUERY_PREDICATE = "{predicate}";
- static final String QUERY_PREDICATE_DESCRIPTION = "The predicate to filter resources by. Omitting the predicate will " +
+ public static final String MSG_SUCCESSFUL_OPERATION = "Successful operation";
+ public static final String MSG_REQUEST_ACCEPTED = "Request is accepted, but not completely processed yet";
+ public static final String MSG_INVALID_ARGUMENTS = "Invalid arguments";
+ public static final String MSG_INVALID_REQUEST = "Invalid request";
+ public static final String MSG_CLUSTER_NOT_FOUND = "Cluster not found";
+ public static final String MSG_CLUSTER_OR_HOST_NOT_FOUND = "Cluster or host not found";
+ public static final String MSG_NOT_AUTHENTICATED = "Not authenticated";
+ public static final String MSG_PERMISSION_DENIED = "Not permitted to perform the operation";
+ public static final String MSG_SERVER_ERROR = "Internal server error";
+ public static final String MSG_RESOURCE_ALREADY_EXISTS = "The requested resource already exists.";
+ public static final String MSG_RESOURCE_NOT_FOUND = "The requested resource doesn't exist.";
+
+ public static final String QUERY_FIELDS = "fields";
+ public static final String QUERY_FILTER_DESCRIPTION = "Filter fields in the response (identifier fields are mandatory)";
+ public static final String QUERY_SORT = "sortBy";
+ public static final String QUERY_SORT_DESCRIPTION = "Sort resources in result by (asc | desc)";
+ public static final String QUERY_PAGE_SIZE = "page_size";
+ public static final String QUERY_PAGE_SIZE_DESCRIPTION = "The number of resources to be returned for the paged response.";
+ public static final String DEFAULT_PAGE_SIZE = "10";
+ public static final String QUERY_FROM = "from";
+ public static final String QUERY_FROM_DESCRIPTION = "The starting page resource (inclusive). \"start\" is also accepted.";
+ public static final String QUERY_FROM_VALUES = "range[0, infinity]";
+ public static final String DEFAULT_FROM = "0";
+ public static final String QUERY_TO = "to";
+ public static final String QUERY_TO_DESCRIPTION = "The ending page resource (inclusive). \"end\" is also accepted.";
+ public static final String QUERY_TO_TYPE = "integer";
+ public static final String QUERY_TO_VALUES = "range[1, infinity]";
+ public static final String QUERY_PREDICATE = "{predicate}";
+ public static final String QUERY_PREDICATE_DESCRIPTION = "The predicate to filter resources by. Omitting the predicate will " +
"match all resources.";
- static final String RESPONSE_CONTAINER_LIST = "List";
+ public static final String RESPONSE_CONTAINER_LIST = "List";
- static final String DATA_TYPE_INT = "integer";
- static final String DATA_TYPE_STRING = "string";
+ public static final String DATA_TYPE_INT = "integer";
+ public static final String DATA_TYPE_STRING = "string";
- static final String PARAM_TYPE_QUERY = "query";
- static final String PARAM_TYPE_BODY = "body";
+ public static final String PARAM_TYPE_QUERY = "query";
+ public static final String PARAM_TYPE_BODY = "body";
- static final String FIELDS_SEPARATOR = ", ";
+ public static final String FIELDS_SEPARATOR = ", ";
- /**
- * Logger instance.
- */
- protected final static Logger LOG = LoggerFactory.getLogger(BaseService.class);
+ private final static Logger LOG = LoggerFactory.getLogger(BaseService.class);
/**
* Factory for creating resource instances.
http://git-wip-us.apache.org/repos/asf/ambari/blob/d173011c/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d173011c/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d173011c/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d173011c/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java
----------------------------------------------------------------------
diff --cc ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java
index 6027519,ed7513f..8de5141
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java
@@@ -72,10 -72,9 +72,11 @@@ import org.apache.ambari.server.control
import org.apache.ambari.server.controller.internal.KerberosDescriptorResourceProvider;
import org.apache.ambari.server.controller.internal.MemberResourceProvider;
import org.apache.ambari.server.controller.internal.RepositoryVersionResourceProvider;
+ import org.apache.ambari.server.controller.internal.RootServiceComponentConfigurationResourceProvider;
import org.apache.ambari.server.controller.internal.ServiceResourceProvider;
import org.apache.ambari.server.controller.internal.UpgradeResourceProvider;
+import org.apache.ambari.server.controller.internal.UserAuthenticationSourceResourceProvider;
+import org.apache.ambari.server.controller.internal.UserResourceProvider;
import org.apache.ambari.server.controller.internal.ViewInstanceResourceProvider;
import org.apache.ambari.server.controller.logging.LoggingRequestHelperFactory;
import org.apache.ambari.server.controller.logging.LoggingRequestHelperFactoryImpl;
http://git-wip-us.apache.org/repos/asf/ambari/blob/d173011c/ambari-server/src/main/java/org/apache/ambari/server/controller/ResourceProviderFactory.java
----------------------------------------------------------------------
diff --cc ambari-server/src/main/java/org/apache/ambari/server/controller/ResourceProviderFactory.java
index dc46a40,f6ca16b..523e21c
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ResourceProviderFactory.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ResourceProviderFactory.java
@@@ -50,16 -49,9 +49,15 @@@ public interface ResourceProviderFactor
ResourceProvider getComponentResourceProvider(AmbariManagementController managementController);
@Named("member")
- ResourceProvider getMemberResourceProvider(Set<String> propertyIds,
- Map<Type, String> keyPropertyIds,
- AmbariManagementController managementController);
+ ResourceProvider getMemberResourceProvider(Set<String> propertyIds, Map<Type, String> keyPropertyIds,
+ AmbariManagementController managementController);
+ @Named("user")
+ ResourceProvider getUserResourceProvider(AmbariManagementController managementController);
+
+ @Named("userAuthenticationSource")
+ ResourceProvider getUserAuthenticationSourceResourceProvider();
+
@Named("hostKerberosIdentity")
ResourceProvider getHostKerberosIdentityResourceProvider(AmbariManagementController managementController);
http://git-wip-us.apache.org/repos/asf/ambari/blob/d173011c/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProvider.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d173011c/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserResourceProvider.java
----------------------------------------------------------------------
diff --cc ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserResourceProvider.java
index 99f88ca,698f419..90effac
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UserResourceProvider.java
@@@ -39,102 -36,36 +39,106 @@@ import org.apache.ambari.server.control
import org.apache.ambari.server.controller.spi.Resource;
import org.apache.ambari.server.controller.spi.ResourceAlreadyExistsException;
import org.apache.ambari.server.controller.spi.ResourcePredicateEvaluator;
+import org.apache.ambari.server.controller.spi.ResourceProvider;
import org.apache.ambari.server.controller.spi.SystemException;
import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
+import org.apache.ambari.server.controller.utilities.PredicateBuilder;
import org.apache.ambari.server.controller.utilities.PropertyHelper;
+import org.apache.ambari.server.orm.entities.MemberEntity;
+import org.apache.ambari.server.orm.entities.UserAuthenticationEntity;
+import org.apache.ambari.server.orm.entities.UserEntity;
import org.apache.ambari.server.security.authorization.AuthorizationException;
+import org.apache.ambari.server.security.authorization.AuthorizationHelper;
+import org.apache.ambari.server.security.authorization.ResourceType;
import org.apache.ambari.server.security.authorization.RoleAuthorization;
+import org.apache.ambari.server.security.authorization.UserAuthenticationType;
+import org.apache.ambari.server.security.authorization.Users;
+import org.apache.commons.lang.StringUtils;
+ import org.slf4j.Logger;
+ import org.slf4j.LoggerFactory;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Inject;
+import com.google.inject.assistedinject.Assisted;
+import com.google.inject.assistedinject.AssistedInject;
+
/**
* Resource provider for user resources.
*/
public class UserResourceProvider extends AbstractControllerResourceProvider implements ResourcePredicateEvaluator {
+ private static final Logger LOG = LoggerFactory.getLogger(UserResourceProvider.class);
+
// ----- Property ID constants ---------------------------------------------
+ public static final String USER_RESOURCE_CATEGORY = "Users";
+
// Users
- public static final String USER_USERNAME_PROPERTY_ID = PropertyHelper.getPropertyId("Users", "user_name");
- public static final String USER_PASSWORD_PROPERTY_ID = PropertyHelper.getPropertyId("Users", "password");
- public static final String USER_OLD_PASSWORD_PROPERTY_ID = PropertyHelper.getPropertyId("Users", "old_password");
- public static final String USER_LDAP_USER_PROPERTY_ID = PropertyHelper.getPropertyId("Users", "ldap_user");
- public static final String USER_TYPE_PROPERTY_ID = PropertyHelper.getPropertyId("Users", "user_type");
- public static final String USER_ACTIVE_PROPERTY_ID = PropertyHelper.getPropertyId("Users", "active");
- public static final String USER_GROUPS_PROPERTY_ID = PropertyHelper.getPropertyId("Users", "groups");
- public static final String USER_ADMIN_PROPERTY_ID = PropertyHelper.getPropertyId("Users", "admin");
-
- private static Set<String> pkPropertyIds =
- new HashSet<>(Arrays.asList(new String[]{
- USER_USERNAME_PROPERTY_ID}));
+ public static final String USERNAME_PROPERTY_ID = "user_name";
+ public static final String DISPLAY_NAME_PROPERTY_ID = "display_name";
+ public static final String LOCAL_USERNAME_PROPERTY_ID = "local_user_name";
+ public static final String ACTIVE_PROPERTY_ID = "active";
+ public static final String CREATE_TIME_PROPERTY_ID = "created";
+ public static final String CONSECUTIVE_FAILURES_PROPERTY_ID = "consecutive_failures";
+ public static final String ADMIN_PROPERTY_ID = "admin";
+ public static final String GROUPS_PROPERTY_ID = "groups";
+
+ public static final String USER_USERNAME_PROPERTY_ID = USER_RESOURCE_CATEGORY + "/" + USERNAME_PROPERTY_ID;
+ public static final String USER_DISPLAY_NAME_PROPERTY_ID = USER_RESOURCE_CATEGORY + "/" + DISPLAY_NAME_PROPERTY_ID;
+ public static final String USER_LOCAL_USERNAME_PROPERTY_ID = USER_RESOURCE_CATEGORY + "/" + LOCAL_USERNAME_PROPERTY_ID;
+ public static final String USER_ACTIVE_PROPERTY_ID = USER_RESOURCE_CATEGORY + "/" + ACTIVE_PROPERTY_ID;
+ public static final String USER_CREATE_TIME_PROPERTY_ID = USER_RESOURCE_CATEGORY + "/" + CREATE_TIME_PROPERTY_ID;
+ public static final String USER_CONSECUTIVE_FAILURES_PROPERTY_ID = USER_RESOURCE_CATEGORY + "/" + CONSECUTIVE_FAILURES_PROPERTY_ID;
+ public static final String USER_ADMIN_PROPERTY_ID = USER_RESOURCE_CATEGORY + "/" + ADMIN_PROPERTY_ID;
+ public static final String USER_GROUPS_PROPERTY_ID = USER_RESOURCE_CATEGORY + "/" + GROUPS_PROPERTY_ID;
+
+ /* *******************************************************
+ * Deprecated properties, kept for backwards compatibility and to maintain API V1 contract.
+ * These properties are related to a user's authentication resource.
+ * ******************************************************* */
+ @Deprecated
+ public static final String PASSWORD_PROPERTY_ID = "password";
+ @Deprecated
+ public static final String OLD_PASSWORD_PROPERTY_ID = "old_password";
+ @Deprecated
+ public static final String LDAP_USER_PROPERTY_ID = "ldap_user";
+ @Deprecated
+ public static final String USER_TYPE_PROPERTY_ID = "user_type";
+
+ @Deprecated
+ public static final String USER_PASSWORD_PROPERTY_ID = USER_RESOURCE_CATEGORY + "/" + PASSWORD_PROPERTY_ID;
+ @Deprecated
+ public static final String USER_OLD_PASSWORD_PROPERTY_ID = USER_RESOURCE_CATEGORY + "/" + OLD_PASSWORD_PROPERTY_ID;
+ @Deprecated
+ public static final String USER_LDAP_USER_PROPERTY_ID = USER_RESOURCE_CATEGORY + "/" + LDAP_USER_PROPERTY_ID;
+ @Deprecated
+ public static final String USER_USER_TYPE_PROPERTY_ID = USER_RESOURCE_CATEGORY + "/" + USER_TYPE_PROPERTY_ID;
+ /* ******************************************************* */
+
+ private static final Set<String> PK_PROPERTY_IDS = ImmutableSet.of(
+ USER_USERNAME_PROPERTY_ID
+ );
+ private static final Set<String> PROPERTY_IDS = ImmutableSet.of(
+ USER_USERNAME_PROPERTY_ID,
+ USER_DISPLAY_NAME_PROPERTY_ID,
+ USER_LOCAL_USERNAME_PROPERTY_ID,
+ USER_ACTIVE_PROPERTY_ID,
+ USER_CREATE_TIME_PROPERTY_ID,
+ USER_CONSECUTIVE_FAILURES_PROPERTY_ID,
+ USER_GROUPS_PROPERTY_ID,
+ USER_PASSWORD_PROPERTY_ID,
+ USER_OLD_PASSWORD_PROPERTY_ID,
+ USER_LDAP_USER_PROPERTY_ID,
+ USER_USER_TYPE_PROPERTY_ID,
+ USER_ADMIN_PROPERTY_ID
+ );
+ private static final Map<Resource.Type, String> KEY_PROPERTY_IDS = ImmutableMap.of(
+ Resource.Type.User, USER_USERNAME_PROPERTY_ID
+ );
+
+ @Inject
+ private Users users;
/**
* Create a new resource provider for the given management controller.
http://git-wip-us.apache.org/repos/asf/ambari/blob/d173011c/ambari-server/src/main/java/org/apache/ambari/server/controller/spi/Resource.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d173011c/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProvider.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d173011c/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d173011c/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d173011c/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d173011c/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d173011c/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d173011c/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d173011c/ambari-server/src/main/resources/META-INF/persistence.xml
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d173011c/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d173011c/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProviderForDNWithSpaceTest.java
----------------------------------------------------------------------
diff --cc ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProviderForDNWithSpaceTest.java
index fd967c2,566d6b7..10076b0
--- a/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProviderForDNWithSpaceTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProviderForDNWithSpaceTest.java
@@@ -26,11 -26,10 +26,12 @@@ import org.apache.ambari.server.H2Datab
import org.apache.ambari.server.audit.AuditLoggerModule;
import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.ControllerModule;
+ import org.apache.ambari.server.ldap.LdapModule;
import org.apache.ambari.server.orm.GuiceJpaInitializer;
import org.apache.ambari.server.orm.dao.UserDAO;
+import org.apache.ambari.server.orm.entities.UserEntity;
import org.apache.ambari.server.security.ClientSecurityType;
+import org.apache.ambari.server.security.authentication.InvalidUsernamePasswordCombinationException;
import org.apache.directory.server.annotations.CreateLdapServer;
import org.apache.directory.server.annotations.CreateTransport;
import org.apache.directory.server.core.annotations.ApplyLdifFiles;
http://git-wip-us.apache.org/repos/asf/ambari/blob/d173011c/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProviderTest.java
----------------------------------------------------------------------
[09/50] [abbrv] ambari git commit: AMBARI-22398. Upstart is not able
to stop the ambari-agent (aonishuk)
Posted by rl...@apache.org.
AMBARI-22398. Upstart is not able to stop the ambari-agent (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e968b121
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e968b121
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e968b121
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: e968b12186848edd7b4e8b7103e8283b61f59c50
Parents: 780e91e
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Thu Nov 9 16:37:58 2017 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Thu Nov 9 16:37:58 2017 +0200
----------------------------------------------------------------------
ambari-agent/src/main/python/ambari_agent/AmbariAgent.py | 3 ---
1 file changed, 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/e968b121/ambari-agent/src/main/python/ambari_agent/AmbariAgent.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/AmbariAgent.py b/ambari-agent/src/main/python/ambari_agent/AmbariAgent.py
index 28b9528..aeb200c 100644
--- a/ambari-agent/src/main/python/ambari_agent/AmbariAgent.py
+++ b/ambari-agent/src/main/python/ambari_agent/AmbariAgent.py
@@ -49,9 +49,6 @@ def main():
mergedArgs = [PYTHON, AGENT_SCRIPT] + args
- # Become a parent for all subprocesses
- os.setpgrp()
-
try:
while status == AGENT_AUTO_RESTART_EXIT_CODE:
mainProcess = subprocess.Popen(mergedArgs)
[41/50] [abbrv] ambari git commit: AMBARI-22448. Oozie Jobs on Hive
Fail With Missing Tarball (ncole)
Posted by rl...@apache.org.
AMBARI-22448. Oozie Jobs on Hive Fail With Missing Tarball (ncole)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/99152d32
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/99152d32
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/99152d32
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 99152d3257a0eb4180283fa882f8283a3eaba196
Parents: 3f2743b
Author: Nate Cole <nc...@hortonworks.com>
Authored: Wed Nov 15 12:52:50 2017 -0500
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Wed Nov 15 12:52:50 2017 -0500
----------------------------------------------------------------------
.../resources/stacks/HDP/2.0.6/properties/stack_packages.json | 3 ++-
.../resources/stacks/HDP/3.0/properties/stack_packages.json | 6 +++---
2 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/99152d32/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json b/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
index 68e6bf8..245449c 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
@@ -1278,7 +1278,8 @@
},
"upgrade-dependencies" : {
"HIVE": ["TEZ"],
- "MAHOUT": ["MAPREDUCE2"]
+ "MAHOUT": ["MAPREDUCE2"],
+ "OOZIE": ["MAPREDUCE2"]
}
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/99152d32/ambari-server/src/main/resources/stacks/HDP/3.0/properties/stack_packages.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/3.0/properties/stack_packages.json b/ambari-server/src/main/resources/stacks/HDP/3.0/properties/stack_packages.json
index d8cd015..5603c0c 100644
--- a/ambari-server/src/main/resources/stacks/HDP/3.0/properties/stack_packages.json
+++ b/ambari-server/src/main/resources/stacks/HDP/3.0/properties/stack_packages.json
@@ -1154,9 +1154,9 @@
}
},
"upgrade-dependencies" : {
- "YARN": ["TEZ"],
- "TEZ": ["YARN"],
- "MAHOUT": ["MAPREDUCE2"]
+ "HIVE": ["TEZ"],
+ "MAHOUT": ["MAPREDUCE2"],
+ "OOZIE": ["MAPREDUCE2"]
}
}
}
[25/50] [abbrv] ambari git commit: AMBARI-22347. Simplify Ambari
configuration tables from AMBARI-21307 (rlevas)
Posted by rl...@apache.org.
AMBARI-22347. Simplify Ambari configuration tables from AMBARI-21307 (rlevas)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4fa9ac55
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4fa9ac55
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4fa9ac55
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 4fa9ac5505d6604f1d74def8fc1ea6eeb3ea3fda
Parents: 18e5490
Author: Robert Levas <rl...@hortonworks.com>
Authored: Mon Nov 13 13:11:42 2017 -0500
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Mon Nov 13 13:12:11 2017 -0500
----------------------------------------------------------------------
.../AmbariConfigurationRequestSwagger.java | 14 +-
.../services/AmbariConfigurationService.java | 46 +-
.../api/services/ldap/AmbariConfiguration.java | 51 +--
.../services/ldap/LdapConfigurationService.java | 4 +-
.../AmbariConfigurationResourceProvider.java | 370 +++++++---------
.../events/AmbariConfigurationChangedEvent.java | 36 ++
.../ambari/server/events/AmbariEvent.java | 4 +-
.../events/AmbariLdapConfigChangedEvent.java | 37 --
.../ldap/domain/AmbariLdapConfiguration.java | 20 +-
.../AmbariLdapConfigurationProvider.java | 57 ++-
.../ads/LdapConnectionTemplateFactory.java | 4 +-
.../server/orm/dao/AmbariConfigurationDAO.java | 146 ++++--
.../orm/entities/AmbariConfigurationEntity.java | 94 ++--
.../entities/AmbariConfigurationEntityPK.java | 88 ++++
.../orm/entities/ConfigurationBaseEntity.java | 159 -------
.../server/upgrade/SchemaUpgradeHelper.java | 3 +-
.../server/upgrade/UpgradeCatalog300.java | 21 +-
.../main/resources/Ambari-DDL-Derby-CREATE.sql | 21 +-
.../main/resources/Ambari-DDL-MySQL-CREATE.sql | 20 +-
.../main/resources/Ambari-DDL-Oracle-CREATE.sql | 20 +-
.../resources/Ambari-DDL-Postgres-CREATE.sql | 19 +-
.../resources/Ambari-DDL-SQLAnywhere-CREATE.sql | 20 +-
.../resources/Ambari-DDL-SQLServer-CREATE.sql | 19 +-
.../src/main/resources/META-INF/persistence.xml | 1 -
...AmbariConfigurationResourceProviderTest.java | 444 ++++++++++++-------
.../orm/dao/AmbariConfigurationDAOTest.java | 298 +++++++++++++
.../server/upgrade/UpgradeCatalog300Test.java | 43 ++
27 files changed, 1223 insertions(+), 836 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fa9ac55/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationRequestSwagger.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationRequestSwagger.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationRequestSwagger.java
index 5e8094e..2dca9f5 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationRequestSwagger.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationRequestSwagger.java
@@ -29,19 +29,9 @@ public interface AmbariConfigurationRequestSwagger extends ApiModel {
interface AmbariConfigurationRequestInfo {
@ApiModelProperty
- Long getId();
+ String getCategoryName();
@ApiModelProperty
- Map<String, Object> getData();
-
- @ApiModelProperty
- String getType();
-
- @ApiModelProperty
- Long getVersion();
-
- @ApiModelProperty(name = "version_tag")
- String getVersionTag();
+ Map<String, Object> getProperties();
}
-
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fa9ac55/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
index 38ae766..86ed666 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
@@ -46,21 +46,21 @@ import io.swagger.annotations.ApiResponses;
* Ambari configuration resources may be shared with components and services in the cluster
* (by recommending them as default values)
*
- * Eg. LDAP configuration is stored as ambariconfiguration.
+ * Eg. LDAP configuration is stored as AmbariConfiguration.
* The request payload has the form:
*
* <pre>
* {
* "AmbariConfiguration": {
- * "type": "ldap-configuration",
- * "data": [
- * {
- * "authentication.ldap.primaryUrl": "localhost:33389"
- * "authentication.ldap.secondaryUrl": "localhost:333"
- * "authentication.ldap.baseDn": "dc=ambari,dc=apache,dc=org"
- * // ......
- * ]
- * }
+ * "category": "ldap-configuration",
+ * "properties": {
+ * "authentication.ldap.primaryUrl": "localhost:33389"
+ * "authentication.ldap.secondaryUrl": "localhost:333"
+ * "authentication.ldap.baseDn": "dc=ambari,dc=apache,dc=org"
+ * // ......
+ * }
+ * }
+ * }
* </pre>
*/
@Path("/ambariconfigs/")
@@ -96,7 +96,7 @@ public class AmbariConfigurationService extends BaseService {
})
public Response createAmbariConfiguration(String body, @Context HttpHeaders headers, @Context UriInfo uri) {
return handleRequest(headers, body, uri, Request.Type.POST, createResource(Resource.Type.AmbariConfiguration,
- Collections.EMPTY_MAP));
+ Collections.emptyMap()));
}
@GET
@@ -108,10 +108,10 @@ public class AmbariConfigurationService extends BaseService {
responseContainer = RESPONSE_CONTAINER_LIST)
@ApiImplicitParams({
@ApiImplicitParam(name = QUERY_FIELDS, value = QUERY_FILTER_DESCRIPTION,
- defaultValue = "AmbariConfiguration/data, AmbariConfiguration/id, AmbariConfiguration/type",
+ defaultValue = "AmbariConfiguration/properties, AmbariConfiguration/category",
dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY),
@ApiImplicitParam(name = QUERY_SORT, value = QUERY_SORT_DESCRIPTION,
- defaultValue = "AmbariConfiguration/id",
+ defaultValue = "AmbariConfiguration/category",
dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY),
@ApiImplicitParam(name = QUERY_PAGE_SIZE, value = QUERY_PAGE_SIZE_DESCRIPTION, defaultValue = DEFAULT_PAGE_SIZE, dataType = DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY),
@ApiImplicitParam(name = QUERY_FROM, value = QUERY_FROM_DESCRIPTION, defaultValue = DEFAULT_FROM, dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY),
@@ -123,11 +123,11 @@ public class AmbariConfigurationService extends BaseService {
})
public Response getAmbariConfigurations(String body, @Context HttpHeaders headers, @Context UriInfo uri) {
return handleRequest(headers, body, uri, Request.Type.GET, createResource(Resource.Type.AmbariConfiguration,
- Collections.EMPTY_MAP));
+ Collections.emptyMap()));
}
@GET
- @Path("{configurationId}")
+ @Path("{category}")
@Produces(MediaType.TEXT_PLAIN)
@ApiOperation(value = "Retrieve the details of an ambari configuration resource",
nickname = "AmbariConfigurationService#getAmbariConfiguration",
@@ -142,13 +142,13 @@ public class AmbariConfigurationService extends BaseService {
@ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR)
})
public Response getAmbariConfiguration(String body, @Context HttpHeaders headers, @Context UriInfo uri,
- @PathParam("configurationId") String configurationId) {
+ @PathParam("category") String category) {
return handleRequest(headers, body, uri, Request.Type.GET, createResource(Resource.Type.AmbariConfiguration,
- Collections.singletonMap(Resource.Type.AmbariConfiguration, configurationId)));
+ Collections.singletonMap(Resource.Type.AmbariConfiguration, category)));
}
@PUT
- @Path("{configurationId}")
+ @Path("{category}")
@Produces(MediaType.TEXT_PLAIN)
@ApiOperation(value = "Updates ambari configuration resources ",
nickname = "AmbariConfigurationService#updateAmbariConfiguration")
@@ -167,13 +167,13 @@ public class AmbariConfigurationService extends BaseService {
@ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR),
})
public Response updateAmbariConfiguration(String body, @Context HttpHeaders headers, @Context UriInfo uri,
- @PathParam("configurationId") String configurationId) {
+ @PathParam("category") String category) {
return handleRequest(headers, body, uri, Request.Type.PUT, createResource(Resource.Type.AmbariConfiguration,
- Collections.singletonMap(Resource.Type.AmbariConfiguration, configurationId)));
+ Collections.singletonMap(Resource.Type.AmbariConfiguration, category)));
}
@DELETE
- @Path("{configurationId}")
+ @Path("{category}")
@Produces(MediaType.TEXT_PLAIN)
@ApiOperation(value = "Deletes an ambari configuration resource",
nickname = "AmbariConfigurationService#deleteAmbariConfiguration")
@@ -185,9 +185,9 @@ public class AmbariConfigurationService extends BaseService {
@ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR),
})
public Response deleteAmbariConfiguration(String body, @Context HttpHeaders headers, @Context UriInfo uri,
- @PathParam("configurationId") String configurationId) {
+ @PathParam("category") String category) {
return handleRequest(headers, body, uri, Request.Type.DELETE, createResource(Resource.Type.AmbariConfiguration,
- Collections.singletonMap(Resource.Type.AmbariConfiguration, configurationId)));
+ Collections.singletonMap(Resource.Type.AmbariConfiguration, category)));
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fa9ac55/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/AmbariConfiguration.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/AmbariConfiguration.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/AmbariConfiguration.java
index b5cc921..e9f0b1e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/AmbariConfiguration.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/AmbariConfiguration.java
@@ -14,9 +14,7 @@
package org.apache.ambari.server.api.services.ldap;
-import java.util.Collections;
import java.util.Map;
-import java.util.Set;
/**
* Domain POJO representing generic ambari configuration data.
@@ -28,22 +26,7 @@ public class AmbariConfiguration {
*/
private String type;
- /**
- * Version tag
- */
- private String versionTag;
-
- /**
- * Version number
- */
- private Integer version;
-
- /**
- * Created timestamp
- */
- private long createdTs;
-
- private Set<Map<String, Object>> data = Collections.emptySet();
+ private Map<String, Object> properties = null;
public String getType() {
return type;
@@ -53,35 +36,11 @@ public class AmbariConfiguration {
this.type = type;
}
- public Set<Map<String, Object>> getData() {
- return data;
- }
-
- public void setData(Set<Map<String, Object>> data) {
- this.data = data;
- }
-
- public String getVersionTag() {
- return versionTag;
- }
-
- public void setVersionTag(String versionTag) {
- this.versionTag = versionTag;
- }
-
- public Integer getVersion() {
- return version;
- }
-
- public void setVersion(Integer version) {
- this.version = version;
- }
-
- public long getCreatedTs() {
- return createdTs;
+ public Map<String, Object> getProperties() {
+ return properties;
}
- public void setCreatedTs(long createdTs) {
- this.createdTs = createdTs;
+ public void setProperties(Map<String, Object> data) {
+ this.properties = data;
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fa9ac55/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
index 13f8835..00c13f6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
@@ -94,7 +94,7 @@ public class LdapConfigurationService extends AmbariConfigurationService {
validateRequest(ldapConfigurationRequest);
AmbariLdapConfiguration ambariLdapConfiguration = ambariLdapConfigurationFactory.createLdapConfiguration(
- ldapConfigurationRequest.getAmbariConfiguration().getData().iterator().next());
+ ldapConfigurationRequest.getAmbariConfiguration().getProperties());
LdapConfigOperation action = LdapConfigOperation.fromAction(ldapConfigurationRequest.getRequestInfo().getAction());
switch (action) {
@@ -154,7 +154,7 @@ public class LdapConfigurationService extends AmbariConfigurationService {
}
if (null == ldapConfigurationRequest.getAmbariConfiguration()
- || ldapConfigurationRequest.getAmbariConfiguration().getData().size() != 1) {
+ || ldapConfigurationRequest.getAmbariConfiguration().getProperties() != null) {
errMsg = String.format("No / Invalid configuration data provided. Request: [%s]", ldapConfigurationRequest);
LOGGER.error(errMsg);
throw new IllegalArgumentException(errMsg);
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fa9ac55/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProvider.java
index 4f4cc70..a24400d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProvider.java
@@ -14,15 +14,15 @@
package org.apache.ambari.server.controller.internal;
-import java.util.Calendar;
+import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-
-import javax.inject.Inject;
+import java.util.TreeMap;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.controller.spi.NoSuchParentResourceException;
@@ -35,20 +35,18 @@ import org.apache.ambari.server.controller.spi.ResourceAlreadyExistsException;
import org.apache.ambari.server.controller.spi.SystemException;
import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
import org.apache.ambari.server.controller.utilities.PredicateHelper;
-import org.apache.ambari.server.events.AmbariEvent;
-import org.apache.ambari.server.events.AmbariLdapConfigChangedEvent;
+import org.apache.ambari.server.controller.utilities.PropertyHelper;
+import org.apache.ambari.server.events.AmbariConfigurationChangedEvent;
import org.apache.ambari.server.events.publishers.AmbariEventPublisher;
import org.apache.ambari.server.orm.dao.AmbariConfigurationDAO;
import org.apache.ambari.server.orm.entities.AmbariConfigurationEntity;
-import org.apache.ambari.server.orm.entities.ConfigurationBaseEntity;
import org.apache.ambari.server.security.authorization.RoleAuthorization;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.collect.Sets;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.inject.assistedinject.AssistedInject;
+import com.google.inject.Inject;
/**
* Resource provider for AmbariConfiguration resources.
@@ -56,62 +54,24 @@ import com.google.inject.assistedinject.AssistedInject;
public class AmbariConfigurationResourceProvider extends AbstractAuthorizedResourceProvider {
private static final Logger LOGGER = LoggerFactory.getLogger(AmbariConfigurationResourceProvider.class);
- private static final String DEFAULT_VERSION_TAG = "Default version";
- private static final Integer DEFAULT_VERSION = 1;
-
- /**
- * Resource property id constants.
- */
- public enum ResourcePropertyId {
-
- ID("AmbariConfiguration/id"),
- TYPE("AmbariConfiguration/type"),
- VERSION("AmbariConfiguration/version"),
- VERSION_TAG("AmbariConfiguration/version_tag"),
- DATA("AmbariConfiguration/data");
-
- private String propertyId;
-
- ResourcePropertyId(String propertyId) {
- this.propertyId = propertyId;
- }
-
- String getPropertyId() {
- return this.propertyId;
- }
- public static ResourcePropertyId fromString(String propertyIdStr) {
- ResourcePropertyId propertyIdFromStr = null;
+ static final String AMBARI_CONFIGURATION_CATEGORY_PROPERTY_ID = PropertyHelper.getPropertyId("AmbariConfiguration", "category");
+ static final String AMBARI_CONFIGURATION_PROPERTIES_PROPERTY_ID = PropertyHelper.getPropertyId("AmbariConfiguration", "properties");
- for (ResourcePropertyId id : ResourcePropertyId.values()) {
- if (id.getPropertyId().equals(propertyIdStr)) {
- propertyIdFromStr = id;
- break;
- }
- }
-
- if (propertyIdFromStr == null) {
- throw new IllegalArgumentException("Unsupported property type: " + propertyIdStr);
- }
-
- return propertyIdFromStr;
-
- }
- }
+ private static final Set<String> PROPERTIES = Collections.unmodifiableSet(
+ new HashSet<>(Arrays.asList(
+ AMBARI_CONFIGURATION_CATEGORY_PROPERTY_ID,
+ AMBARI_CONFIGURATION_PROPERTIES_PROPERTY_ID)
+ )
+ );
- private static Set<String> PROPERTIES = Sets.newHashSet(
- ResourcePropertyId.ID.getPropertyId(),
- ResourcePropertyId.TYPE.getPropertyId(),
- ResourcePropertyId.VERSION.getPropertyId(),
- ResourcePropertyId.VERSION_TAG.getPropertyId(),
- ResourcePropertyId.DATA.getPropertyId());
-
- private static Map<Resource.Type, String> PK_PROPERTY_MAP = Collections.unmodifiableMap(
- new HashMap<Resource.Type, String>() {{
- put(Resource.Type.AmbariConfiguration, ResourcePropertyId.ID.getPropertyId());
- }}
+ private static final Map<Resource.Type, String> PK_PROPERTY_MAP = Collections.unmodifiableMap(
+ Collections.singletonMap(Resource.Type.AmbariConfiguration, AMBARI_CONFIGURATION_CATEGORY_PROPERTY_ID)
);
+ private static final Set<String> PK_PROPERTY_IDS = Collections.unmodifiableSet(
+ new HashSet<>(PK_PROPERTY_MAP.values())
+ );
@Inject
private AmbariConfigurationDAO ambariConfigurationDAO;
@@ -119,210 +79,224 @@ public class AmbariConfigurationResourceProvider extends AbstractAuthorizedResou
@Inject
private AmbariEventPublisher publisher;
-
- private Gson gson;
-
- @AssistedInject
public AmbariConfigurationResourceProvider() {
super(PROPERTIES, PK_PROPERTY_MAP);
- setRequiredCreateAuthorizations(EnumSet.of(RoleAuthorization.AMBARI_MANAGE_CONFIGURATION));
- setRequiredDeleteAuthorizations(EnumSet.of(RoleAuthorization.AMBARI_MANAGE_CONFIGURATION));
- gson = new GsonBuilder().create();
+ Set<RoleAuthorization> authorizations = EnumSet.of(RoleAuthorization.AMBARI_MANAGE_CONFIGURATION);
+ setRequiredCreateAuthorizations(authorizations);
+ setRequiredDeleteAuthorizations(authorizations);
+ setRequiredUpdateAuthorizations(authorizations);
+ setRequiredGetAuthorizations(authorizations);
}
@Override
protected Set<String> getPKPropertyIds() {
- return Sets.newHashSet(ResourcePropertyId.ID.getPropertyId());
+ return PK_PROPERTY_IDS;
}
@Override
- public RequestStatus createResourcesAuthorized(Request request) throws SystemException, UnsupportedPropertyException,
- ResourceAlreadyExistsException, NoSuchParentResourceException {
-
- LOGGER.info("Creating new ambari configuration resource ...");
- AmbariConfigurationEntity ambariConfigurationEntity = null;
- try {
- ambariConfigurationEntity = getEntityFromRequest(request);
- } catch (AmbariException e) {
- throw new NoSuchParentResourceException(e.getMessage());
- }
-
- LOGGER.info("Persisting new ambari configuration: {} ", ambariConfigurationEntity);
-
- try {
- ambariConfigurationDAO.create(ambariConfigurationEntity);
- } catch (Exception e) {
- LOGGER.error("Failed to create resource", e);
- throw new ResourceAlreadyExistsException(e.getMessage());
- }
+ public RequestStatus createResourcesAuthorized(Request request)
+ throws SystemException, UnsupportedPropertyException, ResourceAlreadyExistsException, NoSuchParentResourceException {
- // todo filter by configuration type
- // notify subscribers about the configuration changes
- publisher.publish(new AmbariLdapConfigChangedEvent(AmbariEvent.AmbariEventType.LDAP_CONFIG_CHANGED,
- ambariConfigurationEntity.getId()));
+ createOrAddProperties(null, request.getProperties(), true);
return getRequestStatus(null);
}
-
@Override
protected Set<Resource> getResourcesAuthorized(Request request, Predicate predicate) throws SystemException,
- UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {
- Set<Resource> resources = Sets.newHashSet();
+ UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {
- // retrieves allconfigurations, filtering is done at a higher level
- List<AmbariConfigurationEntity> ambariConfigurationEntities = ambariConfigurationDAO.findAll();
- for (AmbariConfigurationEntity ambariConfigurationEntity : ambariConfigurationEntities) {
- try {
- resources.add(toResource(ambariConfigurationEntity, getPropertyIds()));
- } catch (AmbariException e) {
- LOGGER.error("Error while retrieving ambari configuration", e);
+ return getResources(new Command<Set<Resource>>() {
+ @Override
+ public Set<Resource> invoke() throws AmbariException {
+ Set<Resource> resources = new HashSet<>();
+ Set<String> requestedIds = getRequestPropertyIds(request, predicate);
+
+ if (CollectionUtils.isEmpty(requestedIds)) {
+ requestedIds = PROPERTIES;
+ }
+
+ if (predicate == null) {
+ Set<Resource> _resources = getAmbariConfigurationResources(requestedIds, null);
+ if (!CollectionUtils.isEmpty(_resources)) {
+ resources.addAll(_resources);
+ }
+ } else {
+ for (Map<String, Object> propertyMap : getPropertyMaps(predicate)) {
+ Set<Resource> _resources = getAmbariConfigurationResources(requestedIds, propertyMap);
+ if (!CollectionUtils.isEmpty(_resources)) {
+ resources.addAll(_resources);
+ }
+ }
+ }
+
+ return resources;
}
- }
- return resources;
+ });
}
+
@Override
protected RequestStatus deleteResourcesAuthorized(Request request, Predicate predicate) throws SystemException,
- UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {
+ UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {
- Long idFromRequest = Long.valueOf((String) PredicateHelper.getProperties(predicate).get(ResourcePropertyId.ID.getPropertyId()));
+ String categoryName = (String) PredicateHelper.getProperties(predicate).get(AMBARI_CONFIGURATION_CATEGORY_PROPERTY_ID);
- if (null == idFromRequest) {
+ if (null == categoryName) {
LOGGER.debug("No resource id provided in the request");
} else {
- LOGGER.debug("Deleting amari configuration with id: {}", idFromRequest);
+ LOGGER.debug("Deleting Ambari configuration with id: {}", categoryName);
try {
- ambariConfigurationDAO.removeByPK(idFromRequest);
+ ambariConfigurationDAO.removeByCategory(categoryName);
} catch (IllegalStateException e) {
throw new NoSuchResourceException(e.getMessage());
}
-
}
// notify subscribers about the configuration changes
- publisher.publish(new AmbariLdapConfigChangedEvent(AmbariEvent.AmbariEventType.LDAP_CONFIG_CHANGED, idFromRequest));
-
-
+ publisher.publish(new AmbariConfigurationChangedEvent(categoryName));
return getRequestStatus(null);
-
}
@Override
- protected RequestStatus updateResourcesAuthorized(Request request, Predicate predicate) throws SystemException,
- UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {
- Long idFromRequest = Long.valueOf((String) PredicateHelper.getProperties(predicate).get(ResourcePropertyId.ID.getPropertyId()));
-
- AmbariConfigurationEntity persistedEntity = ambariConfigurationDAO.findByPK(idFromRequest);
- if (persistedEntity == null) {
- String errorMsg = String.format("Entity with primary key [ %s ] not found in the database.", idFromRequest);
- LOGGER.error(errorMsg);
- throw new NoSuchResourceException(errorMsg);
- }
+ protected RequestStatus updateResourcesAuthorized(Request request, Predicate predicate)
+ throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {
- try {
-
- AmbariConfigurationEntity entityFromRequest = getEntityFromRequest(request);
- persistedEntity.getConfigurationBaseEntity().setVersionTag(entityFromRequest.getConfigurationBaseEntity().getVersionTag());
- persistedEntity.getConfigurationBaseEntity().setVersion(entityFromRequest.getConfigurationBaseEntity().getVersion());
- persistedEntity.getConfigurationBaseEntity().setType(entityFromRequest.getConfigurationBaseEntity().getType());
- persistedEntity.getConfigurationBaseEntity().setConfigurationData(entityFromRequest.getConfigurationBaseEntity().getConfigurationData());
- persistedEntity.getConfigurationBaseEntity().setConfigurationAttributes(entityFromRequest.getConfigurationBaseEntity().getConfigurationAttributes());
+ String categoryName = (String) PredicateHelper.getProperties(predicate).get(AMBARI_CONFIGURATION_CATEGORY_PROPERTY_ID);
+ createOrAddProperties(categoryName, request.getProperties(), false);
+ return getRequestStatus(null);
+ }
- ambariConfigurationDAO.update(persistedEntity);
- } catch (AmbariException e) {
- throw new NoSuchParentResourceException(e.getMessage());
+ /**
+ * Retrieves groups of properties from the request data and create or updates them as needed.
+ * <p>
+ * Each group of properties is expected to have a category (<code>AmbariConfiguration/category</code>)
+ * value and one or more property (<code>AmbariConfiguration/properties/property.name</code>) values.
+ * If a category cannot be determined from the propery set, the default category value (passed in)
+ * is used. If a default category is set, it is assumed that it was parsed from the request predicate
+ * (if availabe).
+ *
+ * @param defaultCategoryName the default category to use if needed
+ * @param requestProperties a collection of property maps parsed from the request
+ * @param removePropertiesIfNotSpecified <code>true</code> to remove existing properties that have not been specifed in the request; <code>false</code> append or update the existing set of properties with values from the request
+ * @throws SystemException if an error occurs saving the configuration data
+ */
+ private void createOrAddProperties(String defaultCategoryName, Set<Map<String, Object>> requestProperties, boolean removePropertiesIfNotSpecified)
+ throws SystemException {
+ // set of resource properties (each entry in the set belongs to a different resource)
+ if (requestProperties != null) {
+ for (Map<String, Object> resourceProperties : requestProperties) {
+ Map<String, Map<String, String>> entityMap = parseProperties(defaultCategoryName, resourceProperties);
+
+ if (entityMap != null) {
+ for (Map.Entry<String, Map<String, String>> entry : entityMap.entrySet()) {
+ String categoryName = entry.getKey();
+
+ if (ambariConfigurationDAO.reconcileCategory(categoryName, entry.getValue(), removePropertiesIfNotSpecified)) {
+ // notify subscribers about the configuration changes
+ publisher.publish(new AmbariConfigurationChangedEvent(categoryName));
+ }
+ }
+ }
+ }
}
+ }
- publisher.publish(new AmbariLdapConfigChangedEvent(AmbariEvent.AmbariEventType.LDAP_CONFIG_CHANGED,
- persistedEntity.getId()));
-
+ private Resource toResource(String categoryName, Map<String, String> properties, Set<String> requestedIds) {
+ Resource resource = new ResourceImpl(Resource.Type.AmbariConfiguration);
+ setResourceProperty(resource, AMBARI_CONFIGURATION_CATEGORY_PROPERTY_ID, categoryName, requestedIds);
+ setResourceProperty(resource, AMBARI_CONFIGURATION_PROPERTIES_PROPERTY_ID, properties, requestedIds);
+ return resource;
+ }
- return getRequestStatus(null);
+ /**
+ * Parse the property map from a request into a map of category names to maps of property names and values.
+ *
+ * @param defaultCategoryName the default category name to use if one is not found in the map of properties
+ * @param resourceProperties a map of properties from a request item
+ * @return a map of category names to maps of name/value pairs
+ * @throws SystemException if an issue with the data is determined
+ */
+ private Map<String, Map<String, String>> parseProperties(String defaultCategoryName, Map<String, Object> resourceProperties) throws SystemException {
+ String categoryName = null;
+ Map<String, String> properties = new HashMap<>();
- }
+ for (Map.Entry<String, Object> entry : resourceProperties.entrySet()) {
+ String propertyName = entry.getKey();
- private Resource toResource(AmbariConfigurationEntity entity, Set<String> requestedIds) throws AmbariException {
+ if (AMBARI_CONFIGURATION_CATEGORY_PROPERTY_ID.equals(propertyName)) {
+ if (entry.getValue() instanceof String) {
+ categoryName = (String) entry.getValue();
+ }
+ } else {
+ String propertyCategory = PropertyHelper.getPropertyCategory(entry.getKey());
+ if ((propertyCategory != null) && propertyCategory.equals(AMBARI_CONFIGURATION_PROPERTIES_PROPERTY_ID)) {
+ String name = PropertyHelper.getPropertyName(entry.getKey());
+ Object value = entry.getValue();
+ properties.put(name, (value == null) ? null : value.toString());
+ }
+ }
+ }
- if (null == entity) {
- throw new IllegalArgumentException("Null entity can't be transformed into a resource");
+ if (categoryName == null) {
+ categoryName = defaultCategoryName;
}
- if (null == entity.getConfigurationBaseEntity()) {
- throw new IllegalArgumentException("Invalid configuration entity can't be transformed into a resource");
+ if (StringUtils.isEmpty(categoryName)) {
+ throw new SystemException("The configuration type must be set");
}
- Resource resource = new ResourceImpl(Resource.Type.AmbariConfiguration);
- Set<Map<String, String>> configurationSet = gson.fromJson(entity.getConfigurationBaseEntity().getConfigurationData(), Set.class);
- setResourceProperty(resource, ResourcePropertyId.ID.getPropertyId(), entity.getId(), requestedIds);
- setResourceProperty(resource, ResourcePropertyId.TYPE.getPropertyId(), entity.getConfigurationBaseEntity().getType(), requestedIds);
- setResourceProperty(resource, ResourcePropertyId.DATA.getPropertyId(), configurationSet, requestedIds);
- setResourceProperty(resource, ResourcePropertyId.VERSION.getPropertyId(), entity.getConfigurationBaseEntity().getVersion(), requestedIds);
- setResourceProperty(resource, ResourcePropertyId.VERSION_TAG.getPropertyId(), entity.getConfigurationBaseEntity().getVersionTag(), requestedIds);
+ if (properties.isEmpty()) {
+ throw new SystemException("The configuration properties must be set");
+ }
- return resource;
+ return Collections.singletonMap(categoryName, properties);
}
- private AmbariConfigurationEntity getEntityFromRequest(Request request) throws AmbariException {
+ private Set<Resource> getAmbariConfigurationResources(Set<String> requestedIds, Map<String, Object> propertyMap) {
+ Set<Resource> resources = new HashSet<>();
- AmbariConfigurationEntity ambariConfigurationEntity = new AmbariConfigurationEntity();
- ambariConfigurationEntity.setConfigurationBaseEntity(new ConfigurationBaseEntity());
+ String categoryName = getStringProperty(propertyMap, AMBARI_CONFIGURATION_CATEGORY_PROPERTY_ID);
- // set of resource properties (eache entry in the set belongs to a different resource)
- Set<Map<String, Object>> resourcePropertiesSet = request.getProperties();
+ List<AmbariConfigurationEntity> entities = (categoryName == null)
+ ? ambariConfigurationDAO.findAll()
+ : ambariConfigurationDAO.findByCategory(categoryName);
- if (resourcePropertiesSet.size() != 1) {
- throw new AmbariException("There must be only one resource specified in the request");
- }
+ if (entities != null) {
+ Map<String, Map<String, String>> configurations = new HashMap<>();
- // the configuration type must be set
- if (getValueFromResourceProperties(ResourcePropertyId.TYPE, resourcePropertiesSet.iterator().next()) == null) {
- throw new AmbariException("The configuration type must be set");
- }
+ for (AmbariConfigurationEntity entity : entities) {
+ String category = entity.getCategoryName();
+ Map<String, String> properties = configurations.get(category);
+ if (properties == null) {
+ properties = new TreeMap<>();
+ configurations.put(category, properties);
+ }
- for (ResourcePropertyId resourcePropertyId : ResourcePropertyId.values()) {
- Object requestValue = getValueFromResourceProperties(resourcePropertyId, resourcePropertiesSet.iterator().next());
+ properties.put(entity.getPropertyName(), entity.getPropertyValue());
+ }
- switch (resourcePropertyId) {
- case DATA:
- if (requestValue == null) {
- throw new IllegalArgumentException("No configuration data is provided in the request");
- }
- ambariConfigurationEntity.getConfigurationBaseEntity().setConfigurationData(gson.toJson(requestValue));
- break;
- case TYPE:
- ambariConfigurationEntity.getConfigurationBaseEntity().setType((String) requestValue);
- break;
- case VERSION:
- Integer version = (requestValue == null) ? DEFAULT_VERSION : Integer.valueOf((String) requestValue);
- ambariConfigurationEntity.getConfigurationBaseEntity().setVersion((version));
- break;
- case VERSION_TAG:
- String versionTag = requestValue == null ? DEFAULT_VERSION_TAG : (String) requestValue;
- ambariConfigurationEntity.getConfigurationBaseEntity().setVersionTag(versionTag);
- break;
- default:
- LOGGER.debug("Ignored property in the request: {}", resourcePropertyId);
- break;
+ for (Map.Entry<String, Map<String, String>> entry : configurations.entrySet()) {
+ resources.add(toResource(entry.getKey(), entry.getValue(), requestedIds));
}
}
- ambariConfigurationEntity.getConfigurationBaseEntity().setCreateTimestamp(Calendar.getInstance().getTimeInMillis());
- return ambariConfigurationEntity;
+ return resources;
}
- private Object getValueFromResourceProperties(ResourcePropertyId resourcePropertyIdEnum, Map<String, Object> resourceProperties) {
- LOGGER.debug("Locating resource property [{}] in the resource properties map ...", resourcePropertyIdEnum);
- Object requestValue = null;
+ private String getStringProperty(Map<String, Object> propertyMap, String propertyId) {
+ String value = null;
- if (resourceProperties.containsKey(resourcePropertyIdEnum.getPropertyId())) {
- requestValue = resourceProperties.get(resourcePropertyIdEnum.getPropertyId());
- LOGGER.debug("Found resource property {} in the resource properties map, value: {}", resourcePropertyIdEnum, requestValue);
+ if (propertyMap != null) {
+ Object o = propertyMap.get(propertyId);
+ if (o instanceof String) {
+ value = (String) o;
+ }
}
- return requestValue;
- }
+ return value;
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fa9ac55/ambari-server/src/main/java/org/apache/ambari/server/events/AmbariConfigurationChangedEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/events/AmbariConfigurationChangedEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/events/AmbariConfigurationChangedEvent.java
new file mode 100644
index 0000000..69a15b4
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/events/AmbariConfigurationChangedEvent.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed 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.
+ */
+
+package org.apache.ambari.server.events;
+
+/**
+ * Event signaling the creation or changing of an Ambari configuration entry.
+ */
+public class AmbariConfigurationChangedEvent extends AmbariEvent {
+
+ private final String categoryName;
+
+ /**
+ * Constructor.
+ *
+ */
+ public AmbariConfigurationChangedEvent(String categoryName) {
+ super(AmbariEventType.AMBARI_CONFIGURATION_CHANGED);
+ this.categoryName = categoryName;
+ }
+
+ public String getCategoryName() {
+ return categoryName;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fa9ac55/ambari-server/src/main/java/org/apache/ambari/server/events/AmbariEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/events/AmbariEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/events/AmbariEvent.java
index 0f9ff52..0ece73b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/events/AmbariEvent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/events/AmbariEvent.java
@@ -143,9 +143,9 @@ public abstract class AmbariEvent {
USER_CREATED,
/**
- * LDAP config changed event;
+ * Ambari configuration changed event;
*/
- LDAP_CONFIG_CHANGED;
+ AMBARI_CONFIGURATION_CHANGED;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fa9ac55/ambari-server/src/main/java/org/apache/ambari/server/events/AmbariLdapConfigChangedEvent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/events/AmbariLdapConfigChangedEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/events/AmbariLdapConfigChangedEvent.java
deleted file mode 100644
index 48799d7..0000000
--- a/ambari-server/src/main/java/org/apache/ambari/server/events/AmbariLdapConfigChangedEvent.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed 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.
- */
-
-package org.apache.ambari.server.events;
-
-/**
- * Event signaling the creation or changing of an LDAP configuration entry.
- */
-public class AmbariLdapConfigChangedEvent extends AmbariEvent {
-
- private Long configurationId;
-
- /**
- * Constructor.
- *
- * @param eventType the type of event (not {@code null}).
- */
- public AmbariLdapConfigChangedEvent(AmbariEventType eventType, Long configurationId) {
- super(eventType);
- this.configurationId = configurationId;
- }
-
- public Long getConfigurationId() {
- return configurationId;
- }
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fa9ac55/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfiguration.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfiguration.java b/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfiguration.java
index 8b26cd3..0c1ec0a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfiguration.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfiguration.java
@@ -19,8 +19,8 @@ import java.util.Map;
import javax.inject.Inject;
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -179,21 +179,25 @@ public class AmbariLdapConfiguration {
@Override
public boolean equals(Object o) {
- if (this == o) return true;
+ if (this == o) {
+ return true;
+ }
- if (o == null || getClass() != o.getClass()) return false;
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
AmbariLdapConfiguration that = (AmbariLdapConfiguration) o;
return new EqualsBuilder()
- .append(configurationMap, that.configurationMap)
- .isEquals();
+ .append(configurationMap, that.configurationMap)
+ .isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
- .append(configurationMap)
- .toHashCode();
+ .append(configurationMap)
+ .toHashCode();
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fa9ac55/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java
index c88d420..b32d1ed 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java
@@ -14,14 +14,11 @@
package org.apache.ambari.server.ldap.service;
+import java.util.HashMap;
+import java.util.List;
import java.util.Map;
-import java.util.Set;
-import javax.inject.Inject;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.apache.ambari.server.events.AmbariLdapConfigChangedEvent;
+import org.apache.ambari.server.events.AmbariConfigurationChangedEvent;
import org.apache.ambari.server.events.publishers.AmbariEventPublisher;
import org.apache.ambari.server.ldap.domain.AmbariLdapConfiguration;
import org.apache.ambari.server.ldap.domain.AmbariLdapConfigurationFactory;
@@ -32,8 +29,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.eventbus.Subscribe;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+import com.google.inject.Singleton;
/**
* Provider implementation for LDAP configurations.
@@ -41,7 +39,7 @@ import com.google.gson.GsonBuilder;
* It's responsible for managing LDAP configurations in the application.
* Whenever requested, this provider returns an AmbariLdapConfiguration which is always in sync with the persisted LDAP
* configuration resource.
- *
+ * <p>
* The provider receives notifications on CRUD operations related to the persisted resource and reloads the cached
* configuration instance accordingly.
*/
@@ -60,8 +58,6 @@ public class AmbariLdapConfigurationProvider implements Provider<AmbariLdapConfi
@Inject
private AmbariLdapConfigurationFactory ldapConfigurationFactory;
- private Gson gson = new GsonBuilder().create();
-
@Inject
public AmbariLdapConfigurationProvider() {
}
@@ -73,48 +69,45 @@ public class AmbariLdapConfigurationProvider implements Provider<AmbariLdapConfi
@Override
public AmbariLdapConfiguration get() {
- return instance != null ? instance : loadInstance(null);
+ return instance != null ? instance : loadInstance();
}
/**
* Loads the AmbariLdapConfiguration from the database.
*
- * @param configurationId the configuration id
* @return the AmbariLdapConfiguration instance
*/
- private AmbariLdapConfiguration loadInstance(Long configurationId) {
- AmbariConfigurationEntity configEntity = null;
+ private AmbariLdapConfiguration loadInstance() {
+ List<AmbariConfigurationEntity> configEntities;
LOGGER.info("Loading LDAP configuration ...");
- if (null == configurationId) {
+ configEntities = ambariConfigurationDAOProvider.get().findByCategory("ldap-configuration");
- LOGGER.debug("Initial loading of the ldap configuration ...");
- configEntity = ambariConfigurationDAOProvider.get().getLdapConfiguration();
+ if (configEntities != null) {
+ Map<String, Object> properties = toProperties(configEntities);
+ instance = ldapConfigurationFactory.createLdapConfiguration(properties);
+ }
- } else {
+ LOGGER.info("Loaded LDAP configuration instance: [ {} ]", instance);
- LOGGER.debug("Reloading configuration based on the provied id: {}", configurationId);
- configEntity = ambariConfigurationDAOProvider.get().findByPK(configurationId);
+ return instance;
+ }
- }
+ private Map<String, Object> toProperties(List<AmbariConfigurationEntity> configEntities) {
+ Map<String, Object> map = new HashMap<>();
- if (configEntity != null) {
- Set propertyMaps = gson.fromJson(configEntity.getConfigurationBaseEntity().getConfigurationData(), Set.class);
- instance = ldapConfigurationFactory.createLdapConfiguration((Map<String, Object>) propertyMaps.iterator().next());
+ for (AmbariConfigurationEntity entity : configEntities) {
+ map.put(entity.getPropertyName(), entity.getPropertyValue());
}
- LOGGER.info("Loaded LDAP configuration instance: [ {} ]", instance);
-
- return instance;
+ return map;
}
// On changing the configuration, the provider gets updated with the fresh value
@Subscribe
- public void ambariLdapConfigChanged(AmbariLdapConfigChangedEvent event) {
+ public void ambariLdapConfigChanged(AmbariConfigurationChangedEvent event) {
LOGGER.info("LDAP config changed event received: {}", event);
- loadInstance(event.getConfigurationId());
+ loadInstance();
LOGGER.info("Refreshed LDAP config instance.");
}
-
-
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fa9ac55/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/LdapConnectionTemplateFactory.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/LdapConnectionTemplateFactory.java b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/LdapConnectionTemplateFactory.java
index 8467af0..5e4e0ca 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/LdapConnectionTemplateFactory.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/LdapConnectionTemplateFactory.java
@@ -18,7 +18,7 @@ import javax.inject.Inject;
import javax.inject.Provider;
import javax.inject.Singleton;
-import org.apache.ambari.server.events.AmbariLdapConfigChangedEvent;
+import org.apache.ambari.server.events.AmbariConfigurationChangedEvent;
import org.apache.ambari.server.ldap.domain.AmbariLdapConfiguration;
import org.apache.ambari.server.ldap.service.AmbariLdapException;
import org.apache.ambari.server.ldap.service.LdapConnectionConfigService;
@@ -103,7 +103,7 @@ public class LdapConnectionTemplateFactory {
* @throws AmbariLdapException
*/
@Subscribe
- public void onConfigChange(AmbariLdapConfigChangedEvent event) throws AmbariLdapException {
+ public void onConfigChange(AmbariConfigurationChangedEvent event) throws AmbariLdapException {
ldapConnectionTemplateInstance = create(ambariLdapConfigurationProvider.get());
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fa9ac55/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AmbariConfigurationDAO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AmbariConfigurationDAO.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AmbariConfigurationDAO.java
index 83293ef..e4446d7 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AmbariConfigurationDAO.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AmbariConfigurationDAO.java
@@ -14,13 +14,20 @@
package org.apache.ambari.server.orm.dao;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
import javax.inject.Inject;
import javax.inject.Singleton;
import javax.persistence.EntityExistsException;
import javax.persistence.EntityNotFoundException;
import javax.persistence.TypedQuery;
+import org.apache.ambari.server.orm.RequiresSession;
import org.apache.ambari.server.orm.entities.AmbariConfigurationEntity;
+import org.apache.ambari.server.orm.entities.AmbariConfigurationEntityPK;
+import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -32,7 +39,7 @@ import com.google.inject.persist.Transactional;
*/
@Singleton
-public class AmbariConfigurationDAO extends CrudDAO<AmbariConfigurationEntity, Long> {
+public class AmbariConfigurationDAO extends CrudDAO<AmbariConfigurationEntity, AmbariConfigurationEntityPK> {
private static final Logger LOGGER = LoggerFactory.getLogger(AmbariConfigurationDAO.class);
@@ -41,49 +48,132 @@ public class AmbariConfigurationDAO extends CrudDAO<AmbariConfigurationEntity, L
super(AmbariConfigurationEntity.class);
}
+ /**
+ * Returns the Ambari configuration properties with the requested category name from the database.
+ *
+ * @param categoryName the configuration category name
+ * @return the configuration entity
+ */
+ @RequiresSession
+ public List<AmbariConfigurationEntity> findByCategory(String categoryName) {
+ TypedQuery<AmbariConfigurationEntity> query = entityManagerProvider.get().createNamedQuery(
+ "AmbariConfigurationEntity.findByCategory", AmbariConfigurationEntity.class);
+ query.setParameter("categoryName", categoryName);
+ return daoUtils.selectList(query);
+ }
+
+ /**
+ * Removes the Ambari configuration properties with the requested category name from the database.
+ *
+ * @param categoryName the configuration category name
+ * @return the number of items removed
+ */
+ @Transactional
+ public int removeByCategory(String categoryName) {
+ TypedQuery<AmbariConfigurationEntity> query = entityManagerProvider.get().createNamedQuery(
+ "AmbariConfigurationEntity.deleteByCategory", AmbariConfigurationEntity.class);
+ query.setParameter("categoryName", categoryName);
+ return query.executeUpdate();
+ }
+
@Transactional
public void create(AmbariConfigurationEntity entity) {
- // make sure only one LDAP config entry exists
- if ("ldap-configuration".equals(entity.getConfigurationBaseEntity().getType())) {
- AmbariConfigurationEntity ldapConfigEntity = getLdapConfiguration();
- if (ldapConfigEntity != null) {
- LOGGER.error("Only one LDAP configuration entry can exist!");
- throw new EntityExistsException("LDAP configuration entity already exists!");
- }
+ // make sure only one entry exists per configuration type...
+ AmbariConfigurationEntity foundEntity = findByPK(new AmbariConfigurationEntityPK(entity.getCategoryName(), entity.getPropertyName()));
+ if (foundEntity != null) {
+ String message = String.format("Only one configuration entry can exist for the category %s and name %s", entity.getCategoryName(), entity.getPropertyName());
+ LOGGER.error(message);
+ throw new EntityExistsException(message);
}
+
super.create(entity);
}
+ @Override
+ public AmbariConfigurationEntity merge(AmbariConfigurationEntity entity) {
+ AmbariConfigurationEntity foundEntity = findByPK(new AmbariConfigurationEntityPK(entity.getCategoryName(), entity.getPropertyName()));
+ if (foundEntity == null) {
+ String message = String.format("The configuration entry for the category %s and name %s does not exist", entity.getCategoryName(), entity.getPropertyName());
+ LOGGER.debug(message);
+ throw new EntityNotFoundException(message);
+ }
- @Transactional
- public void update(AmbariConfigurationEntity entity) {
- if (entity.getId() == null || findByPK(entity.getId()) == null) {
- String msg = String.format("The entity with id [ %s ] is not found", entity.getId());
- LOGGER.debug(msg);
- throw new EntityNotFoundException(msg);
+ AmbariConfigurationEntity updatedEntity = entity;
+
+ if (!StringUtils.equals(foundEntity.getPropertyValue(), entity.getPropertyValue())) {
+ // updating the existing entity
+ updatedEntity = super.merge(entity);
+ entityManagerProvider.get().flush();
}
- // updating the existing entity
- super.merge(entity);
- entityManagerProvider.get().flush();
+ return updatedEntity;
}
/**
- * Returns the LDAP configuration from the database.
+ * Reconciles the properties associted with an Ambari confgiration category (for example, ldap-configuration)
+ * using persisted properties and the supplied properties.
+ * <p>
+ * if <code>removeIfNotProvided</code> is <code>true</code>, only properties that exist in the new set of
+ * properties will be persisted; others will be removed.
+ * <p>
+ * If <code>removeIfNotProvided</code> is <code>false</code>, then the new properties will be used
+ * to update or append to the set of persisted properties.
*
- * @return the configuration entity
+ * @param categoryName the category name for the set of properties
+ * @param properties a map of name to value pairs
+ * @param removeIfNotProvided <code>true</code> to explicitly set the set of properties for the category; <code>false</code> to upadate the set of properties for the category
+ * @return <code>true</code> if changes were made; <code>false</code> if not changes were made.
*/
@Transactional
- public AmbariConfigurationEntity getLdapConfiguration() {
- LOGGER.info("Looking up the LDAP configuration ....");
- AmbariConfigurationEntity ldapConfigEntity = null;
+ public boolean reconcileCategory(String categoryName, Map<String, String> properties, boolean removeIfNotProvided) {
+ boolean changesDetected = false;
+ List<AmbariConfigurationEntity> existingEntities = findByCategory(categoryName);
+ Map<String, String> propertiesToProcess = new HashMap<>();
- TypedQuery<AmbariConfigurationEntity> query = entityManagerProvider.get().createNamedQuery(
- "AmbariConfigurationEntity.findByType", AmbariConfigurationEntity.class);
- query.setParameter("typeName", "ldap-configuration");
+ if (properties != null) {
+ propertiesToProcess.putAll(properties);
+ }
+
+ if (existingEntities != null) {
+ for (AmbariConfigurationEntity entity : existingEntities) {
+ String propertyName = entity.getPropertyName();
+
+ if (propertiesToProcess.containsKey(propertyName)) {
+ String newPropertyValue = propertiesToProcess.get(propertyName);
+ if (!StringUtils.equals(newPropertyValue, entity.getPropertyValue())) {
+ // Update the entry...
+ entity.setPropertyValue(newPropertyValue);
+ merge(entity);
+ changesDetected = true;
+ }
+ } else if (removeIfNotProvided) {
+ // Remove the entry since it is not in the new set of properties...
+ remove(entity);
+ changesDetected = true;
+ }
+
+ // If already processed, remove it so we know no to add it later...
+ propertiesToProcess.remove(propertyName);
+ }
+ }
+
+ // Add the new entries...
+ if (!propertiesToProcess.isEmpty()) {
+ for (Map.Entry<String, String> property : propertiesToProcess.entrySet()) {
+ AmbariConfigurationEntity entity = new AmbariConfigurationEntity();
+ entity.setCategoryName(categoryName);
+ entity.setPropertyName(property.getKey());
+ entity.setPropertyValue(property.getValue());
+ create(entity);
+ }
+
+ changesDetected = true;
+ }
+
+ if (changesDetected) {
+ entityManagerProvider.get().flush();
+ }
- ldapConfigEntity = daoUtils.selectSingle(query);
- LOGGER.info("Returned entity: {} ", ldapConfigEntity);
- return ldapConfigEntity;
+ return changesDetected;
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fa9ac55/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AmbariConfigurationEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AmbariConfigurationEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AmbariConfigurationEntity.java
index c9f4695..8cd6751 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AmbariConfigurationEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AmbariConfigurationEntity.java
@@ -14,57 +14,99 @@
package org.apache.ambari.server.orm.entities;
-import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.MapsId;
+import javax.persistence.IdClass;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
-import javax.persistence.OneToOne;
import javax.persistence.Table;
-@Entity
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+
@Table(name = "ambari_configuration")
@NamedQueries({
- @NamedQuery(
- name = "AmbariConfigurationEntity.findByType",
- query = "select ace from AmbariConfigurationEntity ace where ace.configurationBaseEntity.type = :typeName")
+ @NamedQuery(
+ name = "AmbariConfigurationEntity.findByCategory",
+ query = "select ace from AmbariConfigurationEntity ace where ace.categoryName = :categoryName"),
+ @NamedQuery(
+ name = "AmbariConfigurationEntity.deleteByCategory",
+ query = "delete from AmbariConfigurationEntity ace where ace.categoryName = :categoryName")
})
-
+@IdClass(AmbariConfigurationEntityPK.class)
+@Entity
public class AmbariConfigurationEntity {
@Id
- @Column(name = "id")
- private Long id;
+ @Column(name = "category_name")
+ private String categoryName;
+
+ @Id
+ @Column(name = "property_name")
+ private String propertyName;
+
+ @Column(name = "property_value")
+ private String propertyValue;
- @OneToOne(cascade = CascadeType.ALL)
- @MapsId
- @JoinColumn(name = "id")
- private ConfigurationBaseEntity configurationBaseEntity;
+ public String getCategoryName() {
+ return categoryName;
+ }
+
+ public void setCategoryName(String category) {
+ this.categoryName = category;
+ }
- public Long getId() {
- return id;
+ public String getPropertyName() {
+ return propertyName;
}
- public void setId(Long id) {
- this.id = id;
+ public void setPropertyName(String propertyName) {
+ this.propertyName = propertyName;
}
- public ConfigurationBaseEntity getConfigurationBaseEntity() {
- return configurationBaseEntity;
+ public String getPropertyValue() {
+ return propertyValue;
}
- public void setConfigurationBaseEntity(ConfigurationBaseEntity configurationBaseEntity) {
- this.configurationBaseEntity = configurationBaseEntity;
+ public void setPropertyValue(String propertyValue) {
+ this.propertyValue = propertyValue;
}
@Override
public String toString() {
return "AmbariConfigurationEntity{" +
- "id=" + id +
- ", configurationBaseEntity=" + configurationBaseEntity +
- '}';
+ ", category=" + categoryName +
+ ", name=" + propertyName +
+ ", value=" + propertyValue +
+ '}';
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ AmbariConfigurationEntity that = (AmbariConfigurationEntity) o;
+
+ return new EqualsBuilder()
+ .append(categoryName, that.categoryName)
+ .append(propertyName, that.propertyName)
+ .append(propertyValue, that.propertyValue)
+ .isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder(17, 37)
+ .append(categoryName)
+ .append(propertyName)
+ .append(propertyValue)
+ .toHashCode();
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fa9ac55/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AmbariConfigurationEntityPK.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AmbariConfigurationEntityPK.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AmbariConfigurationEntityPK.java
new file mode 100644
index 0000000..3674e12
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AmbariConfigurationEntityPK.java
@@ -0,0 +1,88 @@
+/*
+ * 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.
+ */
+
+package org.apache.ambari.server.orm.entities;
+
+import java.io.Serializable;
+
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+
+/**
+ * Composite primary key for {@link AmbariConfigurationEntity}.
+ */
+public class AmbariConfigurationEntityPK implements Serializable {
+
+ private String categoryName;
+ private String propertyName;
+
+ /**
+ * Constructor.
+ *
+ * @param categoryName configuration category name
+ * @param propertyName configuration property name
+ */
+ public AmbariConfigurationEntityPK(String categoryName, String propertyName) {
+ this.categoryName = categoryName;
+ this.propertyName = propertyName;
+ }
+
+ /**
+ * Get the configuration category name.
+ *
+ * @return category name
+ */
+ public String getCategoryName() {
+ return categoryName;
+ }
+
+ /**
+ * Get the property name.
+ *
+ * @return property name
+ */
+ public String getPropertyName() {
+ return propertyName;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ AmbariConfigurationEntityPK that = (AmbariConfigurationEntityPK) o;
+
+ return new EqualsBuilder()
+ .append(categoryName, that.categoryName)
+ .append(propertyName, that.propertyName)
+ .isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder(17, 37)
+ .append(categoryName)
+ .append(propertyName)
+ .toHashCode();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fa9ac55/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ConfigurationBaseEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ConfigurationBaseEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ConfigurationBaseEntity.java
deleted file mode 100644
index 9ad30d7..0000000
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ConfigurationBaseEntity.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Licensed 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.
- */
-
-package org.apache.ambari.server.orm.entities;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.TableGenerator;
-
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-
-@Table(name = "configuration_base")
-@TableGenerator(
- name = "configuration_id_generator",
- table = "ambari_sequences",
- pkColumnName = "sequence_name",
- valueColumnName = "sequence_value",
- pkColumnValue = "configuration_id_seq",
- initialValue = 1
-)
-@Entity
-public class ConfigurationBaseEntity {
-
- @Id
- @Column(name = "id")
- @GeneratedValue(strategy = GenerationType.TABLE, generator = "configuration_id_generator")
- private Long id;
-
- @Column(name = "version")
- private Integer version;
-
- @Column(name = "version_tag")
- private String versionTag;
-
- @Column(name = "type")
- private String type;
-
- @Column(name = "data")
- private String configurationData;
-
- @Column(name = "attributes")
- private String configurationAttributes;
-
- @Column(name = "create_timestamp")
- private Long createTimestamp;
-
- public Long getId() {
- return id;
- }
-
- public Integer getVersion() {
- return version;
- }
-
- public void setVersion(Integer version) {
- this.version = version;
- }
-
- public String getVersionTag() {
- return versionTag;
- }
-
- public void setVersionTag(String versionTag) {
- this.versionTag = versionTag;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getConfigurationData() {
- return configurationData;
- }
-
- public void setConfigurationData(String configurationData) {
- this.configurationData = configurationData;
- }
-
- public String getConfigurationAttributes() {
- return configurationAttributes;
- }
-
- public void setConfigurationAttributes(String configurationAttributes) {
- this.configurationAttributes = configurationAttributes;
- }
-
- public Long getCreateTimestamp() {
- return createTimestamp;
- }
-
- public void setCreateTimestamp(Long createTimestamp) {
- this.createTimestamp = createTimestamp;
- }
-
- @Override
- public String toString() {
- return "ConfigurationBaseEntity{" +
- "id=" + id +
- ", version=" + version +
- ", versionTag='" + versionTag + '\'' +
- ", type='" + type + '\'' +
- ", configurationData='" + configurationData + '\'' +
- ", configurationAttributes='" + configurationAttributes + '\'' +
- ", createTimestamp=" + createTimestamp +
- '}';
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
-
- if (o == null || getClass() != o.getClass()) return false;
-
- ConfigurationBaseEntity that = (ConfigurationBaseEntity) o;
-
- return new EqualsBuilder()
- .append(id, that.id)
- .append(version, that.version)
- .append(versionTag, that.versionTag)
- .append(type, that.type)
- .append(configurationData, that.configurationData)
- .append(configurationAttributes, that.configurationAttributes)
- .append(createTimestamp, that.createTimestamp)
- .isEquals();
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder(17, 37)
- .append(id)
- .append(version)
- .append(versionTag)
- .append(type)
- .append(configurationData)
- .append(configurationAttributes)
- .append(createTimestamp)
- .toHashCode();
- }
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fa9ac55/ambari-server/src/main/java/org/apache/ambari/server/upgrade/SchemaUpgradeHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/SchemaUpgradeHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/SchemaUpgradeHelper.java
index 8812ef5..9c77129 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/SchemaUpgradeHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/SchemaUpgradeHelper.java
@@ -34,6 +34,7 @@ import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.audit.AuditLoggerModule;
import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.ControllerModule;
+import org.apache.ambari.server.ldap.LdapModule;
import org.apache.ambari.server.orm.DBAccessor;
import org.apache.ambari.server.utils.EventBusSynchronizer;
import org.apache.ambari.server.utils.VersionUtils;
@@ -373,7 +374,7 @@ public class SchemaUpgradeHelper {
System.exit(1);
}
- Injector injector = Guice.createInjector(new UpgradeHelperModule(), new AuditLoggerModule());
+ Injector injector = Guice.createInjector(new UpgradeHelperModule(), new AuditLoggerModule(), new LdapModule());
SchemaUpgradeHelper schemaUpgradeHelper = injector.getInstance(SchemaUpgradeHelper.class);
//Fail if MySQL database has tables with MyISAM engine
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fa9ac55/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog300.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog300.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog300.java
index d3e924e..2de6095 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog300.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog300.java
@@ -66,21 +66,21 @@ public class UpgradeCatalog300 extends AbstractUpgradeCatalog {
protected static final String STAGE_DISPLAY_STATUS_COLUMN = "display_status";
protected static final String REQUEST_TABLE = "request";
protected static final String REQUEST_DISPLAY_STATUS_COLUMN = "display_status";
- protected static final String CLUSTER_CONFIG_TABLE = "clusterconfig";
- protected static final String CLUSTER_CONFIG_SELECTED_COLUMN = "selected";
- protected static final String CLUSTER_CONFIG_SELECTED_TIMESTAMP_COLUMN = "selected_timestamp";
protected static final String HOST_ROLE_COMMAND_TABLE = "host_role_command";
protected static final String HRC_OPS_DISPLAY_NAME_COLUMN = "ops_display_name";
- protected static final String COMPONENT_TABLE = "servicecomponentdesiredstate";
protected static final String COMPONENT_DESIRED_STATE_TABLE = "hostcomponentdesiredstate";
protected static final String COMPONENT_STATE_TABLE = "hostcomponentstate";
protected static final String SERVICE_DESIRED_STATE_TABLE = "servicedesiredstate";
protected static final String SECURITY_STATE_COLUMN = "security_state";
+ protected static final String AMBARI_CONFIGURATION_TABLE = "ambari_configuration";
+ protected static final String AMBARI_CONFIGURATION_CATEGORY_NAME_COLUMN = "category_name";
+ protected static final String AMBARI_CONFIGURATION_PROPERTY_NAME_COLUMN = "property_name";
+ protected static final String AMBARI_CONFIGURATION_PROPERTY_VALUE_COLUMN = "property_value";
+
@Inject
DaoUtils daoUtils;
-
// ----- Constructors ------------------------------------------------------
/**
@@ -123,6 +123,7 @@ public class UpgradeCatalog300 extends AbstractUpgradeCatalog {
updateStageTable();
addOpsDisplayNameColumnToHostRoleCommand();
removeSecurityState();
+ addAmbariConfigurationTable();
}
protected void updateStageTable() throws SQLException {
@@ -134,6 +135,16 @@ public class UpgradeCatalog300 extends AbstractUpgradeCatalog {
new DBAccessor.DBColumnInfo(REQUEST_DISPLAY_STATUS_COLUMN, String.class, 255, HostRoleStatus.PENDING, false));
}
+ protected void addAmbariConfigurationTable() throws SQLException {
+ List<DBAccessor.DBColumnInfo> columns = new ArrayList<>();
+ columns.add(new DBAccessor.DBColumnInfo(AMBARI_CONFIGURATION_CATEGORY_NAME_COLUMN, String.class, 100, null, false));
+ columns.add(new DBAccessor.DBColumnInfo(AMBARI_CONFIGURATION_PROPERTY_NAME_COLUMN, String.class, 100, null, false));
+ columns.add(new DBAccessor.DBColumnInfo(AMBARI_CONFIGURATION_PROPERTY_VALUE_COLUMN, String.class, 255, null, true));
+
+ dbAccessor.createTable(AMBARI_CONFIGURATION_TABLE, columns);
+ dbAccessor.addPKConstraint(AMBARI_CONFIGURATION_TABLE, "PK_ambari_configuration", AMBARI_CONFIGURATION_CATEGORY_NAME_COLUMN, AMBARI_CONFIGURATION_PROPERTY_NAME_COLUMN);
+ }
+
/**
* {@inheritDoc}
*/
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fa9ac55/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
index 7d63494..7045240 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
@@ -84,22 +84,11 @@ CREATE TABLE clusterconfig (
CONSTRAINT UQ_config_type_tag UNIQUE (version_tag, type_name, cluster_id),
CONSTRAINT UQ_config_type_version UNIQUE (cluster_id, type_name, version));
-CREATE TABLE configuration_base (
- id BIGINT NOT NULL,
- version_tag VARCHAR(255) NOT NULL,
- version BIGINT NOT NULL,
- type VARCHAR(255) NOT NULL,
- data VARCHAR(3000) NOT NULL,
- attributes VARCHAR(3000),
- create_timestamp BIGINT NOT NULL,
- CONSTRAINT PK_configuration_base PRIMARY KEY (id)
-);
-
CREATE TABLE ambari_configuration (
- id BIGINT NOT NULL,
- CONSTRAINT PK_ambari_configuration PRIMARY KEY (id),
- CONSTRAINT FK_ambari_conf_conf_base FOREIGN KEY (id) REFERENCES configuration_base (id)
-);
+ category_name VARCHAR(100) NOT NULL,
+ property_name VARCHAR(100) NOT NULL,
+ property_value VARCHAR(255) NOT NULL,
+ CONSTRAINT PK_ambari_configuration PRIMARY KEY (category_name, property_name));
CREATE TABLE serviceconfig (
service_config_id BIGINT NOT NULL,
@@ -1175,8 +1164,6 @@ INSERT INTO ambari_sequences (sequence_name, sequence_value)
union all
select 'servicecomponent_version_id_seq', 0 FROM SYSIBM.SYSDUMMY1
union all
- select 'configuration_id_seq', 0 FROM SYSIBM.SYSDUMMY1
- union all
select 'hostcomponentdesiredstate_id_seq', 0 FROM SYSIBM.SYSDUMMY1;
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fa9ac55/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
index af17353..c950c7e 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
@@ -104,22 +104,11 @@ CREATE TABLE clusterconfig (
CONSTRAINT UQ_config_type_tag UNIQUE (cluster_id, type_name, version_tag),
CONSTRAINT UQ_config_type_version UNIQUE (cluster_id, type_name, version));
-CREATE TABLE configuration_base (
- id BIGINT NOT NULL,
- version_tag VARCHAR(100) NOT NULL,
- version BIGINT NOT NULL,
- type VARCHAR(100) NOT NULL,
- data LONGTEXT NOT NULL,
- attributes LONGTEXT,
- create_timestamp BIGINT NOT NULL,
- CONSTRAINT PK_configuration_base PRIMARY KEY (id)
-);
-
CREATE TABLE ambari_configuration (
- id BIGINT NOT NULL,
- CONSTRAINT PK_ambari_configuration PRIMARY KEY (id),
- CONSTRAINT FK_ambari_conf_conf_base FOREIGN KEY (id) REFERENCES configuration_base (id)
-);
+ category_name VARCHAR(100) NOT NULL,
+ property_name VARCHAR(100) NOT NULL,
+ property_value VARCHAR(255) NOT NULL,
+ CONSTRAINT PK_ambari_configuration PRIMARY KEY (category_name, property_name));
CREATE TABLE serviceconfig (
service_config_id BIGINT NOT NULL,
@@ -1137,7 +1126,6 @@ INSERT INTO ambari_sequences(sequence_name, sequence_value) VALUES
('remote_cluster_id_seq', 0),
('remote_cluster_service_id_seq', 0),
('servicecomponent_version_id_seq', 0),
- ('configuration_id_seq', 0),
('hostcomponentdesiredstate_id_seq', 0);
INSERT INTO adminresourcetype (resource_type_id, resource_type_name) VALUES
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fa9ac55/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
index 89c7971..537ae19 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
@@ -84,22 +84,11 @@ CREATE TABLE clusterconfig (
CONSTRAINT UQ_config_type_tag UNIQUE (cluster_id, type_name, version_tag),
CONSTRAINT UQ_config_type_version UNIQUE (cluster_id, type_name, version));
-CREATE TABLE configuration_base (
- id NUMBER(19) NOT NULL,
- version_tag VARCHAR(255) NOT NULL,
- version NUMBER(19) NOT NULL,
- type VARCHAR(255) NOT NULL,
- data CLOB NOT NULL,
- attributes CLOB,
- create_timestamp NUMBER(19) NOT NULL,
- CONSTRAINT PK_configuration_base PRIMARY KEY (id)
-);
-
CREATE TABLE ambari_configuration (
- id NUMBER(19) NOT NULL,
- CONSTRAINT PK_ambari_configuration PRIMARY KEY (id),
- CONSTRAINT FK_ambari_conf_conf_base FOREIGN KEY (id) REFERENCES configuration_base (id)
-);
+ category_name VARCHAR2(100) NOT NULL,
+ property_name VARCHAR2(100) NOT NULL,
+ property_value VARCHAR2(255) NOT NULL,
+ CONSTRAINT PK_ambari_configuration PRIMARY KEY (category_name, property_name));
CREATE TABLE serviceconfig (
service_config_id NUMBER(19) NOT NULL,
@@ -1116,7 +1105,6 @@ INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('ambari_oper
INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('remote_cluster_id_seq', 0);
INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('remote_cluster_service_id_seq', 0);
INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('servicecomponent_version_id_seq', 0);
-INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('configuration_id_seq', 0);
INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('hostcomponentdesiredstate_id_seq', 0);
INSERT INTO metainfo("metainfo_key", "metainfo_value") values ('version', '${ambariSchemaVersion}');
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fa9ac55/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
index 3d2bd3a..b4952c2 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
@@ -66,21 +66,11 @@ CREATE TABLE clusters (
CONSTRAINT FK_clusters_resource_id FOREIGN KEY (resource_id) REFERENCES adminresource (resource_id)
);
-CREATE TABLE configuration_base (
- id BIGINT NOT NULL,
- version_tag VARCHAR(255) NOT NULL,
- version BIGINT NOT NULL,
- type VARCHAR(255) NOT NULL,
- data TEXT NOT NULL,
- attributes TEXT,
- create_timestamp BIGINT NOT NULL,
- CONSTRAINT PK_configuration_base PRIMARY KEY (id)
-);
-
CREATE TABLE ambari_configuration (
- id BIGINT NOT NULL,
- CONSTRAINT PK_ambari_configuration PRIMARY KEY (id),
- CONSTRAINT FK_ambari_conf_conf_base FOREIGN KEY (id) REFERENCES configuration_base (id)
+ category_name VARCHAR(100) NOT NULL,
+ property_name VARCHAR(100) NOT NULL,
+ property_value VARCHAR(255) NOT NULL,
+ CONSTRAINT PK_ambari_configuration PRIMARY KEY (category_name, property_name)
);
CREATE TABLE clusterconfig (
@@ -1116,7 +1106,6 @@ INSERT INTO ambari_sequences (sequence_name, sequence_value) VALUES
('remote_cluster_id_seq', 0),
('remote_cluster_service_id_seq', 0),
('servicecomponent_version_id_seq', 0),
- ('configuration_id_seq', 0),
('hostcomponentdesiredstate_id_seq', 0);
INSERT INTO adminresourcetype (resource_type_id, resource_type_name) VALUES
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fa9ac55/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
index 55a6c61..4fb0d09 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
@@ -83,22 +83,11 @@ CREATE TABLE clusterconfig (
CONSTRAINT UQ_config_type_tag UNIQUE (cluster_id, type_name, version_tag),
CONSTRAINT UQ_config_type_version UNIQUE (cluster_id, type_name, version));
-CREATE TABLE configuration_base (
- id NUMERIC(19) NOT NULL,
- version_tag VARCHAR(255) NOT NULL,
- version NUMERIC(19) NOT NULL,
- type VARCHAR(255) NOT NULL,
- data TEXT NOT NULL,
- attributes TEXT,
- create_timestamp NUMERIC(19) NOT NULL,
- CONSTRAINT PK_configuration_base PRIMARY KEY (id)
-);
-
CREATE TABLE ambari_configuration (
- id NUMERIC(19) NOT NULL,
- CONSTRAINT PK_ambari_configuration PRIMARY KEY (id),
- CONSTRAINT FK_ambari_conf_conf_base FOREIGN KEY (id) REFERENCES configuration_base (id)
-);
+ category_name VARCHAR(100) NOT NULL,
+ property_name VARCHAR(100) NOT NULL,
+ property_value VARCHAR(255) NOT NULL,
+ CONSTRAINT PK_ambari_configuration PRIMARY KEY (category_name, property_name));
CREATE TABLE serviceconfig (
service_config_id NUMERIC(19) NOT NULL,
@@ -1115,7 +1104,6 @@ INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('remote_clus
INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('remote_cluster_service_id_seq', 0);
INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('servicecomponent_version_id_seq', 0);
INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('hostcomponentdesiredstate_id_seq', 0);
-INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('configuration_id_seq', 0);
insert into adminresourcetype (resource_type_id, resource_type_name)
select 1, 'AMBARI'
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fa9ac55/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
index e5e8af5..8a88aba 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
@@ -97,21 +97,11 @@ CREATE TABLE clusterconfig (
CONSTRAINT UQ_config_type_tag UNIQUE (cluster_id, type_name, version_tag),
CONSTRAINT UQ_config_type_version UNIQUE (cluster_id, type_name, version));
-CREATE TABLE configuration_base (
- id BIGINT NOT NULL,
- version_tag VARCHAR(255) NOT NULL,
- version BIGINT NOT NULL,
- type VARCHAR(255) NOT NULL,
- data VARCHAR(MAX) NOT NULL,
- attributes VARCHAR(MAX),
- create_timestamp BIGINT NOT NULL,
- CONSTRAINT PK_configuration_base PRIMARY KEY (id)
-);
-
CREATE TABLE ambari_configuration (
- id BIGINT NOT NULL,
- CONSTRAINT PK_ambari_configuration PRIMARY KEY (id),
- CONSTRAINT FK_ambari_conf_conf_base FOREIGN KEY (id) REFERENCES configuration_base (id)
+ category_name VARCHAR(100) NOT NULL,
+ property_name VARCHAR(100) NOT NULL,
+ property_value VARCHAR(255) NOT NULL,
+ CONSTRAINT PK_ambari_configuration PRIMARY KEY (category_name, property_name)
);
CREATE TABLE serviceconfig (
@@ -1140,7 +1130,6 @@ BEGIN TRANSACTION
('remote_cluster_id_seq', 0),
('remote_cluster_service_id_seq', 0),
('servicecomponent_version_id_seq', 0),
- ('configuration_id_seq', 0),
('hostcomponentdesiredstate_id_seq', 0);
insert into adminresourcetype (resource_type_id, resource_type_name)
http://git-wip-us.apache.org/repos/asf/ambari/blob/4fa9ac55/ambari-server/src/main/resources/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/META-INF/persistence.xml b/ambari-server/src/main/resources/META-INF/persistence.xml
index 67eef70..686c831 100644
--- a/ambari-server/src/main/resources/META-INF/persistence.xml
+++ b/ambari-server/src/main/resources/META-INF/persistence.xml
@@ -97,7 +97,6 @@
<class>org.apache.ambari.server.orm.entities.KerberosDescriptorEntity</class>
<class>org.apache.ambari.server.orm.entities.RemoteAmbariClusterEntity</class>
<class>org.apache.ambari.server.orm.entities.RemoteAmbariClusterServiceEntity</class>
- <class>org.apache.ambari.server.orm.entities.ConfigurationBaseEntity</class>
<class>org.apache.ambari.server.orm.entities.AmbariConfigurationEntity</class>
<properties>
[26/50] [abbrv] ambari git commit: AMBARI-22429 Log Search UI:
implement logout. (Istvan Tobias via ababiichuk)
Posted by rl...@apache.org.
AMBARI-22429 Log Search UI: implement logout. (Istvan Tobias via ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7428e51d
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7428e51d
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7428e51d
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 7428e51d8e3759edf5248762f0a257a46cc053a5
Parents: 4fa9ac5
Author: Istvan Tobias <to...@gmail.com>
Authored: Tue Nov 14 00:31:01 2017 +0200
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Tue Nov 14 00:31:01 2017 +0200
----------------------------------------------------------------------
.../ambari-logsearch-web/src/app/app.module.ts | 4 +-
.../src/app/components/app.component.spec.ts | 4 +-
.../dropdown-button.component.spec.ts | 4 +-
.../dropdown-list.component.spec.ts | 4 +-
.../filter-button.component.spec.ts | 4 +-
.../filter-dropdown.component.spec.ts | 4 +-
.../login-form/login-form.component.spec.ts | 7 +-
.../login-form/login-form.component.ts | 34 +++--
.../menu-button/menu-button.component.spec.ts | 4 +-
.../timezone-picker.component.spec.ts | 4 +-
.../components/top-menu/top-menu.component.ts | 3 +-
.../ambari-logsearch-web/src/app/mock-data.ts | 3 +-
.../src/app/services/auth.service.spec.ts | 132 +++++++++++++++++++
.../src/app/services/auth.service.ts | 123 +++++++++++++++++
.../services/component-actions.service.spec.ts | 4 +-
.../app/services/component-actions.service.ts | 20 ++-
.../src/assets/i18n/en.json | 1 +
17 files changed, 328 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/7428e51d/ambari-logsearch/ambari-logsearch-web/src/app/app.module.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/app.module.ts b/ambari-logsearch/ambari-logsearch-web/src/app/app.module.ts
index 37f3a49..805f8e2 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/app.module.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/app.module.ts
@@ -53,6 +53,7 @@ import {ComponentsService} from '@app/services/storage/components.service';
import {ServiceLogsFieldsService} from '@app/services/storage/service-logs-fields.service';
import {AuditLogsFieldsService} from '@app/services/storage/audit-logs-fields.service';
import {TabsService} from '@app/services/storage/tabs.service';
+import {AuthService} from '@app/services/auth.service';
import {reducer} from '@app/services/storage/reducers.service';
import {AppComponent} from '@app/components/app.component';
@@ -185,7 +186,8 @@ export function getXHRBackend(injector: Injector, browser: BrowserXhr, xsrf: XSR
provide: XHRBackend,
useFactory: getXHRBackend,
deps: [Injector, BrowserXhr, XSRFStrategy, ResponseOptions]
- }
+ },
+ AuthService
],
bootstrap: [AppComponent],
entryComponents: [NodeBarComponent],
http://git-wip-us.apache.org/repos/asf/ambari/blob/7428e51d/ambari-logsearch/ambari-logsearch-web/src/app/components/app.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/app.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/app.component.spec.ts
index 490e058..bae05ce 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/app.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/app.component.spec.ts
@@ -53,9 +53,9 @@ describe('AppComponent', () => {
}).compileComponents();
}));
- it('should create the app', async(() => {
+ it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
- }));
+ });
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/7428e51d/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.spec.ts
index bd41c04..fc42e3c 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.spec.ts
@@ -36,6 +36,7 @@ import {UtilsService} from '@app/services/utils.service';
import {ComponentActionsService} from '@app/services/component-actions.service';
import {HttpClientService} from '@app/services/http-client.service';
import {LogsContainerService} from '@app/services/logs-container.service';
+import {AuthService} from '@app/services/auth.service';
import {DropdownButtonComponent} from './dropdown-button.component';
@@ -90,7 +91,8 @@ describe('DropdownButtonComponent', () => {
provide: HttpClientService,
useValue: httpClient
},
- LogsContainerService
+ LogsContainerService,
+ AuthService
],
schemas: [NO_ERRORS_SCHEMA]
})
http://git-wip-us.apache.org/repos/asf/ambari/blob/7428e51d/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.spec.ts
index ac2fa84..63824cb 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.spec.ts
@@ -36,6 +36,7 @@ import {ComponentGeneratorService} from '@app/services/component-generator.servi
import {LogsContainerService} from '@app/services/logs-container.service';
import {HttpClientService} from '@app/services/http-client.service';
import {ComponentActionsService} from '@app/services/component-actions.service';
+import {AuthService} from '@app/services/auth.service';
import {DropdownListComponent} from './dropdown-list.component';
@@ -91,7 +92,8 @@ describe('DropdownListComponent', () => {
ClustersService,
ComponentsService,
ServiceLogsTruncatedService,
- TabsService
+ TabsService,
+ AuthService
]
})
.compileComponents();
http://git-wip-us.apache.org/repos/asf/ambari/blob/7428e51d/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-button/filter-button.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-button/filter-button.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-button/filter-button.component.spec.ts
index f9ae154..6a9aca5 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-button/filter-button.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-button/filter-button.component.spec.ts
@@ -36,6 +36,7 @@ import {ComponentActionsService} from '@app/services/component-actions.service';
import {UtilsService} from '@app/services/utils.service';
import {HttpClientService} from '@app/services/http-client.service';
import {LogsContainerService} from '@app/services/logs-container.service';
+import {AuthService} from '@app/services/auth.service';
import {FilterButtonComponent} from './filter-button.component';
@@ -90,7 +91,8 @@ describe('FilterButtonComponent', () => {
provide: HttpClientService,
useValue: httpClient
},
- LogsContainerService
+ LogsContainerService,
+ AuthService
],
schemas: [NO_ERRORS_SCHEMA]
})
http://git-wip-us.apache.org/repos/asf/ambari/blob/7428e51d/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-dropdown/filter-dropdown.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-dropdown/filter-dropdown.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-dropdown/filter-dropdown.component.spec.ts
index f9192f4..8293ba0 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-dropdown/filter-dropdown.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-dropdown/filter-dropdown.component.spec.ts
@@ -35,6 +35,7 @@ import {UtilsService} from '@app/services/utils.service';
import {ComponentActionsService} from '@app/services/component-actions.service';
import {LogsContainerService} from '@app/services/logs-container.service';
import {HttpClientService} from '@app/services/http-client.service';
+import {AuthService} from '@app/services/auth.service';
import {FilterDropdownComponent} from './filter-dropdown.component';
@@ -109,7 +110,8 @@ describe('FilterDropdownComponent', () => {
{
provide: HttpClientService,
useValue: httpClient
- }
+ },
+ AuthService
],
schemas: [NO_ERRORS_SCHEMA]
})
http://git-wip-us.apache.org/repos/asf/ambari/blob/7428e51d/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.spec.ts
----------------------------------------------------------------------
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 fb5c2a0..ac9f3a8 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
@@ -22,6 +22,7 @@ import {TranslationModules} from '@app/test-config.spec';
import {StoreModule} from '@ngrx/store';
import {AppStateService, appState} from '@app/services/storage/app-state.service';
import {HttpClientService} from '@app/services/http-client.service';
+import {AuthService} from '@app/services/auth.service';
import {LoginFormComponent} from './login-form.component';
@@ -58,7 +59,8 @@ describe('LoginFormComponent', () => {
{
provide: HttpClientService,
useValue: httpClient
- }
+ },
+ AuthService
]
})
.compileComponents();
@@ -101,9 +103,6 @@ describe('LoginFormComponent', () => {
expect(component.isLoginAlertDisplayed).toEqual(test.isLoginAlertDisplayed);
});
- it('isLoginInProgress', () => {
- expect(component.isLoginInProgress).toEqual(false);
- });
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/7428e51d/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.ts
----------------------------------------------------------------------
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 2bc45404..39a4975 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
@@ -17,9 +17,10 @@
*/
import {Component} from '@angular/core';
+import {Response} from '@angular/http';
import 'rxjs/add/operator/finally';
-import {HttpClientService} from '@app/services/http-client.service';
import {AppStateService} from '@app/services/storage/app-state.service';
+import {AuthService} from '@app/services/auth.service';
@Component({
selector: 'login-form',
@@ -28,7 +29,7 @@ import {AppStateService} from '@app/services/storage/app-state.service';
})
export class LoginFormComponent {
- constructor(private httpClient: HttpClientService, private appState: AppStateService) {
+ constructor(private authService: AuthService, private appState: AppStateService) {
appState.getParameter('isLoginInProgress').subscribe(value => this.isLoginInProgress = value);
}
@@ -40,20 +41,25 @@ export class LoginFormComponent {
isLoginInProgress: boolean;
- private setIsAuthorized(value: boolean): void {
- this.appState.setParameters({
- isAuthorized: value,
- isLoginInProgress: false
- });
- this.isLoginAlertDisplayed = !value;
- }
+ /**
+ * Handling the response from the login action. Actually the goal only to show or hide the login error alert.
+ * When it gets error response it shows.
+ * @param {Response} resp
+ */
+ private onLoginError = (resp: Response): void => {
+ this.isLoginAlertDisplayed = true;
+ };
+ /**
+ * Handling the response from the login action. Actually the goal only to show or hide the login error alert.
+ * When it gets success response it hides.
+ * @param {Response} resp
+ */
+ private onLoginSuccess = (resp: Response): void => {
+ this.isLoginAlertDisplayed = false;
+ };
login() {
- this.appState.setParameter('isLoginInProgress', true);
- this.httpClient.postFormData('login', {
- username: this.username,
- password: this.password
- }).subscribe(() => this.setIsAuthorized(true), () => this.setIsAuthorized(false));
+ this.authService.login(this.username,this.password).subscribe(this.onLoginSuccess, this.onLoginError);
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/7428e51d/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.spec.ts
index 71bbf67..3836e7a 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.spec.ts
@@ -35,6 +35,7 @@ import {TabsService, tabs} from '@app/services/storage/tabs.service';
import {ComponentActionsService} from '@app/services/component-actions.service';
import {HttpClientService} from '@app/services/http-client.service';
import {LogsContainerService} from '@app/services/logs-container.service';
+import {AuthService} from '@app/services/auth.service';
import {MenuButtonComponent} from './menu-button.component';
@@ -88,7 +89,8 @@ describe('MenuButtonComponent', () => {
provide: HttpClientService,
useValue: httpClient
},
- LogsContainerService
+ LogsContainerService,
+ AuthService
],
schemas: [NO_ERRORS_SCHEMA]
})
http://git-wip-us.apache.org/repos/asf/ambari/blob/7428e51d/ambari-logsearch/ambari-logsearch-web/src/app/components/timezone-picker/timezone-picker.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/timezone-picker/timezone-picker.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/timezone-picker/timezone-picker.component.spec.ts
index 0e4c8a8..ab56589 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/timezone-picker/timezone-picker.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/timezone-picker/timezone-picker.component.spec.ts
@@ -34,6 +34,7 @@ import {TabsService, tabs} from '@app/services/storage/tabs.service';
import {ComponentActionsService} from '@app/services/component-actions.service';
import {HttpClientService} from '@app/services/http-client.service';
import {LogsContainerService} from '@app/services/logs-container.service';
+import {AuthService} from '@app/services/auth.service';
import {TimeZoneAbbrPipe} from '@app/pipes/timezone-abbr.pipe';
import {ModalComponent} from '@app/components/modal/modal.component';
@@ -93,7 +94,8 @@ describe('TimeZonePickerComponent', () => {
provide: HttpClientService,
useValue: httpClient
},
- LogsContainerService
+ LogsContainerService,
+ AuthService
],
})
.compileComponents();
http://git-wip-us.apache.org/repos/asf/ambari/blob/7428e51d/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.ts
index 05c1a62..91f27e8 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.ts
@@ -36,7 +36,8 @@ export class TopMenuComponent {
label: 'Options'
},
{
- label: 'Logout'
+ label: 'authorization.logout',
+ action: 'logout'
}
]
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/7428e51d/ambari-logsearch/ambari-logsearch-web/src/app/mock-data.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/mock-data.ts b/ambari-logsearch/ambari-logsearch-web/src/app/mock-data.ts
index 4325f5b..147efef 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/mock-data.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/mock-data.ts
@@ -20,6 +20,7 @@ import * as moment from 'moment';
export const mockData = {
login: {},
+ logout: {},
api: {
v1: {
audit: {
@@ -1064,4 +1065,4 @@ export const mockData = {
}
}
}
-};
\ No newline at end of file
+};
http://git-wip-us.apache.org/repos/asf/ambari/blob/7428e51d/ambari-logsearch/ambari-logsearch-web/src/app/services/auth.service.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/services/auth.service.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/services/auth.service.spec.ts
new file mode 100644
index 0000000..a465c10
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/services/auth.service.spec.ts
@@ -0,0 +1,132 @@
+/**
+ * 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.
+ */
+
+import {TestBed, inject} from '@angular/core/testing';
+import {HttpModule} from '@angular/http';
+import {Observable} from 'rxjs/Observable';
+import {StoreModule} from '@ngrx/store';
+import {AppStateService, appState} from '@app/services/storage/app-state.service';
+import {AuthService} from '@app/services/auth.service';
+import {HttpClientService} from '@app/services/http-client.service';
+
+describe('AuthService', () => {
+
+ let successResponse = {
+ type: 'default',
+ ok: true,
+ url: '/',
+ status: 200,
+ statusText: 'OK',
+ bytesLoaded: 100,
+ totalBytes: 100,
+ headers: null
+ };
+ let errorResponse = {
+ type: 'error',
+ ok: false,
+ url: '/',
+ status: 401,
+ statusText: 'ERROR',
+ bytesLoaded: 100,
+ totalBytes: 100,
+ headers: null
+ };
+ let currentResponse = successResponse;
+ let httpServiceStub;
+ let authService: AuthService;
+
+ beforeEach(() => {
+ // Note: We add delay to help the isLoginInProgress test case.
+ httpServiceStub = {
+ postFormData: function () {
+ return Observable.create(observer => {
+ observer.next(currentResponse);
+ }).delay(1000);
+ },
+ post: function () {
+ return Observable.create(observer => {
+ observer.next(currentResponse);
+ }).delay(1000);
+ },
+ get: function () {
+ return Observable.create(observer => {
+ observer.next(currentResponse);
+ }).delay(1000);
+ }
+ };
+ TestBed.configureTestingModule({
+ imports: [
+ HttpModule,
+ StoreModule.provideStore({
+ appState
+ })
+ ],
+ providers: [
+ AuthService,
+ AppStateService,
+ {provide: HttpClientService, useValue: httpServiceStub}
+ ]
+ });
+ authService = TestBed.get(AuthService);
+ });
+
+ it('should create service', inject([AuthService], (service: AuthService) => {
+ expect(service).toBeTruthy();
+ }));
+
+ it('should set the isAuthorized state to true in appState when the login is success', inject(
+ [AppStateService],
+ (appStateService: AppStateService) => {
+ currentResponse = successResponse;
+ authService.login('test', 'test')
+ .subscribe(() => {
+ appStateService.getParameter('isAuthorized').subscribe((value) => {
+ expect(value).toBe(true);
+ });
+ }, (value) => {
+ throw value;
+ });
+ }
+ ));
+
+
+ it('should set the isAuthorized state to false in appState when the login is failed', inject(
+ [AppStateService],
+ (appStateService: AppStateService) => {
+ currentResponse = errorResponse;
+ authService.login('test', 'test')
+ .subscribe(() => {
+ appStateService.getParameter('isAuthorized').subscribe((value) => {
+ expect(value).toBe(false);
+ });
+ });
+ }
+ ));
+
+ it('should set the isLoginInProgress state to true when the login started.', inject(
+ [AppStateService],
+ (appStateService: AppStateService) => {
+ currentResponse = successResponse;
+ authService.login('test', 'test');
+ appStateService.getParameter('isLoginInProgress').subscribe((value) => {
+ expect(value).toBe(true);
+ });
+ }
+ ));
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/7428e51d/ambari-logsearch/ambari-logsearch-web/src/app/services/auth.service.ts
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..8785ce2
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/services/auth.service.ts
@@ -0,0 +1,123 @@
+/**
+ * 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.
+ */
+
+import {Injectable} from '@angular/core';
+import {Response} from '@angular/http';
+
+import {Observable} from 'rxjs/Observable';
+
+import {HttpClientService} from '@app/services/http-client.service';
+import {AppStateService} from '@app/services/storage/app-state.service';
+
+/**
+ * This service meant to be a single place where the authorization should happen.
+ */
+@Injectable()
+export class AuthService {
+
+ constructor(private httpClient: HttpClientService, private appState: AppStateService) {}
+
+ /**
+ * The single entry point to request a login action.
+ * @param {string} username
+ * @param {string} password
+ * @returns {Observable<Response>}
+ */
+ login(username: string, password: string): Observable<Response> {
+ this.setLoginInProgressAppState(true);
+ let obs = this.httpClient.postFormData('login', {
+ username: username,
+ password: password
+ });
+ obs.subscribe(
+ (resp: Response) => this.onLoginResponse(resp),
+ (resp: Response) => this.onLoginError(resp)
+ );
+ return obs;
+ }
+
+ /**
+ * The single unique entry point to request a logout action
+ * @returns {Observable<boolean | Error>}
+ */
+ logout(): Observable<Response> {
+ let obs = this.httpClient.get('logout');
+ obs.subscribe(
+ (resp: Response) => this.onLogoutResponse(resp),
+ (resp: Response) => this.onLogoutError(resp)
+ );
+ return obs;
+ }
+
+ /**
+ * Set the isLoginInProgress state in AppState. The reason behind create a function for this is that we set this app
+ * state from two different places so let's do always the same way.
+ * @param {boolean} state the new value of the isLoginInProgress app state.
+ */
+ private setLoginInProgressAppState(state: boolean) {
+ this.appState.setParameter('isLoginInProgress', state);
+ }
+
+ /**
+ * Set the isAuthorized state in AppState. The reason behind create a function for this is that we set this app
+ * state from two different places so let's do always the same way.
+ * @param {boolean} state The new value of the isAuthorized app state.
+ */
+ private setAuthorizedAppState(state: boolean) {
+ this.appState.setParameter('isAuthorized', state);
+ }
+
+ /**
+ * Handling the login success response. The goal is to set the authorized property of the appState.
+ * @param resp
+ */
+ private onLoginResponse(resp: Response): void {
+ if (resp && resp.ok) {
+ this.setLoginInProgressAppState(false);
+ this.setAuthorizedAppState(resp.ok);
+ }
+ }
+
+ /**
+ * Handling the login error response. The goal is to set the authorized property correctly of the appState.
+ * @ToDo decide if we should have a loginError app state.
+ * @param {Reponse} resp
+ */
+ private onLoginError(resp: Response): void {
+ this.setLoginInProgressAppState(false);
+ this.setAuthorizedAppState(false);
+ }
+
+ /**
+ * Handling the logout success response. The goal is to set the authorized property of the appState.
+ * @param {Response} resp
+ */
+ private onLogoutResponse(resp: Response): void {
+ if (resp && resp.ok) {
+ this.setAuthorizedAppState(false);
+ }
+ }
+
+ /**
+ * Handling the logout error response.
+ * @ToDo decide if we should create a logoutError app state or not
+ * @param {Response} resp
+ */
+ private onLogoutError(resp: Response): void {}
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/7428e51d/ambari-logsearch/ambari-logsearch-web/src/app/services/component-actions.service.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/services/component-actions.service.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/services/component-actions.service.spec.ts
index 6f54e65..6d43ff1 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/services/component-actions.service.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/services/component-actions.service.spec.ts
@@ -32,6 +32,7 @@ import {ServiceLogsTruncatedService, serviceLogsTruncated} from '@app/services/s
import {TabsService, tabs} from '@app/services/storage/tabs.service';
import {HttpClientService} from '@app/services/http-client.service';
import {LogsContainerService} from '@app/services/logs-container.service';
+import {AuthService} from '@app/services/auth.service';
import {ComponentActionsService} from './component-actions.service';
@@ -81,7 +82,8 @@ describe('ComponentActionsService', () => {
provide: HttpClientService,
useValue: httpClient
},
- LogsContainerService
+ LogsContainerService,
+ AuthService
]
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/7428e51d/ambari-logsearch/ambari-logsearch-web/src/app/services/component-actions.service.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/services/component-actions.service.ts b/ambari-logsearch/ambari-logsearch-web/src/app/services/component-actions.service.ts
index 73fc94c..e796183 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/services/component-actions.service.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/services/component-actions.service.ts
@@ -21,6 +21,7 @@ import {AppSettingsService} from '@app/services/storage/app-settings.service';
import {TabsService} from '@app/services/storage/tabs.service';
import {CollectionModelService} from '@app/classes/models/store';
import {LogsContainerService} from '@app/services/logs-container.service';
+import {AuthService} from '@app/services/auth.service';
import {ServiceLog} from '@app/classes/models/service-log';
import {ListItem} from '@app/classes/list-item';
@@ -29,7 +30,8 @@ export class ComponentActionsService {
constructor(
private appSettings: AppSettingsService, private tabsStorage: TabsService,
- private logsContainer: LogsContainerService
+ private logsContainer: LogsContainerService,
+ private authService: AuthService
) {
}
@@ -134,4 +136,20 @@ export class ComponentActionsService {
isExclude: true
});
+ /**
+ * Request a login action from the AuthService
+ * @param {string} username
+ * @param {string} password
+ */
+ login(username: string, password: string): void {
+ this.authService.login(username, password);
+ }
+
+ /**
+ * Request a logout action from AuthService
+ */
+ logout(): void {
+ this.authService.logout();
+ }
+
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/7428e51d/ambari-logsearch/ambari-logsearch-web/src/assets/i18n/en.json
----------------------------------------------------------------------
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 16b4b32..b214a4f 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/assets/i18n/en.json
+++ b/ambari-logsearch/ambari-logsearch-web/src/assets/i18n/en.json
@@ -10,6 +10,7 @@
"modal.apply": "Apply",
"modal.close": "Close",
+ "authorization.logout": "Logout",
"authorization.name": "Username",
"authorization.password": "Password",
"authorization.signIn": "Sign In",
[36/50] [abbrv] ambari git commit: AMBARI-22450. Log Search:
reference Log Feeder IDE/maven dev setup in README.md (oleewere)
Posted by rl...@apache.org.
AMBARI-22450. Log Search: reference Log Feeder IDE/maven dev setup in README.md (oleewere)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1a99da44
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1a99da44
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1a99da44
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 1a99da4470d3ce1d928ab56f1a4c2845f940ef53
Parents: a4e7bf3
Author: Oliver Szabo <ol...@gmail.com>
Authored: Wed Nov 15 12:54:25 2017 +0100
Committer: Oliver Szabo <ol...@gmail.com>
Committed: Wed Nov 15 16:13:53 2017 +0100
----------------------------------------------------------------------
ambari-logsearch/README.md | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/1a99da44/ambari-logsearch/README.md
----------------------------------------------------------------------
diff --git a/ambari-logsearch/README.md b/ambari-logsearch/README.md
index 33952a2..2a124d1 100644
--- a/ambari-logsearch/README.md
+++ b/ambari-logsearch/README.md
@@ -34,6 +34,7 @@ In case if you started the containers separately and if you would like to access
### Run applications from IDE / maven
- [Start Log Search locally](ambari-logsearch-server/README.md)
+- [Start Log Feeder locally](ambari-logsearch-logfeeder/README.md)
## Package build process