You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2017/12/14 12:43:57 UTC
[01/23] ambari git commit: AMBARI-22610 Log Search UI: fixes for
search box autocomplete. (ababiichuk)
Repository: ambari
Updated Branches:
refs/heads/branch-feature-AMBARI-21674 10b65076a -> 51a7baeb3
AMBARI-22610 Log Search UI: fixes for search box autocomplete. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/862b7d7b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/862b7d7b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/862b7d7b
Branch: refs/heads/branch-feature-AMBARI-21674
Commit: 862b7d7b17e8e2ad165f548c4f9c328dd9151607
Parents: a9c3bf5
Author: ababiichuk <ab...@hortonworks.com>
Authored: Thu Dec 7 15:23:30 2017 +0200
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Thu Dec 7 19:21:59 2017 +0200
----------------------------------------------------------------------
.../ambari-logsearch-web/package.json | 3 +-
.../ambari-logsearch-web/src/app/app.module.ts | 8 +-
.../src/app/classes/filtering.ts | 2 +-
.../dropdown-list/dropdown-list.component.less | 24 ++-
.../filters-panel/filters-panel.component.html | 5 +-
.../filters-panel/filters-panel.component.ts | 23 +-
.../src/app/components/mixins.less | 17 +-
.../search-box/search-box.component.html | 28 ++-
.../search-box/search-box.component.less | 30 +--
.../search-box/search-box.component.spec.ts | 79 +++++++
.../search-box/search-box.component.ts | 214 ++++++++++---------
.../app/services/component-actions.service.ts | 9 +-
.../src/app/services/logs-container.service.ts | 22 --
ambari-logsearch/ambari-logsearch-web/yarn.lock | 6 +-
14 files changed, 259 insertions(+), 211 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/862b7d7b/ambari-logsearch/ambari-logsearch-web/package.json
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/package.json b/ambari-logsearch/ambari-logsearch-web/package.json
index 2c6aa8d..b9ee179 100644
--- a/ambari-logsearch/ambari-logsearch-web/package.json
+++ b/ambari-logsearch/ambari-logsearch-web/package.json
@@ -34,8 +34,7 @@
"jquery": "^1.12.4",
"moment": "^2.18.1",
"moment-timezone": "^0.5.13",
- "ng2-auto-complete": "^0.12.0",
- "ngx-bootstrap": "^1.6.6",
+ "ngx-bootstrap": "^1.9.3",
"rxjs": "^5.4.3",
"zone.js": "^0.8.4"
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/862b7d7b/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 5e43582..b76de20 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/app.module.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/app.module.ts
@@ -21,13 +21,12 @@ import {NgModule, CUSTOM_ELEMENTS_SCHEMA, Injector} from '@angular/core';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {HttpModule, Http, XHRBackend, BrowserXhr, ResponseOptions, XSRFStrategy} from '@angular/http';
import {InMemoryBackendService} from 'angular-in-memory-web-api';
-import {AlertModule} from 'ngx-bootstrap';
+import {TypeaheadModule} from 'ngx-bootstrap';
import {TranslateModule, TranslateLoader} from '@ngx-translate/core';
import {TranslateHttpLoader} from '@ngx-translate/http-loader';
import {StoreModule} from '@ngrx/store';
import {MomentModule} from 'angular2-moment';
import {MomentTimezoneModule} from 'angular-moment-timezone';
-import {Ng2AutoCompleteModule} from 'ng2-auto-complete';
import {environment} from '@envs/environment';
@@ -150,7 +149,7 @@ export function getXHRBackend(injector: Injector, browser: BrowserXhr, xsrf: XSR
FormsModule,
ReactiveFormsModule,
HttpModule,
- AlertModule.forRoot(),
+ TypeaheadModule.forRoot(),
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
@@ -160,8 +159,7 @@ export function getXHRBackend(injector: Injector, browser: BrowserXhr, xsrf: XSR
}),
StoreModule.provideStore(reducer),
MomentModule,
- MomentTimezoneModule,
- Ng2AutoCompleteModule
+ MomentTimezoneModule
],
providers: [
HttpClientService,
http://git-wip-us.apache.org/repos/asf/ambari/blob/862b7d7b/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 d92dd41..3348969 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/classes/filtering.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/filtering.ts
@@ -65,6 +65,6 @@ export interface SearchBoxParameterProcessed extends SearchBoxParameter {
}
export interface SearchBoxParameterTriggered {
- value: string;
+ item: ListItem;
isExclude: boolean;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/862b7d7b/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.less
index 674b195..d20bf75 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.less
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.less
@@ -22,20 +22,24 @@
max-height: @dropdown-max-height;
overflow-y: auto;
- .list-item-label {
+ > li {
.dropdown-item-default;
- label {
- margin-bottom: 0;
- cursor: pointer;
- }
+ .list-item-label {
+ .dropdown-item-child-default;
- input[type=checkbox]:checked + label:after {
- top: @checkbox-top;
- }
+ label {
+ margin-bottom: 0;
+ cursor: pointer;
+ }
+
+ input[type=checkbox]:checked + label:after {
+ top: @checkbox-top;
+ }
- .label-container {
- width: 100%;
+ .label-container {
+ width: 100%;
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/862b7d7b/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 440efde..f0cf3f4 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
@@ -18,8 +18,9 @@
<form [formGroup]="filtersForm">
<div class="form-inline filter-input-container col-md-8">
<search-box [parameterAddSubject]="queryParameterAdd" [parameterNameChangeSubject]="queryParameterNameChange"
- formControlName="query" [items]="searchBoxItemsTranslated" [itemsOptions]="options"
- [updateValueImmediately]="false" [updateValueSubject]="searchBoxValueUpdate" class="filter-input"></search-box>
+ class="filter-input" formControlName="query" [items]="searchBoxItems | async" [itemsOptions]="options"
+ [updateValueImmediately]="false" [updateValueSubject]="searchBoxValueUpdate"
+ defaultParameterName="log_message"></search-box>
<time-range-picker *ngIf="isFilterConditionDisplayed('timeRange')" formControlName="timeRange"
class="filter-input"></time-range-picker>
<timezone-picker class="filter-input"></timezone-picker>
http://git-wip-us.apache.org/repos/asf/ambari/blob/862b7d7b/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 1717bd7..f9fe94b 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
@@ -24,7 +24,6 @@ import 'rxjs/add/observable/from';
import {FilterCondition, SearchBoxParameter, SearchBoxParameterTriggered} from '@app/classes/filtering';
import {ListItem} from '@app/classes/list-item';
import {LogsType} from '@app/classes/string';
-import {CommonEntry} from '@app/classes/models/common-entry';
import {LogsContainerService} from '@app/services/logs-container.service';
@Component({
@@ -63,38 +62,22 @@ export class FiltersPanelComponent implements OnChanges {
searchBoxItems: Observable<ListItem[]>;
- get searchBoxItemsTranslated(): CommonEntry[] {
- switch (this.logsType) {
- case 'auditLogs':
- return this.logsContainer.auditLogsColumnsTranslated;
- case 'serviceLogs':
- return this.logsContainer.serviceLogsColumnsTranslated;
- default:
- return [];
- }
- }
-
get filters(): {[key: string]: FilterCondition} {
return this.logsContainer.filters;
}
/**
* Object with options for search box parameter values
- * @returns {[key: string]: CommonEntry[]}
+ * @returns {[key: string]: ListItem[]}
*/
- get options(): {[key: string]: CommonEntry[]} {
+ get options(): {[key: string]: ListItem[]} {
return Object.keys(this.filters).filter((key: string): boolean => {
const condition = this.filters[key];
return Boolean(condition.fieldName && condition.options);
}).reduce((currentValue, currentKey) => {
const condition = this.filters[currentKey];
return Object.assign(currentValue, {
- [condition.fieldName]: condition.options.map((option: ListItem): CommonEntry => {
- return {
- name: option.value,
- value: option.value
- }
- })
+ [condition.fieldName]: condition.options
});
}, {});
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/862b7d7b/ambari-logsearch/ambari-logsearch-web/src/app/components/mixins.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/mixins.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/mixins.less
index 0bf169d..a6e5616 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/mixins.less
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/mixins.less
@@ -95,21 +95,26 @@
.dropdown-item-default {
display: block;
- padding: 3px 20px;
- clear: both;
- font-weight: 400;
- line-height: 1.42857143;
color: #333;
- white-space: nowrap;
cursor: pointer;
- &:hover {
+ &.active > a, &:hover {
color: #262626;
text-decoration: none;
background-color: #F5F5F5;
}
}
+.dropdown-item-child-default {
+ display: block;
+ min-height: 24px;
+ padding: 3px 20px;
+ clear: both;
+ font-weight: 400;
+ line-height: 1.42857143;
+ white-space: nowrap;
+}
+
.log-colors {
&.fatal {
color: @fatal-color;
http://git-wip-us.apache.org/repos/asf/ambari/blob/862b7d7b/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.html b/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.html
index 5ab9a69..786c130 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.html
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.html
@@ -15,26 +15,24 @@
limitations under the License.
-->
+<ng-template #listItemTemplate let-item="item">
+ {{item.label | translate}}
+</ng-template>
<label class="parameter-label" *ngFor="let parameter of parameters">
<span *ngIf="parameter.isExclude" class="fa fa-search-minus"></span>
{{parameter.label | translate}}:
<span class="parameter-value">{{parameter.value}}</span>
<span class="fa fa-times remove-parameter" (click)="removeParameter($event, parameter.id)"></span>
</label>
-<span class="active-parameter-label" *ngIf="isActive && activeItem">{{activeItem.name | translate}}:</span>
+<span class="active-parameter-label" *ngIf="isActive && activeItem">{{activeItem.label | translate}}:</span>
<div [ngClass]="{'search-item-container': true, 'active': isActive, 'value': isValueInput}">
- <span class="parameter-input-wrapper">
- <input #parameterInput auto-complete class="search-item-input parameter-input form-control"
- [(ngModel)]="currentValue" [source]="items" display-property-name="name"
- [list-formatter]="itemsListFormatter" [value-formatter]="itemsValueFormatter" [match-formatted]="true"
- (valueChanged)="changeParameterName({value: $event.value, isExclude: false})"
- (keyup)="onParameterKeyUp($event)">
- </span>
- <span [ngClass]="{'no-options': !activeItemValueOptions.length}">
- <input #valueInput auto-complete [(ngModel)]="currentValue" [source]="activeItemValueOptions"
- [list-formatter]="itemsListFormatter" [value-formatter]="itemsValueFormatter" [match-formatted]="true"
- (valueChanged)="onParameterValueChange($event.value)" (keydown)="onParameterValueKeyDown($event)"
- (keyup)="onParameterValueKeyUp($event)" class="search-item-input value-input form-control">
- </span>
- <div class="search-item-text">{{currentValue}}</div>
+ <input #parameterInput [(ngModel)]="currentValue" [typeahead]="items" typeaheadOptionField="value"
+ [typeaheadItemTemplate]="listItemTemplate" (typeaheadNoResults)="setParameterNameMatchFlag($event)"
+ (typeaheadOnSelect)="changeParameterName({item: $event.item, isExclude: false})"
+ (focus)="onParameterInputFocus()" (keyup)="onParameterKeyUp($event)"
+ class="search-item-input parameter-input form-control">
+ <input #valueInput [(ngModel)]="currentValue" [typeahead]="activeItemValueOptions" typeaheadOptionField="value"
+ [typeaheadItemTemplate]="listItemTemplate" (typeaheadNoResults)="setParameterValueMatchFlag($event)"
+ (typeaheadOnSelect)="onParameterValueChange($event.value)" (keydown)="onParameterValueKeyDown($event)"
+ (keyup)="onParameterValueKeyUp($event)" class="search-item-input value-input form-control">
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/862b7d7b/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.less
index 9deea92..80c0e5d 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.less
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.less
@@ -70,11 +70,6 @@
.collapsed-form-control;
}
- .search-item-text {
- visibility: hidden;
- padding: 0 @input-padding;
- }
-
&.active {
min-width: @dropdown-min-width;
@@ -87,35 +82,24 @@
}
&.value {
- .parameter-input-wrapper {
- /deep/ .ng2-auto-complete-wrapper {
- display: none;
- }
+ .parameter-input {
+ display: none;
}
.value-input {
width: 100%;
}
}
-
- .no-options {
- /deep/ .ng2-auto-complete {
- display: none;
- }
- }
}
- /deep/ .ng2-auto-complete {
- cursor: pointer;
+ /deep/ typeahead-container .dropdown-menu {
.dropdown-list-default;
- > ul {
- border: none;
+ > li {
+ .dropdown-item-default;
- li {
- border: none;
- background-color: initial;
- .dropdown-item-default;
+ > a{
+ .dropdown-item-child-default;
}
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/862b7d7b/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.spec.ts
index 72795a4..8d42c84 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.spec.ts
@@ -48,4 +48,83 @@ describe('SearchBoxComponent', () => {
it('should create component', () => {
expect(component).toBeTruthy();
});
+
+ describe('#activeItemValueOptions()', () => {
+ const cases = [
+ {
+ itemsOptions: null,
+ activeItem: {
+ value: 'v0'
+ },
+ result: [],
+ title: 'no options available'
+ },
+ {
+ itemsOptions: {
+ v1: [
+ {
+ value: 'v2'
+ }
+ ]
+ },
+ activeItem: null,
+ result: [],
+ title: 'no active item'
+ },
+ {
+ itemsOptions: {},
+ activeItem: {
+ value: 'v3'
+ },
+ result: [],
+ title: 'empty itemsOptions object'
+ },
+ {
+ itemsOptions: {
+ v4: [
+ {
+ value: 'v5'
+ }
+ ]
+ },
+ activeItem: {
+ value: 'v6'
+ },
+ result: [],
+ title: 'no options available for active item'
+ },
+ {
+ itemsOptions: {
+ v7: [
+ {
+ value: 'v8'
+ },
+ {
+ value: 'v9'
+ }
+ ]
+ },
+ activeItem: {
+ value: 'v7'
+ },
+ result: [
+ {
+ value: 'v8'
+ },
+ {
+ value: 'v9'
+ }
+ ],
+ title: 'options are available for active item'
+ }
+ ];
+
+ cases.forEach(test => {
+ it(test.title, () => {
+ component.itemsOptions = test.itemsOptions;
+ component.activeItem = test.activeItem;
+ expect(component.activeItemValueOptions).toEqual(test.result);
+ });
+ });
+ });
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/862b7d7b/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 64b8c36..b2136f4 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
@@ -16,11 +16,11 @@
* limitations under the License.
*/
-import {Component, OnInit, OnDestroy, Input, ViewChild, ElementRef, forwardRef} from '@angular/core';
+import {Component, OnInit, OnDestroy, HostListener, Input, ViewChild, ElementRef, forwardRef} from '@angular/core';
import {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms';
import {Subject} from 'rxjs/Subject';
import {SearchBoxParameter, SearchBoxParameterProcessed, SearchBoxParameterTriggered} from '@app/classes/filtering';
-import {CommonEntry} from '@app/classes/models/common-entry';
+import {ListItem} from '@app/classes/list-item';
import {UtilsService} from '@app/services/utils.service';
@Component({
@@ -37,53 +37,65 @@ import {UtilsService} from '@app/services/utils.service';
})
export class SearchBoxComponent implements OnInit, OnDestroy, ControlValueAccessor {
- constructor(private element: ElementRef, private utils: UtilsService) {
- this.rootElement = element.nativeElement;
- this.rootElement.addEventListener('click', this.onRootClick);
- this.rootElement.addEventListener('keydown', this.onRootKeyDown);
+ constructor(private utils: UtilsService) {
}
ngOnInit(): void {
this.parameterInput = this.parameterInputRef.nativeElement;
this.valueInput = this.valueInputRef.nativeElement;
- this.parameterInput.addEventListener('focus', this.onParameterInputFocus);
- this.parameterInput.addEventListener('blur', this.onParameterInputBlur);
- this.valueInput.addEventListener('blur', this.onValueInputBlur);
this.parameterNameChangeSubject.subscribe(this.onParameterNameChange);
this.parameterAddSubject.subscribe(this.onParameterAdd);
this.updateValueSubject.subscribe(this.updateValue);
}
ngOnDestroy(): void {
- this.rootElement.removeEventListener('click', this.onRootClick);
- this.rootElement.removeEventListener('keydown', this.onRootKeyDown);
- this.parameterInput.removeEventListener('focus', this.onParameterInputFocus);
- this.parameterInput.removeEventListener('blur', this.onParameterInputBlur);
- this.valueInput.removeEventListener('blur', this.onValueInputBlur);
this.parameterNameChangeSubject.unsubscribe();
this.parameterAddSubject.unsubscribe();
this.updateValueSubject.unsubscribe();
}
- private readonly messageParameterName: string = 'log_message';
-
private currentId: number = 0;
private isExclude: boolean = false;
+ /**
+ * Indicates whether search box is currently active
+ * @type {boolean}
+ */
isActive: boolean = false;
- isParameterInput: boolean = false;
-
+ /**
+ * Indicates whether search query parameter value is currently typed
+ * @type {boolean}
+ */
isValueInput: boolean = false;
currentValue: string;
+ /**
+ * Indicates whether there's no autocomplete matches in preset options for search query parameter name
+ * @type {boolean}
+ */
+ private noMatchingParameterName: boolean = true;
+
+ /**
+ * Indicates whether there's no autocomplete matches in preset options for search query parameter value
+ * @type {boolean}
+ */
+ private noMatchingParameterValue: boolean = true;
+
+ @Input()
+ items: ListItem[] = [];
+
@Input()
- items: CommonEntry[] = [];
+ itemsOptions: {[key: string]: ListItem[]} = {};
+ /**
+ * Name of parameter to be used if there are no matching values
+ * @type {string}
+ */
@Input()
- itemsOptions: {[key: string]: CommonEntry[]};
+ defaultParameterName?: string;
@Input()
parameterNameChangeSubject: Subject<SearchBoxParameterTriggered> = new Subject();
@@ -95,7 +107,8 @@ export class SearchBoxComponent implements OnInit, OnDestroy, ControlValueAccess
updateValueSubject: Subject<void> = new Subject();
/**
- * Indicates whether form should receive updated value immediately after user adds new search parameter
+ * Indicates whether form should receive updated value immediately after user adds new search parameter, without
+ * explicit actions like pressing Submit button or Enter key
* @type {boolean}
*/
@Input()
@@ -107,65 +120,65 @@ export class SearchBoxComponent implements OnInit, OnDestroy, ControlValueAccess
@ViewChild('valueInput')
valueInputRef: ElementRef;
- private rootElement: HTMLElement;
-
private parameterInput: HTMLInputElement;
private valueInput: HTMLInputElement;
- activeItem: CommonEntry | null = null;
+ /**
+ * Currently active search query parameter
+ * @type {ListItem | null}
+ */
+ activeItem: ListItem | null = null;
+ /**
+ * Search query parameters that are already specified by user
+ * @type {SearchBoxParameterProcessed[]}
+ */
parameters: SearchBoxParameterProcessed[] = [];
- get activeItemValueOptions(): CommonEntry[] {
+ /**
+ * Available options for value of currently active search query parameter
+ * @returns {ListItem[]}
+ */
+ get activeItemValueOptions(): ListItem[] {
return this.itemsOptions && this.activeItem && this.itemsOptions[this.activeItem.value] ?
this.itemsOptions[this.activeItem.value] : [];
}
private onChange: (fn: any) => void;
- private onRootClick = (): void => {
+ @HostListener('click')
+ private onRootClick(): void {
if (!this.isActive) {
this.parameterInput.focus();
}
- };
+ }
- private onRootKeyDown = (event: KeyboardEvent): void => {
+ @HostListener('keydown', ['$event'])
+ private onRootKeyDown(event: KeyboardEvent): void {
if (this.utils.isEnterPressed(event)) {
event.preventDefault();
}
};
- private onParameterInputFocus = (): void => {
- this.isActive = true;
- this.isValueInput = false;
- this.isParameterInput = true;
- };
-
- private onParameterInputBlur = (): void => {
- if (!this.isValueInput) {
- this.clear();
- }
+ @HostListener('blur')
+ private onRootBlur(): void {
+ this.clear();
};
- private onValueInputBlur = (): void => {
- if (!this.isParameterInput) {
- this.clear();
- }
- };
+ onParameterInputFocus(): void {
+ this.isActive = true;
+ }
private switchToParameterInput = (): void => {
- this.activeItem = null;
+ this.clear();
+ this.isActive = true;
this.isValueInput = false;
setTimeout(() => this.parameterInput.focus(), 0);
};
- private getItemByValue(name: string): CommonEntry {
- return this.items.find((field: CommonEntry): boolean => field.value === name);
- }
-
- private getItemByName(name: string): CommonEntry {
- return this.items.find((field: CommonEntry): boolean => field.name === name);
+ private getItemByValue(name: string): ListItem {
+ return this.items.find((field: ListItem): boolean => field.value === name);
}
clear(): void {
@@ -176,28 +189,17 @@ export class SearchBoxComponent implements OnInit, OnDestroy, ControlValueAccess
this.valueInput.value = '';
}
- itemsListFormatter(item: CommonEntry): string {
- return item.name;
- }
-
- itemsValueFormatter(item: CommonEntry): string {
- return item.value;
- }
-
changeParameterName(options: SearchBoxParameterTriggered): void {
this.parameterNameChangeSubject.next(options);
}
onParameterNameChange = (options: SearchBoxParameterTriggered): void => {
- if (options.value) {
- this.activeItem = this.getItemByValue(options.value);
- this.isExclude = options.isExclude;
- this.isActive = true;
- this.isParameterInput = false;
- this.isValueInput = true;
- this.currentValue = '';
- setTimeout(() => this.valueInput.focus(), 0);
- }
+ this.activeItem = options.item.label ? options.item : this.getItemByValue(options.item.value);
+ this.isExclude = options.isExclude;
+ this.isActive = true;
+ this.isValueInput = true;
+ this.currentValue = '';
+ this.valueInput.focus();
};
onParameterValueKeyDown(event: KeyboardEvent): void {
@@ -207,59 +209,63 @@ export class SearchBoxComponent implements OnInit, OnDestroy, ControlValueAccess
}
onParameterValueKeyUp(event: KeyboardEvent): void {
- if (this.utils.isEnterPressed(event) && this.currentValue) {
+ if (this.utils.isEnterPressed(event) && this.currentValue && this.noMatchingParameterValue) {
this.onParameterValueChange(this.currentValue);
}
}
onParameterValueChange(value: string): void {
- if (value) {
- this.parameters.push({
- id: this.currentId++,
- name: this.activeItem.value,
- label: this.activeItem.name,
- value: value,
- isExclude: this.isExclude
- });
- if (this.updateValueImmediately) {
- this.updateValueSubject.next();
- }
+ this.parameters.push({
+ id: this.currentId++,
+ name: this.activeItem.value,
+ label: this.activeItem.label,
+ value: value,
+ isExclude: this.isExclude
+ });
+ if (this.updateValueImmediately) {
+ this.updateValueSubject.next();
}
this.switchToParameterInput();
}
- onParameterAdd = (options: SearchBoxParameter): void => {
- const item = this.getItemByValue(options.name);
+ /**
+ * Adding the new parameter to search query
+ * @param parameter {SearchBoxParameter}
+ */
+ onParameterAdd = (parameter: SearchBoxParameter): void => {
+ const item = this.getItemByValue(parameter.name);
this.parameters.push({
id: this.currentId++,
- name: options.name,
- label: item.name,
- value: options.value,
- isExclude: options.isExclude
+ name: parameter.name,
+ label: item.label,
+ value: parameter.value,
+ isExclude: parameter.isExclude
});
if (this.updateValueImmediately) {
this.updateValueSubject.next();
}
+ this.switchToParameterInput();
};
- onParameterKeyUp = (event: KeyboardEvent): void => {
- if (this.utils.isEnterPressed(event) && this.currentValue) {
- const existingItem = this.getItemByName(this.currentValue);
- if (existingItem) {
- this.changeParameterName({
- value: this.currentValue,
- isExclude: false
- });
- } else {
+ onParameterKeyUp(event: KeyboardEvent): void {
+ if (this.utils.isEnterPressed(event)) {
+ if (!this.currentValue && !this.updateValueImmediately) {
+ this.updateValueSubject.next();
+ } else if (this.currentValue && this.noMatchingParameterName && this.defaultParameterName) {
this.parameterAddSubject.next({
- name: this.messageParameterName,
+ name: this.defaultParameterName,
value: this.currentValue,
isExclude: false
});
}
}
- };
+ }
+ /**
+ * Removing parameter from search query
+ * @param event {MouseEvent} - event that triggered this action
+ * @param id {number} - id of parameter
+ */
removeParameter(event: MouseEvent, id: number): void {
this.parameters = this.parameters.filter((parameter: SearchBoxParameterProcessed): boolean => parameter.id !== id);
if (this.updateValueImmediately) {
@@ -275,6 +281,22 @@ export class SearchBoxComponent implements OnInit, OnDestroy, ControlValueAccess
}
};
+ /**
+ * Update flag that indicates presence of autocomplete matches in preset options for search query parameter name
+ * @param hasNoMatches {boolean}
+ */
+ setParameterNameMatchFlag(hasNoMatches: boolean): void {
+ this.noMatchingParameterName = hasNoMatches;
+ }
+
+ /**
+ * Update flag that indicates presence of autocomplete matches in preset options for search query parameter value
+ * @param hasNoMatches {boolean}
+ */
+ setParameterValueMatchFlag(hasNoMatches: boolean): void {
+ this.noMatchingParameterValue = hasNoMatches;
+ }
+
writeValue(parameters: SearchBoxParameterProcessed[] = []): void {
this.parameters = parameters;
this.updateValueSubject.next();
http://git-wip-us.apache.org/repos/asf/ambari/blob/862b7d7b/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 0fc9fde..51b0c0b 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
@@ -29,9 +29,8 @@ import {ListItem} from '@app/classes/list-item';
export class ComponentActionsService {
constructor(
- private appSettings: AppSettingsService, private tabsStorage: TabsService,
- private logsContainer: LogsContainerService,
- private authService: AuthService
+ private appSettings: AppSettingsService, private tabsStorage: TabsService, private authService: AuthService,
+ private logsContainer: LogsContainerService
) {
}
@@ -132,7 +131,9 @@ export class ComponentActionsService {
}
proceedWithExclude = (item: string): void => this.logsContainer.queryParameterNameChange.next({
- value: item,
+ item: {
+ value: item
+ },
isExclude: true
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/862b7d7b/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 4adf577..e754aa4 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
@@ -116,8 +116,6 @@ export class LogsContainerService {
this.loadLogs();
});
});
- this.auditLogsColumns.subscribe(this.getTranslationKeysSubscriber('auditLogsColumnsTranslated'));
- this.serviceLogsColumns.subscribe(this.getTranslationKeysSubscriber('serviceLogsColumnsTranslated'));
}
private readonly paginationOptions: string[] = ['10', '25', '50', '100'];
@@ -572,30 +570,10 @@ export class LogsContainerService {
}
}
- private getTranslationKeysSubscriber = (propertyName: string): (items: ListItem[]) => void => {
- return (items: ListItem[]): void => {
- const keys = items.map((item: ListItem): string => item.label);
- if (keys.length) {
- this.translate.get(keys).first().subscribe((translation: {[key: string]: string}): void => {
- this[propertyName] = items.map((item: ListItem): CommonEntry => {
- return {
- name: translation[item.label],
- value: item.value
- };
- });
- });
- }
- };
- };
-
auditLogsColumns: Observable<ListItem[]> = this.auditLogsFieldsStorage.getAll().map(this.columnsMapper);
- auditLogsColumnsTranslated: CommonEntry[] = [];
-
serviceLogsColumns: Observable<ListItem[]> = this.serviceLogsFieldsStorage.getAll().map(this.columnsMapper);
- serviceLogsColumnsTranslated: CommonEntry[] = [];
-
serviceLogs: Observable<ServiceLog[]> = Observable.combineLatest(this.serviceLogsStorage.getAll(), this.serviceLogsColumns).map(this.logsMapper);
auditLogs: Observable<AuditLog[]> = Observable.combineLatest(this.auditLogsStorage.getAll(), this.auditLogsColumns).map(this.logsMapper);
http://git-wip-us.apache.org/repos/asf/ambari/blob/862b7d7b/ambari-logsearch/ambari-logsearch-web/yarn.lock
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/yarn.lock b/ambari-logsearch/ambari-logsearch-web/yarn.lock
index c005503..8eb2bbd 100644
--- a/ambari-logsearch/ambari-logsearch-web/yarn.lock
+++ b/ambari-logsearch/ambari-logsearch-web/yarn.lock
@@ -4152,11 +4152,7 @@ negotiator@0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.1.tgz#2b327184e8992101177b28563fb5e7102acd0ca9"
-ng2-auto-complete@^0.12.0:
- version "0.12.0"
- resolved "https://registry.yarnpkg.com/ng2-auto-complete/-/ng2-auto-complete-0.12.0.tgz#9a78c39c5012404e7bc8365c03815ab7f68cea3d"
-
-ngx-bootstrap@^1.6.6:
+ngx-bootstrap@^1.9.3:
version "1.9.3"
resolved "https://registry.yarnpkg.com/ngx-bootstrap/-/ngx-bootstrap-1.9.3.tgz#28e75d14fb1beaee609383d7694de4eb3ba03b26"
[11/23] ambari git commit: AMBARI-22622. NFSGateway start failing
with error : "ERROR: You must be a privileged user in order to run a secure
service." (aonishuk)
Posted by nc...@apache.org.
AMBARI-22622. NFSGateway start failing with error : "ERROR: You must be a privileged user in order to run a secure service." (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/09672641
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/09672641
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/09672641
Branch: refs/heads/branch-feature-AMBARI-21674
Commit: 096726416556baedbc53f74ee60ea2056df90380
Parents: 45f2a6e
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Mon Dec 11 16:15:01 2017 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Mon Dec 11 16:15:01 2017 +0200
----------------------------------------------------------------------
.../HDFS/3.0.0.3.0/package/scripts/status_params.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/09672641/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/status_params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/status_params.py b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/status_params.py
index 153f9a6..437ac92 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/status_params.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/3.0.0.3.0/package/scripts/status_params.py
@@ -42,7 +42,7 @@ else:
snamenode_pid_file = format("{hadoop_pid_dir}/hadoop-{hdfs_user}-secondarynamenode.pid")
journalnode_pid_file = format("{hadoop_pid_dir}/hadoop-{hdfs_user}-journalnode.pid")
zkfc_pid_file = format("{hadoop_pid_dir}/hadoop-{hdfs_user}-zkfc.pid")
- nfsgateway_pid_file = format("{hadoop_pid_dir_prefix}/root/hadoop_privileged_nfs3.pid")
+ nfsgateway_pid_file = format("{hadoop_pid_dir_prefix}/privileged-root-nfs3.pid")
# Security related/required params
hostname = config['hostname']
[07/23] ambari git commit: AMBARI-22616 noplugins switch should not
be used for yum repos backed by RedHat Satellite/Spacewalk (dgrinenko)
Posted by nc...@apache.org.
AMBARI-22616 noplugins switch should not be used for yum repos backed by RedHat Satellite/Spacewalk (dgrinenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1ed7c086
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1ed7c086
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1ed7c086
Branch: refs/heads/branch-feature-AMBARI-21674
Commit: 1ed7c086e4d417b47de8a2a7b80e28956cf01d47
Parents: 348bdd6
Author: Dmytro Grinenko <ha...@apache.org>
Authored: Fri Dec 8 16:30:46 2017 +0200
Committer: Dmytro Grinenko <ha...@apache.org>
Committed: Fri Dec 8 16:30:46 2017 +0200
----------------------------------------------------------------------
.../core/providers/package/yumrpm.py | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/1ed7c086/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 c83a3ce..3742ff6 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
@@ -52,8 +52,8 @@ YUM_TR_PREFIX = "transaction-"
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", "--noplugins"]
-ALL_AVAILABLE_PACKAGES_CMD = [AMBARI_SUDO_BINARY, "yum", "list", "available", "--noplugins"]
+ALL_INSTALLED_PACKAGES_CMD = [AMBARI_SUDO_BINARY, "yum", "list", "installed"]
+ALL_AVAILABLE_PACKAGES_CMD = [AMBARI_SUDO_BINARY, "yum", "list", "available"]
VERIFY_DEPENDENCY_CMD = ['/usr/bin/yum', '-d', '0', '-e', '0', 'check', 'dependencies']
# base command output sample:
@@ -191,7 +191,14 @@ class YumProvider(RPMBasedPackageProvider):
for line in lines[skip_index:]:
items = items + line.strip(' \t\n\r').split()
- for i in range(0, len(items), 3):
+ items_count = len(items)
+
+ for i in range(0, items_count, 3):
+
+ # check if we reach the end
+ if i+3 > items_count:
+ break
+
if '.' in items[i]:
items[i] = items[i][:items[i].rindex('.')]
if items[i + 2].find('@') == 0:
[02/23] ambari git commit: AMBARI-22589 Ambari web UI stack version
page is empty due to NPE when target stack does not contain all services from
the current stack (dili)
Posted by nc...@apache.org.
AMBARI-22589 Ambari web UI stack version page is empty due to NPE when target stack does not contain all services from the current stack (dili)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f4d27390
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f4d27390
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f4d27390
Branch: refs/heads/branch-feature-AMBARI-21674
Commit: f4d27390f0de5a0e85c143e783312d03f24adf54
Parents: 862b7d7
Author: Di Li <di...@apache.org>
Authored: Thu Dec 7 14:05:45 2017 -0500
Committer: Di Li <di...@apache.org>
Committed: Thu Dec 7 14:05:45 2017 -0500
----------------------------------------------------------------------
.../admin/stack_upgrade/upgrade_version_column_view.js | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/f4d27390/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_column_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_column_view.js b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_column_view.js
index 9ddb083..3a406d8 100644
--- a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_column_view.js
+++ b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_version_column_view.js
@@ -51,12 +51,21 @@ App.UpgradeVersionColumnView = App.UpgradeVersionBoxView.extend({
var stackService = originalServices.findProperty('name', service.get('serviceName'));
var isAvailable = this.isStackServiceAvailable(stackService);
+
+ var notUpgradable = false;
+ if (!stackService) {
+ console.error(stackService + " definition does not exist in the stack.")
+ notUpgradable = true;
+ } else {
+ notUpgradable = this.getNotUpgradable(isAvailable, stackService.get('isUpgradable'));
+ }
+
return Em.Object.create({
displayName: service.get('displayName'),
name: service.get('serviceName'),
latestVersion: stackService ? stackService.get('latestVersion') : '',
isVersionInvisible: !stackService,
- notUpgradable: this.getNotUpgradable(isAvailable, stackService.get('isUpgradable')),
+ notUpgradable: notUpgradable,
isAvailable: isAvailable
});
}, this);
[17/23] ambari git commit: AMBARI-22638. yarn.timeline-service
property enabled overriding preset secure blueprint config for the same
Posted by nc...@apache.org.
AMBARI-22638. yarn.timeline-service property enabled overriding preset secure blueprint config for the same
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e46575a1
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e46575a1
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e46575a1
Branch: refs/heads/branch-feature-AMBARI-21674
Commit: e46575a17d4b9877aa5a67aa87ee690c326f6a64
Parents: a928a9c
Author: Doroszlai, Attila <ad...@hortonworks.com>
Authored: Wed Dec 13 07:14:38 2017 +0100
Committer: Doroszlai, Attila <ad...@hortonworks.com>
Committed: Wed Dec 13 21:22:08 2017 +0100
----------------------------------------------------------------------
.../main/resources/common-services/YARN/3.0.0.3.0/kerberos.json | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/e46575a1/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/kerberos.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/kerberos.json b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/kerberos.json
index a3cfaea..a9ad1cc 100644
--- a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/kerberos.json
+++ b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/kerberos.json
@@ -15,7 +15,7 @@
"configurations": [
{
"yarn-site": {
- "yarn.timeline-service.enabled": "true",
+ "yarn.timeline-service.enabled": "false",
"yarn.timeline-service.http-authentication.type": "kerberos",
"yarn.acl.enable": "true",
"yarn.admin.acl": "${yarn-env/yarn_user},dr.who",
@@ -291,4 +291,4 @@
]
}
]
-}
\ No newline at end of file
+}
[23/23] ambari git commit: Merge branch 'trunk' into
branch-feature-AMBARI-21674
Posted by nc...@apache.org.
Merge branch 'trunk' into branch-feature-AMBARI-21674
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/51a7baeb
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/51a7baeb
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/51a7baeb
Branch: refs/heads/branch-feature-AMBARI-21674
Commit: 51a7baeb3dedda7a9b4a6582d0a8d148b0794a73
Parents: 10b6507 dc31e51
Author: Nate Cole <nc...@hortonworks.com>
Authored: Thu Dec 14 07:43:50 2017 -0500
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Thu Dec 14 07:43:50 2017 -0500
----------------------------------------------------------------------
.../app/views/userManagement/groupEdit.html | 2 +-
.../userManagement/modals/groupCreate.html | 2 +-
.../views/userManagement/modals/userCreate.html | 3 +-
.../app/views/userManagement/userEdit.html | 2 +-
.../core/providers/package/yumrpm.py | 13 +-
.../functions/setup_ranger_plugin_xml.py | 14 +-
.../config/api/LogSearchConfigFactory.java | 49 +-
.../config/api/LogSearchConfigLogFeeder.java | 3 +-
.../ambari-logsearch-logfeeder/.gitignore | 1 +
.../ambari-logsearch-logfeeder/pom.xml | 62 ++-
.../org/apache/ambari/logfeeder/LogFeeder.java | 167 +------
.../ambari/logfeeder/LogFeederCommandLine.java | 28 +-
.../ambari/logfeeder/common/ConfigHandler.java | 47 +-
.../ambari/logfeeder/common/ConfigItem.java | 8 +-
.../logfeeder/common/LogEntryParseTester.java | 3 +-
.../logfeeder/common/LogFeederConstants.java | 50 ++
.../logfeeder/conf/ApplicationConfig.java | 107 ++++
.../logfeeder/conf/InputSimulateConfig.java | 154 ++++++
.../logfeeder/conf/LogEntryCacheConfig.java | 118 +++++
.../ambari/logfeeder/conf/LogFeederProps.java | 226 +++++++++
.../logfeeder/conf/LogFeederSecurityConfig.java | 189 +++++++
.../logfeeder/conf/MetricsCollectorConfig.java | 113 +++++
.../apache/ambari/logfeeder/filter/Filter.java | 7 +-
.../ambari/logfeeder/filter/FilterGrok.java | 7 +-
.../ambari/logfeeder/filter/FilterKeyValue.java | 5 +-
.../logfeeder/input/AbstractInputFile.java | 11 +-
.../apache/ambari/logfeeder/input/Input.java | 25 +-
.../logfeeder/input/InputConfigUploader.java | 82 +--
.../ambari/logfeeder/input/InputManager.java | 28 +-
.../ambari/logfeeder/input/InputSimulate.java | 44 +-
.../logfeeder/loglevelfilter/FilterLogData.java | 73 ---
.../loglevelfilter/LogLevelFilterHandler.java | 89 +++-
.../logfeeder/metrics/LogFeederAMSClient.java | 22 +-
.../logfeeder/metrics/MetricsManager.java | 16 +-
.../ambari/logfeeder/metrics/StatsLogger.java | 83 ++++
.../ambari/logfeeder/output/OutputFile.java | 5 +-
.../ambari/logfeeder/output/OutputHDFSFile.java | 8 +-
.../ambari/logfeeder/output/OutputKafka.java | 5 +-
.../ambari/logfeeder/output/OutputManager.java | 36 +-
.../ambari/logfeeder/output/OutputS3File.java | 8 +-
.../ambari/logfeeder/output/OutputSolr.java | 10 +-
.../logfeeder/util/LogFeederPropertiesUtil.java | 498 -------------------
.../apache/ambari/logfeeder/util/SSLUtil.java | 134 -----
.../shipper-conf/input.config-sample.json | 2 +-
.../src/main/resources/log4j.xml | 15 +-
.../src/main/resources/logfeeder.properties | 18 +-
.../ambari/logfeeder/filter/FilterGrokTest.java | 3 +-
.../ambari/logfeeder/filter/FilterJSONTest.java | 3 +-
.../logfeeder/filter/FilterKeyValueTest.java | 3 +-
.../ambari/logfeeder/input/InputFileTest.java | 11 +-
.../logfeeder/input/InputManagerTest.java | 12 +-
.../logconfig/LogConfigHandlerTest.java | 148 ------
.../logfeeder/metrics/MetricsManagerTest.java | 7 -
.../logfeeder/output/OutputKafkaTest.java | 7 +-
.../logfeeder/output/OutputManagerTest.java | 32 +-
.../logfeeder/output/OutputS3FileTest.java | 9 +-
.../ambari/logfeeder/output/OutputSolrTest.java | 10 +-
.../ambari-logsearch-web/package.json | 3 +-
.../ambari-logsearch-web/src/app/app.module.ts | 8 +-
.../src/app/classes/filtering.ts | 2 +-
.../src/app/classes/histogram-options.ts | 3 +-
.../dropdown-list/dropdown-list.component.less | 24 +-
.../filters-panel/filters-panel.component.html | 5 +-
.../filters-panel/filters-panel.component.ts | 23 +-
.../logs-container.component.html | 2 +-
.../logs-container.component.less | 5 +-
.../src/app/components/mixins.less | 35 +-
.../search-box/search-box.component.html | 28 +-
.../search-box/search-box.component.less | 30 +-
.../search-box/search-box.component.spec.ts | 79 +++
.../search-box/search-box.component.ts | 214 ++++----
.../time-histogram.component.html | 29 ++
.../time-histogram.component.less | 162 +++++-
.../time-histogram.component.spec.ts | 138 ++++-
.../time-histogram/time-histogram.component.ts | 377 ++++++++++++--
.../app/services/component-actions.service.ts | 9 +-
.../src/app/services/logs-container.service.ts | 26 +-
.../src/assets/i18n/en.json | 13 +-
ambari-logsearch/ambari-logsearch-web/yarn.lock | 6 +-
.../ambari/server/agent/ExecutionCommand.java | 37 +-
.../internal/ClientConfigResourceProvider.java | 2 +
.../internal/HostResourceProvider.java | 2 +-
.../internal/ScaleClusterRequest.java | 17 +-
.../org/apache/ambari/server/state/Cluster.java | 9 +
.../server/state/cluster/ClusterImpl.java | 31 ++
.../3.0.0.3.0/package/scripts/status_params.py | 2 +-
.../0.12.0.2.0/package/scripts/params_linux.py | 2 +
.../2.1.0.3.0/package/scripts/params_linux.py | 1 +
.../package/scripts/setup_ranger_kafka.py | 14 +-
.../0.8.1/package/scripts/setup_ranger_kafka.py | 15 +-
.../package/scripts/setup_ranger_knox.py | 16 +-
.../package/scripts/setup_ranger_knox.py | 16 +-
.../0.9.1/package/scripts/setup_ranger_storm.py | 15 +-
.../package/scripts/setup_ranger_storm.py | 15 +-
.../configuration-mapred/mapred-site.xml | 2 +-
.../2.1.0.2.0/package/scripts/params_linux.py | 41 +-
.../configuration-mapred/mapred-site.xml | 2 +-
.../YARN/3.0.0.3.0/kerberos.json | 4 +-
.../3.0.0.3.0/package/scripts/params_linux.py | 41 +-
.../scripts/interpreter_json_template.py | 152 ++++++
.../package/scripts/livy2_config_template.py | 112 -----
.../ZEPPELIN/0.7.0/package/scripts/master.py | 24 +-
.../package/scripts/spark2_config_template.py | 84 ----
.../stacks/HDP/2.6/upgrades/config-upgrade.xml | 2 +-
.../ExecutionCommandWrapperTest.java | 5 +
.../AmbariCustomCommandExecutionHelperTest.java | 46 ++
.../internal/ScaleClusterRequestTest.java | 38 +-
.../apache/ambari/server/orm/OrmTestHelper.java | 3 +
.../2.6/ZEPPELIN/interpreter_json_generated.py | 2 +-
.../controllers/main/service/info/configs.js | 46 +-
ambari-web/app/messages.js | 1 +
.../mixins/common/configs/configs_comparator.js | 1 -
.../app/mixins/common/configs/configs_loader.js | 8 +-
ambari-web/app/models/configs/config_group.js | 8 +
ambari-web/app/models/repository.js | 3 +-
ambari-web/app/styles/application.less | 243 +--------
ambari-web/app/styles/common.less | 1 +
ambari-web/app/styles/modal_popups.less | 8 +-
.../app/styles/service_configurations.less | 297 +++++++++++
ambari-web/app/styles/widgets.less | 7 +-
ambari-web/app/styles/wizard.less | 19 +-
ambari-web/app/templates.js | 2 +
.../common/configs/compare_property.hbs | 38 --
.../common/configs/configs_comparison_cell.hbs | 26 +
.../common/configs/configs_comparison_row.hbs | 79 +++
.../app/templates/common/configs/controls.hbs | 12 +-
.../templates/common/configs/service_config.hbs | 30 +-
.../common/configs/service_config_category.hbs | 120 ++---
.../service_config_layout_tab_compare.hbs | 80 +++
.../common/configs/service_config_wizard.hbs | 8 +-
.../comparison/config_widget_comparison.hbs | 37 --
.../common/configs/widgets/controls.hbs | 15 -
.../templates/common/filter_combo_cleanable.hbs | 7 +-
.../app/templates/main/host/configs_service.hbs | 2 +-
.../app/templates/main/service/info/configs.hbs | 2 +-
ambari-web/app/views.js | 3 +-
.../common/configs/compare_property_view.js | 25 -
.../configs/config_versions_control_view.js | 39 +-
.../configs/overriddenPropertyRow_view.js | 31 --
.../service_config_layout_tab_compare_view.js | 31 ++
.../views/common/configs/service_config_view.js | 7 +-
.../configs/service_configs_by_category_view.js | 17 +-
.../comparison/config_widget_comparison_view.js | 23 -
.../app/views/common/filter_combo_cleanable.js | 6 +-
.../upgrade_version_column_view.js | 11 +-
.../common/configs/configs_comparator_test.js | 5 -
.../config_versions_control_view_test.js | 1 -
.../configs/overriddenProperty_view_test.js | 42 --
.../service_configs_by_category_view_test.js | 18 +-
149 files changed, 3697 insertions(+), 2472 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/51a7baeb/ambari-web/app/messages.js
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/51a7baeb/ambari-web/app/styles/wizard.less
----------------------------------------------------------------------
[20/23] ambari git commit: AMBARI-22639. Log Feeder refactor:
integrate with spring boot (oleewere)
Posted by nc...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputConfigUploader.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputConfigUploader.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputConfigUploader.java
index 8f8c4fd..e8066be 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputConfigUploader.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputConfigUploader.java
@@ -27,60 +27,76 @@ import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.apache.ambari.logfeeder.util.LogFeederPropertiesUtil;
+import org.apache.ambari.logfeeder.common.ConfigHandler;
+import org.apache.ambari.logfeeder.conf.LogFeederProps;
+import org.apache.ambari.logfeeder.loglevelfilter.LogLevelFilterHandler;
import org.apache.ambari.logsearch.config.api.LogSearchConfigLogFeeder;
-import org.apache.log4j.Logger;
import com.google.common.io.Files;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
public class InputConfigUploader extends Thread {
- protected static final Logger LOG = Logger.getLogger(InputConfigUploader.class);
+
+ protected static final Logger LOG = LoggerFactory.getLogger(InputConfigUploader.class);
private static final long SLEEP_BETWEEN_CHECK = 2000;
- private final File configDir;
- private final FilenameFilter inputConfigFileFilter = new FilenameFilter() {
- @Override
- public boolean accept(File dir, String name) {
- return name.startsWith("input.config-") && name.endsWith(".json");
- }
- };
+ private File configDir;
+ private final FilenameFilter inputConfigFileFilter = (dir, name) -> name.startsWith("input.config-") && name.endsWith(".json");
private final Set<String> filesHandled = new HashSet<>();
private final Pattern serviceNamePattern = Pattern.compile("input.config-(.+).json");
- private final LogSearchConfigLogFeeder config;
-
- public static void load(LogSearchConfigLogFeeder config) {
- new InputConfigUploader(config).start();
- }
-
- private InputConfigUploader(LogSearchConfigLogFeeder config) {
+
+ @Inject
+ private LogSearchConfigLogFeeder config;
+
+ @Inject
+ private LogFeederProps logFeederProps;
+
+ @Inject
+ private LogLevelFilterHandler logLevelFilterHandler;
+
+ @Inject
+ private ConfigHandler configHandler;
+
+ public InputConfigUploader() {
super("Input Config Loader");
setDaemon(true);
-
- this.configDir = new File(LogFeederPropertiesUtil.getConfigDir());
- this.config = config;
+ }
+
+ @PostConstruct
+ public void init() throws Exception {
+ this.configDir = new File(logFeederProps.getConfDir());
+ this.start();
+ config.monitorInputConfigChanges(configHandler, logLevelFilterHandler, logFeederProps.getClusterName());
}
@Override
public void run() {
while (true) {
File[] inputConfigFiles = configDir.listFiles(inputConfigFileFilter);
- for (File inputConfigFile : inputConfigFiles) {
- if (!filesHandled.contains(inputConfigFile.getAbsolutePath())) {
- try {
- Matcher m = serviceNamePattern.matcher(inputConfigFile.getName());
- m.find();
- String serviceName = m.group(1);
- String inputConfig = Files.toString(inputConfigFile, Charset.defaultCharset());
-
- if (!config.inputConfigExists(serviceName)) {
- config.createInputConfig(LogFeederPropertiesUtil.getClusterName(), serviceName, inputConfig);
+ if (inputConfigFiles != null) {
+ for (File inputConfigFile : inputConfigFiles) {
+ if (!filesHandled.contains(inputConfigFile.getAbsolutePath())) {
+ try {
+ Matcher m = serviceNamePattern.matcher(inputConfigFile.getName());
+ m.find();
+ String serviceName = m.group(1);
+ String inputConfig = Files.toString(inputConfigFile, Charset.defaultCharset());
+ if (!config.inputConfigExists(serviceName)) {
+ config.createInputConfig(logFeederProps.getClusterName(), serviceName, inputConfig);
+ }
+ filesHandled.add(inputConfigFile.getAbsolutePath());
+ } catch (Exception e) {
+ LOG.warn("Error handling file " + inputConfigFile.getAbsolutePath(), e);
}
- filesHandled.add(inputConfigFile.getAbsolutePath());
- } catch (Exception e) {
- LOG.warn("Error handling file " + inputConfigFile.getAbsolutePath(), e);
}
}
+ } else {
+ LOG.warn("Cannot find input config files in config dir ({})", logFeederProps.getConfDir());
}
try {
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputManager.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputManager.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputManager.java
index f1b422f..d1f38ed 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputManager.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputManager.java
@@ -33,22 +33,25 @@ import java.util.Map;
import java.util.Set;
import java.util.UUID;
+import com.google.common.annotations.VisibleForTesting;
+import org.apache.ambari.logfeeder.conf.LogFeederProps;
import org.apache.ambari.logfeeder.metrics.MetricData;
import org.apache.ambari.logfeeder.util.FileUtil;
-import org.apache.ambari.logfeeder.util.LogFeederPropertiesUtil;
import org.apache.ambari.logfeeder.util.LogFeederUtil;
import org.apache.commons.io.filefilter.WildcardFileFilter;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.apache.solr.common.util.Base64;
+import javax.inject.Inject;
+
public class InputManager {
private static final Logger LOG = Logger.getLogger(InputManager.class);
private static final String CHECKPOINT_SUBFOLDER_NAME = "logfeeder_checkpoints";
private Map<String, List<Input>> inputs = new HashMap<>();
- private Set<Input> notReadyList = new HashSet<Input>();
+ private Set<Input> notReadyList = new HashSet<>();
private boolean isDrain = false;
@@ -59,6 +62,9 @@ public class InputManager {
private Thread inputIsReadyMonitor;
+ @Inject
+ private LogFeederProps logFeederProps;
+
public List<Input> getInputList(String serviceName) {
return inputs.get(serviceName);
}
@@ -118,11 +124,11 @@ public class InputManager {
}
private void initCheckPointSettings() {
- checkPointExtension = LogFeederPropertiesUtil.getCheckPointExtension();
+ checkPointExtension = logFeederProps.getCheckPointExtension();
LOG.info("Determining valid checkpoint folder");
boolean isCheckPointFolderValid = false;
// We need to keep track of the files we are reading.
- String checkPointFolder = LogFeederPropertiesUtil.getCheckpointFolder();
+ String checkPointFolder = logFeederProps.getCheckpointFolder();
if (!StringUtils.isEmpty(checkPointFolder)) {
checkPointFolderFile = new File(checkPointFolder);
isCheckPointFolderValid = verifyCheckPointFolder(checkPointFolderFile);
@@ -130,8 +136,7 @@ public class InputManager {
if (!isCheckPointFolderValid) {
// Let's use tmp folder
- String tmpFolder = LogFeederPropertiesUtil.getLogFeederTempDir();
- checkPointFolderFile = new File(tmpFolder, CHECKPOINT_SUBFOLDER_NAME);
+ checkPointFolderFile = new File(logFeederProps.getTmpDir(), CHECKPOINT_SUBFOLDER_NAME);
LOG.info("Checking if tmp folder can be used for checkpoints. Folder=" + checkPointFolderFile);
isCheckPointFolderValid = verifyCheckPointFolder(checkPointFolderFile);
if (isCheckPointFolderValid) {
@@ -184,7 +189,7 @@ public class InputManager {
public void startInputs(String serviceName) {
for (Input input : inputs.get(serviceName)) {
try {
- input.init();
+ input.init(logFeederProps);
if (input.isReady()) {
input.monitor();
} else {
@@ -419,4 +424,13 @@ public class InputManager {
}
}
}
+
+ @VisibleForTesting
+ public void setLogFeederProps(LogFeederProps logFeederProps) {
+ this.logFeederProps = logFeederProps;
+ }
+
+ public LogFeederProps getLogFeederProps() {
+ return logFeederProps;
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputSimulate.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputSimulate.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputSimulate.java
index df6c941..2b2d145 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputSimulate.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/InputSimulate.java
@@ -30,10 +30,11 @@ import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.ambari.logfeeder.conf.InputSimulateConfig;
+import org.apache.ambari.logfeeder.conf.LogFeederProps;
import org.apache.ambari.logfeeder.filter.Filter;
import org.apache.ambari.logfeeder.filter.FilterJSON;
import org.apache.ambari.logfeeder.output.Output;
-import org.apache.ambari.logfeeder.util.LogFeederPropertiesUtil;
import org.apache.ambari.logfeeder.util.LogFeederUtil;
import org.apache.ambari.logsearch.config.api.model.inputconfig.InputDescriptor;
import org.apache.ambari.logsearch.config.zookeeper.model.inputconfig.impl.FilterJsonDescriptorImpl;
@@ -65,32 +66,37 @@ public class InputSimulate extends Input {
}
private final Random random = new Random(System.currentTimeMillis());
-
- private final List<String> types;
- private final String level;
- private final int numberOfWords;
- private final int minLogWords;
- private final int maxLogWords;
- private final long sleepMillis;
- private final String host;
-
- public InputSimulate() throws Exception {
+
+ private InputSimulateConfig conf;
+ private List<String> types;
+ private String level;
+ private int numberOfWords;
+ private int minLogWords;
+ private int maxLogWords;
+ private long sleepMillis;
+ private String host;
+
+ @Override
+ public void init(LogFeederProps logFeederProps) throws Exception {
+ super.init(logFeederProps);
+ conf = logFeederProps.getInputSimulateConfig();
this.types = getSimulatedLogTypes();
- this.level = LogFeederPropertiesUtil.getSimulateLogLevel();
- this.numberOfWords = LogFeederPropertiesUtil.getSimulateNumberOfWords();
- this.minLogWords = LogFeederPropertiesUtil.getSimulateMinLogWords();
- this.maxLogWords = LogFeederPropertiesUtil.getSimulateMaxLogWords();
- this.sleepMillis = LogFeederPropertiesUtil.getSimulateSleepMilliseconds();
+ this.level = conf.getSimulateLogLevel();
+ this.numberOfWords = conf.getSimulateNumberOfWords();
+ this.minLogWords = conf.getSimulateMinLogWords();
+ this.maxLogWords = conf.getSimulateMaxLogWords();
+ this.sleepMillis = conf.getSimulateSleepMilliseconds();
this.host = "#" + hostNumber.incrementAndGet() + "-" + LogFeederUtil.hostName;
-
+
Filter filter = new FilterJSON();
filter.loadConfig(new FilterJsonDescriptorImpl());
filter.setInput(this);
addFilter(filter);
+
}
-
+
private List<String> getSimulatedLogTypes() {
- String logsToSimulate = LogFeederPropertiesUtil.getSimulateLogIds();
+ String logsToSimulate = conf.getSimulateLogIds();
return (logsToSimulate == null) ?
inputTypes :
Arrays.asList(logsToSimulate.split(","));
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/loglevelfilter/FilterLogData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/loglevelfilter/FilterLogData.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/loglevelfilter/FilterLogData.java
deleted file mode 100644
index 6173f53..0000000
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/loglevelfilter/FilterLogData.java
+++ /dev/null
@@ -1,73 +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.
- */
-
-package org.apache.ambari.logfeeder.loglevelfilter;
-
-import java.util.Map;
-
-import org.apache.ambari.logfeeder.common.LogFeederConstants;
-import org.apache.ambari.logfeeder.input.InputMarker;
-import org.apache.ambari.logfeeder.util.LogFeederUtil;
-import org.apache.commons.collections.MapUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.log4j.Logger;
-
-public enum FilterLogData {
- INSTANCE;
-
- private static final Logger LOG = Logger.getLogger(FilterLogData.class);
-
- private static final boolean DEFAULT_VALUE = true;
-
- public boolean isAllowed(String jsonBlock, InputMarker inputMarker) {
- if (StringUtils.isEmpty(jsonBlock)) {
- return DEFAULT_VALUE;
- }
- Map<String, Object> jsonObj = LogFeederUtil.toJSONObject(jsonBlock);
- return isAllowed(jsonObj, inputMarker);
- }
-
- public boolean isAllowed(Map<String, Object> jsonObj, InputMarker inputMarker) {
- if ("audit".equals(inputMarker.input.getInputDescriptor().getRowtype()))
- return true;
-
- boolean isAllowed = applyFilter(jsonObj);
- if (!isAllowed) {
- LOG.trace("Filter block the content :" + LogFeederUtil.getGson().toJson(jsonObj));
- }
- return isAllowed;
- }
-
-
- private boolean applyFilter(Map<String, Object> jsonObj) {
- if (MapUtils.isEmpty(jsonObj)) {
- LOG.warn("Output jsonobj is empty");
- return DEFAULT_VALUE;
- }
-
- String hostName = (String) jsonObj.get(LogFeederConstants.SOLR_HOST);
- String logId = (String) jsonObj.get(LogFeederConstants.SOLR_COMPONENT);
- String level = (String) jsonObj.get(LogFeederConstants.SOLR_LEVEL);
- if (StringUtils.isNotBlank(hostName) && StringUtils.isNotBlank(logId) && StringUtils.isNotBlank(level)) {
- return LogLevelFilterHandler.isAllowed(hostName, logId, level);
- } else {
- return DEFAULT_VALUE;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/loglevelfilter/LogLevelFilterHandler.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/loglevelfilter/LogLevelFilterHandler.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/loglevelfilter/LogLevelFilterHandler.java
index e44873b..83c293b 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/loglevelfilter/LogLevelFilterHandler.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/loglevelfilter/LogLevelFilterHandler.java
@@ -21,7 +21,6 @@ package org.apache.ambari.logfeeder.loglevelfilter;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
-import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@@ -29,19 +28,28 @@ import java.util.Map;
import java.util.TimeZone;
import org.apache.ambari.logfeeder.common.LogFeederConstants;
-import org.apache.ambari.logfeeder.util.LogFeederPropertiesUtil;
+import org.apache.ambari.logfeeder.conf.LogFeederProps;
+import org.apache.ambari.logfeeder.input.InputMarker;
+import org.apache.ambari.logfeeder.util.LogFeederUtil;
import org.apache.ambari.logsearch.config.api.LogLevelFilterMonitor;
import org.apache.ambari.logsearch.config.api.LogSearchConfig;
import org.apache.ambari.logsearch.config.api.model.loglevelfilter.LogLevelFilter;
import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.StringUtils;
-import org.apache.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
public class LogLevelFilterHandler implements LogLevelFilterMonitor {
- private static final Logger LOG = Logger.getLogger(LogLevelFilterHandler.class);
+ private static final Logger LOG = LoggerFactory.getLogger(LogLevelFilterHandler.class);
private static final String TIMEZONE = "GMT";
private static final String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS";
+
+ private static final boolean DEFAULT_VALUE = true;
private static ThreadLocal<DateFormat> formatter = new ThreadLocal<DateFormat>() {
protected DateFormat initialValue() {
@@ -50,16 +58,19 @@ public class LogLevelFilterHandler implements LogLevelFilterMonitor {
return dateFormat;
}
};
-
- private static LogSearchConfig config;
- private static boolean filterEnabled;
- private static List<String> defaultLogLevels;
- private static Map<String, LogLevelFilter> filters = new HashMap<>();
-
- public static void init(LogSearchConfig config_) {
- config = config_;
- filterEnabled = LogFeederPropertiesUtil.isLogFilterEnabled();
- defaultLogLevels = Arrays.asList(LogFeederPropertiesUtil.getIncludeDefaultLevel().split(","));
+
+ @Inject
+ private LogFeederProps logFeederProps;
+
+ private LogSearchConfig config;
+ private Map<String, LogLevelFilter> filters = new HashMap<>();
+
+ public LogLevelFilterHandler(LogSearchConfig config) {
+ this.config = config;
+ }
+
+ @PostConstruct
+ public void init() {
TimeZone.setDefault(TimeZone.getTimeZone(TIMEZONE));
}
@@ -77,8 +88,8 @@ public class LogLevelFilterHandler implements LogLevelFilterMonitor {
}
}
- public static boolean isAllowed(String hostName, String logId, String level) {
- if (!filterEnabled) {
+ public boolean isAllowed(String hostName, String logId, String level) {
+ if (!logFeederProps.isLogLevelFilterEnabled()) {
return true;
}
@@ -87,7 +98,43 @@ public class LogLevelFilterHandler implements LogLevelFilterMonitor {
return allowedLevels.isEmpty() || allowedLevels.contains(level);
}
- private static synchronized LogLevelFilter findLogFilter(String logId) {
+ public boolean isAllowed(String jsonBlock, InputMarker inputMarker) {
+ if (org.apache.commons.lang3.StringUtils.isEmpty(jsonBlock)) {
+ return DEFAULT_VALUE;
+ }
+ Map<String, Object> jsonObj = LogFeederUtil.toJSONObject(jsonBlock);
+ return isAllowed(jsonObj, inputMarker);
+ }
+
+ public boolean isAllowed(Map<String, Object> jsonObj, InputMarker inputMarker) {
+ if ("audit".equals(inputMarker.input.getInputDescriptor().getRowtype()))
+ return true;
+
+ boolean isAllowed = applyFilter(jsonObj);
+ if (!isAllowed) {
+ LOG.trace("Filter block the content :" + LogFeederUtil.getGson().toJson(jsonObj));
+ }
+ return isAllowed;
+ }
+
+
+ public boolean applyFilter(Map<String, Object> jsonObj) {
+ if (MapUtils.isEmpty(jsonObj)) {
+ LOG.warn("Output jsonobj is empty");
+ return DEFAULT_VALUE;
+ }
+
+ String hostName = (String) jsonObj.get(LogFeederConstants.SOLR_HOST);
+ String logId = (String) jsonObj.get(LogFeederConstants.SOLR_COMPONENT);
+ String level = (String) jsonObj.get(LogFeederConstants.SOLR_LEVEL);
+ if (org.apache.commons.lang3.StringUtils.isNotBlank(hostName) && org.apache.commons.lang3.StringUtils.isNotBlank(logId) && org.apache.commons.lang3.StringUtils.isNotBlank(level)) {
+ return isAllowed(hostName, logId, level);
+ } else {
+ return DEFAULT_VALUE;
+ }
+ }
+
+ private synchronized LogLevelFilter findLogFilter(String logId) {
LogLevelFilter logFilter = filters.get(logId);
if (logFilter != null) {
return logFilter;
@@ -96,10 +143,10 @@ public class LogLevelFilterHandler implements LogLevelFilterMonitor {
LOG.info("Filter is not present for log " + logId + ", creating default filter");
LogLevelFilter defaultFilter = new LogLevelFilter();
defaultFilter.setLabel(logId);
- defaultFilter.setDefaultLevels(defaultLogLevels);
+ defaultFilter.setDefaultLevels(logFeederProps.getIncludeDefaultLogLevels());
try {
- config.createLogLevelFilter(LogFeederPropertiesUtil.getClusterName(), logId, defaultFilter);
+ config.createLogLevelFilter(logFeederProps.getClusterName(), logId, defaultFilter);
filters.put(logId, defaultFilter);
} catch (Exception e) {
LOG.warn("Could not persist the default filter for log " + logId, e);
@@ -108,7 +155,7 @@ public class LogLevelFilterHandler implements LogLevelFilterMonitor {
return defaultFilter;
}
- private static List<String> getAllowedLevels(String hostName, LogLevelFilter componentFilter) {
+ private List<String> getAllowedLevels(String hostName, LogLevelFilter componentFilter) {
String componentName = componentFilter.getLabel();
List<String> hosts = componentFilter.getHosts();
List<String> defaultLevels = componentFilter.getDefaultLevels();
@@ -134,7 +181,7 @@ public class LogLevelFilterHandler implements LogLevelFilterMonitor {
return defaultLevels;
}
- private static boolean isFilterExpired(LogLevelFilter logLevelFilter) {
+ private boolean isFilterExpired(LogLevelFilter logLevelFilter) {
if (logLevelFilter == null)
return false;
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/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 c832358..ba986c7 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
@@ -19,15 +19,13 @@
package org.apache.ambari.logfeeder.metrics;
-import org.apache.ambari.logfeeder.util.LogFeederPropertiesUtil;
-import org.apache.ambari.logfeeder.util.SSLUtil;
+import org.apache.ambari.logfeeder.conf.LogFeederSecurityConfig;
+import org.apache.ambari.logfeeder.conf.MetricsCollectorConfig;
import org.apache.commons.lang3.StringUtils;
import org.apache.hadoop.metrics2.sink.timeline.AbstractTimelineMetricsSink;
import org.apache.hadoop.metrics2.sink.timeline.TimelineMetrics;
import org.apache.log4j.Logger;
-import com.google.common.base.Splitter;
-
import java.util.Collection;
import java.util.List;
@@ -40,16 +38,16 @@ public class LogFeederAMSClient extends AbstractTimelineMetricsSink {
private final String collectorPort;
private final String collectorPath;
- public LogFeederAMSClient() {
- String collectorHostsString = LogFeederPropertiesUtil.getMetricsCollectorHosts();
+ public LogFeederAMSClient(MetricsCollectorConfig metricsCollectorConfig, LogFeederSecurityConfig securityConfig) {
+ String collectorHostsString = metricsCollectorConfig.getHostsString();
if (!StringUtils.isBlank(collectorHostsString)) {
collectorHostsString = collectorHostsString.trim();
LOG.info("AMS collector Hosts=" + collectorHostsString);
- collectorHosts = Splitter.on(",").splitToList(collectorHostsString);
- collectorProtocol = LogFeederPropertiesUtil.getMetricsCollectorProtocol();
- collectorPort = LogFeederPropertiesUtil.getMetricsCollectorPort();
- collectorPath = LogFeederPropertiesUtil.getMetricsCollectorPath();
+ collectorHosts = metricsCollectorConfig.getHosts();
+ collectorProtocol = metricsCollectorConfig.getProtocol();
+ collectorPort = metricsCollectorConfig.getPort();
+ collectorPath = metricsCollectorConfig.getPath();
} else {
collectorHosts = null;
collectorProtocol = null;
@@ -57,8 +55,8 @@ public class LogFeederAMSClient extends AbstractTimelineMetricsSink {
collectorPath = null;
}
- if (StringUtils.isNotBlank(SSLUtil.getTrustStoreLocation())) {
- loadTruststore(SSLUtil.getTrustStoreLocation(), SSLUtil.getTrustStoreType(), SSLUtil.getTrustStorePassword());
+ if (StringUtils.isNotBlank(securityConfig.getTrustStoreLocation())) {
+ loadTruststore(securityConfig.getTrustStoreLocation(), securityConfig.getTrustStoreType(), securityConfig.getTrustStorePassword());
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/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 6e8ac04..96084c1 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
@@ -24,11 +24,16 @@ import java.util.HashMap;
import java.util.List;
import java.util.TreeMap;
+import org.apache.ambari.logfeeder.conf.LogFeederSecurityConfig;
+import org.apache.ambari.logfeeder.conf.MetricsCollectorConfig;
import org.apache.ambari.logfeeder.util.LogFeederUtil;
import org.apache.hadoop.metrics2.sink.timeline.TimelineMetric;
import org.apache.hadoop.metrics2.sink.timeline.TimelineMetrics;
import org.apache.log4j.Logger;
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+
public class MetricsManager {
private static final Logger LOG = Logger.getLogger(MetricsManager.class);
@@ -40,13 +45,20 @@ public class MetricsManager {
private int publishIntervalMS = 60 * 1000;
private int maxMetricsBuffer = 60 * 60 * 1000; // If AMS is down, we should not keep the metrics in memory forever
- private HashMap<String, TimelineMetric> metricsMap = new HashMap<String, TimelineMetric>();
+ private HashMap<String, TimelineMetric> metricsMap = new HashMap<>();
private LogFeederAMSClient amsClient = null;
+ @Inject
+ private MetricsCollectorConfig metricsCollectorConfig;
+
+ @Inject
+ private LogFeederSecurityConfig logFeederSecurityConfig;
+
+ @PostConstruct
public void init() {
LOG.info("Initializing MetricsManager()");
if (amsClient == null) {
- amsClient = new LogFeederAMSClient();
+ amsClient = new LogFeederAMSClient(metricsCollectorConfig, logFeederSecurityConfig);
}
if (amsClient.getCollectorUri(null) != null) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/StatsLogger.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/StatsLogger.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/StatsLogger.java
new file mode 100644
index 0000000..1dd9287
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/metrics/StatsLogger.java
@@ -0,0 +1,83 @@
+/*
+ * 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.logfeeder.metrics;
+
+import org.apache.ambari.logfeeder.common.ConfigHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+import java.util.ArrayList;
+import java.util.List;
+
+public class StatsLogger extends Thread {
+
+ private static final Logger LOG = LoggerFactory.getLogger(StatsLogger.class);
+
+ private static final int CHECKPOINT_CLEAN_INTERVAL_MS = 24 * 60 * 60 * 60 * 1000; // 24 hours
+
+ private long lastCheckPointCleanedMS = 0;
+
+ @Inject
+ private ConfigHandler configHandler;
+
+ @Inject
+ private MetricsManager metricsManager;
+
+ public StatsLogger() {
+ super("statLogger");
+ setDaemon(true);
+ }
+
+ @PostConstruct
+ public void init() {
+ this.start();
+ }
+
+ @Override
+ public void run() {
+ while (true) {
+ try {
+ Thread.sleep(30 * 1000);
+ } catch (Throwable t) {
+ // Ignore
+ }
+ try {
+ logStats();
+ } catch (Throwable t) {
+ LOG.error("LogStats: Caught exception while logging stats.", t);
+ }
+
+ if (System.currentTimeMillis() > (lastCheckPointCleanedMS + CHECKPOINT_CLEAN_INTERVAL_MS)) {
+ lastCheckPointCleanedMS = System.currentTimeMillis();
+ configHandler.cleanCheckPointFiles();
+ }
+ }
+ }
+
+ private void logStats() {
+ configHandler.logStats();
+ if (metricsManager.isMetricsEnabled()) {
+ List<MetricData> metricsList = new ArrayList<MetricData>();
+ configHandler.addMetrics(metricsList);
+ metricsManager.useMetrics(metricsList);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputFile.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputFile.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputFile.java
index e1a0bb9..4576deb 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputFile.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputFile.java
@@ -26,6 +26,7 @@ import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;
+import org.apache.ambari.logfeeder.conf.LogFeederProps;
import org.apache.ambari.logfeeder.input.InputMarker;
import org.apache.ambari.logfeeder.util.LogFeederUtil;
import org.apache.commons.csv.CSVFormat;
@@ -41,8 +42,8 @@ public class OutputFile extends Output {
private String codec;
@Override
- public void init() throws Exception {
- super.init();
+ public void init(LogFeederProps logFeederProps) throws Exception {
+ super.init(logFeederProps);
filePath = getStringValue("path");
if (StringUtils.isEmpty(filePath)) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputHDFSFile.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputHDFSFile.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputHDFSFile.java
index ba4d60a..ed66eb0 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputHDFSFile.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputHDFSFile.java
@@ -19,6 +19,7 @@
package org.apache.ambari.logfeeder.output;
+import org.apache.ambari.logfeeder.conf.LogFeederProps;
import org.apache.ambari.logfeeder.input.InputMarker;
import org.apache.ambari.logfeeder.output.spool.LogSpooler;
import org.apache.ambari.logfeeder.output.spool.LogSpoolerContext;
@@ -26,7 +27,6 @@ import org.apache.ambari.logfeeder.output.spool.RolloverCondition;
import org.apache.ambari.logfeeder.output.spool.RolloverHandler;
import org.apache.ambari.logfeeder.util.LogFeederUtil;
import org.apache.ambari.logfeeder.util.LogFeederHDFSUtil;
-import org.apache.ambari.logfeeder.util.LogFeederPropertiesUtil;
import org.apache.ambari.logfeeder.util.PlaceholderUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.hadoop.fs.FileSystem;
@@ -65,8 +65,8 @@ public class OutputHDFSFile extends Output implements RolloverHandler, RolloverC
private LogSpooler logSpooler;
@Override
- public void init() throws Exception {
- super.init();
+ public void init(LogFeederProps logFeederProps) throws Exception {
+ super.init(logFeederProps);
hdfsOutDir = getStringValue("hdfs_out_dir");
hdfsHost = getStringValue("hdfs_host");
hdfsPort = getStringValue("hdfs_port");
@@ -88,7 +88,7 @@ public class OutputHDFSFile extends Output implements RolloverHandler, RolloverC
HashMap<String, String> contextParam = buildContextParam();
hdfsOutDir = PlaceholderUtil.replaceVariables(hdfsOutDir, contextParam);
LOG.info("hdfs Output dir=" + hdfsOutDir);
- String localFileDir = LogFeederPropertiesUtil.getLogFeederTempDir() + "hdfs/service/";
+ String localFileDir = logFeederProps.getTmpDir() + "hdfs/service/";
logSpooler = new LogSpooler(localFileDir, filenamePrefix, this, this);
this.startHDFSCopyThread();
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputKafka.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputKafka.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputKafka.java
index 52fc6f8..5c8ec82 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputKafka.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputKafka.java
@@ -25,6 +25,7 @@ import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.LinkedTransferQueue;
+import org.apache.ambari.logfeeder.conf.LogFeederProps;
import org.apache.ambari.logfeeder.input.InputMarker;
import org.apache.ambari.logfeeder.util.LogFeederUtil;
import org.apache.commons.lang3.StringUtils;
@@ -66,8 +67,8 @@ public class OutputKafka extends Output {
}
@Override
- public void init() throws Exception {
- super.init();
+ public void init(LogFeederProps logFeederProps) throws Exception {
+ super.init(logFeederProps);
Properties props = initProperties();
producer = creteKafkaProducer(props);
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputManager.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputManager.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputManager.java
index 48716fa..f5c4176 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputManager.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputManager.java
@@ -26,10 +26,12 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
+import com.google.common.annotations.VisibleForTesting;
import org.apache.ambari.logfeeder.common.LogFeederConstants;
+import org.apache.ambari.logfeeder.conf.LogFeederProps;
import org.apache.ambari.logfeeder.input.Input;
import org.apache.ambari.logfeeder.input.InputMarker;
-import org.apache.ambari.logfeeder.loglevelfilter.FilterLogData;
+import org.apache.ambari.logfeeder.loglevelfilter.LogLevelFilterHandler;
import org.apache.ambari.logfeeder.metrics.MetricData;
import org.apache.ambari.logfeeder.util.LogFeederUtil;
import org.apache.ambari.logfeeder.util.MurmurHash;
@@ -38,6 +40,8 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
+import javax.inject.Inject;
+
public class OutputManager {
private static final Logger LOG = Logger.getLogger(OutputManager.class);
@@ -51,6 +55,12 @@ public class OutputManager {
private static long docCounter = 0;
private MetricData messageTruncateMetric = new MetricData(null, false);
+ @Inject
+ private LogLevelFilterHandler logLevelFilterHandler;
+
+ @Inject
+ private LogFeederProps logFeederProps;
+
private OutputLineFilter outputLineFilter = new OutputLineFilter();
public List<Output> getOutputs() {
@@ -73,7 +83,7 @@ public class OutputManager {
public void init() throws Exception {
for (Output output : outputs) {
- output.init();
+ output.init(logFeederProps);
}
}
@@ -146,7 +156,7 @@ public class OutputManager {
jsonObj.put("message_md5", "" + MurmurHash.hash64A(logMessage.getBytes(), 31174077));
}
}
- if (FilterLogData.INSTANCE.isAllowed(jsonObj, inputMarker)
+ if (logLevelFilterHandler.isAllowed(jsonObj, inputMarker)
&& !outputLineFilter.apply(jsonObj, inputMarker.input)) {
for (Output output : input.getOutputList()) {
try {
@@ -179,7 +189,7 @@ public class OutputManager {
}
public void write(String jsonBlock, InputMarker inputMarker) {
- if (FilterLogData.INSTANCE.isAllowed(jsonBlock, inputMarker)) {
+ if (logLevelFilterHandler.isAllowed(jsonBlock, inputMarker)) {
for (Output output : inputMarker.input.getOutputList()) {
try {
output.write(jsonBlock, inputMarker);
@@ -255,4 +265,22 @@ public class OutputManager {
}
}
}
+
+ public LogLevelFilterHandler getLogLevelFilterHandler() {
+ return logLevelFilterHandler;
+ }
+
+ @VisibleForTesting
+ public void setLogLevelFilterHandler(LogLevelFilterHandler logLevelFilterHandler) {
+ this.logLevelFilterHandler = logLevelFilterHandler;
+ }
+
+ public LogFeederProps getLogFeederProps() {
+ return logFeederProps;
+ }
+
+ @VisibleForTesting
+ public void setLogFeederProps(LogFeederProps logFeederProps) {
+ this.logFeederProps = logFeederProps;
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputS3File.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputS3File.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputS3File.java
index 5b213e8..d8eed2b 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputS3File.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputS3File.java
@@ -20,13 +20,13 @@ package org.apache.ambari.logfeeder.output;
import com.google.common.annotations.VisibleForTesting;
import org.apache.ambari.logfeeder.common.LogFeederConstants;
+import org.apache.ambari.logfeeder.conf.LogFeederProps;
import org.apache.ambari.logfeeder.filter.Filter;
import org.apache.ambari.logfeeder.input.InputMarker;
import org.apache.ambari.logfeeder.output.spool.LogSpooler;
import org.apache.ambari.logfeeder.output.spool.LogSpoolerContext;
import org.apache.ambari.logfeeder.output.spool.RolloverCondition;
import org.apache.ambari.logfeeder.output.spool.RolloverHandler;
-import org.apache.ambari.logfeeder.util.LogFeederPropertiesUtil;
import org.apache.ambari.logfeeder.util.LogFeederUtil;
import org.apache.ambari.logfeeder.util.S3Util;
import org.apache.ambari.logsearch.config.api.model.inputconfig.FilterDescriptor;
@@ -62,8 +62,8 @@ public class OutputS3File extends Output implements RolloverCondition, RolloverH
private S3Uploader s3Uploader;
@Override
- public void init() throws Exception {
- super.init();
+ public void init(LogFeederProps logFeederProps) throws Exception {
+ super.init(logFeederProps);
s3OutputConfiguration = S3OutputConfiguration.fromConfigBlock(this);
}
@@ -206,7 +206,7 @@ public class OutputS3File extends Output implements RolloverCondition, RolloverH
@VisibleForTesting
protected LogSpooler createSpooler(String filePath) {
- String spoolDirectory = LogFeederPropertiesUtil.getLogFeederTempDir() + "/s3/service";
+ String spoolDirectory = getLogFeederProps().getTmpDir() + "/s3/service";
LOG.info(String.format("Creating spooler with spoolDirectory=%s, filePath=%s", spoolDirectory, filePath));
return new LogSpooler(spoolDirectory, new File(filePath).getName()+"-", this, this,
s3OutputConfiguration.getRolloverTimeThresholdSecs());
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputSolr.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputSolr.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputSolr.java
index 38219df..cdb869a 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputSolr.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputSolr.java
@@ -35,9 +35,9 @@ import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
+import org.apache.ambari.logfeeder.conf.LogFeederProps;
import org.apache.ambari.logfeeder.input.InputMarker;
import org.apache.ambari.logfeeder.util.DateUtil;
-import org.apache.ambari.logfeeder.util.LogFeederPropertiesUtil;
import org.apache.ambari.logfeeder.util.LogFeederUtil;
import org.apache.ambari.logsearch.config.api.model.outputconfig.OutputProperties;
import org.apache.ambari.logsearch.config.api.model.outputconfig.OutputSolrProperties;
@@ -109,8 +109,8 @@ public class OutputSolr extends Output implements CollectionStateWatcher {
}
@Override
- public void init() throws Exception {
- super.init();
+ public void init(LogFeederProps logFeederProps) throws Exception {
+ super.init(logFeederProps);
initParams();
setupSecurity();
createOutgoingBuffer();
@@ -175,8 +175,8 @@ public class OutputSolr extends Output implements CollectionStateWatcher {
}
private void setupSecurity() {
- String jaasFile = LogFeederPropertiesUtil.getSolrJaasFile();
- boolean securityEnabled = LogFeederPropertiesUtil.isSolrKerberosEnabled();
+ String jaasFile = getLogFeederProps().getLogFeederSecurityConfig().getSolrJaasFile();
+ boolean securityEnabled = getLogFeederProps().getLogFeederSecurityConfig().isSolrKerberosEnabled();
if (securityEnabled) {
System.setProperty("java.security.auth.login.config", jaasFile);
HttpClientUtil.addConfigurer(new Krb5HttpClientConfigurer());
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/LogFeederPropertiesUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/LogFeederPropertiesUtil.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/LogFeederPropertiesUtil.java
deleted file mode 100644
index 1636653..0000000
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/LogFeederPropertiesUtil.java
+++ /dev/null
@@ -1,498 +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.
- */
-
-package org.apache.ambari.logfeeder.util;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.util.HashMap;
-import java.util.Properties;
-
-import org.apache.ambari.logfeeder.LogFeeder;
-import org.apache.ambari.logsearch.config.api.LogSearchPropertyDescription;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.log4j.Logger;
-
-/**
- * This class contains utility methods used by LogFeeder
- */
-public class LogFeederPropertiesUtil {
- private static final Logger LOG = Logger.getLogger(LogFeederPropertiesUtil.class);
-
- public static final String LOGFEEDER_PROPERTIES_FILE = "logfeeder.properties";
-
- private static Properties props;
- public static Properties getProperties() {
- return props;
- }
-
- public static void loadProperties() throws Exception {
- loadProperties(LOGFEEDER_PROPERTIES_FILE);
- }
-
- /**
- * This method will read the properties from System, followed by propFile and finally from the map
- */
- public static void loadProperties(String propFile) throws Exception {
- LOG.info("Loading properties. propFile=" + propFile);
- props = new Properties(System.getProperties());
- boolean propLoaded = false;
-
- // First get properties file path from environment value
- String propertiesFilePath = System.getProperty("properties");
- if (StringUtils.isNotEmpty(propertiesFilePath)) {
- File propertiesFile = new File(propertiesFilePath);
- if (propertiesFile.exists() && propertiesFile.isFile()) {
- LOG.info("Properties file path set in environment. Loading properties file=" + propertiesFilePath);
- try (FileInputStream fis = new FileInputStream(propertiesFile)) {
- props.load(fis);
- propLoaded = true;
- } catch (Throwable t) {
- LOG.error("Error loading properties file. properties file=" + propertiesFile.getAbsolutePath());
- }
- } else {
- LOG.error("Properties file path set in environment, but file not found. properties file=" + propertiesFilePath);
- }
- }
-
- if (!propLoaded) {
- try (BufferedInputStream bis = (BufferedInputStream) LogFeeder.class.getClassLoader().getResourceAsStream(propFile)) {
- // Properties not yet loaded, let's try from class loader
- if (bis != null) {
- LOG.info("Loading properties file " + propFile + " from classpath");
- props.load(bis);
- propLoaded = true;
- } else {
- LOG.fatal("Properties file not found in classpath. properties file name= " + propFile);
- }
- }
- }
-
- if (!propLoaded) {
- LOG.fatal("Properties file is not loaded.");
- throw new Exception("Properties not loaded");
- }
- }
-
- public static String getStringProperty(String key) {
- return props == null ? null : props.getProperty(key);
- }
-
- public static String getStringProperty(String key, String defaultValue) {
- return props == null ? defaultValue : props.getProperty(key, defaultValue);
- }
-
- public static boolean getBooleanProperty(String key, boolean defaultValue) {
- String value = getStringProperty(key);
- return toBoolean(value, defaultValue);
- }
-
- private static boolean toBoolean(String value, boolean defaultValue) {
- if (StringUtils.isEmpty(value)) {
- return defaultValue;
- }
-
- return "true".equalsIgnoreCase(value) || "yes".equalsIgnoreCase(value);
- }
-
- public static int getIntProperty(String key, int defaultValue) {
- return getIntProperty(key, defaultValue, null, null);
- }
-
- public static int getIntProperty(String key, int defaultValue, Integer minValue, Integer maxValue) {
- String value = getStringProperty(key);
- int retValue = LogFeederUtil.objectToInt(value, defaultValue, ", key=" + key);
- if (minValue != null && retValue < minValue) {
- LOG.info("Minimum rule was applied for " + key + ": " + retValue + " < " + minValue);
- retValue = minValue;
- }
- if (maxValue != null && retValue > maxValue) {
- LOG.info("Maximum rule was applied for " + key + ": " + retValue + " > " + maxValue);
- retValue = maxValue;
- }
- return retValue;
- }
-
- private static final String CLUSTER_NAME_PROPERTY = "cluster.name";
-
- @LogSearchPropertyDescription(
- name = CLUSTER_NAME_PROPERTY,
- description = "The name of the cluster the Log Feeder program runs in.",
- examples = {"cl1"},
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- public static String getClusterName() {
- return getStringProperty(CLUSTER_NAME_PROPERTY);
- }
-
- private static final String TMP_DIR_PROPERTY = "logfeeder.tmp.dir";
- private static final String DEFAULT_TMP_DIR = "/tmp/$username/logfeeder/";
- private static String logFeederTempDir = null;
-
- @LogSearchPropertyDescription(
- name = TMP_DIR_PROPERTY,
- description = "The tmp dir used for creating temporary files.",
- examples = {"/tmp/"},
- defaultValue = DEFAULT_TMP_DIR,
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- public synchronized static String getLogFeederTempDir() {
- if (logFeederTempDir == null) {
- String tempDirValue = getStringProperty(TMP_DIR_PROPERTY, DEFAULT_TMP_DIR);
- HashMap<String, String> contextParam = new HashMap<String, String>();
- String username = System.getProperty("user.name");
- contextParam.put("username", username);
- logFeederTempDir = PlaceholderUtil.replaceVariables(tempDirValue, contextParam);
- }
- return logFeederTempDir;
- }
-
- public static final String CREDENTIAL_STORE_PROVIDER_PATH_PROPERTY = "hadoop.security.credential.provider.path";
-
- @LogSearchPropertyDescription(
- name = CREDENTIAL_STORE_PROVIDER_PATH_PROPERTY,
- description = "The jceks file that provides passwords.",
- examples = {"jceks://file/etc/ambari-logsearch-logfeeder/conf/logfeeder.jceks"},
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- public static String getCredentialStoreProviderPath() {
- return getStringProperty(CREDENTIAL_STORE_PROVIDER_PATH_PROPERTY);
- }
-
- private static final String CONFIG_FILES_PROPERTY = "logfeeder.config.files";
-
- @LogSearchPropertyDescription(
- name = CONFIG_FILES_PROPERTY,
- description = "Comma separated list of the config files containing global / output configurations.",
- examples = {"global.json,output.json", "/etc/ambari-logsearch-logfeeder/conf/global.json"},
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- public static String getConfigFiles() {
- return getStringProperty(CONFIG_FILES_PROPERTY);
- }
-
- private static final String CONFIG_DIR_PROPERTY = "logfeeder.config.dir";
-
- @LogSearchPropertyDescription(
- name = CONFIG_DIR_PROPERTY,
- description = "The directory where shipper configuration files are looked for.",
- examples = {"/etc/ambari-logsearch-logfeeder/conf"},
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- public static String getConfigDir() {
- return getStringProperty(CONFIG_DIR_PROPERTY);
- }
-
- public static final String CHECKPOINT_EXTENSION_PROPERTY = "logfeeder.checkpoint.extension";
- public static final String DEFAULT_CHECKPOINT_EXTENSION = ".cp";
-
- @LogSearchPropertyDescription(
- name = CHECKPOINT_EXTENSION_PROPERTY,
- description = "The extension used for checkpoint files.",
- examples = {"ckp"},
- defaultValue = DEFAULT_CHECKPOINT_EXTENSION,
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- public static String getCheckPointExtension() {
- return getStringProperty(CHECKPOINT_EXTENSION_PROPERTY, DEFAULT_CHECKPOINT_EXTENSION);
- }
-
- private static final String CHECKPOINT_FOLDER_PROPERTY = "logfeeder.checkpoint.folder";
-
- @LogSearchPropertyDescription(
- name = CHECKPOINT_FOLDER_PROPERTY,
- description = "The folder wher checkpoint files are stored.",
- examples = {"/etc/ambari-logsearch-logfeeder/conf/checkpoints"},
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- public static String getCheckpointFolder() {
- return getStringProperty(CHECKPOINT_FOLDER_PROPERTY);
- }
-
- private static final String CACHE_ENABLED_PROPERTY = "logfeeder.cache.enabled";
- private static final boolean DEFAULT_CACHE_ENABLED = false;
-
- @LogSearchPropertyDescription(
- name = CACHE_ENABLED_PROPERTY,
- description = "Enables the usage of a cache to avoid duplications.",
- examples = {"true"},
- defaultValue = DEFAULT_CACHE_ENABLED + "",
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- public static boolean isCacheEnabled() {
- return getBooleanProperty(CACHE_ENABLED_PROPERTY, DEFAULT_CACHE_ENABLED);
- }
-
- private static final String CACHE_KEY_FIELD_PROPERTY = "logfeeder.cache.key.field";
- private static final String DEFAULT_CACHE_KEY_FIELD = "log_message";
-
- @LogSearchPropertyDescription(
- name = CACHE_KEY_FIELD_PROPERTY,
- description = "The field which's value should be cached and should be checked for repteitions.",
- examples = {"some_field_prone_to_repeating_value"},
- defaultValue = DEFAULT_CACHE_KEY_FIELD,
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- public static String getCacheKeyField() {
- return getStringProperty(CACHE_KEY_FIELD_PROPERTY, DEFAULT_CACHE_KEY_FIELD);
- }
-
- private static final String CACHE_SIZE_PROPERTY = "logfeeder.cache.size";
- private static final int DEFAULT_CACHE_SIZE = 100;
-
- @LogSearchPropertyDescription(
- name = CACHE_SIZE_PROPERTY,
- description = "The number of log entries to cache in order to avoid duplications.",
- examples = {"50"},
- defaultValue = DEFAULT_CACHE_SIZE + "",
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- public static int getCacheSize() {
- return getIntProperty(CACHE_SIZE_PROPERTY, DEFAULT_CACHE_SIZE);
- }
-
- private static final String CACHE_LAST_DEDUP_ENABLED_PROPERTY = "logfeeder.cache.last.dedup.enabled";
- private static final boolean DEFAULT_CACHE_LAST_DEDUP_ENABLED = false;
-
- @LogSearchPropertyDescription(
- name = CACHE_LAST_DEDUP_ENABLED_PROPERTY,
- description = "Enable filtering directly repeating log entries irrelevant of the time spent between them.",
- examples = {"true"},
- defaultValue = DEFAULT_CACHE_LAST_DEDUP_ENABLED + "",
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- public static boolean isCacheLastDedupEnabled() {
- return getBooleanProperty(CACHE_LAST_DEDUP_ENABLED_PROPERTY, DEFAULT_CACHE_LAST_DEDUP_ENABLED);
- }
-
- private static final String CACHE_DEDUP_INTERVAL_PROPERTY = "logfeeder.cache.dedup.interval";
- private static final long DEFAULT_CACHE_DEDUP_INTERVAL = 1000;
-
- @LogSearchPropertyDescription(
- name = CACHE_DEDUP_INTERVAL_PROPERTY,
- description = "Maximum number of milliseconds between two identical messages to be filtered out.",
- examples = {"500"},
- defaultValue = DEFAULT_CACHE_DEDUP_INTERVAL + "",
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- public static String getCacheDedupInterval() {
- return getStringProperty(CACHE_DEDUP_INTERVAL_PROPERTY, String.valueOf(DEFAULT_CACHE_DEDUP_INTERVAL));
- }
-
- private static final String LOG_FILTER_ENABLE_PROPERTY = "logfeeder.log.filter.enable";
- private static final boolean DEFAULT_LOG_FILTER_ENABLE = false;
-
- @LogSearchPropertyDescription(
- name = LOG_FILTER_ENABLE_PROPERTY,
- description = "Enables the filtering of the log entries by log level filters.",
- examples = {"true"},
- defaultValue = DEFAULT_LOG_FILTER_ENABLE + "",
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- public static boolean isLogFilterEnabled() {
- return getBooleanProperty(LOG_FILTER_ENABLE_PROPERTY, DEFAULT_LOG_FILTER_ENABLE);
- }
-
- private static final String INCLUDE_DEFAULT_LEVEL_PROPERTY = "logfeeder.include.default.level";
-
- @LogSearchPropertyDescription(
- name = INCLUDE_DEFAULT_LEVEL_PROPERTY,
- description = "Comma separtaed list of the default log levels to be enabled by the filtering.",
- examples = {"FATAL,ERROR,WARN"},
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- public static String getIncludeDefaultLevel() {
- return getStringProperty(INCLUDE_DEFAULT_LEVEL_PROPERTY);
- }
-
- private static final String DEFAULT_SOLR_JAAS_FILE = "/etc/security/keytabs/logsearch_solr.service.keytab";
- private static final String SOLR_JAAS_FILE_PROPERTY = "logfeeder.solr.jaas.file";
-
- @LogSearchPropertyDescription(
- name = SOLR_JAAS_FILE_PROPERTY,
- description = "The jaas file used for solr.",
- examples = {"/etc/ambari-logsearch-logfeeder/conf/logfeeder_jaas.conf"},
- defaultValue = DEFAULT_SOLR_JAAS_FILE,
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- public static String getSolrJaasFile() {
- return getStringProperty(SOLR_JAAS_FILE_PROPERTY, DEFAULT_SOLR_JAAS_FILE);
- }
-
- private static final String SOLR_KERBEROS_ENABLE_PROPERTY = "logfeeder.solr.kerberos.enable";
- private static final boolean DEFAULT_SOLR_KERBEROS_ENABLE = false;
-
- @LogSearchPropertyDescription(
- name = SOLR_KERBEROS_ENABLE_PROPERTY,
- description = "Enables using kerberos for accessing solr.",
- examples = {"true"},
- defaultValue = DEFAULT_SOLR_KERBEROS_ENABLE + "",
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- public static boolean isSolrKerberosEnabled() {
- return getBooleanProperty(SOLR_KERBEROS_ENABLE_PROPERTY, DEFAULT_SOLR_KERBEROS_ENABLE);
- }
-
- private static final String METRICS_COLLECTOR_HOSTS_PROPERTY = "logfeeder.metrics.collector.hosts";
-
- @LogSearchPropertyDescription(
- name = METRICS_COLLECTOR_HOSTS_PROPERTY,
- description = "Comma separtaed list of metric collector hosts.",
- examples = {"c6401.ambari.apache.org"},
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- public static String getMetricsCollectorHosts() {
- return getStringProperty(METRICS_COLLECTOR_HOSTS_PROPERTY);
- }
-
- private static final String METRICS_COLLECTOR_PROTOCOL_PROPERTY = "logfeeder.metrics.collector.protocol";
-
- @LogSearchPropertyDescription(
- name = METRICS_COLLECTOR_PROTOCOL_PROPERTY,
- description = "The protocol used by metric collectors.",
- examples = {"http", "https"},
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- public static String getMetricsCollectorProtocol() {
- return getStringProperty(METRICS_COLLECTOR_PROTOCOL_PROPERTY);
- }
-
- private static final String METRICS_COLLECTOR_PORT_PROPERTY = "logfeeder.metrics.collector.port";
-
- @LogSearchPropertyDescription(
- name = METRICS_COLLECTOR_PORT_PROPERTY,
- description = "The port used by metric collectors.",
- examples = {"6188"},
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- public static String getMetricsCollectorPort() {
- return getStringProperty(METRICS_COLLECTOR_PORT_PROPERTY);
- }
-
- private static final String METRICS_COLLECTOR_PATH_PROPERTY = "logfeeder.metrics.collector.path";
-
- @LogSearchPropertyDescription(
- name = METRICS_COLLECTOR_PATH_PROPERTY,
- description = "The path used by metric collectors.",
- examples = {"/ws/v1/timeline/metrics"},
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- public static String getMetricsCollectorPath() {
- return getStringProperty(METRICS_COLLECTOR_PATH_PROPERTY);
- }
-
- private static final String SIMULATE_INPUT_NUMBER_PROPERTY = "logfeeder.simulate.input_number";
- private static final int DEFAULT_SIMULATE_INPUT_NUMBER = 0;
-
- @LogSearchPropertyDescription(
- name = SIMULATE_INPUT_NUMBER_PROPERTY,
- description = "The number of the simulator instances to run with. O means no simulation.",
- examples = {"10"},
- defaultValue = DEFAULT_SIMULATE_INPUT_NUMBER + "",
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- public static int getSimulateInputNumber() {
- return getIntProperty(SIMULATE_INPUT_NUMBER_PROPERTY, DEFAULT_SIMULATE_INPUT_NUMBER);
- }
-
- private static final String SIMULATE_LOG_LEVEL_PROPERTY = "logfeeder.simulate.log_level";
- private static final String DEFAULT_SIMULATE_LOG_LEVEL = "WARN";
-
- @LogSearchPropertyDescription(
- name = SIMULATE_LOG_LEVEL_PROPERTY,
- description = "The log level to create the simulated log entries with.",
- examples = {"INFO"},
- defaultValue = DEFAULT_SIMULATE_LOG_LEVEL,
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- public static String getSimulateLogLevel() {
- return getStringProperty(SIMULATE_LOG_LEVEL_PROPERTY, DEFAULT_SIMULATE_LOG_LEVEL);
- }
-
- private static final String SIMULATE_NUMBER_OF_WORDS_PROPERTY = "logfeeder.simulate.number_of_words";
- private static final int DEFAULT_SIMULATE_NUMBER_OF_WORDS = 1000;
-
- @LogSearchPropertyDescription(
- name = SIMULATE_NUMBER_OF_WORDS_PROPERTY,
- description = "The size of the set of words that may be used to create the simulated log entries with.",
- examples = {"100"},
- defaultValue = DEFAULT_SIMULATE_NUMBER_OF_WORDS + "",
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- public static int getSimulateNumberOfWords() {
- return getIntProperty(SIMULATE_NUMBER_OF_WORDS_PROPERTY, DEFAULT_SIMULATE_NUMBER_OF_WORDS, 50, 1000000);
- }
-
- private static final String SIMULATE_MIN_LOG_WORDS_PROPERTY = "logfeeder.simulate.min_log_words";
- private static final int DEFAULT_SIMULATE_MIN_LOG_WORDS = 5;
-
- @LogSearchPropertyDescription(
- name = SIMULATE_MIN_LOG_WORDS_PROPERTY,
- description = "The minimum number of words in a simulated log entry.",
- examples = {"3"},
- defaultValue = DEFAULT_SIMULATE_MIN_LOG_WORDS + "",
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- public static int getSimulateMinLogWords() {
- return getIntProperty(SIMULATE_MIN_LOG_WORDS_PROPERTY, DEFAULT_SIMULATE_MIN_LOG_WORDS, 1, 10);
- }
-
- private static final String SIMULATE_MAX_LOG_WORDS_PROPERTY = "logfeeder.simulate.max_log_words";
- private static final int DEFAULT_SIMULATE_MAX_LOG_WORDS = 5;
-
- @LogSearchPropertyDescription(
- name = SIMULATE_MAX_LOG_WORDS_PROPERTY,
- description = "The maximum number of words in a simulated log entry.",
- examples = {"8"},
- defaultValue = DEFAULT_SIMULATE_MAX_LOG_WORDS + "",
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- public static int getSimulateMaxLogWords() {
- return getIntProperty(SIMULATE_MAX_LOG_WORDS_PROPERTY, DEFAULT_SIMULATE_MAX_LOG_WORDS, 10, 20);
- }
-
- private static final String SIMULATE_SLEEP_MILLISECONDS_PROPERTY = "logfeeder.simulate.sleep_milliseconds";
- private static final int DEFAULT_SIMULATE_SLEEP_MILLISECONDS = 10000;
-
- @LogSearchPropertyDescription(
- name = SIMULATE_SLEEP_MILLISECONDS_PROPERTY,
- description = "The milliseconds to sleep between creating two simulated log entries.",
- examples = {"5000"},
- defaultValue = DEFAULT_SIMULATE_SLEEP_MILLISECONDS + "",
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- public static int getSimulateSleepMilliseconds() {
- return getIntProperty(SIMULATE_SLEEP_MILLISECONDS_PROPERTY, DEFAULT_SIMULATE_SLEEP_MILLISECONDS);
- }
-
- private static final String SIMULATE_LOG_IDS_PROPERTY = "logfeeder.simulate.log_ids";
-
- @LogSearchPropertyDescription(
- name = SIMULATE_LOG_IDS_PROPERTY,
- description = "The comma separated list of log ids for which to create the simulated log entries.",
- examples = {"ambari_server,zookeeper,infra_solr,logsearch_app"},
- defaultValue = "The log ids of the installed services in the cluster",
- sources = {LOGFEEDER_PROPERTIES_FILE}
- )
- public static String getSimulateLogIds() {
- return getStringProperty(SIMULATE_LOG_IDS_PROPERTY);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/SSLUtil.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/SSLUtil.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/SSLUtil.java
deleted file mode 100644
index 6bcaac9..0000000
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/util/SSLUtil.java
+++ /dev/null
@@ -1,134 +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.
- */
-
-package org.apache.ambari.logfeeder.util;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.log4j.Logger;
-
-import java.io.File;
-import java.nio.charset.Charset;
-
-public class SSLUtil {
- private static final Logger LOG = Logger.getLogger(SSLUtil.class);
-
- private static final String KEYSTORE_LOCATION_ARG = "javax.net.ssl.keyStore";
- private static final String TRUSTSTORE_LOCATION_ARG = "javax.net.ssl.trustStore";
- private static final String KEYSTORE_TYPE_ARG = "javax.net.ssl.keyStoreType";
- private static final String TRUSTSTORE_TYPE_ARG = "javax.net.ssl.trustStoreType";
- private static final String KEYSTORE_PASSWORD_ARG = "javax.net.ssl.keyStorePassword";
- private static final String TRUSTSTORE_PASSWORD_ARG = "javax.net.ssl.trustStorePassword";
- private static final String KEYSTORE_PASSWORD_PROPERTY_NAME = "logfeeder_keystore_password";
- private static final String TRUSTSTORE_PASSWORD_PROPERTY_NAME = "logfeeder_truststore_password";
- private static final String KEYSTORE_PASSWORD_FILE = "ks_pass.txt";
- private static final String TRUSTSTORE_PASSWORD_FILE = "ts_pass.txt";
-
- private static final String LOGFEEDER_CERT_DEFAULT_FOLDER = "/etc/ambari-logsearch-portal/conf/keys";
- private static final String LOGFEEDER_STORE_DEFAULT_PASSWORD = "bigdata";
-
- private SSLUtil() {
- throw new UnsupportedOperationException();
- }
-
- public static String getKeyStoreLocation() {
- return System.getProperty(KEYSTORE_LOCATION_ARG);
- }
-
- public static String getKeyStoreType() {
- return System.getProperty(KEYSTORE_TYPE_ARG);
- }
-
- public static String getKeyStorePassword() {
- return System.getProperty(KEYSTORE_PASSWORD_ARG);
- }
-
- public static String getTrustStoreLocation() {
- return System.getProperty(TRUSTSTORE_LOCATION_ARG);
- }
-
- public static String getTrustStoreType() {
- return System.getProperty(TRUSTSTORE_TYPE_ARG);
- }
-
- public static String getTrustStorePassword() {
- return System.getProperty(TRUSTSTORE_PASSWORD_ARG);
- }
-
- public static void ensureStorePasswords() {
- ensureStorePassword(KEYSTORE_LOCATION_ARG, KEYSTORE_PASSWORD_ARG, KEYSTORE_PASSWORD_PROPERTY_NAME, KEYSTORE_PASSWORD_FILE);
- ensureStorePassword(TRUSTSTORE_LOCATION_ARG, TRUSTSTORE_PASSWORD_ARG, TRUSTSTORE_PASSWORD_PROPERTY_NAME, TRUSTSTORE_PASSWORD_FILE);
- }
-
- private static void ensureStorePassword(String locationArg, String pwdArg, String propertyName, String fileName) {
- if (StringUtils.isNotEmpty(System.getProperty(locationArg)) && StringUtils.isEmpty(System.getProperty(pwdArg))) {
- String password = getPassword(propertyName, fileName);
- System.setProperty(pwdArg, password);
- }
- }
-
- private static String getPassword(String propertyName, String fileName) {
- String credentialStorePassword = getPasswordFromCredentialStore(propertyName);
- if (credentialStorePassword != null) {
- return credentialStorePassword;
- }
-
- String filePassword = getPasswordFromFile(fileName);
- if (filePassword != null) {
- return filePassword;
- }
-
- return LOGFEEDER_STORE_DEFAULT_PASSWORD;
- }
-
- private static String getPasswordFromCredentialStore(String propertyName) {
- try {
- String providerPath = LogFeederPropertiesUtil.getCredentialStoreProviderPath();
- if (providerPath == null) {
- return null;
- }
-
- Configuration config = new Configuration();
- config.set(LogFeederPropertiesUtil.CREDENTIAL_STORE_PROVIDER_PATH_PROPERTY, providerPath);
- char[] passwordChars = config.getPassword(propertyName);
- return (ArrayUtils.isNotEmpty(passwordChars)) ? new String(passwordChars) : null;
- } catch (Exception e) {
- LOG.warn(String.format("Could not load password %s from credential store, using default password", propertyName));
- return null;
- }
- }
-
- private static String getPasswordFromFile(String fileName) {
- try {
- File pwdFile = new File(LOGFEEDER_CERT_DEFAULT_FOLDER, fileName);
- if (!pwdFile.exists()) {
- FileUtils.writeStringToFile(pwdFile, LOGFEEDER_STORE_DEFAULT_PASSWORD, Charset.defaultCharset());
- return LOGFEEDER_STORE_DEFAULT_PASSWORD;
- } else {
- return FileUtils.readFileToString(pwdFile, Charset.defaultCharset());
- }
- } catch (Exception e) {
- LOG.warn("Exception occurred during read/write password file for keystore/truststore.", e);
- return null;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/resources/log-samples/shipper-conf/input.config-sample.json
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/resources/log-samples/shipper-conf/input.config-sample.json b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/resources/log-samples/shipper-conf/input.config-sample.json
index 4ab2eb2..e54c974 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/resources/log-samples/shipper-conf/input.config-sample.json
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/resources/log-samples/shipper-conf/input.config-sample.json
@@ -22,7 +22,7 @@
"post_map_values": {
"logtime": {
"map_date": {
- "date_pattern": "yyyy-MM-dd HH:mm:ss,SSS"
+ "target_date_pattern": "yyyy-MM-dd HH:mm:ss,SSS"
}
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/resources/log4j.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/resources/log4j.xml b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/resources/log4j.xml
index eb20665..d01160c 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/resources/log4j.xml
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/resources/log4j.xml
@@ -23,7 +23,6 @@
<param name="Target" value="System.out" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d [%t] %-5p %C{6} (%F:%L) - %m%n" />
- <!-- <param name="ConversionPattern" value="%d [%t] %-5p %c %x - %m%n"/> -->
</layout>
</appender>
@@ -43,10 +42,8 @@
<param name="maxFileSize" value="10MB" />
<param name="maxBackupIndex" value="10" />
<layout class="org.apache.ambari.logsearch.appender.LogsearchConversion" />
- </appender>
-
+ </appender>
- <!-- Logs to suppress BEGIN -->
<category name="org.apache.solr.common.cloud.ZkStateReader" additivity="false">
<priority value="error" />
<appender-ref ref="daily_rolling_file" />
@@ -56,19 +53,15 @@
<priority value="fatal" />
<appender-ref ref="daily_rolling_file" />
</category>
- <!-- Logs to suppress END -->
<category name="org.apache.ambari.logfeeder" additivity="false">
<priority value="INFO" />
- <appender-ref ref="console" />
- <!-- <appender-ref ref="daily_rolling_file" /> -->
- <appender-ref ref="rolling_file_json"/>
+ <appender-ref ref="console" />
</category>
<root>
- <priority value="warn" />
- <!-- <appender-ref ref="console" /> -->
- <!-- <appender-ref ref="daily_rolling_file" /> -->
+ <priority value="info"/>
+ <appender-ref ref="console"/>
</root>
</log4j:configuration>
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/resources/logfeeder.properties
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/resources/logfeeder.properties b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/resources/logfeeder.properties
index 115778b..4b49446 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/resources/logfeeder.properties
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/resources/logfeeder.properties
@@ -14,23 +14,27 @@
# limitations under the License.
cluster.name=cl1
-logfeeder.checkpoint.folder=target/checkpoints
+logsearch.config.zk_connect_string=localhost:2181
+
logfeeder.metrics.collector.hosts=
-logfeeder.config.dir=target/classes/log-samples/shipper-conf/
-logfeeder.config.files=target/classes/log-samples/shipper-conf/global.config.json,\
- target/classes/log-samples/shipper-conf/input.config-sample.json,\
- target/classes/log-samples/shipper-conf/output.config-sample.json
+logfeeder.checkpoint.folder=${LOGFEEDER_RELATIVE_LOCATION:}target/checkpoints
+logfeeder.config.dir=${LOGFEEDER_RELATIVE_LOCATION:}target/classes/log-samples/shipper-conf/
+logfeeder.config.files=${LOGFEEDER_RELATIVE_LOCATION:}target/classes/log-samples/shipper-conf/global.config.json,\
+ ${LOGFEEDER_RELATIVE_LOCATION:}target/classes/log-samples/shipper-conf/output.config-sample.json
+
logfeeder.log.filter.enable=true
+
logfeeder.solr.config.interval=5
logfeeder.solr.core.config.name=history
logfeeder.solr.zk_connect_string=localhost:2181
+
logfeeder.cache.enabled=true
logfeeder.cache.size=100
logfeeder.cache.key.field=log_message
logfeeder.cache.dedup.interval=1000
logfeeder.cache.last.dedup.enabled=true
-logsearch.config.zk_connect_string=localhost:2181
+
logfeeder.include.default.level=FATAL,ERROR,WARN,INFO,DEBUG,TRACE,UNKNOWN
#logfeeder tmp dir
-logfeeder.tmp.dir=target/tmp
+logfeeder.tmp.dir=${LOGFEEDER_RELATIVE_LOCATION:}target/tmp
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterGrokTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterGrokTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterGrokTest.java
index 8d7e86c..e3a822a 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterGrokTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterGrokTest.java
@@ -20,6 +20,7 @@ package org.apache.ambari.logfeeder.filter;
import java.util.Map;
+import org.apache.ambari.logfeeder.conf.LogFeederProps;
import org.apache.ambari.logfeeder.input.Input;
import org.apache.ambari.logfeeder.input.InputMarker;
import org.apache.ambari.logfeeder.output.OutputManager;
@@ -52,7 +53,7 @@ public class FilterGrokTest {
filterGrok.loadConfig(filterGrokDescriptor);
filterGrok.setOutputManager(mockOutputManager);
filterGrok.setInput(EasyMock.mock(Input.class));
- filterGrok.init();
+ filterGrok.init(new LogFeederProps());
}
@Test
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterJSONTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterJSONTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterJSONTest.java
index acc3d4d..ef10c46 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterJSONTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterJSONTest.java
@@ -26,6 +26,7 @@ import java.util.TimeZone;
import org.apache.ambari.logfeeder.common.LogFeederConstants;
import org.apache.ambari.logfeeder.common.LogFeederException;
+import org.apache.ambari.logfeeder.conf.LogFeederProps;
import org.apache.ambari.logfeeder.input.InputMarker;
import org.apache.ambari.logfeeder.output.OutputManager;
import org.apache.ambari.logsearch.config.zookeeper.model.inputconfig.impl.FilterJsonDescriptorImpl;
@@ -54,7 +55,7 @@ public class FilterJSONTest {
filterJson = new FilterJSON();
filterJson.loadConfig(filterJsonDescriptor);
filterJson.setOutputManager(mockOutputManager);
- filterJson.init();
+ filterJson.init(new LogFeederProps());
}
@Test
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterKeyValueTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterKeyValueTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterKeyValueTest.java
index ae978fb..4a85b88 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterKeyValueTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/filter/FilterKeyValueTest.java
@@ -20,6 +20,7 @@ package org.apache.ambari.logfeeder.filter;
import java.util.Map;
+import org.apache.ambari.logfeeder.conf.LogFeederProps;
import org.apache.ambari.logfeeder.output.OutputManager;
import org.apache.ambari.logsearch.config.api.model.inputconfig.FilterKeyValueDescriptor;
import org.apache.ambari.logsearch.config.zookeeper.model.inputconfig.impl.FilterKeyValueDescriptorImpl;
@@ -49,7 +50,7 @@ public class FilterKeyValueTest {
filterKeyValue = new FilterKeyValue();
filterKeyValue.loadConfig(filterKeyValueDescriptor);
filterKeyValue.setOutputManager(mockOutputManager);
- filterKeyValue.init();
+ filterKeyValue.init(new LogFeederProps());
}
@Test
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/input/InputFileTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/input/InputFileTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/input/InputFileTest.java
index efebc08..01b4e54 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/input/InputFileTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/input/InputFileTest.java
@@ -24,6 +24,8 @@ import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
+import org.apache.ambari.logfeeder.conf.LogEntryCacheConfig;
+import org.apache.ambari.logfeeder.conf.LogFeederProps;
import org.apache.ambari.logfeeder.filter.Filter;
import org.apache.ambari.logfeeder.input.InputMarker;
import org.apache.ambari.logsearch.config.zookeeper.model.inputconfig.impl.InputFileDescriptorImpl;
@@ -61,6 +63,8 @@ public class InputFileTest {
private InputMarker testInputMarker;
+ private LogFeederProps logFeederProps;
+
@Rule
public ExpectedException expectedException = ExpectedException.none();
@@ -74,6 +78,9 @@ public class InputFileTest {
@Before
public void setUp() throws Exception {
+ logFeederProps = new LogFeederProps();
+ LogEntryCacheConfig logEntryCacheConfig = new LogEntryCacheConfig();
+ logFeederProps.setLogEntryCacheConfig(logEntryCacheConfig);
}
public void init(String path) throws Exception {
@@ -87,7 +94,7 @@ public class InputFileTest {
Filter capture = new Filter() {
@Override
- public void init() {
+ public void init(LogFeederProps logFeederProps) {
}
@Override
@@ -103,7 +110,7 @@ public class InputFileTest {
inputFile = new InputFile();
inputFile.loadConfig(inputFileDescriptor);
inputFile.addFilter(capture);
- inputFile.init();
+ inputFile.init(logFeederProps);
}
@Test
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/input/InputManagerTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/input/InputManagerTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/input/InputManagerTest.java
index 46fbc3b..9dba349 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/input/InputManagerTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/input/InputManagerTest.java
@@ -24,6 +24,7 @@ import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.List;
+import org.apache.ambari.logfeeder.conf.LogFeederProps;
import org.apache.ambari.logfeeder.metrics.MetricData;
import org.junit.Test;
@@ -62,10 +63,12 @@ public class InputManagerTest {
Input input1 = strictMock(Input.class);
Input input2 = strictMock(Input.class);
Input input3 = strictMock(Input.class);
-
- input1.init(); expectLastCall();
- input2.init(); expectLastCall();
- input3.init(); expectLastCall();
+
+ LogFeederProps logFeederProps = new LogFeederProps();
+
+ input1.init(logFeederProps); expectLastCall();
+ input2.init(logFeederProps); expectLastCall();
+ input3.init(logFeederProps); expectLastCall();
expect(input1.isReady()).andReturn(true);
expect(input2.isReady()).andReturn(true);
@@ -78,6 +81,7 @@ public class InputManagerTest {
replay(input1, input2, input3);
InputManager manager = new InputManager();
+ manager.setLogFeederProps(logFeederProps);
manager.add("serviceName", input1);
manager.add("serviceName", input2);
manager.add("serviceName", input3);
[05/23] ambari git commit: AMBARI-22609. Install wizard stacks on
select version step (alexantonenko)
Posted by nc...@apache.org.
AMBARI-22609. Install wizard stacks on select version step (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ed327bd5
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ed327bd5
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ed327bd5
Branch: refs/heads/branch-feature-AMBARI-21674
Commit: ed327bd53eb140789b548044ebd207b3c47ccf3b
Parents: 2b285da
Author: Alex Antonenko <aa...@hortonworks.com>
Authored: Fri Dec 8 14:37:44 2017 +0300
Committer: Alex Antonenko <aa...@hortonworks.com>
Committed: Fri Dec 8 14:37:44 2017 +0300
----------------------------------------------------------------------
ambari-web/app/models/repository.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/ed327bd5/ambari-web/app/models/repository.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/repository.js b/ambari-web/app/models/repository.js
index d85c55d..58314cf 100644
--- a/ambari-web/app/models/repository.js
+++ b/ambari-web/app/models/repository.js
@@ -71,7 +71,8 @@ App.Repository = DS.Model.extend({
* @type {boolean}
*/
isGPL: function () {
- return this.get('tags').contains('GPL');
+ var tags = this.get('tags');
+ return tags && tags.contains('GPL');
}.property('tags'),
/**
[16/23] ambari git commit: AMBARI-22628 - YARN Shuffle Service Can't
Be Found On Client-Only Nodes After New Cluster Install (jonathanhurley)
Posted by nc...@apache.org.
AMBARI-22628 - YARN Shuffle Service Can't Be Found On Client-Only Nodes After New Cluster Install (jonathanhurley)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a928a9cd
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a928a9cd
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a928a9cd
Branch: refs/heads/branch-feature-AMBARI-21674
Commit: a928a9cd8f0c995e0aa5b9bc52c6b975d7f87edb
Parents: 8e23fa2
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Mon Dec 11 09:03:09 2017 -0500
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Wed Dec 13 13:26:56 2017 -0500
----------------------------------------------------------------------
.../ambari/server/agent/ExecutionCommand.java | 37 ++++++----------
.../internal/ClientConfigResourceProvider.java | 2 +
.../org/apache/ambari/server/state/Cluster.java | 9 ++++
.../server/state/cluster/ClusterImpl.java | 31 +++++++++++++
.../2.1.0.2.0/package/scripts/params_linux.py | 41 +++++++++++++++--
.../3.0.0.3.0/package/scripts/params_linux.py | 41 +++++++++++++++--
.../ExecutionCommandWrapperTest.java | 5 +++
.../AmbariCustomCommandExecutionHelperTest.java | 46 ++++++++++++++++++++
.../apache/ambari/server/orm/OrmTestHelper.java | 3 ++
9 files changed, 183 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/a928a9cd/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java
index 5ee4bf6..9093985 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java
@@ -29,8 +29,6 @@ import org.apache.ambari.annotations.ExperimentalFeature;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.RoleCommand;
import org.apache.ambari.server.state.Cluster;
-import org.apache.ambari.server.state.Service;
-import org.apache.ambari.server.state.ServiceComponent;
import org.apache.ambari.server.state.UpgradeContext.UpgradeSummary;
import org.apache.ambari.server.utils.StageUtils;
import org.slf4j.Logger;
@@ -553,30 +551,21 @@ public class ExecutionCommand extends AgentCommand {
}
/**
- * Used to set a map of {service -> { component -> version}}. This is necessary when performing
- * an upgrade to correct build paths of required binaries.
- * @param cluster the cluster from which to build the map
+ * Used to set a map of {service -> { component -> version}}. This is
+ * necessary when performing an upgrade to correct build paths of required
+ * binaries. This method will only set the version information for a component
+ * if:
+ * <ul>
+ * <li>The component advertises a version</li>
+ * <li>The repository for the component has been resolved and the version can
+ * be trusted</li>
+ * </ul>
+ *
+ * @param cluster
+ * the cluster from which to build the map
*/
public void setComponentVersions(Cluster cluster) throws AmbariException {
- Map<String, Map<String, String>> componentVersionMap = new HashMap<>();
-
- for (Service service : cluster.getServices().values()) {
- Map<String, String> componentMap = new HashMap<>();
-
- boolean shouldSet = false;
- for (ServiceComponent component : service.getServiceComponents().values()) {
- if (component.isVersionAdvertised()) {
- shouldSet = true;
- componentMap.put(component.getName(), component.getDesiredVersion());
- }
- }
-
- if (shouldSet) {
- componentVersionMap.put(service.getName(), componentMap);
- }
- }
-
- this.componentVersionMap = componentVersionMap;
+ componentVersionMap = cluster.getComponentVersionMap();
}
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/a928a9cd/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProvider.java
index 75f47ca..dcafdea 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProvider.java
@@ -458,6 +458,8 @@ public class ClientConfigResourceProvider extends AbstractControllerResourceProv
jsonContent.put("clusterName", cluster.getClusterName());
jsonContent.put("serviceName", serviceName);
jsonContent.put("role", componentName);
+ jsonContent.put("componentVersionMap", cluster.getComponentVersionMap());
+
jsonConfigurations = gson.toJson(jsonContent);
File tmpDirectory = new File(TMP_PATH);
http://git-wip-us.apache.org/repos/asf/ambari/blob/a928a9cd/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java b/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
index 90dd611..62226af 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
@@ -673,4 +673,13 @@ public interface Cluster {
*/
void addSuspendedUpgradeParameters(Map<String, String> commandParams,
Map<String, String> roleParams);
+
+ /**
+ * Gets a mapping of service to component/version for every installed
+ * component in the cluster which advertises a version and for which the
+ * repository has been resolved.
+ *
+ * @return a mapping of service to component version, or an empty map.
+ */
+ Map<String, Map<String, String>> getComponentVersionMap();
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a928a9cd/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 8f5e4f4..c23b971 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
@@ -2725,4 +2725,35 @@ public class ClusterImpl implements Cluster {
// suspended goes in role params
roleParams.put(KeyNames.UPGRADE_SUSPENDED, Boolean.TRUE.toString().toLowerCase());
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Map<String, Map<String, String>> getComponentVersionMap() {
+ Map<String, Map<String, String>> componentVersionMap = new HashMap<>();
+
+ for (Service service : getServices().values()) {
+ Map<String, String> componentMap = new HashMap<>();
+ for (ServiceComponent component : service.getServiceComponents().values()) {
+ // skip components which don't advertise a version
+ if (!component.isVersionAdvertised()) {
+ continue;
+ }
+
+ // if the repo isn't resolved, then we can't trust the version
+ if (!component.getDesiredRepositoryVersion().isResolved()) {
+ continue;
+ }
+
+ componentMap.put(component.getName(), component.getDesiredVersion());
+ }
+
+ if (!componentMap.isEmpty()) {
+ componentVersionMap.put(service.getName(), componentMap);
+ }
+ }
+
+ return componentVersionMap;
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a928a9cd/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 1bc01d4..9997779 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
@@ -21,6 +21,7 @@ Ambari Agent
import os
from resource_management.core import sudo
+from resource_management.core.logger import Logger
from resource_management.libraries.script.script import Script
from resource_management.libraries.resources.hdfs_resource import HdfsResource
from resource_management.libraries.functions import component_version
@@ -84,11 +85,45 @@ stack_supports_timeline_state_store = check_stack_feature(StackFeature.TIMELINE_
# It cannot be used during the initial Cluser Install because the version is not yet known.
version = default("/commandParams/version", None)
+def get_spark_version(service_name, component_name, yarn_version):
+ """
+ Attempts to calculate the correct version placeholder value for spark or spark2 based on
+ what is installed in the cluster. If Spark is not installed, then this value will need to be
+ that of YARN so it can still find the correct shuffle class.
+
+ On cluster installs, we have not yet calcualted any versions and all known values could be None.
+ This doesn't affect daemons, but it does affect client-only hosts where they will never receive
+ a start command after install. Therefore, this function will attempt to use stack-select as a
+ last resort to get a value value.
+ :param service_name: the service name (SPARK, SPARK2, etc)
+ :param component_name: the component name (SPARK_CLIENT, etc)
+ :param yarn_version: the default version of Yarn to use if no spark is installed
+ :return: a value for the version placeholder in shuffle classpath properties
+ """
+ # start off seeing if we need to populate a default value for YARN
+ if yarn_version is None:
+ yarn_version = component_version.get_component_repository_version(service_name = "YARN",
+ component_name = "YARN_CLIENT")
+
+ # now try to get the version of spark/spark2, defaulting to the version if YARN
+ shuffle_classpath_version = component_version.get_component_repository_version(service_name = service_name,
+ component_name = component_name, default_value = yarn_version)
+
+ # even with the default of using YARN's version, on an install this might be None since we haven't
+ # calculated the version of YARN yet - use stack_select as a last ditch effort
+ if shuffle_classpath_version is None:
+ try:
+ shuffle_classpath_version = stack_select.get_role_component_current_stack_version()
+ except:
+ Logger.exception("Unable to query for the correct shuffle classpath")
+
+ return shuffle_classpath_version
+
# these are used to render the classpath for picking up Spark classes
# in the event that spark is not installed, then we must default to the vesrion of YARN installed
# since it will still load classes from its own spark version
-spark_version = component_version.get_component_repository_version(service_name = "SPARK", component_name = "SPARK_CLIENT", default_value = version)
-spark2_version = component_version.get_component_repository_version(service_name = "SPARK2", component_name = "SPARK2_CLIENT", default_value = version)
+spark_version = get_spark_version("SPARK", "SPARK_CLIENT", version)
+spark2_version = get_spark_version("SPARK2", "SPARK2_CLIENT", version)
stack_supports_ranger_kerberos = check_stack_feature(StackFeature.RANGER_KERBEROS_SUPPORT, version_for_stack_feature_checks)
stack_supports_ranger_audit_db = check_stack_feature(StackFeature.RANGER_AUDIT_DB_SUPPORT, version_for_stack_feature_checks)
@@ -548,5 +583,3 @@ if enable_ranger_yarn and is_supported_yarn_ranger:
# need this to capture cluster name from where ranger yarn plugin is enabled
cluster_name = config['clusterName']
-
-# ranger yarn plugin end section
http://git-wip-us.apache.org/repos/asf/ambari/blob/a928a9cd/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 b8a5382..8e9632c 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
@@ -21,6 +21,7 @@ Ambari Agent
import os
from resource_management.core import sudo
+from resource_management.core.logger import Logger
from resource_management.libraries.script.script import Script
from resource_management.libraries.resources.hdfs_resource import HdfsResource
from resource_management.libraries.functions import component_version
@@ -84,11 +85,45 @@ stack_supports_timeline_state_store = check_stack_feature(StackFeature.TIMELINE_
# It cannot be used during the initial Cluser Install because the version is not yet known.
version = default("/commandParams/version", None)
+def get_spark_version(service_name, component_name, yarn_version):
+ """
+ Attempts to calculate the correct version placeholder value for spark or spark2 based on
+ what is installed in the cluster. If Spark is not installed, then this value will need to be
+ that of YARN so it can still find the correct shuffle class.
+
+ On cluster installs, we have not yet calcualted any versions and all known values could be None.
+ This doesn't affect daemons, but it does affect client-only hosts where they will never receive
+ a start command after install. Therefore, this function will attempt to use stack-select as a
+ last resort to get a value value.
+ :param service_name: the service name (SPARK, SPARK2, etc)
+ :param component_name: the component name (SPARK_CLIENT, etc)
+ :param yarn_version: the default version of Yarn to use if no spark is installed
+ :return: a value for the version placeholder in shuffle classpath properties
+ """
+ # start off seeing if we need to populate a default value for YARN
+ if yarn_version is None:
+ yarn_version = component_version.get_component_repository_version(service_name = "YARN",
+ component_name = "YARN_CLIENT")
+
+ # now try to get the version of spark/spark2, defaulting to the version if YARN
+ shuffle_classpath_version = component_version.get_component_repository_version(service_name = service_name,
+ component_name = component_name, default_value = yarn_version)
+
+ # even with the default of using YARN's version, on an install this might be None since we haven't
+ # calculated the version of YARN yet - use stack_select as a last ditch effort
+ if shuffle_classpath_version is None:
+ try:
+ shuffle_classpath_version = stack_select.get_role_component_current_stack_version()
+ except:
+ Logger.exception("Unable to query for the correct shuffle classpath")
+
+ return shuffle_classpath_version
+
# these are used to render the classpath for picking up Spark classes
# in the event that spark is not installed, then we must default to the vesrion of YARN installed
# since it will still load classes from its own spark version
-spark_version = component_version.get_component_repository_version(service_name = "SPARK", component_name = "SPARK_CLIENT", default_value = version)
-spark2_version = component_version.get_component_repository_version(service_name = "SPARK2", component_name = "SPARK2_CLIENT", default_value = version)
+spark_version = get_spark_version("SPARK", "SPARK_CLIENT", version)
+spark2_version = get_spark_version("SPARK2", "SPARK2_CLIENT", version)
stack_supports_ranger_kerberos = check_stack_feature(StackFeature.RANGER_KERBEROS_SUPPORT, version_for_stack_feature_checks)
stack_supports_ranger_audit_db = check_stack_feature(StackFeature.RANGER_AUDIT_DB_SUPPORT, version_for_stack_feature_checks)
@@ -547,5 +582,3 @@ if enable_ranger_yarn and is_supported_yarn_ranger:
# need this to capture cluster name from where ranger yarn plugin is enabled
cluster_name = config['clusterName']
-
-# ranger yarn plugin end section
http://git-wip-us.apache.org/repos/asf/ambari/blob/a928a9cd/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapperTest.java
index f12c701..10ef219 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapperTest.java
@@ -285,7 +285,12 @@ public class ExecutionCommandWrapperTest {
Cluster cluster = clusters.getCluster(CLUSTER1);
StackId stackId = cluster.getDesiredStackVersion();
+
+ // set the repo version resolved state to verify that the version is not sent
RepositoryVersionEntity repositoryVersion = ormTestHelper.getOrCreateRepositoryVersion(stackId, "0.1-0000");
+ repositoryVersion.setResolved(false);
+ ormTestHelper.repositoryVersionDAO.merge(repositoryVersion);
+
Service service = cluster.getService("HDFS");
service.setDesiredRepositoryVersion(repositoryVersion);
http://git-wip-us.apache.org/repos/asf/ambari/blob/a928a9cd/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelperTest.java
index 26c79e6..6bece66 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelperTest.java
@@ -564,6 +564,52 @@ public class AmbariCustomCommandExecutionHelperTest {
Assert.assertTrue(command.getComponentVersionMap().containsKey("ZOOKEEPER"));
}
+ /**
+ * Tests that if a component's repository is not resolved, then the repo
+ * version map does not get populated.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testAvailableServicesMapIsEmptyWhenRepositoriesNotResolved() throws Exception {
+
+ // set all repos to resolve=false to verify that we don't get a
+ // component version map
+ RepositoryVersionDAO repositoryVersionDAO = injector.getInstance(RepositoryVersionDAO.class);
+ List<RepositoryVersionEntity> repoVersions = repositoryVersionDAO.findAll();
+ for (RepositoryVersionEntity repoVersion : repoVersions) {
+ repoVersion.setResolved(false);
+ repositoryVersionDAO.merge(repoVersion);
+ }
+
+ Map<String, String> requestProperties = new HashMap<String, String>() {
+ {
+ put(REQUEST_CONTEXT_PROPERTY, "Refresh YARN Capacity Scheduler");
+ put("command", "REFRESHQUEUES");
+ }
+ };
+
+ ExecuteActionRequest actionRequest = new ExecuteActionRequest("c1", "REFRESHQUEUES",
+ new HashMap<String, String>() {
+ {
+ put("forceRefreshConfigTags", "capacity-scheduler");
+ }
+ }, false);
+
+ actionRequest.getResourceFilters().add(new RequestResourceFilter("YARN", "RESOURCEMANAGER",
+ Collections.singletonList("c1-c6401")));
+
+ EasyMock.replay(hostRoleCommand, actionManager, configHelper);
+
+ ambariManagementController.createAction(actionRequest, requestProperties);
+ Request request = requestCapture.getValue();
+ Stage stage = request.getStages().iterator().next();
+ List<ExecutionCommandWrapper> commands = stage.getExecutionCommands("c1-c6401");
+ ExecutionCommand command = commands.get(0).getExecutionCommand();
+
+ Assert.assertTrue(MapUtils.isEmpty(command.getComponentVersionMap()));
+ }
+
@Test
public void testCommandRepository() throws Exception {
Cluster cluster = clusters.getCluster("c1");
http://git-wip-us.apache.org/repos/asf/ambari/blob/a928a9cd/ambari-server/src/test/java/org/apache/ambari/server/orm/OrmTestHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/OrmTestHelper.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/OrmTestHelper.java
index 9da66f2..911c570 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/orm/OrmTestHelper.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/OrmTestHelper.java
@@ -674,6 +674,9 @@ public class OrmTestHelper {
repositoryVersion = repositoryVersionDAO.create(stackEntity, version,
String.valueOf(System.currentTimeMillis()) + uniqueCounter.incrementAndGet(), operatingSystems);
+
+ repositoryVersion.setResolved(true);
+ repositoryVersion = repositoryVersionDAO.merge(repositoryVersion);
} catch (Exception ex) {
LOG.error("Caught exception", ex);
[04/23] ambari git commit: AMBARI-22612 Log Search UI: Fixes for
Top-Level Buttons. (Istvan Tobias via ababiichuk)
Posted by nc...@apache.org.
AMBARI-22612 Log Search UI: Fixes for Top-Level Buttons. (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/2b285dac
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2b285dac
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2b285dac
Branch: refs/heads/branch-feature-AMBARI-21674
Commit: 2b285dac1667e80b89c8719f1746cb433bf0d4dc
Parents: 367dd17
Author: Istvan Tobias <to...@gmail.com>
Authored: Thu Dec 7 19:33:00 2017 +0200
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Fri Dec 8 12:33:10 2017 +0200
----------------------------------------------------------------------
.../app/components/logs-container/logs-container.component.html | 2 +-
.../app/components/logs-container/logs-container.component.less | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/2b285dac/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.html b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.html
index 13911bd..5e401d8 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.html
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.html
@@ -17,7 +17,7 @@
<div class="tabs-container container-fluid">
<div class="row">
- <div class="col-md-12">
+ <div class="col-md-12 tabs-menu-container">
<tabs class="pull-left" [items]="tabs | async" (tabSwitched)="onSwitchTab($event)"
(tabClosed)="onCloseTab($event[0], $event[1])"></tabs>
<action-menu class="pull-right"></action-menu>
http://git-wip-us.apache.org/repos/asf/ambari/blob/2b285dac/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.less
index 9902b79..b4d44fb 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.less
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.less
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-@import '../variables';
+@import '../mixins';
:host {
display: block;
@@ -27,6 +27,9 @@
}
.tabs-container {
border-bottom: 1px solid @table-border-color;
+ .tabs-menu-container {
+ .flex-vertical-align;
+ }
}
filters-panel {
[09/23] ambari git commit: AMBARI-22615 Log Search UI: improve
histogram display. (Istvan Tobias via ababiichuk)
Posted by nc...@apache.org.
AMBARI-22615 Log Search UI: improve histogram display. (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/b1fd131f
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b1fd131f
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b1fd131f
Branch: refs/heads/branch-feature-AMBARI-21674
Commit: b1fd131f78feda8f9fef6f33dbc8c67e3fdf539f
Parents: ee50629
Author: Istvan Tobias <to...@gmail.com>
Authored: Fri Dec 8 13:32:20 2017 +0200
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Fri Dec 8 19:00:36 2017 +0200
----------------------------------------------------------------------
.../src/app/classes/histogram-options.ts | 3 +-
.../src/app/components/mixins.less | 18 +-
.../time-histogram.component.html | 29 ++
.../time-histogram.component.less | 162 +++++++-
.../time-histogram.component.spec.ts | 138 ++++++-
.../time-histogram/time-histogram.component.ts | 377 ++++++++++++++++---
.../src/app/services/logs-container.service.ts | 4 +-
.../src/assets/i18n/en.json | 13 +-
8 files changed, 669 insertions(+), 75 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/b1fd131f/ambari-logsearch/ambari-logsearch-web/src/app/classes/histogram-options.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/histogram-options.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/histogram-options.ts
index dee5d98..15fefde 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/classes/histogram-options.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/histogram-options.ts
@@ -27,8 +27,7 @@ export interface HistogramStyleOptions {
margin?: HistogramMarginOptions;
height?: number;
tickPadding?: number;
- columnWidth?: number;
- dragAreaColor?: string;
+ columnWidth?: {[key:string]: number};
}
export interface HistogramOptions extends HistogramStyleOptions {
http://git-wip-us.apache.org/repos/asf/ambari/blob/b1fd131f/ambari-logsearch/ambari-logsearch-web/src/app/components/mixins.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/mixins.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/mixins.less
index a6e5616..890887a 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/mixins.less
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/mixins.less
@@ -203,25 +203,11 @@
display: inline-block;
width: 0;
height: 0;
- margin-left: @caret-width * .85;
vertical-align: @caret-width * .85;
content: "";
.caret-direction(@caret-width, @direction, @color);
}
// This is the main caret mixin to create the common and the direction related css
-.caret(@caret-width; @direction: down; @color: @base-font-color; @position: before) {
-
- &::before when (@position = before) {
- .caret-style(@caret-width, @direction, @color);
- }
- &::after when (@position = after) {
- .caret-style(@caret-width, @direction, @color);
- }
-
- &:empty::before when (@position = before) {
- margin-left: 0;
- }
- &:empty::after when (@position = after) {
- margin-left: 0;
- }
+.caret-mixin(@caret-width; @direction: down; @color: @base-font-color; @position: before) {
+ .caret-style(@caret-width, @direction, @color);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b1fd131f/ambari-logsearch/ambari-logsearch-web/src/app/components/time-histogram/time-histogram.component.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/time-histogram/time-histogram.component.html b/ambari-logsearch/ambari-logsearch-web/src/app/components/time-histogram/time-histogram.component.html
index 299e46e..1193b2e 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/time-histogram/time-histogram.component.html
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/time-histogram/time-histogram.component.html
@@ -15,4 +15,33 @@
limitations under the License.
-->
+<header>
+ <div class="container-fluid">
+ <div class="row">
+ <div *ngIf="chartTimeGap" class="time-gap col-lg-2 col-md-offset-5">
+ {{chartTimeGap.value}} {{chartTimeGap.label | translate}} {{'histogram.gap' | translate}}
+ </div>
+ <div class="legends col-md-5" [class.md-offset-7]="!chartTimeGap">
+ <div *ngFor="let legend of legends" class="legend {{legend.level | lowercase}}">
+ {{ legend.label | translate }}
+ </div>
+ </div>
+ </div>
+ </div>
+</header>
<div #container></div>
+<footer *ngIf="firstDateTick || lastDateTick">
+ <div *ngIf="firstDateTick" class="first-date-tick-label">{{firstDateTick | amTz:timeZone | amDateFormat:historyStartEndTimeFormat}}</div>
+ <div *ngIf="lastDateTick" class="last-date-tick-label">{{lastDateTick | amTz:timeZone | amDateFormat:historyStartEndTimeFormat}}</div>
+</footer>
+<div [ngClass]="{hide: !tooltipInfo, 'tooltip-left': tooltipOnTheLeft, 'tooltip-chart': true}" #tooltipEl
+ [style.top]="tooltipInfo ? (tooltipPosition.top + 'px') : ''" [style.left]="tooltipInfo ? (tooltipPosition.left + 'px') : ''">
+ <ng-container *ngIf="tooltipInfo">
+ <div class="tooltip-chart-date">{{tooltipInfo.timeStamp | amTz:timeZone | amDateFormat:tickTimeFormat}}</div>
+ <div *ngFor="let data of tooltipInfo.data" class="level {{data.level | lowercase}}">
+ <span class="level-label">{{data.levelLabel | translate }}</span>
+ <span class="level-value">{{data.value}}</span>
+ </div>
+ </ng-container>
+</div>
+
http://git-wip-us.apache.org/repos/asf/ambari/blob/b1fd131f/ambari-logsearch/ambari-logsearch-web/src/app/components/time-histogram/time-histogram.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/time-histogram/time-histogram.component.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/time-histogram/time-histogram.component.less
index e8d3240..1d3766d 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/time-histogram/time-histogram.component.less
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/time-histogram/time-histogram.component.less
@@ -16,25 +16,179 @@
* limitations under the License.
*/
+@import '../mixins';
+
:host {
- display: block;
- cursor: crosshair;
+ position: relative;
+ .level-mixin(@level, @size: .8em) {
+ @name: "@{level}-color";
+ border-radius: 100%;
+ content: "";
+ display: inline-block;
+ height: .8em;
+ width: .8em;
+ background-color: @@name;
+ }
+
background: #ECECEC; // TODO add style according to actual design
+ display: block;
+
/deep/ .axis {
.domain {
display: none;
}
-
.tick {
cursor: default;
-
line {
display: none;
}
}
}
+ /deep/ svg {
+ cursor: crosshair;
+ }
+
/deep/ .value {
cursor: pointer;
+ rect {
+ transition: opacity 250ms;
+ opacity: .8;
+ &:hover {
+ opacity: 1;
+ }
+ }
+ }
+
+ /deep/ .tooltip-chart {
+ background: #fff;
+ border-radius: 4px;
+ border: @input-border;
+ display: block;
+ font-size: .8em;
+ margin: 0 1.5em;
+ min-height: 2em;
+ min-width: 5em;
+ padding: .5em;
+ position: absolute;
+ &:empty {
+ display: none;
+ }
+ &::before {
+ .caret-mixin(6px, left, #fff);
+ left: -6px;
+ position: absolute;
+ top: calc(50% - 2px);
+ }
+ &.tooltip-left::before {
+ display: none;
+ }
+ &.tooltip-left::after {
+ .caret-mixin(6px, right, #fff);
+ right: -6px;
+ position: absolute;
+ top: calc(50% - 2px);
+ }
+ .tooltip-chart-date {
+ padding: 0 0 .1em 0;
+ text-align: center;
+ }
+ .level {
+ display: flex;
+ &::before {
+ margin: auto .2em auto 0;
+ }
+ .level-label {
+ flex-grow: 3;
+ padding: 0 2em 0 0;
+ }
+ .level-value {
+ text-align: right;
+ }
+ }
+
+ .fatal::before {
+ .level-mixin('fatal');
+ }
+ .error::before {
+ .level-mixin('error');
+ }
+ .warn::before {
+ .level-mixin('warning');
+ }
+ .info::before {
+ .level-mixin('info');
+ }
+ .trace::before {
+ .level-mixin('trace');
+ }
+ .debug::before {
+ .level-mixin('debug');
+ }
+ .unknown::before {
+ .level-mixin('unknown');
+ }
+ }
+ header {
+ padding: .5rem;
}
+ .legends {
+ text-align: right;
+ .legend {
+ display: inline-block;
+ font-size: 1rem;
+ text-transform: uppercase;
+ padding-right: 1em;
+ }
+ .fatal::before {
+ .level-mixin('fatal');
+ }
+ .error::before {
+ .level-mixin('error');
+ }
+ .warn::before {
+ .level-mixin('warning');
+ }
+ .info::before {
+ .level-mixin('info');
+ }
+ .trace::before {
+ .level-mixin('trace');
+ }
+ .debug::before {
+ .level-mixin('debug');
+ }
+ .unknown::before {
+ .level-mixin('unknown');
+ }
+ }
+
+ .time-gap {
+ color: #666;
+ font-size: 1.2rem;
+ text-align: center;
+ }
+
+ footer {
+ display: flex;
+ div {
+ color: #666;
+ flex-grow: 1;
+ font-size: 1.2rem;
+ padding: 0 1em .5em 1em;
+ }
+ .last-date-tick-label {
+ text-align: right;
+ }
+ }
+
+ /deep/ rect.drag-area {
+ fill: #fff;
+ }
+
+ /deep/ rect.unselected-drag-area {
+ fill: darken(@main-background-color, 10%);
+ opacity: .6;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b1fd131f/ambari-logsearch/ambari-logsearch-web/src/app/components/time-histogram/time-histogram.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/time-histogram/time-histogram.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/time-histogram/time-histogram.component.spec.ts
index 9e056be..ee14780 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/time-histogram/time-histogram.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/time-histogram/time-histogram.component.spec.ts
@@ -19,35 +19,157 @@
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import {StoreModule} from '@ngrx/store';
import {AppSettingsService, appSettings} from '@app/services/storage/app-settings.service';
+import {TranslationModules} from '@app/test-config.spec';
+import {MomentModule} from 'angular2-moment';
+import {MomentTimezoneModule} from 'angular-moment-timezone';
+import {TimeZoneAbbrPipe} from '@app/pipes/timezone-abbr.pipe';
+import {ServiceLogsHistogramDataService} from '@app/services/storage/service-logs-histogram-data.service';
import {TimeHistogramComponent} from './time-histogram.component';
+import {LogsContainerService} from '@app/services/logs-container.service';
+import {HttpClientService} from "@app/services/http-client.service";
+import {AppStateService} from "@app/services/storage/app-state.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";
+import {ServiceLogsFieldsService} from "@app/services/storage/service-logs-fields.service";
+import {ServiceLogsTruncatedService} from "@app/services/storage/service-logs-truncated.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";
describe('TimeHistogramComponent', () => {
let component: TimeHistogramComponent;
let fixture: ComponentFixture<TimeHistogramComponent>;
+ let histogramData: any;
+ let customOptions: any;
beforeEach(async(() => {
+ const httpClient = {
+ get: () => {
+ return {
+ subscribe: () => {}
+ }
+ }
+ };
+ histogramData = {
+ "1512476481940": {
+ "FATAL": 0,
+ "ERROR": 1000,
+ "WARN": 700,
+ "INFO": 0,
+ "DEBUG": 0,
+ "TRACE": 0,
+ "UNKNOWN": 0
+ }, "1512472881940": {"FATAL": 0, "ERROR": 2000, "WARN": 900, "INFO": 0, "DEBUG": 0, "TRACE": 0, "UNKNOWN": 0}
+ };
+ customOptions = {
+ keysWithColors: {
+ FATAL: '#830A0A',
+ ERROR: '#E81D1D',
+ WARN: '#FF8916',
+ INFO: '#2577B5',
+ DEBUG: '#65E8FF',
+ TRACE: '#888',
+ UNKNOWN: '#BDBDBD'
+ }
+ };
TestBed.configureTestingModule({
- declarations: [TimeHistogramComponent],
+ declarations: [TimeHistogramComponent, TimeZoneAbbrPipe],
imports: [
StoreModule.provideStore({
appSettings
- })
+ }),
+ ...TranslationModules,
+ MomentModule,
+ MomentTimezoneModule
],
providers: [
- AppSettingsService
+ AppSettingsService,
+ ServiceLogsHistogramDataService,
+ LogsContainerService,
+ {
+ provide: HttpClientService,
+ useValue: httpClient
+ },
+ AppStateService,
+ AuditLogsService,
+ AuditLogsFieldsService,
+ ServiceLogsService,
+ ServiceLogsFieldsService,
+ ServiceLogsHistogramDataService,
+ ServiceLogsTruncatedService,
+ TabsService,
+ ClustersService,
+ ComponentsService,
+ HostsService
]
})
- .compileComponents();
+ .compileComponents();
}));
beforeEach(() => {
- fixture = TestBed.createComponent(TimeHistogramComponent);
- component = fixture.componentInstance;
- fixture.detectChanges();
- });
+ fixture = TestBed.createComponent(TimeHistogramComponent);
+ component = fixture.componentInstance;
+ component.customOptions = customOptions;
+ component.svgId = "HistogramSvg";
+ component.data = histogramData;
+ fixture.detectChanges();
+ });
it('should create component', () => {
expect(component).toBeTruthy();
});
+
+ const getTimeGapTestCases = [{
+ startDate: new Date(2017, 0, 1),
+ endDate: new Date(2017, 0, 8),
+ expected: {
+ unit: 'week',
+ value: 1,
+ label: 'histogram.gap.week'
+ }
+ }, {
+ startDate: new Date(2017, 0, 1),
+ endDate: new Date(2017, 0, 2),
+ expected: {
+ unit: 'day',
+ value: 1,
+ label: 'histogram.gap.day'
+ }
+ }, {
+ startDate: new Date(2017, 0, 1, 1),
+ endDate: new Date(2017, 0, 1, 2),
+ expected: {
+ unit: 'hour',
+ value: 1,
+ label: 'histogram.gap.hour'
+ }
+ }, {
+ startDate: new Date(2017, 0, 1, 1, 1),
+ endDate: new Date(2017, 0, 1, 1, 2),
+ expected: {
+ unit: 'minute',
+ value: 1,
+ label: 'histogram.gap.minute'
+ }
+ }, {
+ startDate: new Date(2017, 0, 1, 1, 1, 1),
+ endDate: new Date(2017, 0, 1, 1, 1, 11),
+ expected: {
+ unit: 'second',
+ value: 10,
+ label: 'histogram.gap.seconds'
+ }
+ }];
+
+ getTimeGapTestCases.forEach((test) => {
+ it(`should the getTimeGap return with the proper time gap obj for ${test.expected.value} ${test.expected.unit} difference`, () => {
+ const getTimeGap: (startDate: Date, endDate: Date) => {value: number, unit: string} = component['getTimeGap'];
+ const gap = getTimeGap(test.startDate, test.endDate);
+ expect(gap).toEqual(test.expected);
+ });
+ });
+
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b1fd131f/ambari-logsearch/ambari-logsearch-web/src/app/components/time-histogram/time-histogram.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/time-histogram/time-histogram.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/time-histogram/time-histogram.component.ts
index e255166..fb3092f 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/time-histogram/time-histogram.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/time-histogram/time-histogram.component.ts
@@ -30,19 +30,19 @@ import {HistogramStyleOptions, HistogramOptions} from '@app/classes/histogram-op
})
export class TimeHistogramComponent implements OnInit, AfterViewInit, OnChanges {
- constructor(private appSettings: AppSettingsService) {
- appSettings.getParameter('timeZone').subscribe((value: string): void => {
+ constructor(private appSettings: AppSettingsService) {}
+
+ ngOnInit() {
+ this.appSettings.getParameter('timeZone').subscribe((value: string): void => {
this.timeZone = value;
this.createHistogram();
});
- }
-
- ngOnInit() {
this.options = Object.assign({}, this.defaultOptions, this.customOptions);
}
ngAfterViewInit() {
this.htmlElement = this.element.nativeElement;
+ this.tooltipElement = this.tooltipEl.nativeElement;
this.host = d3.select(this.htmlElement);
}
@@ -53,6 +53,9 @@ export class TimeHistogramComponent implements OnInit, AfterViewInit, OnChanges
@ViewChild('container')
element: ElementRef;
+ @ViewChild('tooltipEl')
+ tooltipEl: ElementRef;
+
@Input()
svgId: string;
@@ -67,15 +70,20 @@ export class TimeHistogramComponent implements OnInit, AfterViewInit, OnChanges
private readonly defaultOptions: HistogramStyleOptions = {
margin: {
- top: 20,
- right: 20,
- bottom: 40,
+ top: 5,
+ right: 50,
+ bottom: 30,
left: 50
},
- height: 200,
+ height: 150,
tickPadding: 10,
- columnWidth: 20,
- dragAreaColor: '#FFF'
+ columnWidth: {
+ second: 40,
+ minute: 30,
+ hour: 25,
+ day: 20,
+ base: 20
+ }
};
private options: HistogramOptions;
@@ -99,6 +107,7 @@ export class TimeHistogramComponent implements OnInit, AfterViewInit, OnChanges
private yAxis;
private htmlElement: HTMLElement;
+ private tooltipElement: HTMLElement;
private dragArea: Selection<SVGGraphicsElement, undefined, SVGGraphicsElement, undefined>;
@@ -108,10 +117,68 @@ export class TimeHistogramComponent implements OnInit, AfterViewInit, OnChanges
private maxDragX: number;
- private readonly timeFormat: string = 'MM/DD HH:mm';
+ private readonly tickTimeFormat: string = 'MM/DD HH:mm';
+ private readonly historyStartEndTimeFormat = 'dddd, MMMM DD, YYYY';
histogram: any;
+ /**
+ * This property is to hold the data of the bar where the mouse is over.
+ */
+ private tooltipInfo: {data: object, timeStamp: number};
+ /**
+ * This is the computed position of the tooltip relative to the @htmlElement which is the container of the histogram.
+ * It is set when the mousemoving over the bars in the @handleRectMouseMove method.
+ */
+ private tooltipPosition: {top: number, left: number};
+ /**
+ * This property indicates if the tooltip should be positioned on the left side of the cursor or not.
+ * It should be true when the tooltip is out from the window.
+ * @type {boolean}
+ */
+ private tooltipOnTheLeft: boolean = false;
+ /**
+ * This property holds the data structure describing the gaps between the xAxis ticks.
+ * The unit property can be: second, minute, hour, day
+ * The value is the number of the given unit.
+ */
+ private chartTimeGap: {value: number, unit: string, label: string} | null;
+ /**
+ * This is the rectangle element to represent the unselected time range on the left side of the selected time range
+ */
+ private leftDragArea: Selection<SVGGraphicsElement, undefined, SVGGraphicsElement, undefined>;
+ /**
+ * This is the rectangle element to represent the unselected time range on the right side of the selected time range
+ */
+ private rightDragArea: Selection<SVGGraphicsElement, undefined, SVGGraphicsElement, undefined>;
+ /**
+ * This is a Date object holding the value of the first tick of the xAxis. It is a helper getter for the template.
+ */
+ private get firstDateTick(): Date | undefined {
+ const ticks = this.xScale && this.xScale.ticks();
+ return (ticks && ticks.length && ticks[0]) || undefined;
+ }
+ /**
+ * This is a Date object holding the value of the last tick of the xAxis. It is a helper getter for the template.
+ */
+ private get lastDateTick(): Date | undefined {
+ const ticks = this.xScale && this.xScale.ticks();
+ return (ticks && ticks.length && ticks[ticks.length-1]) || undefined;
+ }
+
+ /**
+ * This will return the information about the used levels and the connected colors and labels.
+ * The goal is to provide an easy property to the template to display the legend of the levels.
+ * @returns {Array<{level: string; label: string; color: string}>}
+ */
+ private get legends(): Array<{level: string, label: string, color: string}> {
+ return Object.keys(this.options.keysWithColors).map(level => Object.assign({},{
+ level,
+ label: `levels.${level.toLowerCase()}`,
+ color: this.options.keysWithColors[level]
+ }));
+ }
+
private createHistogram(): void {
if (this.host) {
this.setup();
@@ -139,13 +206,21 @@ export class TimeHistogramComponent implements OnInit, AfterViewInit, OnChanges
.attr('transform', `translate(${margin.left},${margin.top})`);
}
+ /**
+ * It draws the svg representation of the x axis. The goal is to set the ticks here, add the axis to the svg element
+ * and set the position of the axis.
+ */
private drawXAxis(): void {
this.xAxis = d3.axisBottom(this.xScale)
- .tickFormat(tick => moment(tick).tz(this.timeZone).format(this.timeFormat))
+ .tickFormat(tick => moment(tick).tz(this.timeZone).format(this.tickTimeFormat))
.tickPadding(this.options.tickPadding);
- this.svg.append('g').attr('class', 'axis').attr('transform', `translate(0,${this.options.height})`).call(this.xAxis);
+ this.svg.append('g').attr('class', 'axis axis-x').attr('transform', `translate(0,${this.options.height})`).call(this.xAxis);
}
+ /**
+ * It draws the svg representation of the y axis. The goal is to set the ticks here, add the axis to the svg element
+ * and set the position of the axis.
+ */
private drawYAxis(): void {
this.yAxis = d3.axisLeft(this.yScale).tickFormat((tick: number): string | undefined => {
if (Number.isInteger(tick)) {
@@ -154,30 +229,248 @@ export class TimeHistogramComponent implements OnInit, AfterViewInit, OnChanges
return;
}
}).tickPadding(this.options.tickPadding);
- this.svg.append('g').attr('class', 'axis').call(this.yAxis).append('text');
+ this.svg.append('g').attr('class', 'axis axis-y').call(this.yAxis).append('text');
+ };
+
+ /**
+ * The goal is to handle the mouse over event on the rect svg elements so that we can populate the tooltip info object
+ * and set the initial position of the tooltip. So we call the corresponding methods.
+ * @param d The data for the currently "selected" bar
+ * @param {number} index The index of the current element in the selection
+ * @param elements The selection of the elements
+ */
+ private handleRectMouseOver = (d: any, index: number, elements: any):void => {
+ this.setTooltipDataFromChartData(d);
+ this.setTooltipPosition();
+ };
+
+ /**
+ * The goal is to handle the movement of the mouse over the rect svg elements, so that we can set the position of
+ * the tooltip by calling the @setTooltipPosition method.
+ */
+ private handleRectMouseMove = ():void => {
+ this.setTooltipPosition();
+ };
+
+ /**
+ * The goal is to reset the tooltipInfo object so that the tooltip will be hidden.
+ */
+ private handleRectMouseOut = ():void => {
+ this.tooltipInfo = null;
+ };
+
+ /**
+ * The goal is set the tooltip
+ * @param d
+ */
+ private setTooltipDataFromChartData(d: {data: any, [key: string]: any}): void {
+ let {timeStamp, ...data} = d.data;
+ let levelColors = this.options.keysWithColors;
+ this.tooltipInfo = {
+ data: Object.keys(levelColors).map(key => Object.assign({}, {
+ level: key,
+ levelLabel: `levels.${key.toLowerCase()}`,
+ value: data[key]
+ })),
+ timeStamp
+ };
+ }
+
+ /**
+ * The goal of this function is to set the tooltip position regarding the d3.mouse event relative to the @htmlElement.
+ * Onlty if we have @tooltipInfo
+ */
+ private setTooltipPosition():void {
+ if (this.tooltipInfo) {
+ let tEl = this.tooltipElement;
+ let pos = d3.mouse(this.htmlElement);
+ let left = pos[0];
+ let top = pos[1] - (tEl.offsetHeight / 2);
+ let tooltipWidth = tEl.offsetWidth;
+ let windowSize = window.innerWidth;
+ if (left + tooltipWidth > windowSize) {
+ left = pos[0] - (tooltipWidth + 25);
+ }
+ this.tooltipOnTheLeft = left < pos[0];
+ this.tooltipPosition = {left, top};
+ }
+ };
+
+ /**
+ * The goal is to calculate the time gap between the given dates. It will return an object representing the unit and
+ * the value in the given unit. Eg.: {unit: 'minute', value: 5}
+ * @param {Date} startDate
+ * @param {Date} endDate
+ * @returns {{value: number; unit: string, label: string}}
+ */
+ private getTimeGap(startDate: Date, endDate: Date): {value: number, unit: string, label: string} {
+ const startDateMoment = moment(startDate);
+ const endDateMoment = moment(endDate);
+ const diffInWeek: number = endDateMoment.diff(startDateMoment, 'weeks');
+ const diffInDay: number = endDateMoment.diff(startDateMoment, 'days');
+ const diffInHour: number = endDateMoment.diff(startDateMoment, 'hours');
+ const diffInMin: number = endDateMoment.diff(startDateMoment, 'minutes');
+ const diffInSec: number = endDateMoment.diff(startDateMoment, 'seconds');
+ const value = diffInWeek >= 1 ? diffInWeek : (
+ diffInDay >= 1 ? diffInDay : (
+ diffInHour >= 1 ? diffInHour : (diffInMin >= 1 ? diffInMin : diffInSec)
+ )
+ );
+ const unit: string = diffInWeek >= 1 ? 'week' : (
+ diffInDay >= 1 ? `day` : (
+ diffInHour >= 1 ? `hour` : (diffInMin >= 1 ? `minute` : `second`)
+ )
+ );
+ const label = `histogram.gap.${unit}${value>1 ? 's' : ''}`;
+ return {
+ value,
+ unit,
+ label
+ };
+ }
+
+ /**
+ * The goal is to have a simple function to set the time gap corresponding to the xScale ticks.
+ * It will reset the time gap if the xScale is not set or there are no ticks.
+ */
+ private setChartTimeGapByXScale() {
+ let ticks = this.xScale && this.xScale.ticks();
+ if (ticks && ticks.length) {
+ this.setChartTimeGap(ticks[0], ticks[1] || ticks[0]);
+ } else {
+ this.resetChartTimeGap();
+ }
+ }
+
+ /**
+ * Simply reset the time gap property to null.
+ */
+ private resetChartTimeGap(): void {
+ this.chartTimeGap = null;
+ }
+
+ /**
+ * The goal is to have a single point where we set the chartTimeGap property corresponding the given timerange.
+ * @param {Date} startDate
+ * @param {Date} endDate
+ */
+ private setChartTimeGap(startDate: Date, endDate: Date): void {
+ this.chartTimeGap = this.getTimeGap(startDate, endDate);
+ }
+
+ /**
+ * Set the domain for the y scale regarding the given data. The maximum value of the data is the sum of the log level
+ * values.
+ * An example data: [{timeStamp: 1233455677, WARN: 12, ERROR: 123}]
+ * @param {Array<{timeStamp: number; [p: string]: number}>} data
+ */
+ private setYScaleDomain(data: Array<{timeStamp: number, [key: string]: number}>): void {
+ const keys = Object.keys(this.options.keysWithColors);
+ const maxYValue = d3.max(data, item => keys.reduce((sum: number, key: string): number => sum + item[key], 0));
+ this.yScale.domain([0, maxYValue]);
+ }
+
+ /**
+ * Set the domain values for the x scale regarding the given data.
+ * An example data: [{timeStamp: 1233455677, WARN: 12, ERROR: 123}]
+ * @param {Array<{timeStamp: number; [p: string]: any}>} data
+ */
+ private setXScaleDomain(data: Array<{timeStamp: number, [key: string]: any}>): void {
+ this.xScale.domain(d3.extent(data, item => item.timeStamp)).nice();
}
private populate(): void {
- const keys = Object.keys(this.options.keysWithColors),
- data = this.data,
- timeStamps = Object.keys(data),
- formattedData = timeStamps.map((timeStamp: string): {[key: string]: number} => Object.assign({
+ const keys = Object.keys(this.options.keysWithColors);
+ const data = this.data;
+ const timeStamps = Object.keys(data);
+ // we create a more consumable data structure for d3
+ const formattedData = timeStamps.map((timeStamp: string): {timeStamp: number, [key: string]: number} => Object.assign({
timeStamp: Number(timeStamp)
- }, data[timeStamp])),
- layers = (d3.stack().keys(keys)(formattedData)),
- columnWidth = this.options.columnWidth;
- this.xScale.domain(d3.extent(formattedData, item => item.timeStamp));
- this.yScale.domain([0, d3.max(formattedData, item => keys.reduce((sum: number, key: string): number => sum + item[key], 0))]);
+ }, data[timeStamp]));
+ const layers = (d3.stack().keys(keys)(formattedData));
+
+ // after we have the data we set the domain values both scales
+ this.setXScaleDomain(formattedData);
+ this.setYScaleDomain(formattedData);
+
+ // Setting the timegap label above the chart
+ this.setChartTimeGapByXScale();
+
+ let unitD3TimeProp = this.chartTimeGap.unit.charAt(0).toUpperCase() + this.chartTimeGap.unit.slice(1);
+ this.xScale.nice(d3[`time${unitD3TimeProp}`], 2);
+
+ let columnWidth = this.options.columnWidth[this.chartTimeGap.unit] || this.options.columnWidth.base;
+
+ // drawing the axis
this.drawXAxis();
this.drawYAxis();
- const layer = this.svg.selectAll().data(d3.transpose<any>(layers)).enter().append('g').attr('class', 'value');
- layer.selectAll().data(item => item).enter().append('rect')
- .attr('x', item => this.xScale(item.data.timeStamp) - columnWidth / 2).attr('y', item => this.yScale(item[1]))
- .attr('height', item => this.yScale(item[0]) - this.yScale(item[1])).attr('width', columnWidth.toString())
- .style('fill', (item, index) => this.colorScale(index));
+
+ // populate the data and drawing the bars
+ const layer = this.svg.selectAll('.value').data(d3.transpose<any>(layers))
+ .attr('class', 'value')
+ .enter().append('g')
+ .attr('class', 'value');
+ layer.selectAll('.value rect').data(item => item)
+ .attr('x', item => this.xScale(item.data.timeStamp) - columnWidth / 2)
+ .attr('y', item => this.yScale(item[1]))
+ .attr('height', item => this.yScale(item[0]) - this.yScale(item[1]))
+ .attr('width', columnWidth.toString())
+ .style('fill', (item, index) => this.colorScale(index))
+ .enter().append('rect')
+ .attr('x', item => this.xScale(item.data.timeStamp) - columnWidth / 2)
+ .attr('y', item => this.yScale(item[1]))
+ .attr('height', item => this.yScale(item[0]) - this.yScale(item[1]))
+ .attr('width', columnWidth.toString())
+ .style('fill', (item, index) => this.colorScale(index))
+ .on('mouseover', this.handleRectMouseOver)
+ .on('mousemove', this.handleRectMouseMove)
+ .on('mouseout', this.handleRectMouseOut);
this.setDragBehavior();
}
+ private getTimeRangeByXRanges(startX: number, endX:number): [number, number] {
+ const xScaleInterval = this.xScale.domain().map((point: Date): number => point.valueOf());
+ const xScaleLength = xScaleInterval[1] - xScaleInterval[0];
+ const ratio = xScaleLength / this.width;
+ return [Math.round(xScaleInterval[0] + ratio * startX), Math.round(xScaleInterval[0] + ratio * endX)];
+ }
+
+ /**
+ * The goal is to create the two shadow rectangle beside the selected area. Actually we blurout the not selected
+ * timeranges
+ * @param {number} startX This is the starting position of the drag event withing the container
+ * @param {number} currentX This is the ending point of the drag within the container
+ */
+ private createInvertDragArea(startX: number, currentX: number): void {
+ const height: number = this.options.height + this.options.margin.top + this.options.margin.bottom;
+ this.leftDragArea = this.svg.insert('rect').attr('height', height).attr('class', 'unselected-drag-area');
+ this.rightDragArea = this.svg.insert('rect').attr('height', height).attr('class', 'unselected-drag-area');
+ this.setInvertDragArea(startX, currentX);
+ }
+
+ /**
+ * Set the position and the width of the blur/shadow rectangles of the unselected area(s).
+ * @param {number} startX The start point of the selected area.
+ * @param {number} currentX The end point of the selected area.
+ */
+ private setInvertDragArea(startX: number, currentX: number): void {
+ const left: number = Math.min(startX, currentX);
+ const right: number = Math.max(startX, currentX);
+ let rightAreaWidth: number = this.width - right;
+ rightAreaWidth = rightAreaWidth > 0 ? rightAreaWidth : 0;
+ let leftAreaWidth: number = left > 0 ? left : 0;
+ this.leftDragArea.attr('x', 0).attr('width', leftAreaWidth);
+ this.rightDragArea.attr('x', right).attr('width', rightAreaWidth);
+ }
+
+ /**
+ * The goal is to have a single point where we remove the rectangles of the blur/shadow, unselected time range(s)
+ */
+ private clearInvertDragArea(): void {
+ this.leftDragArea.remove();
+ this.rightDragArea.remove();
+ }
+
private setDragBehavior(): void {
this.minDragX = this.options.margin.left;
this.maxDragX = this.htmlElement.clientWidth;
@@ -188,25 +481,25 @@ export class TimeHistogramComponent implements OnInit, AfterViewInit, OnChanges
}
this.dragStartX = Math.max(0, this.getDragX(containers[0]) - this.options.margin.left);
this.dragArea = this.svg.insert('rect', ':first-child').attr('x', this.dragStartX).attr('y', 0).attr('width', 0)
- .attr('height', this.options.height).style('fill', this.options.dragAreaColor);
+ .attr('height', this.options.height).attr('class', 'drag-area');
})
.on('drag', (datum: undefined, index: number, containers: ContainerElement[]): void => {
- const currentX = Math.max(this.getDragX(containers[0]), this.minDragX) - this.options.margin.left,
- startX = Math.min(currentX, this.dragStartX),
- currentWidth = Math.abs(currentX - this.dragStartX);
+ const mousePos = this.getDragX(containers[0]);
+ const currentX = Math.max(mousePos, this.minDragX) - this.options.margin.left;
+ const startX = Math.min(currentX, this.dragStartX);
+ const currentWidth = Math.abs(currentX - this.dragStartX);
this.dragArea.attr('x', startX).attr('width', currentWidth);
+ let timeRange = this.getTimeRangeByXRanges(startX, startX + currentWidth);
+ this.setChartTimeGap(new Date(timeRange[0]), new Date(timeRange[1]));
})
.on('end', (): void => {
- const dragAreaDetails = this.dragArea.node().getBBox(),
- startX = Math.max(0, dragAreaDetails.x),
- endX = Math.min(this.width, dragAreaDetails.x + dragAreaDetails.width),
- xScaleInterval = this.xScale.domain().map((point: Date): number => point.valueOf()),
- xScaleLength = xScaleInterval[1] - xScaleInterval[0],
- ratio = xScaleLength / this.width,
- startTimeStamp = Math.round(xScaleInterval[0] + ratio * startX),
- endTimeStamp = Math.round(xScaleInterval[0] + ratio * endX);
- this.selectArea.emit([startTimeStamp, endTimeStamp]);
+ const dragAreaDetails = this.dragArea.node().getBBox();
+ const startX = Math.max(0, dragAreaDetails.x);
+ const endX = Math.min(this.width, dragAreaDetails.x + dragAreaDetails.width);
+ const dateRange: [number, number] = this.getTimeRangeByXRanges(startX, endX);
+ this.selectArea.emit(dateRange);
this.dragArea.remove();
+ this.setChartTimeGap(new Date(dateRange[0]), new Date(dateRange[1]));
})
);
d3.selectAll(`svg#${this.svgId} .value, svg#${this.svgId} .axis`).call(d3.drag().on('start', (): void => {
http://git-wip-us.apache.org/repos/asf/ambari/blob/b1fd131f/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 e754aa4..d719893 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
@@ -476,9 +476,9 @@ export class LogsContainerService {
};
readonly colors = {
- WARN: '#FF8916',
- ERROR: '#E81D1D',
FATAL: '#830A0A',
+ ERROR: '#E81D1D',
+ WARN: '#FF8916',
INFO: '#2577B5',
DEBUG: '#65E8FF',
TRACE: '#888',
http://git-wip-us.apache.org/repos/asf/ambari/blob/b1fd131f/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 6c916aa..3f4f5c8 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/assets/i18n/en.json
+++ b/ambari-logsearch/ambari-logsearch-web/src/assets/i18n/en.json
@@ -158,5 +158,16 @@
"logs.totalEventFound": "{{totalCount}} events found",
"logs.noEventFound": "No event found",
"logs.hideGraph": "Hide Graph",
- "logs.showGraph": "Show Graph"
+ "logs.showGraph": "Show Graph",
+
+ "histogram.gap": "gap",
+ "histogram.gaps": "gaps",
+ "histogram.gap.second": "second",
+ "histogram.gap.seconds": "seconds",
+ "histogram.gap.minute": "minute",
+ "histogram.gap.minutes": "minutes",
+ "histogram.gap.hour": "hour",
+ "histogram.gap.hours": "hours",
+ "histogram.gap.day": "day",
+ "histogram.gap.days": "days"
}
[13/23] ambari git commit: AMBARI-22539. Cannot add host with
host_name in request body
Posted by nc...@apache.org.
AMBARI-22539. Cannot add host with host_name in request body
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/636a2a96
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/636a2a96
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/636a2a96
Branch: refs/heads/branch-feature-AMBARI-21674
Commit: 636a2a96cc19e7a588f70c9b91735af3008ed0e0
Parents: 4be18df
Author: Doroszlai, Attila <ad...@hortonworks.com>
Authored: Wed Nov 29 09:02:30 2017 +0100
Committer: Doroszlai, Attila <ad...@hortonworks.com>
Committed: Mon Dec 11 20:14:07 2017 +0100
----------------------------------------------------------------------
.../internal/HostResourceProvider.java | 2 +-
.../internal/ScaleClusterRequest.java | 17 +--------
.../internal/ScaleClusterRequestTest.java | 38 +++++++++++++++-----
3 files changed, 31 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/636a2a96/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 f683afd..776be0c 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
@@ -1066,7 +1066,7 @@ public class HostResourceProvider extends AbstractControllerResourceProvider {
*
* @return the host name for the host request
*/
- private String getHostNameFromProperties(Map<String, Object> properties) {
+ public static String getHostNameFromProperties(Map<String, Object> properties) {
String hostname = (String) properties.get(HOST_HOST_NAME_PROPERTY_ID);
return hostname != null ? hostname :
http://git-wip-us.apache.org/repos/asf/ambari/blob/636a2a96/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ScaleClusterRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ScaleClusterRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ScaleClusterRequest.java
index fe33f93..5e5eec8 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ScaleClusterRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ScaleClusterRequest.java
@@ -119,7 +119,7 @@ public class ScaleClusterRequest extends BaseClusterRequest {
"Currently, a scaling request may only refer to a single blueprint");
}
- String hostName = getHostNameFromProperties(properties);
+ String hostName = HostResourceProvider.getHostNameFromProperties(properties);
boolean containsHostCount = properties.containsKey(HostResourceProvider.HOST_COUNT_PROPERTY_ID);
boolean containsHostPredicate = properties.containsKey(HostResourceProvider.HOST_PREDICATE_PROPERTY_ID);
@@ -212,21 +212,6 @@ public class ScaleClusterRequest extends BaseClusterRequest {
}
/**
- * Get the host name from the request properties.
- *
- * @param properties request properties
- * @return host name
- */
- //todo: this was copied exactly from HostResourceProvider
- private String getHostNameFromProperties(Map<String, Object> properties) {
- String hostName = (String) properties.get(HostResourceProvider.HOST_HOST_NAME_PROPERTY_ID);
- if (hostName == null) {
- hostName = (String) properties.get(HostResourceProvider.HOST_NAME_PROPERTY_ID);
- }
- return hostName;
- }
-
- /**
* Get the total number of requested hosts for the request.
* @return total requested host count
*/
http://git-wip-us.apache.org/repos/asf/ambari/blob/636a2a96/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ScaleClusterRequestTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ScaleClusterRequestTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ScaleClusterRequestTest.java
index 2a03b1f..b9f32a0 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ScaleClusterRequestTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ScaleClusterRequestTest.java
@@ -102,12 +102,17 @@ public class ScaleClusterRequestTest {
@Test
public void test_basic_hostName() throws Exception {
+ Map<String, Object> props = createScaleClusterPropertiesGroup1_HostName(CLUSTER_NAME, BLUEPRINT_NAME);
+ addSingleHostByName(props);
+ addSingleHostByName(replaceWithPlainHostNameKey(props));
+ }
+
+ private void addSingleHostByName(Map<String, Object> props) throws InvalidTopologyTemplateException {
// reset default host resource provider expectations to none since no host predicate is used
reset(hostResourceProvider);
replay(hostResourceProvider);
- ScaleClusterRequest scaleClusterRequest = new ScaleClusterRequest(Collections.singleton(
- createScaleClusterPropertiesGroup1_HostName(CLUSTER_NAME, BLUEPRINT_NAME)));
+ ScaleClusterRequest scaleClusterRequest = new ScaleClusterRequest(Collections.singleton(props));
assertEquals(TopologyRequest.Type.SCALE, scaleClusterRequest.getType());
assertEquals(String.format("Scale Cluster '%s' (+%s hosts)", CLUSTER_NAME, "1"),
@@ -129,13 +134,21 @@ public class ScaleClusterRequestTest {
@Test
public void testMultipleHostNames() throws Exception {
- // reset default host resource provider expectations to none since no host predicate is used
- reset(hostResourceProvider);
- replay(hostResourceProvider);
-
Set<Map<String, Object>> propertySet = new HashSet<>();
propertySet.add(createScaleClusterPropertiesGroup1_HostName(CLUSTER_NAME, BLUEPRINT_NAME));
propertySet.add(createScaleClusterPropertiesGroup1_HostName2(CLUSTER_NAME, BLUEPRINT_NAME));
+ addMultipleHostsByName(propertySet);
+
+ for (Map<String, Object> props : propertySet) {
+ replaceWithPlainHostNameKey(props);
+ }
+ addMultipleHostsByName(propertySet);
+ }
+
+ private void addMultipleHostsByName(Set<Map<String, Object>> propertySet) throws InvalidTopologyTemplateException {
+ // reset default host resource provider expectations to none since no host predicate is used
+ reset(hostResourceProvider);
+ replay(hostResourceProvider);
ScaleClusterRequest scaleClusterRequest = new ScaleClusterRequest(propertySet);
@@ -294,7 +307,7 @@ public class ScaleClusterRequestTest {
public void test_NoHostNameOrHostCount() throws Exception {
Map<String, Object> properties = createScaleClusterPropertiesGroup1_HostName(CLUSTER_NAME, BLUEPRINT_NAME);
// remove host name
- properties.remove("host_name");
+ properties.remove(HostResourceProvider.HOST_HOST_NAME_PROPERTY_ID);
// reset default host resource provider expectations to none
reset(hostResourceProvider);
@@ -336,8 +349,15 @@ public class ScaleClusterRequestTest {
properties.put(HostResourceProvider.HOST_CLUSTER_NAME_PROPERTY_ID, clusterName);
properties.put(HostResourceProvider.BLUEPRINT_PROPERTY_ID, blueprintName);
properties.put(HostResourceProvider.HOST_GROUP_PROPERTY_ID, GROUP1_NAME);
- properties.put(HostResourceProvider.HOST_NAME_PROPERTY_ID, HOST1_NAME);
+ properties.put(HostResourceProvider.HOST_HOST_NAME_PROPERTY_ID, HOST1_NAME);
+
+ return properties;
+ }
+ // include host name under "host_name" key instead of "Hosts/host_name"
+ private static Map<String, Object> replaceWithPlainHostNameKey(Map<String, Object> properties) {
+ Object value = properties.remove(HostResourceProvider.HOST_HOST_NAME_PROPERTY_ID);
+ properties.put(HostResourceProvider.HOST_NAME_PROPERTY_ID, value);
return properties;
}
@@ -381,7 +401,7 @@ public class ScaleClusterRequestTest {
properties.put(HostResourceProvider.HOST_CLUSTER_NAME_PROPERTY_ID, clusterName);
properties.put(HostResourceProvider.BLUEPRINT_PROPERTY_ID, blueprintName);
properties.put(HostResourceProvider.HOST_GROUP_PROPERTY_ID, GROUP1_NAME);
- properties.put(HostResourceProvider.HOST_NAME_PROPERTY_ID, HOST2_NAME);
+ properties.put(HostResourceProvider.HOST_HOST_NAME_PROPERTY_ID, HOST2_NAME);
return properties;
}
[03/23] ambari git commit: AMBARI-22595. Livy2 keytabs are not
getting configured automatically in zeppelin. (prabhjyotsingh via sshridhar).
Posted by nc...@apache.org.
AMBARI-22595. Livy2 keytabs are not getting configured automatically in zeppelin. (prabhjyotsingh via sshridhar).
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/367dd174
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/367dd174
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/367dd174
Branch: refs/heads/branch-feature-AMBARI-21674
Commit: 367dd174a5b84eb1764d148da3b29c6c55c58a94
Parents: f4d2739
Author: Swapan Shridhar <ss...@hortonworks.com>
Authored: Thu Dec 7 14:02:58 2017 -0800
Committer: Swapan Shridhar <ss...@hortonworks.com>
Committed: Thu Dec 7 14:02:58 2017 -0800
----------------------------------------------------------------------
.../common-services/ZEPPELIN/0.7.0/package/scripts/master.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/367dd174/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 5efc277..bb4c5b2 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
@@ -403,7 +403,7 @@ class Master(Script):
interpreter_settings = config_data['interpreterSettings']
for interpreter_setting in interpreter_settings:
interpreter = interpreter_settings[interpreter_setting]
- if interpreter['group'] == 'livy' and params.livy_livyserver_host:
+ if interpreter['group'] == 'livy':
if params.zeppelin_kerberos_principal and params.zeppelin_kerberos_keytab and params.security_enabled:
interpreter['properties']['zeppelin.livy.principal'] = params.zeppelin_kerberos_principal
interpreter['properties']['zeppelin.livy.keytab'] = params.zeppelin_kerberos_keytab
[14/23] ambari git commit: AMBARI-22626. Zeppelin Interpreter
settings are getting updated after zeppelin restart. (Prabhjyot Singh via
yusaku)
Posted by nc...@apache.org.
AMBARI-22626. Zeppelin Interpreter settings are getting updated after zeppelin restart. (Prabhjyot Singh via yusaku)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8e90d59c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8e90d59c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8e90d59c
Branch: refs/heads/branch-feature-AMBARI-21674
Commit: 8e90d59c0852ad89391577207989c0f186265701
Parents: 636a2a9
Author: Yusaku Sako <yu...@hortonworks.com>
Authored: Tue Dec 12 08:15:08 2017 -0800
Committer: Yusaku Sako <yu...@hortonworks.com>
Committed: Tue Dec 12 08:15:08 2017 -0800
----------------------------------------------------------------------
.../scripts/interpreter_json_template.py | 152 +++++++++++++++++++
.../package/scripts/livy2_config_template.py | 112 --------------
.../ZEPPELIN/0.7.0/package/scripts/master.py | 22 ---
.../package/scripts/spark2_config_template.py | 84 ----------
.../2.6/ZEPPELIN/interpreter_json_generated.py | 2 +-
5 files changed, 153 insertions(+), 219 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/8e90d59c/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/interpreter_json_template.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/interpreter_json_template.py b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/interpreter_json_template.py
index 713db23..b373e22 100644
--- a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/interpreter_json_template.py
+++ b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/interpreter_json_template.py
@@ -128,6 +128,68 @@ template = '''
"isUserImpersonate": false
}
},
+ "2C4U48MY3_spark2": {
+ "id": "2C4U48MY3_spark2",
+ "name": "spark2",
+ "group": "spark",
+ "properties": {
+ "spark.executor.memory": "",
+ "args": "",
+ "zeppelin.spark.printREPLOutput": "true",
+ "spark.cores.max": "",
+ "zeppelin.dep.additionalRemoteRepository": "spark-packages,http://dl.bintray.com/spark-packages/maven,false;",
+ "zeppelin.spark.importImplicit": "true",
+ "zeppelin.spark.sql.stacktrace": "false",
+ "zeppelin.spark.concurrentSQL": "false",
+ "zeppelin.spark.useHiveContext": "true",
+ "zeppelin.pyspark.python": "python",
+ "zeppelin.dep.localrepo": "local-repo",
+ "zeppelin.R.knitr": "true",
+ "zeppelin.spark.maxResult": "1000",
+ "master": "local[*]",
+ "spark.app.name": "Zeppelin",
+ "zeppelin.R.image.width": "100%",
+ "zeppelin.R.render.options": "out.format \u003d \u0027html\u0027, comment \u003d NA, echo \u003d FALSE, results \u003d \u0027asis\u0027, message \u003d F, warning \u003d F",
+ "zeppelin.R.cmd": "R"
+ },
+ "status": "READY",
+ "interpreterGroup": [
+ {
+ "name": "spark",
+ "class": "org.apache.zeppelin.spark.SparkInterpreter",
+ "defaultInterpreter": true
+ },
+ {
+ "name": "sql",
+ "class": "org.apache.zeppelin.spark.SparkSqlInterpreter",
+ "defaultInterpreter": false
+ },
+ {
+ "name": "dep",
+ "class": "org.apache.zeppelin.spark.DepInterpreter",
+ "defaultInterpreter": false
+ },
+ {
+ "name": "pyspark",
+ "class": "org.apache.zeppelin.spark.PySparkInterpreter",
+ "defaultInterpreter": false
+ },
+ {
+ "name": "r",
+ "class": "org.apache.zeppelin.spark.SparkRInterpreter",
+ "defaultInterpreter": false
+ }
+ ],
+ "dependencies": [],
+ "option": {
+ "remote": true,
+ "port": -1,
+ "perNoteSession": false,
+ "perNoteProcess": false,
+ "isExistingProcess": false,
+ "setPermission": false
+ }
+ },
"2CK8A9MEG": {
"id": "2CK8A9MEG",
"name": "jdbc",
@@ -259,6 +321,96 @@ template = '''
"isUserImpersonate": false
}
},
+ "2C8A4SZ9T_livy2": {
+ "id": "2C8A4SZ9T_livy2",
+ "status": "READY",
+ "group": "livy",
+ "name": "livy2",
+ "properties": {
+ "zeppelin.livy.keytab": "",
+ "zeppelin.livy.spark.sql.maxResult": "1000",
+ "livy.spark.executor.instances": "",
+ "livy.spark.executor.memory": "",
+ "livy.spark.dynamicAllocation.enabled": "",
+ "livy.spark.dynamicAllocation.cachedExecutorIdleTimeout": "",
+ "livy.spark.dynamicAllocation.initialExecutors": "",
+ "zeppelin.livy.session.create_timeout": "120",
+ "livy.spark.driver.memory": "",
+ "zeppelin.livy.displayAppInfo": "true",
+ "livy.spark.jars.packages": "",
+ "livy.spark.dynamicAllocation.maxExecutors": "",
+ "zeppelin.livy.concurrentSQL": "false",
+ "zeppelin.livy.principal": "",
+ "livy.spark.executor.cores": "",
+ "zeppelin.livy.url": "http://localhost:8998",
+ "zeppelin.livy.pull_status.interval.millis": "1000",
+ "livy.spark.driver.cores": "",
+ "livy.spark.dynamicAllocation.minExecutors": ""
+ },
+ "interpreterGroup": [
+ {
+ "class": "org.apache.zeppelin.livy.LivySparkInterpreter",
+ "editor": {
+ "editOnDblClick": false,
+ "language": "scala"
+ },
+ "name": "spark",
+ "defaultInterpreter": false
+ },
+ {
+ "class": "org.apache.zeppelin.livy.LivySparkSQLInterpreter",
+ "editor": {
+ "editOnDblClick": false,
+ "language": "sql"
+ },
+ "name": "sql",
+ "defaultInterpreter": false
+ },
+ {
+ "class": "org.apache.zeppelin.livy.LivyPySparkInterpreter",
+ "editor": {
+ "editOnDblClick": false,
+ "language": "python"
+ },
+ "name": "pyspark",
+ "defaultInterpreter": false
+ },
+ {
+ "class": "org.apache.zeppelin.livy.LivyPySpark3Interpreter",
+ "editor": {
+ "editOnDblClick": false,
+ "language": "python"
+ },
+ "name": "pyspark3",
+ "defaultInterpreter": false
+ },
+ {
+ "class": "org.apache.zeppelin.livy.LivySparkRInterpreter",
+ "editor": {
+ "editOnDblClick": false,
+ "language": "r"
+ },
+ "name": "sparkr",
+ "defaultInterpreter": false
+ },
+ {
+ "name": "shared",
+ "class": "org.apache.zeppelin.livy.LivySharedInterpreter",
+ "defaultInterpreter": false
+ }
+ ],
+ "dependencies": [],
+ "option": {
+ "setPermission": false,
+ "remote": true,
+ "users": [],
+ "isExistingProcess": false,
+ "perUser": "scoped",
+ "isUserImpersonate": false,
+ "perNote": "shared",
+ "port": -1
+ }
+ },
"2CKAY1A8Y": {
"id": "2CKAY1A8Y",
"name": "md",
http://git-wip-us.apache.org/repos/asf/ambari/blob/8e90d59c/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/livy2_config_template.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/livy2_config_template.py b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/livy2_config_template.py
deleted file mode 100644
index c9030bd..0000000
--- a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/livy2_config_template.py
+++ /dev/null
@@ -1,112 +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.
-
-"""
-
-template = '''
-{
- "id": "2C8A4SZ9T_livy2",
- "status": "READY",
- "group": "livy",
- "name": "livy2",
- "properties": {
- "zeppelin.livy.keytab": "",
- "zeppelin.livy.spark.sql.maxResult": "1000",
- "livy.spark.executor.instances": "",
- "livy.spark.executor.memory": "",
- "livy.spark.dynamicAllocation.enabled": "",
- "livy.spark.dynamicAllocation.cachedExecutorIdleTimeout": "",
- "livy.spark.dynamicAllocation.initialExecutors": "",
- "zeppelin.livy.session.create_timeout": "120",
- "livy.spark.driver.memory": "",
- "zeppelin.livy.displayAppInfo": "true",
- "livy.spark.jars.packages": "",
- "livy.spark.dynamicAllocation.maxExecutors": "",
- "zeppelin.livy.concurrentSQL": "false",
- "zeppelin.livy.principal": "",
- "livy.spark.executor.cores": "",
- "zeppelin.livy.url": "http://localhost:8998",
- "zeppelin.livy.pull_status.interval.millis": "1000",
- "livy.spark.driver.cores": "",
- "livy.spark.dynamicAllocation.minExecutors": ""
- },
- "interpreterGroup": [
- {
- "class": "org.apache.zeppelin.livy.LivySparkInterpreter",
- "editor": {
- "editOnDblClick": false,
- "language": "scala"
- },
- "name": "spark",
- "defaultInterpreter": false
- },
- {
- "class": "org.apache.zeppelin.livy.LivySparkSQLInterpreter",
- "editor": {
- "editOnDblClick": false,
- "language": "sql"
- },
- "name": "sql",
- "defaultInterpreter": false
- },
- {
- "class": "org.apache.zeppelin.livy.LivyPySparkInterpreter",
- "editor": {
- "editOnDblClick": false,
- "language": "python"
- },
- "name": "pyspark",
- "defaultInterpreter": false
- },
- {
- "class": "org.apache.zeppelin.livy.LivyPySpark3Interpreter",
- "editor": {
- "editOnDblClick": false,
- "language": "python"
- },
- "name": "pyspark3",
- "defaultInterpreter": false
- },
- {
- "class": "org.apache.zeppelin.livy.LivySparkRInterpreter",
- "editor": {
- "editOnDblClick": false,
- "language": "r"
- },
- "name": "sparkr",
- "defaultInterpreter": false
- },
- {
- "name": "shared",
- "class": "org.apache.zeppelin.livy.LivySharedInterpreter",
- "defaultInterpreter": false
- }
- ],
- "dependencies": [],
- "option": {
- "setPermission": false,
- "remote": true,
- "users": [],
- "isExistingProcess": false,
- "perUser": "scoped",
- "isUserImpersonate": false,
- "perNote": "shared",
- "port": -1
- }
-}
-'''
http://git-wip-us.apache.org/repos/asf/ambari/blob/8e90d59c/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 bb4c5b2..ee264a4 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
@@ -450,16 +450,6 @@ class Master(Script):
config_data = self.get_interpreter_settings()
interpreter_settings = config_data['interpreterSettings']
- if 'spark2-defaults' in params.config['configurations']:
- spark2_config = self.get_spark2_interpreter_config()
- config_id = spark2_config["id"]
- interpreter_settings[config_id] = spark2_config
-
- if params.livy2_livyserver_host:
- livy2_config = self.get_livy2_interpreter_config()
- config_id = livy2_config["id"]
- interpreter_settings[config_id] = livy2_config
-
if params.zeppelin_interpreter:
settings_to_delete = []
for settings_key, interpreter in interpreter_settings.items():
@@ -612,17 +602,5 @@ class Master(Script):
import params
return glob.glob(params.zeppelin_dir + '/interpreter/spark/dep/zeppelin-spark-dependencies*.jar')
- def get_spark2_interpreter_config(self):
- import spark2_config_template
- import json
-
- return json.loads(spark2_config_template.template)
-
- def get_livy2_interpreter_config(self):
- import livy2_config_template
- import json
-
- return json.loads(livy2_config_template.template)
-
if __name__ == "__main__":
Master().execute()
http://git-wip-us.apache.org/repos/asf/ambari/blob/8e90d59c/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/spark2_config_template.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/spark2_config_template.py b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/spark2_config_template.py
deleted file mode 100644
index 28a63c6..0000000
--- a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/spark2_config_template.py
+++ /dev/null
@@ -1,84 +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.
-
-"""
-
-template = '''
-{
- "id": "2C4U48MY3_spark2",
- "name": "spark2",
- "group": "spark",
- "properties": {
- "spark.executor.memory": "",
- "args": "",
- "zeppelin.spark.printREPLOutput": "true",
- "spark.cores.max": "",
- "zeppelin.dep.additionalRemoteRepository": "spark-packages,http://dl.bintray.com/spark-packages/maven,false;",
- "zeppelin.spark.importImplicit": "true",
- "zeppelin.spark.sql.stacktrace": "false",
- "zeppelin.spark.concurrentSQL": "false",
- "zeppelin.spark.useHiveContext": "true",
- "zeppelin.pyspark.python": "python",
- "zeppelin.dep.localrepo": "local-repo",
- "zeppelin.R.knitr": "true",
- "zeppelin.spark.maxResult": "1000",
- "master": "local[*]",
- "spark.app.name": "Zeppelin",
- "zeppelin.R.image.width": "100%",
- "zeppelin.R.render.options": "out.format \u003d \u0027html\u0027, comment \u003d NA, echo \u003d FALSE, results \u003d \u0027asis\u0027, message \u003d F, warning \u003d F",
- "zeppelin.R.cmd": "R"
- },
- "status": "READY",
- "interpreterGroup": [
- {
- "name": "spark",
- "class": "org.apache.zeppelin.spark.SparkInterpreter",
- "defaultInterpreter": true
- },
- {
- "name": "sql",
- "class": "org.apache.zeppelin.spark.SparkSqlInterpreter",
- "defaultInterpreter": false
- },
- {
- "name": "dep",
- "class": "org.apache.zeppelin.spark.DepInterpreter",
- "defaultInterpreter": false
- },
- {
- "name": "pyspark",
- "class": "org.apache.zeppelin.spark.PySparkInterpreter",
- "defaultInterpreter": false
- },
- {
- "name": "r",
- "class": "org.apache.zeppelin.spark.SparkRInterpreter",
- "defaultInterpreter": false
- }
- ],
- "dependencies": [],
- "option": {
- "remote": true,
- "port": -1,
- "perNoteSession": false,
- "perNoteProcess": false,
- "isExistingProcess": false,
- "setPermission": false
- }
-}
-'''
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/8e90d59c/ambari-server/src/test/python/stacks/2.6/ZEPPELIN/interpreter_json_generated.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.6/ZEPPELIN/interpreter_json_generated.py b/ambari-server/src/test/python/stacks/2.6/ZEPPELIN/interpreter_json_generated.py
index 4b4dc1f..9bc8905 100644
--- a/ambari-server/src/test/python/stacks/2.6/ZEPPELIN/interpreter_json_generated.py
+++ b/ambari-server/src/test/python/stacks/2.6/ZEPPELIN/interpreter_json_generated.py
@@ -20,7 +20,7 @@ limitations under the License.
template = '\n{\n "interpreterSettings": {\n "2CKEKWY8Z": {\n "id": "2CKEKWY8Z",\n "name": "angular",\n "group": "angular",\n "properties": {},\n "status": "READY",\n "interpreterGroup": [\n {\n "name": "angular",\n "class": "org.apache.zeppelin.angular.AngularInterpreter",\n "defaultInterpreter": false,\n "editor": {\n "editOnDblClick": true\n }\n }\n ],\n "dependencies": [],\n "option": {\n "remote": true,\n "port": -1,\n "perNote": "shared",\n "perUser": "shared",\n "isExistingProcess": false,\n "setPermission": false,\n "users": [],\n "isUserImpersonate": false\n }\n },\n "2CKX8WPU1": {\n "id": "2CKX8WPU1",\n "name": "spark",\n "group": "spark",\n "properties": {\n "spark.executor.memory": "512m",\n "args": "",\n "zeppelin.spark.printREPLOutput": "true",\n
"spark.cores.max": "",\n "zeppelin.dep.additionalRemoteRepository": "spark-packages,http://dl.bintray.com/spark-packages/maven,false;",\n "zeppelin.spark.sql.stacktrace": "false",\n "zeppelin.spark.importImplicit": "true",\n "zeppelin.spark.concurrentSQL": "false",\n "zeppelin.spark.useHiveContext": "true",\n "zeppelin.pyspark.python": "python",\n "zeppelin.dep.localrepo": "local-repo",\n "zeppelin.R.knitr": "true",\n "zeppelin.spark.maxResult": "1000",\n "master": "yarn-client",\n "spark.app.name": "Zeppelin",\n "zeppelin.R.image.width": "100%",\n "zeppelin.R.render.options": "out.format \\u003d \\u0027html\\u0027, comment \\u003d NA, echo \\u003d FALSE, results \\u003d \\u0027asis\\u0027, message \\u003d F, warning \\u003d F",\n "zeppelin.R.cmd": "R"\n },\n "status": "READY",\n "interpreterGroup": [\n {\n "name": "spark",\n "class": "org
.apache.zeppelin.spark.SparkInterpreter",\n "defaultInterpreter": true,\n "editor": {\n "language": "scala"\n }\n },\n {\n "name": "sql",\n "class": "org.apache.zeppelin.spark.SparkSqlInterpreter",\n "defaultInterpreter": false,\n "editor": {\n "language": "sql"\n }\n },\n {\n "name": "dep",\n "class": "org.apache.zeppelin.spark.DepInterpreter",\n "defaultInterpreter": false,\n "editor": {\n "language": "scala"\n }\n },\n {\n "name": "pyspark",\n "class": "org.apache.zeppelin.spark.PySparkInterpreter",\n "defaultInterpreter": false,\n "editor": {\n "language": "python"\n }\n },\n {\n "name": "r",\n "class": "org.apache.zeppelin.spark.SparkRInterpreter",\n "defaultInterpreter": false,\n "edi
tor": {\n "language": "r"\n }\n }\n ],\n "dependencies": [],\n "option": {\n "remote": true,\n "port": -1,\n "perNote": "shared",\n "perUser": "shared",\n "isExistingProcess": false,\n "setPermission": false,\n "users": [],\n "isUserImpersonate": false\n }\n },\n "2CK8A9MEG": {\n "id": "2CK8A9MEG",\n "name": "jdbc",\n "group": "jdbc",\n "properties": {\n "default.password": "",\n "zeppelin.jdbc.auth.type": "",\n "common.max_count": "1000",\n "zeppelin.jdbc.principal": "",\n "default.user": "gpadmin",\n "default.url": "jdbc:postgresql://localhost:5432/",\n "default.driver": "org.postgresql.Driver",\n "zeppelin.jdbc.keytab.location": "",\n "zeppelin.jdbc.concurrent.use": "true",\n "zeppelin.jdbc.concurrent.max_connection": "10"\n },\n "status": "READY",\n "interpreterGroup":
[\n {\n "name": "sql",\n "class": "org.apache.zeppelin.jdbc.JDBCInterpreter",\n "defaultInterpreter": false,\n "editor": {\n "language": "sql",\n "editOnDblClick": false\n }\n }\n ],\n "dependencies": [],\n "option": {\n "remote": true,\n "port": -1,\n "perNote": "shared",\n "perUser": "shared",\n "isExistingProcess": false,\n "setPermission": false,\n "users": [],\n "isUserImpersonate": false\n }\n },\n "2CKX6DGQZ": {\n "id": "2CKX6DGQZ",\n "name": "livy",\n "group": "livy",\n "properties": {\n "zeppelin.livy.pull_status.interval.millis": "1000",\n "livy.spark.executor.memory": "",\n "zeppelin.livy.session.create_timeout": "120",\n "zeppelin.livy.principal": "",\n "zeppelin.livy.spark.sql.maxResult": "1000",\n "zeppelin.livy.keytab": "",\n "zeppelin.liv
y.concurrentSQL": "false",\n "zeppelin.livy.spark.sql.field.truncate": "true",\n "livy.spark.executor.cores": "",\n "zeppelin.livy.displayAppInfo": "false",\n "zeppelin.livy.url": "http://localhost:8998",\n "livy.spark.dynamicAllocation.minExecutors": "",\n "livy.spark.driver.cores": "",\n "livy.spark.jars.packages": "",\n "livy.spark.dynamicAllocation.enabled": "",\n "livy.spark.executor.instances": "",\n "livy.spark.dynamicAllocation.cachedExecutorIdleTimeout": "",\n "livy.spark.dynamicAllocation.maxExecutors": "",\n "livy.spark.dynamicAllocation.initialExecutors": "",\n "livy.spark.driver.memory": ""\n },\n "status": "READY",\n "interpreterGroup": [\n {\n "name": "spark",\n "class": "org.apache.zeppelin.livy.LivySparkInterpreter",\n "defaultInterpreter": true,\n "editor": {\n "language": "scala",\n "editOnDblCli
ck": false\n }\n },\n {\n "name": "sql",\n "class": "org.apache.zeppelin.livy.LivySparkSQLInterpreter",\n "defaultInterpreter": false,\n "editor": {\n "language": "sql",\n "editOnDblClick": false\n }\n },\n {\n "name": "pyspark",\n "class": "org.apache.zeppelin.livy.LivyPySparkInterpreter",\n "defaultInterpreter": false,\n "editor": {\n "language": "python",\n "editOnDblClick": false\n }\n },\n {\n "name": "pyspark3",\n "class": "org.apache.zeppelin.livy.LivyPySpark3Interpreter",\n "defaultInterpreter": false,\n "editor": {\n "language": "python",\n "editOnDblClick": false\n }\n },\n {\n "name": "sparkr",\n "class": "org.apache.zeppelin.livy.LivySparkRInterpreter",\n "defaultInterpreter": false,
\n "editor": {\n "language": "r",\n "editOnDblClick": false\n }\n }\n ],\n "dependencies": [],\n "option": {\n "remote": true,\n "port": -1,\n "perNote": "shared",\n "perUser": "scoped",\n "isExistingProcess": false,\n "setPermission": false,\n "users": [],\n "isUserImpersonate": false\n }\n },\n "2CKAY1A8Y": {\n "id": "2CKAY1A8Y",\n "name": "md",\n "group": "md",\n "properties": {\n "markdown.parser.type": "markdown4j"\n },\n "status": "READY",\n "interpreterGroup": [\n {\n "name": "md",\n "class": "org.apache.zeppelin.markdown.Markdown",\n "defaultInterpreter": false,\n "editor": {\n "language": "markdown",\n "editOnDblClick": true\n }\n }\n ],\n "dependencies": [],\n "option": {\n "remote": true,\n "port
": -1,\n "perNote": "shared",\n "perUser": "shared",\n "isExistingProcess": false,\n "setPermission": false,\n "users": [],\n "isUserImpersonate": false\n }\n },\n "2CHS8UYQQ": {\n "id": "2CHS8UYQQ",\n "name": "sh",\n "group": "sh",\n "properties": {\n "zeppelin.shell.keytab.location": "",\n "shell.command.timeout.millisecs": "60000",\n "zeppelin.shell.principal": "",\n "zeppelin.shell.auth.type": ""\n },\n "status": "READY",\n "interpreterGroup": [\n {\n "name": "sh",\n "class": "org.apache.zeppelin.shell.ShellInterpreter",\n "defaultInterpreter": false,\n "editor": {\n "language": "sh",\n "editOnDblClick": false\n }\n }\n ],\n "dependencies": [],\n "option": {\n "remote": true,\n "port": -1,\n "perNote": "shared",\n "perUser": "shared",\n
"isExistingProcess": false,\n "setPermission": false,\n "users": [],\n "isUserImpersonate": false\n }\n }\n },\n "interpreterBindings": {},\n "interpreterRepositories": [\n {\n "id": "central",\n "type": "default",\n "url": "http://repo1.maven.org/maven2/",\n "releasePolicy": {\n "enabled": true,\n "updatePolicy": "daily",\n "checksumPolicy": "warn"\n },\n "snapshotPolicy": {\n "enabled": true,\n "updatePolicy": "daily",\n "checksumPolicy": "warn"\n },\n "mirroredRepositories": [],\n "repositoryManager": false\n },\n {\n "id": "local",\n "type": "default",\n "url": "file:///home/zeppelin/.m2/repository",\n "releasePolicy": {\n "enabled": true,\n "updatePolicy": "daily",\n "checksumPolicy": "warn"\n },\n "snapshotPolicy": {\n "enabled": true,\n "updatePolicy": "daily",\n "checksumPolicy
": "warn"\n },\n "mirroredRepositories": [],\n "repositoryManager": false\n }\n ]\n}\n'
-template_after_base = '{\n "interpreterSettings": {\n "2CHS8UYQQ": {\n "status": "READY", \n "group": "sh", \n "name": "sh", \n "id": "2CHS8UYQQ", \n "interpreterGroup": [\n {\n "editor": {\n "editOnDblClick": false, \n "language": "sh"\n }, \n "defaultInterpreter": false, \n "name": "sh", \n "class": "org.apache.zeppelin.shell.ShellInterpreter"\n }\n ], \n "dependencies": [], \n "properties": {\n "shell.command.timeout.millisecs": "60000", \n "zeppelin.shell.auth.type": "", \n "zeppelin.shell.keytab.location": "", \n "zeppelin.shell.principal": ""\n }, \n "option": {\n "setPermission": false, \n "remote": true, \n "users": [], \n "isExistingProcess": false, \n "perUser": "shared", \n "isUserImpersonate": false, \n "perNote": "shared", \n "port": -1\n }\n }, \
n "2CKAY1A8Y": {\n "status": "READY", \n "group": "md", \n "name": "md", \n "id": "2CKAY1A8Y", \n "interpreterGroup": [\n {\n "editor": {\n "editOnDblClick": true, \n "language": "markdown"\n }, \n "defaultInterpreter": false, \n "name": "md", \n "class": "org.apache.zeppelin.markdown.Markdown"\n }\n ], \n "dependencies": [], \n "properties": {\n "markdown.parser.type": "markdown4j"\n }, \n "option": {\n "setPermission": false, \n "remote": true, \n "users": [], \n "isExistingProcess": false, \n "perUser": "shared", \n "isUserImpersonate": false, \n "perNote": "shared", \n "port": -1\n }\n }, \n "2CKX8WPU1": {\n "status": "READY", \n "group": "spark", \n "name": "spark", \n "id": "2CKX8WPU1", \n "interpreterGroup": [\n {\n "editor": {\n
"language": "scala"\n }, \n "defaultInterpreter": true, \n "name": "spark", \n "class": "org.apache.zeppelin.spark.SparkInterpreter"\n }, \n {\n "editor": {\n "language": "sql"\n }, \n "defaultInterpreter": false, \n "name": "sql", \n "class": "org.apache.zeppelin.spark.SparkSqlInterpreter"\n }, \n {\n "editor": {\n "language": "scala"\n }, \n "defaultInterpreter": false, \n "name": "dep", \n "class": "org.apache.zeppelin.spark.DepInterpreter"\n }, \n {\n "editor": {\n "language": "python"\n }, \n "defaultInterpreter": false, \n "name": "pyspark", \n "class": "org.apache.zeppelin.spark.PySparkInterpreter"\n }, \n {\n "editor": {\n "language": "r"\n }, \n "defaultInterpreter": fals
e, \n "name": "r", \n "class": "org.apache.zeppelin.spark.SparkRInterpreter"\n }\n ], \n "dependencies": [], \n "properties": {\n "zeppelin.dep.additionalRemoteRepository": "spark-packages,http://dl.bintray.com/spark-packages/maven,false;", \n "zeppelin.dep.localrepo": "local-repo", \n "zeppelin.spark.useHiveContext": "true", \n "zeppelin.spark.printREPLOutput": "true", \n "zeppelin.R.image.width": "100%", \n "zeppelin.spark.importImplicit": "true", \n "spark.app.name": "Zeppelin", \n "args": "", \n "zeppelin.spark.sql.stacktrace": "false", \n "zeppelin.spark.concurrentSQL": "false", \n "zeppelin.R.cmd": "R", \n "master": "yarn-client", \n "zeppelin.pyspark.python": "python", \n "zeppelin.R.knitr": "true", \n "zeppelin.R.render.options": "out.format = \'html\', comment = NA, echo = FALSE, results = \'asis\', message = F, warning = F", \n
"spark.executor.memory": "512m", \n "zeppelin.spark.maxResult": "1000", \n "spark.cores.max": ""\n }, \n "option": {\n "setPermission": false, \n "remote": true, \n "users": [], \n "isExistingProcess": false, \n "perUser": "shared", \n "isUserImpersonate": false, \n "perNote": "shared", \n "port": -1\n }\n }, \n "2CK8A9MEG": {\n "status": "READY", \n "group": "jdbc", \n "name": "jdbc", \n "id": "2CK8A9MEG", \n "interpreterGroup": [\n {\n "editor": {\n "editOnDblClick": false, \n "language": "sql"\n }, \n "defaultInterpreter": false, \n "name": "sql", \n "class": "org.apache.zeppelin.jdbc.JDBCInterpreter"\n }\n ], \n "dependencies": [], \n "properties": {\n "common.max_count": "1000", \n "zeppelin.jdbc.keytab.location": "", \n "zeppelin.jdbc.concurre
nt.max_connection": "10", \n "default.user": "gpadmin", \n "zeppelin.jdbc.auth.type": "", \n "default.url": "jdbc:postgresql://localhost:5432/", \n "default.driver": "org.postgresql.Driver", \n "zeppelin.jdbc.concurrent.use": "true", \n "default.password": "", \n "zeppelin.jdbc.principal": ""\n }, \n "option": {\n "setPermission": false, \n "remote": true, \n "users": [], \n "isExistingProcess": false, \n "perUser": "shared", \n "isUserImpersonate": false, \n "perNote": "shared", \n "port": -1\n }\n }, \n "2CKEKWY8Z": {\n "status": "READY", \n "group": "angular", \n "name": "angular", \n "id": "2CKEKWY8Z", \n "interpreterGroup": [\n {\n "editor": {\n "editOnDblClick": true\n }, \n "defaultInterpreter": false, \n "name": "angular", \n "class": "org.apache.zeppelin.angular.A
ngularInterpreter"\n }\n ], \n "dependencies": [], \n "properties": {}, \n "option": {\n "setPermission": false, \n "remote": true, \n "users": [], \n "isExistingProcess": false, \n "perUser": "shared", \n "isUserImpersonate": false, \n "perNote": "shared", \n "port": -1\n }\n }, \n "2CKX6DGQZ": {\n "status": "READY", \n "group": "livy", \n "name": "livy", \n "id": "2CKX6DGQZ", \n "interpreterGroup": [\n {\n "editor": {\n "editOnDblClick": false, \n "language": "scala"\n }, \n "defaultInterpreter": true, \n "name": "spark", \n "class": "org.apache.zeppelin.livy.LivySparkInterpreter"\n }, \n {\n "editor": {\n "editOnDblClick": false, \n "language": "sql"\n }, \n "defaultInterpreter": false, \n "name": "sql", \n "cl
ass": "org.apache.zeppelin.livy.LivySparkSQLInterpreter"\n }, \n {\n "editor": {\n "editOnDblClick": false, \n "language": "python"\n }, \n "defaultInterpreter": false, \n "name": "pyspark", \n "class": "org.apache.zeppelin.livy.LivyPySparkInterpreter"\n }, \n {\n "editor": {\n "editOnDblClick": false, \n "language": "python"\n }, \n "defaultInterpreter": false, \n "name": "pyspark3", \n "class": "org.apache.zeppelin.livy.LivyPySpark3Interpreter"\n }, \n {\n "editor": {\n "editOnDblClick": false, \n "language": "r"\n }, \n "defaultInterpreter": false, \n "name": "sparkr", \n "class": "org.apache.zeppelin.livy.LivySparkRInterpreter"\n }\n ], \n "dependencies": [], \n "properties": {\n "livy.spark.dynamicAllocation.in
itialExecutors": "", \n "zeppelin.livy.keytab": "", \n "zeppelin.livy.spark.sql.maxResult": "1000", \n "livy.spark.executor.instances": "", \n "livy.spark.driver.memory": "", \n "livy.spark.executor.memory": "", \n "livy.spark.dynamicAllocation.enabled": "", \n "livy.spark.dynamicAllocation.cachedExecutorIdleTimeout": "", \n "livy.spark.driver.cores": "", \n "zeppelin.livy.session.create_timeout": "120", \n "zeppelin.livy.principal": "", \n "livy.spark.jars.packages": "", \n "livy.spark.dynamicAllocation.maxExecutors": "", \n "zeppelin.livy.concurrentSQL": "false", \n "zeppelin.livy.displayAppInfo": "false", \n "livy.spark.dynamicAllocation.minExecutors": "", \n "zeppelin.livy.url": "http://localhost:8998", \n "zeppelin.livy.spark.sql.field.truncate": "true", \n "zeppelin.livy.pull_status.interval.millis": "1000", \n "livy.spark.executor.cores": ""\n
}, \n "option": {\n "setPermission": false, \n "remote": true, \n "users": [], \n "isExistingProcess": false, \n "perUser": "scoped", \n "isUserImpersonate": false, \n "perNote": "shared", \n "port": -1\n }\n }\n }, \n "interpreterBindings": {}, \n "interpreterRepositories": [\n {\n "releasePolicy": {\n "checksumPolicy": "warn", \n "enabled": true, \n "updatePolicy": "daily"\n }, \n "mirroredRepositories": [], \n "snapshotPolicy": {\n "checksumPolicy": "warn", \n "enabled": true, \n "updatePolicy": "daily"\n }, \n "url": "http://repo1.maven.org/maven2/", \n "repositoryManager": false, \n "type": "default", \n "id": "central"\n }, \n {\n "releasePolicy": {\n "checksumPolicy": "warn", \n "enabled": true, \n "updatePolicy": "daily"\n }, \n "mirroredRepositories": [], \n "snaps
hotPolicy": {\n "checksumPolicy": "warn", \n "enabled": true, \n "updatePolicy": "daily"\n }, \n "url": "file:///home/zeppelin/.m2/repository", \n "repositoryManager": false, \n "type": "default", \n "id": "local"\n }\n ]\n}'
+template_after_base = '{\n "interpreterSettings": {\n "2CHS8UYQQ": {\n "status": "READY", \n "group": "sh", \n "name": "sh", \n "id": "2CHS8UYQQ", \n "interpreterGroup": [\n {\n "editor": {\n "editOnDblClick": false, \n "language": "sh"\n }, \n "defaultInterpreter": false, \n "name": "sh", \n "class": "org.apache.zeppelin.shell.ShellInterpreter"\n }\n ], \n "dependencies": [], \n "properties": {\n "shell.command.timeout.millisecs": "60000", \n "zeppelin.shell.auth.type": "", \n "zeppelin.shell.keytab.location": "", \n "zeppelin.shell.principal": ""\n }, \n "option": {\n "setPermission": false, \n "remote": true, \n "users": [], \n "isExistingProcess": false, \n "perUser": "shared", \n "isUserImpersonate": false, \n "perNote": "shared", \n "port": -1\n }\n }, \
n "2CKAY1A8Y": {\n "status": "READY", \n "group": "md", \n "name": "md", \n "id": "2CKAY1A8Y", \n "interpreterGroup": [\n {\n "editor": {\n "editOnDblClick": true, \n "language": "markdown"\n }, \n "defaultInterpreter": false, \n "name": "md", \n "class": "org.apache.zeppelin.markdown.Markdown"\n }\n ], \n "dependencies": [], \n "properties": {\n "markdown.parser.type": "markdown4j"\n }, \n "option": {\n "setPermission": false, \n "remote": true, \n "users": [], \n "isExistingProcess": false, \n "perUser": "shared", \n "isUserImpersonate": false, \n "perNote": "shared", \n "port": -1\n }\n }, \n "2CKX8WPU1": {\n "status": "READY", \n "group": "spark", \n "name": "spark", \n "id": "2CKX8WPU1", \n "interpreterGroup": [\n {\n "editor": {\n
"language": "scala"\n }, \n "defaultInterpreter": true, \n "name": "spark", \n "class": "org.apache.zeppelin.spark.SparkInterpreter"\n }, \n {\n "editor": {\n "language": "sql"\n }, \n "defaultInterpreter": false, \n "name": "sql", \n "class": "org.apache.zeppelin.spark.SparkSqlInterpreter"\n }, \n {\n "editor": {\n "language": "scala"\n }, \n "defaultInterpreter": false, \n "name": "dep", \n "class": "org.apache.zeppelin.spark.DepInterpreter"\n }, \n {\n "editor": {\n "language": "python"\n }, \n "defaultInterpreter": false, \n "name": "pyspark", \n "class": "org.apache.zeppelin.spark.PySparkInterpreter"\n }, \n {\n "editor": {\n "language": "r"\n }, \n "defaultInterpreter": fals
e, \n "name": "r", \n "class": "org.apache.zeppelin.spark.SparkRInterpreter"\n }\n ], \n "dependencies": [], \n "properties": {\n "zeppelin.dep.additionalRemoteRepository": "spark-packages,http://dl.bintray.com/spark-packages/maven,false;", \n "zeppelin.dep.localrepo": "local-repo", \n "zeppelin.spark.useHiveContext": "true", \n "zeppelin.spark.printREPLOutput": "true", \n "zeppelin.R.image.width": "100%", \n "zeppelin.spark.importImplicit": "true", \n "spark.app.name": "Zeppelin", \n "args": "", \n "zeppelin.spark.sql.stacktrace": "false", \n "zeppelin.spark.concurrentSQL": "false", \n "zeppelin.R.cmd": "R", \n "master": "yarn-client", \n "zeppelin.pyspark.python": "python", \n "zeppelin.R.knitr": "true", \n "zeppelin.R.render.options": "out.format = \'html\', comment = NA, echo = FALSE, results = \'asis\', message = F, warning = F", \n
"spark.executor.memory": "512m", \n "zeppelin.spark.maxResult": "1000", \n "spark.cores.max": ""\n }, \n "option": {\n "setPermission": false, \n "remote": true, \n "users": [], \n "isExistingProcess": false, \n "perUser": "shared", \n "isUserImpersonate": false, \n "perNote": "shared", \n "port": -1\n }\n }, \n "2CK8A9MEG": {\n "status": "READY", \n "group": "jdbc", \n "name": "jdbc", \n "id": "2CK8A9MEG", \n "interpreterGroup": [\n {\n "editor": {\n "editOnDblClick": false, \n "language": "sql"\n }, \n "defaultInterpreter": false, \n "name": "sql", \n "class": "org.apache.zeppelin.jdbc.JDBCInterpreter"\n }\n ], \n "dependencies": [], \n "properties": {\n "common.max_count": "1000", \n "zeppelin.jdbc.keytab.location": "", \n "zeppelin.jdbc.concurre
nt.max_connection": "10", \n "default.user": "gpadmin", \n "zeppelin.jdbc.auth.type": "", \n "default.url": "jdbc:postgresql://localhost:5432/", \n "default.driver": "org.postgresql.Driver", \n "zeppelin.jdbc.concurrent.use": "true", \n "default.password": "", \n "zeppelin.jdbc.principal": ""\n }, \n "option": {\n "setPermission": false, \n "remote": true, \n "users": [], \n "isExistingProcess": false, \n "perUser": "shared", \n "isUserImpersonate": false, \n "perNote": "shared", \n "port": -1\n }\n }, \n "2C4U48MY3_spark2": {\n "status": "READY", \n "group": "spark", \n "name": "spark2", \n "id": "2C4U48MY3_spark2", \n "interpreterGroup": [\n {\n "defaultInterpreter": true, \n "name": "spark", \n "class": "org.apache.zeppelin.spark.SparkInterpreter"\n }, \n {\n "defaultInterpre
ter": false, \n "name": "sql", \n "class": "org.apache.zeppelin.spark.SparkSqlInterpreter"\n }, \n {\n "defaultInterpreter": false, \n "name": "dep", \n "class": "org.apache.zeppelin.spark.DepInterpreter"\n }, \n {\n "defaultInterpreter": false, \n "name": "pyspark", \n "class": "org.apache.zeppelin.spark.PySparkInterpreter"\n }, \n {\n "defaultInterpreter": false, \n "name": "r", \n "class": "org.apache.zeppelin.spark.SparkRInterpreter"\n }\n ], \n "dependencies": [], \n "properties": {\n "zeppelin.dep.additionalRemoteRepository": "spark-packages,http://dl.bintray.com/spark-packages/maven,false;", \n "zeppelin.dep.localrepo": "local-repo", \n "zeppelin.spark.useHiveContext": "true", \n "zeppelin.spark.printREPLOutput": "true", \n "zeppelin.R.image.width": "100%", \n "zeppelin.spar
k.importImplicit": "true", \n "spark.app.name": "Zeppelin", \n "args": "", \n "zeppelin.spark.sql.stacktrace": "false", \n "zeppelin.spark.concurrentSQL": "false", \n "zeppelin.R.cmd": "R", \n "master": "local[*]", \n "zeppelin.pyspark.python": "python", \n "zeppelin.R.knitr": "true", \n "zeppelin.R.render.options": "out.format = \'html\', comment = NA, echo = FALSE, results = \'asis\', message = F, warning = F", \n "spark.executor.memory": "", \n "zeppelin.spark.maxResult": "1000", \n "spark.cores.max": ""\n }, \n "option": {\n "setPermission": false, \n "perNoteProcess": false, \n "remote": true, \n "perNoteSession": false, \n "isExistingProcess": false, \n "port": -1\n }\n }, \n "2CKEKWY8Z": {\n "status": "READY", \n "group": "angular", \n "name": "angular", \n "id": "2CKEKWY8Z", \n "interpreterGroup": [\n
{\n "editor": {\n "editOnDblClick": true\n }, \n "defaultInterpreter": false, \n "name": "angular", \n "class": "org.apache.zeppelin.angular.AngularInterpreter"\n }\n ], \n "dependencies": [], \n "properties": {}, \n "option": {\n "setPermission": false, \n "remote": true, \n "users": [], \n "isExistingProcess": false, \n "perUser": "shared", \n "isUserImpersonate": false, \n "perNote": "shared", \n "port": -1\n }\n }, \n "2C8A4SZ9T_livy2": {\n "status": "READY", \n "group": "livy", \n "name": "livy2", \n "id": "2C8A4SZ9T_livy2", \n "interpreterGroup": [\n {\n "defaultInterpreter": false, \n "class": "org.apache.zeppelin.livy.LivySparkInterpreter", \n "name": "spark", \n "editor": {\n "editOnDblClick": false, \n "language": "scala"\n }
\n }, \n {\n "defaultInterpreter": false, \n "class": "org.apache.zeppelin.livy.LivySparkSQLInterpreter", \n "name": "sql", \n "editor": {\n "editOnDblClick": false, \n "language": "sql"\n }\n }, \n {\n "defaultInterpreter": false, \n "class": "org.apache.zeppelin.livy.LivyPySparkInterpreter", \n "name": "pyspark", \n "editor": {\n "editOnDblClick": false, \n "language": "python"\n }\n }, \n {\n "defaultInterpreter": false, \n "class": "org.apache.zeppelin.livy.LivyPySpark3Interpreter", \n "name": "pyspark3", \n "editor": {\n "editOnDblClick": false, \n "language": "python"\n }\n }, \n {\n "defaultInterpreter": false, \n "class": "org.apache.zeppelin.livy.LivySparkRInterpreter", \n "name": "sparkr", \n
"editor": {\n "editOnDblClick": false, \n "language": "r"\n }\n }, \n {\n "defaultInterpreter": false, \n "name": "shared", \n "class": "org.apache.zeppelin.livy.LivySharedInterpreter"\n }\n ], \n "dependencies": [], \n "properties": {\n "zeppelin.livy.keytab": "", \n "zeppelin.livy.spark.sql.maxResult": "1000", \n "livy.spark.executor.instances": "", \n "livy.spark.executor.memory": "", \n "livy.spark.dynamicAllocation.enabled": "", \n "livy.spark.dynamicAllocation.cachedExecutorIdleTimeout": "", \n "livy.spark.dynamicAllocation.initialExecutors": "", \n "zeppelin.livy.principal": "", \n "zeppelin.livy.session.create_timeout": "120", \n "livy.spark.driver.memory": "", \n "livy.spark.jars.packages": "", \n "livy.spark.dynamicAllocation.maxExecutors": "", \n "zeppelin.livy.concurrentSQL": "fals
e", \n "zeppelin.livy.displayAppInfo": "true", \n "livy.spark.dynamicAllocation.minExecutors": "", \n "zeppelin.livy.url": "http://localhost:8998", \n "zeppelin.livy.pull_status.interval.millis": "1000", \n "livy.spark.driver.cores": "", \n "livy.spark.executor.cores": ""\n }, \n "option": {\n "setPermission": false, \n "remote": true, \n "users": [], \n "isExistingProcess": false, \n "perUser": "scoped", \n "isUserImpersonate": false, \n "perNote": "shared", \n "port": -1\n }\n }, \n "2CKX6DGQZ": {\n "status": "READY", \n "group": "livy", \n "name": "livy", \n "id": "2CKX6DGQZ", \n "interpreterGroup": [\n {\n "editor": {\n "editOnDblClick": false, \n "language": "scala"\n }, \n "defaultInterpreter": true, \n "name": "spark", \n "class": "org.apache.zeppelin.livy.LivyS
parkInterpreter"\n }, \n {\n "editor": {\n "editOnDblClick": false, \n "language": "sql"\n }, \n "defaultInterpreter": false, \n "name": "sql", \n "class": "org.apache.zeppelin.livy.LivySparkSQLInterpreter"\n }, \n {\n "editor": {\n "editOnDblClick": false, \n "language": "python"\n }, \n "defaultInterpreter": false, \n "name": "pyspark", \n "class": "org.apache.zeppelin.livy.LivyPySparkInterpreter"\n }, \n {\n "editor": {\n "editOnDblClick": false, \n "language": "python"\n }, \n "defaultInterpreter": false, \n "name": "pyspark3", \n "class": "org.apache.zeppelin.livy.LivyPySpark3Interpreter"\n }, \n {\n "editor": {\n "editOnDblClick": false, \n "language": "r"\n }, \n "defaultInte
rpreter": false, \n "name": "sparkr", \n "class": "org.apache.zeppelin.livy.LivySparkRInterpreter"\n }\n ], \n "dependencies": [], \n "properties": {\n "livy.spark.dynamicAllocation.initialExecutors": "", \n "zeppelin.livy.keytab": "", \n "zeppelin.livy.spark.sql.maxResult": "1000", \n "livy.spark.executor.instances": "", \n "livy.spark.driver.memory": "", \n "livy.spark.executor.memory": "", \n "livy.spark.dynamicAllocation.enabled": "", \n "livy.spark.dynamicAllocation.cachedExecutorIdleTimeout": "", \n "livy.spark.driver.cores": "", \n "zeppelin.livy.session.create_timeout": "120", \n "zeppelin.livy.principal": "", \n "livy.spark.jars.packages": "", \n "livy.spark.dynamicAllocation.maxExecutors": "", \n "zeppelin.livy.concurrentSQL": "false", \n "zeppelin.livy.displayAppInfo": "false", \n "livy.spark.dynamicAllocation.minExecutors
": "", \n "zeppelin.livy.url": "http://localhost:8998", \n "zeppelin.livy.spark.sql.field.truncate": "true", \n "zeppelin.livy.pull_status.interval.millis": "1000", \n "livy.spark.executor.cores": ""\n }, \n "option": {\n "setPermission": false, \n "remote": true, \n "users": [], \n "isExistingProcess": false, \n "perUser": "scoped", \n "isUserImpersonate": false, \n "perNote": "shared", \n "port": -1\n }\n }\n }, \n "interpreterBindings": {}, \n "interpreterRepositories": [\n {\n "releasePolicy": {\n "checksumPolicy": "warn", \n "enabled": true, \n "updatePolicy": "daily"\n }, \n "mirroredRepositories": [], \n "snapshotPolicy": {\n "checksumPolicy": "warn", \n "enabled": true, \n "updatePolicy": "daily"\n }, \n "url": "http://repo1.maven.org/maven2/", \n "repositoryManager": false, \n "type": "d
efault", \n "id": "central"\n }, \n {\n "releasePolicy": {\n "checksumPolicy": "warn", \n "enabled": true, \n "updatePolicy": "daily"\n }, \n "mirroredRepositories": [], \n "snapshotPolicy": {\n "checksumPolicy": "warn", \n "enabled": true, \n "updatePolicy": "daily"\n }, \n "url": "file:///home/zeppelin/.m2/repository", \n "repositoryManager": false, \n "type": "default", \n "id": "local"\n }\n ]\n}'
template_after_without_spark_and_livy = '{\n "interpreterSettings": {\n "2CHS8UYQQ": {\n "status": "READY", \n "group": "sh", \n "name": "sh", \n "id": "2CHS8UYQQ", \n "interpreterGroup": [\n {\n "editor": {\n "editOnDblClick": false, \n "language": "sh"\n }, \n "defaultInterpreter": false, \n "name": "sh", \n "class": "org.apache.zeppelin.shell.ShellInterpreter"\n }\n ], \n "dependencies": [], \n "properties": {\n "shell.command.timeout.millisecs": "60000", \n "zeppelin.shell.auth.type": "", \n "zeppelin.shell.keytab.location": "", \n "zeppelin.shell.principal": ""\n }, \n "option": {\n "setPermission": false, \n "remote": true, \n "users": [], \n "isExistingProcess": false, \n "perUser": "shared", \n "isUserImpersonate": false, \n "perNote": "shared", \n "port": -1\
n }\n }, \n "2CKAY1A8Y": {\n "status": "READY", \n "group": "md", \n "name": "md", \n "id": "2CKAY1A8Y", \n "interpreterGroup": [\n {\n "editor": {\n "editOnDblClick": true, \n "language": "markdown"\n }, \n "defaultInterpreter": false, \n "name": "md", \n "class": "org.apache.zeppelin.markdown.Markdown"\n }\n ], \n "dependencies": [], \n "properties": {\n "markdown.parser.type": "markdown4j"\n }, \n "option": {\n "setPermission": false, \n "remote": true, \n "users": [], \n "isExistingProcess": false, \n "perUser": "shared", \n "isUserImpersonate": false, \n "perNote": "shared", \n "port": -1\n }\n }, \n "2CKX8WPU1": {\n "status": "READY", \n "group": "spark", \n "name": "spark", \n "id": "2CKX8WPU1", \n "interpreterGroup": [\n {\n
"editor": {\n "language": "scala"\n }, \n "defaultInterpreter": true, \n "name": "spark", \n "class": "org.apache.zeppelin.spark.SparkInterpreter"\n }, \n {\n "editor": {\n "language": "sql"\n }, \n "defaultInterpreter": false, \n "name": "sql", \n "class": "org.apache.zeppelin.spark.SparkSqlInterpreter"\n }, \n {\n "editor": {\n "language": "scala"\n }, \n "defaultInterpreter": false, \n "name": "dep", \n "class": "org.apache.zeppelin.spark.DepInterpreter"\n }, \n {\n "editor": {\n "language": "python"\n }, \n "defaultInterpreter": false, \n "name": "pyspark", \n "class": "org.apache.zeppelin.spark.PySparkInterpreter"\n }, \n {\n "editor": {\n "language": "r"\n }, \n "default
Interpreter": false, \n "name": "r", \n "class": "org.apache.zeppelin.spark.SparkRInterpreter"\n }\n ], \n "dependencies": [], \n "properties": {\n "zeppelin.dep.additionalRemoteRepository": "spark-packages,http://dl.bintray.com/spark-packages/maven,false;", \n "zeppelin.dep.localrepo": "local-repo", \n "zeppelin.spark.useHiveContext": "true", \n "zeppelin.spark.printREPLOutput": "true", \n "zeppelin.R.image.width": "100%", \n "zeppelin.spark.importImplicit": "true", \n "spark.app.name": "Zeppelin", \n "args": "", \n "zeppelin.spark.sql.stacktrace": "false", \n "zeppelin.spark.concurrentSQL": "false", \n "SPARK_HOME": "/usr/hdp/current/spark-client/", \n "zeppelin.R.cmd": "R", \n "master": "yarn-client", \n "zeppelin.pyspark.python": "python", \n "zeppelin.R.knitr": "true", \n "zeppelin.R.render.options": "out.format = \'html\', comm
ent = NA, echo = FALSE, results = \'asis\', message = F, warning = F", \n "spark.executor.memory": "512m", \n "zeppelin.spark.maxResult": "1000", \n "spark.cores.max": ""\n }, \n "option": {\n "setPermission": false, \n "remote": true, \n "users": [], \n "isExistingProcess": false, \n "perUser": "shared", \n "isUserImpersonate": false, \n "perNote": "shared", \n "port": -1\n }\n }, \n "2CK8A9MEG": {\n "status": "READY", \n "group": "jdbc", \n "name": "jdbc", \n "id": "2CK8A9MEG", \n "interpreterGroup": [\n {\n "editor": {\n "editOnDblClick": false, \n "language": "sql"\n }, \n "defaultInterpreter": false, \n "name": "sql", \n "class": "org.apache.zeppelin.jdbc.JDBCInterpreter"\n }\n ], \n "dependencies": [], \n "properties": {\n "common.max_count": "1000", \n
"zeppelin.jdbc.keytab.location": "", \n "zeppelin.jdbc.concurrent.max_connection": "10", \n "default.user": "gpadmin", \n "zeppelin.jdbc.auth.type": "", \n "default.url": "jdbc:postgresql://localhost:5432/", \n "default.driver": "org.postgresql.Driver", \n "zeppelin.jdbc.concurrent.use": "true", \n "default.password": "", \n "zeppelin.jdbc.principal": ""\n }, \n "option": {\n "setPermission": false, \n "remote": true, \n "users": [], \n "isExistingProcess": false, \n "perUser": "shared", \n "isUserImpersonate": false, \n "perNote": "shared", \n "port": -1\n }\n }, \n "2CKEKWY8Z": {\n "status": "READY", \n "group": "angular", \n "name": "angular", \n "id": "2CKEKWY8Z", \n "interpreterGroup": [\n {\n "editor": {\n "editOnDblClick": true\n }, \n "defaultInterpreter": false, \n
"name": "angular", \n "class": "org.apache.zeppelin.angular.AngularInterpreter"\n }\n ], \n "dependencies": [], \n "properties": {}, \n "option": {\n "setPermission": false, \n "remote": true, \n "users": [], \n "isExistingProcess": false, \n "perUser": "shared", \n "isUserImpersonate": false, \n "perNote": "shared", \n "port": -1\n }\n }\n }, \n "interpreterBindings": {}, \n "interpreterRepositories": [\n {\n "releasePolicy": {\n "checksumPolicy": "warn", \n "enabled": true, \n "updatePolicy": "daily"\n }, \n "mirroredRepositories": [], \n "snapshotPolicy": {\n "checksumPolicy": "warn", \n "enabled": true, \n "updatePolicy": "daily"\n }, \n "url": "http://repo1.maven.org/maven2/", \n "repositoryManager": false, \n "type": "default", \n "id": "central"\n }, \n {\n "releasePoli
cy": {\n "checksumPolicy": "warn", \n "enabled": true, \n "updatePolicy": "daily"\n }, \n "mirroredRepositories": [], \n "snapshotPolicy": {\n "checksumPolicy": "warn", \n "enabled": true, \n "updatePolicy": "daily"\n }, \n "url": "file:///home/zeppelin/.m2/repository", \n "repositoryManager": false, \n "type": "default", \n "id": "local"\n }\n ]\n}'
[21/23] ambari git commit: AMBARI-22639. Log Feeder refactor:
integrate with spring boot (oleewere)
Posted by nc...@apache.org.
AMBARI-22639. Log Feeder refactor: integrate with spring boot (oleewere)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/31e8e55a
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/31e8e55a
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/31e8e55a
Branch: refs/heads/branch-feature-AMBARI-21674
Commit: 31e8e55a900e0dd4915810302da22991e7cc54e4
Parents: a3d4c3d
Author: Oliver Szabo <ol...@gmail.com>
Authored: Tue Dec 12 22:34:09 2017 +0100
Committer: Oliver Szabo <ol...@gmail.com>
Committed: Wed Dec 13 22:44:51 2017 +0100
----------------------------------------------------------------------
.../config/api/LogSearchConfigFactory.java | 49 +-
.../config/api/LogSearchConfigLogFeeder.java | 3 +-
.../ambari-logsearch-logfeeder/.gitignore | 1 +
.../ambari-logsearch-logfeeder/pom.xml | 62 ++-
.../org/apache/ambari/logfeeder/LogFeeder.java | 167 +------
.../ambari/logfeeder/LogFeederCommandLine.java | 28 +-
.../ambari/logfeeder/common/ConfigHandler.java | 47 +-
.../ambari/logfeeder/common/ConfigItem.java | 8 +-
.../logfeeder/common/LogEntryParseTester.java | 3 +-
.../logfeeder/common/LogFeederConstants.java | 50 ++
.../logfeeder/conf/ApplicationConfig.java | 107 ++++
.../logfeeder/conf/InputSimulateConfig.java | 154 ++++++
.../logfeeder/conf/LogEntryCacheConfig.java | 118 +++++
.../ambari/logfeeder/conf/LogFeederProps.java | 226 +++++++++
.../logfeeder/conf/LogFeederSecurityConfig.java | 189 +++++++
.../logfeeder/conf/MetricsCollectorConfig.java | 113 +++++
.../apache/ambari/logfeeder/filter/Filter.java | 7 +-
.../ambari/logfeeder/filter/FilterGrok.java | 7 +-
.../ambari/logfeeder/filter/FilterKeyValue.java | 5 +-
.../logfeeder/input/AbstractInputFile.java | 11 +-
.../apache/ambari/logfeeder/input/Input.java | 25 +-
.../logfeeder/input/InputConfigUploader.java | 82 +--
.../ambari/logfeeder/input/InputManager.java | 28 +-
.../ambari/logfeeder/input/InputSimulate.java | 44 +-
.../logfeeder/loglevelfilter/FilterLogData.java | 73 ---
.../loglevelfilter/LogLevelFilterHandler.java | 89 +++-
.../logfeeder/metrics/LogFeederAMSClient.java | 22 +-
.../logfeeder/metrics/MetricsManager.java | 16 +-
.../ambari/logfeeder/metrics/StatsLogger.java | 83 ++++
.../ambari/logfeeder/output/OutputFile.java | 5 +-
.../ambari/logfeeder/output/OutputHDFSFile.java | 8 +-
.../ambari/logfeeder/output/OutputKafka.java | 5 +-
.../ambari/logfeeder/output/OutputManager.java | 36 +-
.../ambari/logfeeder/output/OutputS3File.java | 8 +-
.../ambari/logfeeder/output/OutputSolr.java | 10 +-
.../logfeeder/util/LogFeederPropertiesUtil.java | 498 -------------------
.../apache/ambari/logfeeder/util/SSLUtil.java | 134 -----
.../shipper-conf/input.config-sample.json | 2 +-
.../src/main/resources/log4j.xml | 15 +-
.../src/main/resources/logfeeder.properties | 18 +-
.../ambari/logfeeder/filter/FilterGrokTest.java | 3 +-
.../ambari/logfeeder/filter/FilterJSONTest.java | 3 +-
.../logfeeder/filter/FilterKeyValueTest.java | 3 +-
.../ambari/logfeeder/input/InputFileTest.java | 11 +-
.../logfeeder/input/InputManagerTest.java | 12 +-
.../logconfig/LogConfigHandlerTest.java | 148 ------
.../logfeeder/metrics/MetricsManagerTest.java | 7 -
.../logfeeder/output/OutputKafkaTest.java | 7 +-
.../logfeeder/output/OutputManagerTest.java | 32 +-
.../logfeeder/output/OutputS3FileTest.java | 9 +-
.../ambari/logfeeder/output/OutputSolrTest.java | 10 +-
51 files changed, 1542 insertions(+), 1259 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-config-api/src/main/java/org/apache/ambari/logsearch/config/api/LogSearchConfigFactory.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-config-api/src/main/java/org/apache/ambari/logsearch/config/api/LogSearchConfigFactory.java b/ambari-logsearch/ambari-logsearch-config-api/src/main/java/org/apache/ambari/logsearch/config/api/LogSearchConfigFactory.java
index a84a97b..c74fad3 100644
--- a/ambari-logsearch/ambari-logsearch-config-api/src/main/java/org/apache/ambari/logsearch/config/api/LogSearchConfigFactory.java
+++ b/ambari-logsearch/ambari-logsearch-config-api/src/main/java/org/apache/ambari/logsearch/config/api/LogSearchConfigFactory.java
@@ -37,12 +37,13 @@ public class LogSearchConfigFactory {
* @param properties The properties of the component for which the configuration is created. If the properties contain the
* "logsearch.config.class" entry than the class defined there would be used instead of the default class.
* @param defaultClass The default configuration class to use if not specified otherwise.
+ * @param init initialize the properties and zookeeper client
* @return The Log Search Configuration instance.
* @throws Exception Throws exception if the defined class does not implement LogSearchConfigServer, or doesn't have an empty
* constructor, or throws an exception in it's init method.
*/
public static LogSearchConfigServer createLogSearchConfigServer(Map<String, String> properties,
- Class<? extends LogSearchConfigServer> defaultClass) throws Exception {
+ Class<? extends LogSearchConfigServer> defaultClass, boolean init) throws Exception {
try {
LogSearchConfigServer logSearchConfig = null;
String configClassName = properties.get("logsearch.config.server.class");
@@ -57,8 +58,9 @@ public class LogSearchConfigFactory {
} else {
logSearchConfig = defaultClass.newInstance();
}
-
- logSearchConfig.init(properties);
+ if (init) {
+ logSearchConfig.init(properties);
+ }
return logSearchConfig;
} catch (Exception e) {
LOG.error("Could not initialize logsearch config.", e);
@@ -74,12 +76,13 @@ public class LogSearchConfigFactory {
* "logsearch.config.class" entry than the class defined there would be used instead of the default class.
* @param clusterName The name of the cluster.
* @param defaultClass The default configuration class to use if not specified otherwise.
+ * @param init initialize the properties and zookeeper client
* @return The Log Search Configuration instance.
* @throws Exception Throws exception if the defined class does not implement LogSearchConfigLogFeeder, or doesn't have an empty
* constructor, or throws an exception in it's init method.
*/
public static LogSearchConfigLogFeeder createLogSearchConfigLogFeeder(Map<String, String> properties, String clusterName,
- Class<? extends LogSearchConfigLogFeeder> defaultClass) throws Exception {
+ Class<? extends LogSearchConfigLogFeeder> defaultClass, boolean init) throws Exception {
try {
LogSearchConfigLogFeeder logSearchConfig = null;
String configClassName = properties.get("logsearch.config.logfeeder.class");
@@ -94,12 +97,46 @@ public class LogSearchConfigFactory {
} else {
logSearchConfig = defaultClass.newInstance();
}
-
- logSearchConfig.init(properties, clusterName);
+ if (init) {
+ logSearchConfig.init(properties, clusterName);
+ }
return logSearchConfig;
} catch (Exception e) {
LOG.error("Could not initialize logsearch config.", e);
throw e;
}
}
+
+ /**
+ * Creates a Log Search Configuration instance for the Log Search Server that implements
+ * {@link org.apache.ambari.logsearch.config.api.LogSearchConfigServer}.
+ *
+ * @param properties The properties of the component for which the configuration is created. If the properties contain the
+ * "logsearch.config.class" entry than the class defined there would be used instead of the default class.
+ * @param defaultClass The default configuration class to use if not specified otherwise.
+ * @return The Log Search Configuration instance.
+ * @throws Exception Throws exception if the defined class does not implement LogSearchConfigServer, or doesn't have an empty
+ * constructor, or throws an exception in it's init method.
+ */
+ public static LogSearchConfigServer createLogSearchConfigServer(Map<String, String> properties,
+ Class<? extends LogSearchConfigServer> defaultClass) throws Exception {
+ return createLogSearchConfigServer(properties, defaultClass, true);
+ }
+
+ /**
+ * Creates a Log Search Configuration instance for the Log Search Server that implements
+ * {@link org.apache.ambari.logsearch.config.api.LogSearchConfigLogFeeder}.
+ *
+ * @param properties The properties of the component for which the configuration is created. If the properties contain the
+ * "logsearch.config.class" entry than the class defined there would be used instead of the default class.
+ * @param clusterName The name of the cluster.
+ * @param defaultClass The default configuration class to use if not specified otherwise.
+ * @return The Log Search Configuration instance.
+ * @throws Exception Throws exception if the defined class does not implement LogSearchConfigLogFeeder, or doesn't have an empty
+ * constructor, or throws an exception in it's init method.
+ */
+ public static LogSearchConfigLogFeeder createLogSearchConfigLogFeeder(Map<String, String> properties, String clusterName,
+ Class<? extends LogSearchConfigLogFeeder> defaultClass) throws Exception {
+ return createLogSearchConfigLogFeeder(properties, clusterName, defaultClass, true);
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-config-api/src/main/java/org/apache/ambari/logsearch/config/api/LogSearchConfigLogFeeder.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-config-api/src/main/java/org/apache/ambari/logsearch/config/api/LogSearchConfigLogFeeder.java b/ambari-logsearch/ambari-logsearch-config-api/src/main/java/org/apache/ambari/logsearch/config/api/LogSearchConfigLogFeeder.java
index 6ed36fd..1387515 100644
--- a/ambari-logsearch/ambari-logsearch-config-api/src/main/java/org/apache/ambari/logsearch/config/api/LogSearchConfigLogFeeder.java
+++ b/ambari-logsearch/ambari-logsearch-config-api/src/main/java/org/apache/ambari/logsearch/config/api/LogSearchConfigLogFeeder.java
@@ -68,8 +68,7 @@ public interface LogSearchConfigLogFeeder extends LogSearchConfig {
/**
* Saves the properties of an Output Solr.
- *
- * @param type The type of the Output Solr.
+ *
* @param outputConfigMonitors The monitors which want to watch the output config changes.
* @throws Exception
*/
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/.gitignore
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/.gitignore b/ambari-logsearch/ambari-logsearch-logfeeder/.gitignore
new file mode 100644
index 0000000..7b00482
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/.gitignore
@@ -0,0 +1 @@
+*.pid
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/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 01710bf..005af15 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/pom.xml
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/pom.xml
@@ -33,6 +33,8 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <spring.version>4.3.10.RELEASE</spring.version>
+ <spring-boot.version>1.5.6.RELEASE</spring-boot.version>
</properties>
<dependencies>
@@ -67,11 +69,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.17</version>
- </dependency>
- <dependency>
<groupId>io.thekraken</groupId>
<artifactId>grok</artifactId>
<version>0.1.4</version>
@@ -102,16 +99,6 @@
<version>18.0</version>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.7.20</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>1.7.20</version>
- </dependency>
- <dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<version>1.2</version>
@@ -152,6 +139,10 @@
<version>${hadoop.version}</version>
<exclusions>
<exclusion>
+ <artifactId>slf4j-log4j12</artifactId>
+ <groupId>org.slf4j</groupId>
+ </exclusion>
+ <exclusion>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
</exclusion>
@@ -179,6 +170,32 @@
<artifactId>commons-io</artifactId>
<version>${common.io.version}</version>
</dependency>
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ <version>1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter</artifactId>
+ <version>${spring-boot.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-log4j</artifactId>
+ <version>1.3.8.RELEASE</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-configuration-processor</artifactId>
+ <version>${spring-boot.version}</version>
+ </dependency>
</dependencies>
<build>
<finalName>LogFeeder</finalName>
@@ -225,6 +242,21 @@
</arguments>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <version>${spring-boot.version}</version>
+ <configuration>
+ <classifier>exec</classifier>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
<!-- copy-dependencies -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/LogFeeder.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/LogFeeder.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/LogFeeder.java
index 5114743..2d31e5a 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/LogFeeder.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/LogFeeder.java
@@ -16,146 +16,41 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.ambari.logfeeder;
+import com.google.gson.GsonBuilder;
+import org.apache.ambari.logfeeder.common.LogEntryParseTester;
+import org.apache.commons.io.FileUtils;
+import org.apache.log4j.LogManager;
+import org.springframework.boot.Banner;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.system.ApplicationPidFileWriter;
+
import java.io.File;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import org.apache.ambari.logfeeder.common.ConfigHandler;
-import org.apache.ambari.logfeeder.common.LogEntryParseTester;
-import org.apache.ambari.logsearch.config.api.LogSearchConfigFactory;
-import org.apache.ambari.logsearch.config.api.LogSearchConfigLogFeeder;
-import org.apache.ambari.logsearch.config.zookeeper.LogSearchConfigLogFeederZK;
-import org.apache.commons.io.FileUtils;
-import org.apache.ambari.logfeeder.input.InputConfigUploader;
-import org.apache.ambari.logfeeder.loglevelfilter.LogLevelFilterHandler;
-import org.apache.ambari.logfeeder.metrics.MetricData;
-import org.apache.ambari.logfeeder.metrics.MetricsManager;
-import org.apache.ambari.logfeeder.util.LogFeederPropertiesUtil;
-import org.apache.ambari.logfeeder.util.SSLUtil;
-import com.google.common.collect.Maps;
-import com.google.gson.GsonBuilder;
-
-import org.apache.hadoop.util.ShutdownHookManager;
-import org.apache.log4j.LogManager;
-import org.apache.log4j.Logger;
-
+@SpringBootApplication(
+ scanBasePackages = {"org.apache.ambari.logfeeder"}
+)
public class LogFeeder {
- private static final Logger LOG = Logger.getLogger(LogFeeder.class);
-
- private static final int LOGFEEDER_SHUTDOWN_HOOK_PRIORITY = 30;
- private static final int CHECKPOINT_CLEAN_INTERVAL_MS = 24 * 60 * 60 * 60 * 1000; // 24 hours
-
- private final LogFeederCommandLine cli;
-
- private ConfigHandler configHandler;
- private LogSearchConfigLogFeeder config;
-
- private MetricsManager metricsManager = new MetricsManager();
-
- private long lastCheckPointCleanedMS = 0;
- private Thread statLoggerThread = null;
-
- private LogFeeder(LogFeederCommandLine cli) {
- this.cli = cli;
- }
-
- public void run() {
- try {
- init();
- monitor();
- } catch (Throwable t) {
- LOG.fatal("Caught exception in main.", t);
- System.exit(1);
- }
- }
-
- private void init() throws Throwable {
- long startTime = System.currentTimeMillis();
-
- SSLUtil.ensureStorePasswords();
-
- config = LogSearchConfigFactory.createLogSearchConfigLogFeeder(Maps.fromProperties(LogFeederPropertiesUtil.getProperties()),
- LogFeederPropertiesUtil.getClusterName(), LogSearchConfigLogFeederZK.class);
- configHandler = new ConfigHandler(config);
- configHandler.init();
- LogLevelFilterHandler.init(config);
- InputConfigUploader.load(config);
- config.monitorInputConfigChanges(configHandler, new LogLevelFilterHandler(), LogFeederPropertiesUtil.getClusterName());
-
- metricsManager.init();
-
- LOG.debug("==============");
-
- long endTime = System.currentTimeMillis();
- LOG.info("Took " + (endTime - startTime) + " ms to initialize");
- }
-
- private class JVMShutdownHook extends Thread {
-
- public void run() {
- try {
- LOG.info("Processing is shutting down.");
-
- configHandler.close();
- config.close();
- logStats();
-
- LOG.info("LogSearch is exiting.");
- } catch (Throwable t) {
- // Ignore
- }
- }
- }
-
- private void monitor() throws Exception {
- JVMShutdownHook logFeederJVMHook = new JVMShutdownHook();
- ShutdownHookManager.get().addShutdownHook(logFeederJVMHook, LOGFEEDER_SHUTDOWN_HOOK_PRIORITY);
-
- statLoggerThread = new Thread("statLogger") {
-
- @Override
- public void run() {
- while (true) {
- try {
- Thread.sleep(30 * 1000);
- } catch (Throwable t) {
- // Ignore
- }
- try {
- logStats();
- } catch (Throwable t) {
- LOG.error("LogStats: Caught exception while logging stats.", t);
- }
-
- if (System.currentTimeMillis() > (lastCheckPointCleanedMS + CHECKPOINT_CLEAN_INTERVAL_MS)) {
- lastCheckPointCleanedMS = System.currentTimeMillis();
- configHandler.cleanCheckPointFiles();
- }
- }
- }
- };
- statLoggerThread.setDaemon(true);
- statLoggerThread.start();
-
- }
-
- private void logStats() {
- configHandler.logStats();
-
- if (metricsManager.isMetricsEnabled()) {
- List<MetricData> metricsList = new ArrayList<MetricData>();
- configHandler.addMetrics(metricsList);
- metricsManager.useMetrics(metricsList);
+ public static void main(String[] args) {
+ LogFeederCommandLine cli = new LogFeederCommandLine(args);
+ if (cli.isTest()) {
+ test(cli);
}
+ String pidFile = System.getenv("PID_FILE") == null ? "logfeeder.pid" : System.getenv("PID_FILE");
+ new SpringApplicationBuilder(LogFeeder.class)
+ .bannerMode(Banner.Mode.OFF)
+ .listeners(new ApplicationPidFileWriter(pidFile))
+ .run(args);
}
- public void test() {
+ private static void test(LogFeederCommandLine cli) {
try {
LogManager.shutdown();
String testLogEntry = cli.getTestLogEntry();
@@ -173,22 +68,4 @@ public class LogFeeder {
e.printStackTrace(System.out);
}
}
-
- public static void main(String[] args) {
- LogFeederCommandLine cli = new LogFeederCommandLine(args);
-
- LogFeeder logFeeder = new LogFeeder(cli);
-
- if (cli.isMonitor()) {
- try {
- LogFeederPropertiesUtil.loadProperties();
- } catch (Throwable t) {
- LOG.warn("Could not load logfeeder properites");
- System.exit(1);
- }
- logFeeder.run();
- } else if (cli.isTest()) {
- logFeeder.test();
- }
- }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/LogFeederCommandLine.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/LogFeederCommandLine.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/LogFeederCommandLine.java
index d996f98..61e7a1e 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/LogFeederCommandLine.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/LogFeederCommandLine.java
@@ -30,14 +30,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
public class LogFeederCommandLine {
private static final Logger LOG = LoggerFactory.getLogger(LogFeederCommandLine.class);
-
- private static final String MONITOR_COMMAND = "monitor";
private static final String TEST_COMMAND = "test";
private static final String TEST_LOG_ENTRY_OPTION = "test-log-entry";
@@ -60,11 +57,6 @@ public class LogFeederCommandLine {
.desc("Print commands")
.build();
- Option monitorOption = Option.builder("m")
- .longOpt(MONITOR_COMMAND)
- .desc("Monitor log files")
- .build();
-
Option testOption = Option.builder("t")
.longOpt(TEST_COMMAND)
.desc("Test if log entry is parseable")
@@ -95,7 +87,6 @@ public class LogFeederCommandLine {
.build();
options.addOption(helpOption);
- options.addOption(monitorOption);
options.addOption(testOption);
options.addOption(testLogEntryOption);
options.addOption(testShipperConfOption);
@@ -111,21 +102,14 @@ public class LogFeederCommandLine {
System.exit(0);
}
String command = "";
- if (cli.hasOption("m")) {
- command = MONITOR_COMMAND;
- } else if (cli.hasOption("t")) {
+ if (cli.hasOption("t")) {
command = TEST_COMMAND;
validateRequiredOptions(cli, command, testLogEntryOption, testShipperConfOption);
} else {
- List<String> commands = Arrays.asList(MONITOR_COMMAND, TEST_COMMAND);
- helpFormatter.printHelp(COMMAND_LINE_SYNTAX, options);
- LOG.error(String.format("One of the supported commands is required (%s)", StringUtils.join(commands, "|")));
- System.exit(1);
+ LOG.info("Start application in monitor mode ");
}
} catch (Exception e) {
- LOG.error("Error parsing command line parameters", e);
- helpFormatter.printHelp(COMMAND_LINE_SYNTAX, options);
- System.exit(1);
+ LOG.info("Error parsing command line parameters: {}. LogFeeder will be started in monitoring mode.", e.getMessage());
}
}
@@ -142,12 +126,8 @@ public class LogFeederCommandLine {
}
}
- public boolean isMonitor() {
- return cli.hasOption('m');
- }
-
public boolean isTest() {
- return cli.hasOption('t');
+ return cli != null && cli.hasOption('t');
}
public String getTestLogEntry() {
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/ConfigHandler.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/ConfigHandler.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/ConfigHandler.java
index 243b344..35c0e6a 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/ConfigHandler.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/ConfigHandler.java
@@ -33,6 +33,8 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
+import com.google.common.collect.Maps;
+import org.apache.ambari.logfeeder.conf.LogFeederProps;
import org.apache.ambari.logfeeder.filter.Filter;
import org.apache.ambari.logfeeder.input.Input;
import org.apache.ambari.logfeeder.input.InputManager;
@@ -47,7 +49,6 @@ import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.ambari.logfeeder.util.AliasUtil.AliasType;
-import org.apache.ambari.logfeeder.util.LogFeederPropertiesUtil;
import org.apache.ambari.logsearch.config.api.InputConfigMonitor;
import org.apache.ambari.logsearch.config.api.LogSearchConfigLogFeeder;
import org.apache.ambari.logsearch.config.api.model.inputconfig.FilterDescriptor;
@@ -62,16 +63,24 @@ import org.apache.log4j.Logger;
import com.google.gson.reflect.TypeToken;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+
public class ConfigHandler implements InputConfigMonitor {
private static final Logger LOG = Logger.getLogger(ConfigHandler.class);
private final LogSearchConfigLogFeeder logSearchConfig;
-
- private final OutputManager outputManager = new OutputManager();
- private final InputManager inputManager = new InputManager();
+
+ @Inject
+ private InputManager inputManager;
+ @Inject
+ private OutputManager outputManager;
+ @Inject
+ private LogFeederProps logFeederProps;
private final Map<String, Object> globalConfigs = new HashMap<>();
- private final List<String> globalConfigJsons = new ArrayList<String>();
+ private final List<String> globalConfigJsons = new ArrayList<>();
private final List<InputDescriptor> inputConfigList = new ArrayList<>();
private final List<FilterDescriptor> filterConfigList = new ArrayList<>();
@@ -82,9 +91,11 @@ public class ConfigHandler implements InputConfigMonitor {
public ConfigHandler(LogSearchConfigLogFeeder logSearchConfig) {
this.logSearchConfig = logSearchConfig;
}
-
+
+ @PostConstruct
public void init() throws Exception {
loadConfigFiles();
+ logSearchConfig.init(Maps.fromProperties(logFeederProps.getProperties()), logFeederProps.getClusterName());
loadOutputs();
simulateIfNeeded();
@@ -114,7 +125,7 @@ public class ConfigHandler implements InputConfigMonitor {
private List<String> getConfigFiles() {
List<String> configFiles = new ArrayList<>();
- String logFeederConfigFilesProperty = LogFeederPropertiesUtil.getConfigFiles();
+ String logFeederConfigFilesProperty = logFeederProps.getConfigFiles();
LOG.info("logfeeder.config.files=" + logFeederConfigFilesProperty);
if (logFeederConfigFilesProperty != null) {
configFiles.addAll(Arrays.asList(logFeederConfigFilesProperty.split(",")));
@@ -217,7 +228,7 @@ public class ConfigHandler implements InputConfigMonitor {
}
private void simulateIfNeeded() throws Exception {
- int simulatedInputNumber = LogFeederPropertiesUtil.getSimulateInputNumber();
+ int simulatedInputNumber = logFeederProps.getInputSimulateConfig().getSimulateInputNumber();
if (simulatedInputNumber == 0)
return;
@@ -347,18 +358,15 @@ public class ConfigHandler implements InputConfigMonitor {
}
private void sortFilters() {
- Collections.sort(filterConfigList, new Comparator<FilterDescriptor>() {
- @Override
- public int compare(FilterDescriptor o1, FilterDescriptor o2) {
- Integer o1Sort = o1.getSortOrder();
- Integer o2Sort = o2.getSortOrder();
- if (o1Sort == null || o2Sort == null) {
- return 0;
- }
-
- return o1Sort - o2Sort;
+ Collections.sort(filterConfigList, (o1, o2) -> {
+ Integer o1Sort = o1.getSortOrder();
+ Integer o2Sort = o2.getSortOrder();
+ if (o1Sort == null || o2Sort == null) {
+ return 0;
}
- } );
+
+ return o1Sort - o2Sort;
+ });
}
private void assignOutputsToInputs(String serviceName) {
@@ -428,6 +436,7 @@ public class ConfigHandler implements InputConfigMonitor {
outputManager.addMetricsContainers(metricsList);
}
+ @PreDestroy
public void close() {
inputManager.close();
outputManager.close();
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/ConfigItem.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/ConfigItem.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/ConfigItem.java
index 5c20a8e..30bd9fd 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/ConfigItem.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/ConfigItem.java
@@ -21,6 +21,7 @@ package org.apache.ambari.logfeeder.common;
import java.util.List;
+import org.apache.ambari.logfeeder.conf.LogFeederProps;
import org.apache.ambari.logfeeder.metrics.MetricData;
import org.apache.ambari.logfeeder.util.LogFeederUtil;
import org.apache.log4j.Logger;
@@ -30,6 +31,7 @@ public abstract class ConfigItem {
protected static final Logger LOG = Logger.getLogger(ConfigBlock.class);
private boolean drain = false;
+ private LogFeederProps logFeederProps;
public MetricData statMetric = new MetricData(getStatMetricName(), false);
public ConfigItem() {
@@ -59,7 +61,8 @@ public abstract class ConfigItem {
/**
* This method needs to be overwritten by deriving classes.
*/
- public void init() throws Exception {
+ public void init(LogFeederProps logFeederProps) throws Exception {
+ this.logFeederProps = logFeederProps;
}
public abstract boolean isEnabled();
@@ -94,4 +97,7 @@ public abstract class ConfigItem {
this.drain = drain;
}
+ public LogFeederProps getLogFeederProps() {
+ return logFeederProps;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/LogEntryParseTester.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/LogEntryParseTester.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/LogEntryParseTester.java
index ec29f69..1a701e1 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/LogEntryParseTester.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/LogEntryParseTester.java
@@ -25,6 +25,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.apache.ambari.logfeeder.conf.LogFeederProps;
import org.apache.ambari.logfeeder.input.Input;
import org.apache.ambari.logfeeder.input.InputMarker;
import org.apache.ambari.logfeeder.output.Output;
@@ -76,7 +77,7 @@ public class LogEntryParseTester {
ConfigHandler configHandler = new ConfigHandler(null);
Input input = configHandler.getTestInput(inputConfig, logId);
final Map<String, Object> result = new HashMap<>();
- input.getFirstFilter().init();
+ input.getFirstFilter().init(new LogFeederProps());
input.addOutput(new Output() {
@Override
public void write(String block, InputMarker inputMarker) throws Exception {
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/LogFeederConstants.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/LogFeederConstants.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/LogFeederConstants.java
index a7cccc6..b241831 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/LogFeederConstants.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/LogFeederConstants.java
@@ -38,4 +38,54 @@ public class LogFeederConstants {
public static final String S3_PATH_SEPARATOR = "/";
public static final String IN_MEMORY_TIMESTAMP = "in_memory_timestamp";
+
+ public static final String LOGFEEDER_PROPERTIES_FILE = "logfeeder.properties";
+ public static final String CLUSTER_NAME_PROPERTY = "cluster.name";
+ public static final String TMP_DIR_PROPERTY = "logfeeder.tmp.dir";
+
+ public static final String METRICS_COLLECTOR_PROTOCOL_PROPERTY = "logfeeder.metrics.collector.protocol";
+ public static final String METRICS_COLLECTOR_PORT_PROPERTY = "logfeeder.metrics.collector.port";
+ public static final String METRICS_COLLECTOR_HOSTS_PROPERTY = "logfeeder.metrics.collector.hosts";
+ public static final String METRICS_COLLECTOR_PATH_PROPERTY = "logfeeder.metrics.collector.path";
+
+ public static final String LOG_FILTER_ENABLE_PROPERTY = "logfeeder.log.filter.enable";
+ public static final String INCLUDE_DEFAULT_LEVEL_PROPERTY = "logfeeder.include.default.level";
+
+ public static final String CONFIG_DIR_PROPERTY = "logfeeder.config.dir";
+ public static final String CONFIG_FILES_PROPERTY = "logfeeder.config.files";
+
+ public static final String SIMULATE_INPUT_NUMBER_PROPERTY = "logfeeder.simulate.input_number";
+ public static final int DEFAULT_SIMULATE_INPUT_NUMBER = 0;
+ public static final String SIMULATE_LOG_LEVEL_PROPERTY = "logfeeder.simulate.log_level";
+ public static final String DEFAULT_SIMULATE_LOG_LEVEL = "WARN";
+ public static final String SIMULATE_NUMBER_OF_WORDS_PROPERTY = "logfeeder.simulate.number_of_words";
+ public static final int DEFAULT_SIMULATE_NUMBER_OF_WORDS = 1000;
+ public static final String SIMULATE_MIN_LOG_WORDS_PROPERTY = "logfeeder.simulate.min_log_words";
+ public static final int DEFAULT_SIMULATE_MIN_LOG_WORDS = 5;
+ public static final String SIMULATE_MAX_LOG_WORDS_PROPERTY = "logfeeder.simulate.max_log_words";
+ public static final int DEFAULT_SIMULATE_MAX_LOG_WORDS = 5;
+ public static final String SIMULATE_SLEEP_MILLISECONDS_PROPERTY = "logfeeder.simulate.sleep_milliseconds";
+ public static final int DEFAULT_SIMULATE_SLEEP_MILLISECONDS = 10000;
+ public static final String SIMULATE_LOG_IDS_PROPERTY = "logfeeder.simulate.log_ids";
+
+ public static final String SOLR_KERBEROS_ENABLE_PROPERTY = "logfeeder.solr.kerberos.enable";
+ public static final boolean DEFAULT_SOLR_KERBEROS_ENABLE = false;
+ public static final String DEFAULT_SOLR_JAAS_FILE = "/etc/security/keytabs/logsearch_solr.service.keytab";
+ public static final String SOLR_JAAS_FILE_PROPERTY = "logfeeder.solr.jaas.file";
+
+ public static final String CACHE_ENABLED_PROPERTY = "logfeeder.cache.enabled";
+ public static final boolean DEFAULT_CACHE_ENABLED = false;
+ public static final String CACHE_KEY_FIELD_PROPERTY = "logfeeder.cache.key.field";
+ public static final String DEFAULT_CACHE_KEY_FIELD = "log_message";
+ public static final String CACHE_SIZE_PROPERTY = "logfeeder.cache.size";
+ public static final int DEFAULT_CACHE_SIZE = 100;
+ public static final String CACHE_LAST_DEDUP_ENABLED_PROPERTY = "logfeeder.cache.last.dedup.enabled";
+ public static final boolean DEFAULT_CACHE_LAST_DEDUP_ENABLED = false;
+ public static final String CACHE_DEDUP_INTERVAL_PROPERTY = "logfeeder.cache.dedup.interval";
+ public static final long DEFAULT_CACHE_DEDUP_INTERVAL = 1000;
+
+ public static final String CHECKPOINT_FOLDER_PROPERTY = "logfeeder.checkpoint.folder";
+ public static final String CHECKPOINT_EXTENSION_PROPERTY = "logfeeder.checkpoint.extension";
+ public static final String DEFAULT_CHECKPOINT_EXTENSION = ".cp";
+
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/conf/ApplicationConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/conf/ApplicationConfig.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/conf/ApplicationConfig.java
new file mode 100644
index 0000000..cfb6c78
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/conf/ApplicationConfig.java
@@ -0,0 +1,107 @@
+/*
+ * 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.logfeeder.conf;
+
+import com.google.common.collect.Maps;
+import org.apache.ambari.logfeeder.common.ConfigHandler;
+import org.apache.ambari.logfeeder.common.LogFeederConstants;
+import org.apache.ambari.logfeeder.input.InputConfigUploader;
+import org.apache.ambari.logfeeder.input.InputManager;
+import org.apache.ambari.logfeeder.loglevelfilter.LogLevelFilterHandler;
+import org.apache.ambari.logfeeder.metrics.MetricsManager;
+import org.apache.ambari.logfeeder.metrics.StatsLogger;
+import org.apache.ambari.logfeeder.output.OutputManager;
+import org.apache.ambari.logsearch.config.api.LogSearchConfigFactory;
+import org.apache.ambari.logsearch.config.api.LogSearchConfigLogFeeder;
+import org.apache.ambari.logsearch.config.zookeeper.LogSearchConfigLogFeederZK;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.DependsOn;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
+
+import javax.inject.Inject;
+
+@Configuration
+@PropertySource(value = {
+ "classpath:" + LogFeederConstants.LOGFEEDER_PROPERTIES_FILE
+})
+public class ApplicationConfig {
+
+ @Inject
+ private LogFeederProps logFeederProps;
+
+ @Bean
+ public static PropertySourcesPlaceholderConfigurer propertyConfigurer() {
+ return new PropertySourcesPlaceholderConfigurer();
+ }
+
+ @Bean
+ public LogFeederSecurityConfig logFeederSecurityConfig() {
+ return new LogFeederSecurityConfig();
+ }
+
+ @Bean
+ @DependsOn("logSearchConfigLogFeeder")
+ public ConfigHandler configHandler() throws Exception {
+ return new ConfigHandler(logSearchConfigLogFeeder());
+ }
+
+ @Bean
+ @DependsOn("logFeederSecurityConfig")
+ public LogSearchConfigLogFeeder logSearchConfigLogFeeder() throws Exception {
+ return LogSearchConfigFactory.createLogSearchConfigLogFeeder(
+ Maps.fromProperties(logFeederProps.getProperties()),
+ logFeederProps.getClusterName(),
+ LogSearchConfigLogFeederZK.class,false);
+ }
+
+ @Bean
+ public MetricsManager metricsManager() {
+ return new MetricsManager();
+ }
+
+ @Bean
+ @DependsOn("configHandler")
+ public LogLevelFilterHandler logLevelFilterHandler() throws Exception {
+ return new LogLevelFilterHandler(logSearchConfigLogFeeder());
+ }
+
+ @Bean
+ @DependsOn({"configHandler", "logSearchConfigLogFeeder", "logLevelFilterHandler"})
+ public InputConfigUploader inputConfigUploader() {
+ return new InputConfigUploader();
+ }
+
+ @Bean
+ @DependsOn("inputConfigUploader")
+ public StatsLogger statsLogger() {
+ return new StatsLogger();
+ }
+
+ @Bean
+ public InputManager inputManager() {
+ return new InputManager();
+ }
+
+ @Bean
+ public OutputManager outputManager() {
+ return new OutputManager();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/conf/InputSimulateConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/conf/InputSimulateConfig.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/conf/InputSimulateConfig.java
new file mode 100644
index 0000000..cf087f9
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/conf/InputSimulateConfig.java
@@ -0,0 +1,154 @@
+/*
+ * 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.logfeeder.conf;
+
+import org.apache.ambari.logfeeder.common.LogFeederConstants;
+import org.apache.ambari.logsearch.config.api.LogSearchPropertyDescription;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class InputSimulateConfig {
+
+ @LogSearchPropertyDescription(
+ name = LogFeederConstants.SIMULATE_INPUT_NUMBER_PROPERTY,
+ description = "The number of the simulator instances to run with. O means no simulation.",
+ examples = {"10"},
+ defaultValue = LogFeederConstants.DEFAULT_SIMULATE_INPUT_NUMBER + "",
+ sources = {LogFeederConstants.LOGFEEDER_PROPERTIES_FILE}
+ )
+ @Value("${"+ LogFeederConstants.SIMULATE_INPUT_NUMBER_PROPERTY + ":0}")
+ private Integer simulateInputNumber;
+
+ @LogSearchPropertyDescription(
+ name = LogFeederConstants.SIMULATE_LOG_LEVEL_PROPERTY,
+ description = "The log level to create the simulated log entries with.",
+ examples = {"INFO"},
+ defaultValue = LogFeederConstants.DEFAULT_SIMULATE_LOG_LEVEL,
+ sources = {LogFeederConstants.LOGFEEDER_PROPERTIES_FILE}
+ )
+ @Value("${"+ LogFeederConstants.SIMULATE_LOG_LEVEL_PROPERTY + ":"+ LogFeederConstants.DEFAULT_SIMULATE_LOG_LEVEL + "}")
+ private String simulateLogLevel;
+
+ @LogSearchPropertyDescription(
+ name = LogFeederConstants.SIMULATE_NUMBER_OF_WORDS_PROPERTY,
+ description = "The size of the set of words that may be used to create the simulated log entries with.",
+ examples = {"100"},
+ defaultValue = LogFeederConstants.DEFAULT_SIMULATE_NUMBER_OF_WORDS + "",
+ sources = {LogFeederConstants.LOGFEEDER_PROPERTIES_FILE}
+ )
+ @Value("${" + LogFeederConstants.SIMULATE_NUMBER_OF_WORDS_PROPERTY + ":" + LogFeederConstants.DEFAULT_SIMULATE_NUMBER_OF_WORDS + "}")
+ private Integer simulateNumberOfWords;
+
+ @LogSearchPropertyDescription(
+ name = LogFeederConstants.SIMULATE_MIN_LOG_WORDS_PROPERTY,
+ description = "The minimum number of words in a simulated log entry.",
+ examples = {"3"},
+ defaultValue = LogFeederConstants.DEFAULT_SIMULATE_MIN_LOG_WORDS + "",
+ sources = {LogFeederConstants.LOGFEEDER_PROPERTIES_FILE}
+ )
+ @Value("${" + LogFeederConstants.SIMULATE_MIN_LOG_WORDS_PROPERTY + ":" + LogFeederConstants.DEFAULT_SIMULATE_MIN_LOG_WORDS + "}")
+ private Integer simulateMinLogWords;
+
+ @LogSearchPropertyDescription(
+ name = LogFeederConstants.SIMULATE_MAX_LOG_WORDS_PROPERTY,
+ description = "The maximum number of words in a simulated log entry.",
+ examples = {"8"},
+ defaultValue = LogFeederConstants.DEFAULT_SIMULATE_MAX_LOG_WORDS + "",
+ sources = {LogFeederConstants.LOGFEEDER_PROPERTIES_FILE}
+ )
+ @Value("${" + LogFeederConstants.SIMULATE_MAX_LOG_WORDS_PROPERTY + ":" + LogFeederConstants.DEFAULT_SIMULATE_MAX_LOG_WORDS + "}")
+ private Integer simulateMaxLogWords;
+
+ @LogSearchPropertyDescription(
+ name = LogFeederConstants.SIMULATE_SLEEP_MILLISECONDS_PROPERTY,
+ description = "The milliseconds to sleep between creating two simulated log entries.",
+ examples = {"5000"},
+ defaultValue = LogFeederConstants.DEFAULT_SIMULATE_SLEEP_MILLISECONDS + "",
+ sources = {LogFeederConstants.LOGFEEDER_PROPERTIES_FILE}
+ )
+ @Value("${" + LogFeederConstants.SIMULATE_SLEEP_MILLISECONDS_PROPERTY + ":" + LogFeederConstants.DEFAULT_SIMULATE_SLEEP_MILLISECONDS + "}")
+ private Integer simulateSleepMilliseconds;
+
+ @LogSearchPropertyDescription(
+ name = LogFeederConstants.SIMULATE_LOG_IDS_PROPERTY,
+ description = "The comma separated list of log ids for which to create the simulated log entries.",
+ examples = {"ambari_server,zookeeper,infra_solr,logsearch_app"},
+ defaultValue = "The log ids of the installed services in the cluster",
+ sources = {LogFeederConstants.LOGFEEDER_PROPERTIES_FILE}
+ )
+ @Value("${" + LogFeederConstants.SIMULATE_LOG_IDS_PROPERTY + ":}")
+ private String simulateLogIds;
+
+ public Integer getSimulateInputNumber() {
+ return simulateInputNumber;
+ }
+
+ public void setSimulateInputNumber(Integer simulateInputNumber) {
+ this.simulateInputNumber = simulateInputNumber;
+ }
+
+ public String getSimulateLogLevel() {
+ return simulateLogLevel;
+ }
+
+ public void setSimulateLogLevel(String simulateLogLevel) {
+ this.simulateLogLevel = simulateLogLevel;
+ }
+
+ public Integer getSimulateNumberOfWords() {
+ return simulateNumberOfWords;
+ }
+
+ public void setSimulateNumberOfWords(Integer simulateNumberOfWords) {
+ this.simulateNumberOfWords = simulateNumberOfWords;
+ }
+
+ public Integer getSimulateMinLogWords() {
+ return simulateMinLogWords;
+ }
+
+ public void setSimulateMinLogWords(Integer simulateMinLogWords) {
+ this.simulateMinLogWords = simulateMinLogWords;
+ }
+
+ public Integer getSimulateMaxLogWords() {
+ return simulateMaxLogWords;
+ }
+
+ public void setSimulateMaxLogWords(Integer simulateMaxLogWords) {
+ this.simulateMaxLogWords = simulateMaxLogWords;
+ }
+
+ public Integer getSimulateSleepMilliseconds() {
+ return simulateSleepMilliseconds;
+ }
+
+ public void setSimulateSleepMilliseconds(Integer simulateSleepMilliseconds) {
+ this.simulateSleepMilliseconds = simulateSleepMilliseconds;
+ }
+
+ public String getSimulateLogIds() {
+ return simulateLogIds;
+ }
+
+ public void setSimulateLogIds(String simulateLogIds) {
+ this.simulateLogIds = simulateLogIds;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/conf/LogEntryCacheConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/conf/LogEntryCacheConfig.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/conf/LogEntryCacheConfig.java
new file mode 100644
index 0000000..353bdc1
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/conf/LogEntryCacheConfig.java
@@ -0,0 +1,118 @@
+/*
+ * 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.logfeeder.conf;
+
+import org.apache.ambari.logfeeder.common.LogFeederConstants;
+import org.apache.ambari.logsearch.config.api.LogSearchPropertyDescription;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class LogEntryCacheConfig {
+
+ @LogSearchPropertyDescription(
+ name = LogFeederConstants.CACHE_ENABLED_PROPERTY,
+ description = "Enables the usage of a cache to avoid duplications.",
+ examples = {"true"},
+ defaultValue = LogFeederConstants.DEFAULT_CACHE_ENABLED + "",
+ sources = {LogFeederConstants.LOGFEEDER_PROPERTIES_FILE}
+ )
+ @Value("${" + LogFeederConstants.CACHE_ENABLED_PROPERTY + ":" + LogFeederConstants.DEFAULT_CACHE_ENABLED + "}")
+ private boolean cacheEnabled;
+
+ @LogSearchPropertyDescription(
+ name = LogFeederConstants.CACHE_KEY_FIELD_PROPERTY,
+ description = "The field which's value should be cached and should be checked for repetitions.",
+ examples = {"some_field_prone_to_repeating_value"},
+ defaultValue = LogFeederConstants.DEFAULT_CACHE_KEY_FIELD,
+ sources = {LogFeederConstants.LOGFEEDER_PROPERTIES_FILE}
+ )
+ @Value("${" + LogFeederConstants.CACHE_KEY_FIELD_PROPERTY + ":" + LogFeederConstants.DEFAULT_CACHE_KEY_FIELD + "}")
+ private String cacheKeyField;
+
+ @LogSearchPropertyDescription(
+ name = LogFeederConstants.CACHE_SIZE_PROPERTY,
+ description = "The number of log entries to cache in order to avoid duplications.",
+ examples = {"50"},
+ defaultValue = LogFeederConstants.DEFAULT_CACHE_SIZE + "",
+ sources = {LogFeederConstants.LOGFEEDER_PROPERTIES_FILE}
+ )
+ @Value("${" + LogFeederConstants.CACHE_SIZE_PROPERTY + ":" + LogFeederConstants.DEFAULT_CACHE_SIZE + "}")
+ private Integer cacheSize;
+
+ @LogSearchPropertyDescription(
+ name = LogFeederConstants.CACHE_LAST_DEDUP_ENABLED_PROPERTY,
+ description = "Enable filtering directly repeating log entries irrelevant of the time spent between them.",
+ examples = {"true"},
+ defaultValue = LogFeederConstants.DEFAULT_CACHE_LAST_DEDUP_ENABLED + "",
+ sources = {LogFeederConstants.LOGFEEDER_PROPERTIES_FILE}
+ )
+ @Value("${" + LogFeederConstants.CACHE_LAST_DEDUP_ENABLED_PROPERTY + ":" + LogFeederConstants.DEFAULT_CACHE_LAST_DEDUP_ENABLED + "}")
+ private Boolean cacheLastDedupEnabled;
+
+ @LogSearchPropertyDescription(
+ name = LogFeederConstants.CACHE_DEDUP_INTERVAL_PROPERTY,
+ description = "Maximum number of milliseconds between two identical messages to be filtered out.",
+ examples = {"500"},
+ defaultValue = LogFeederConstants.DEFAULT_CACHE_DEDUP_INTERVAL + "",
+ sources = {LogFeederConstants.LOGFEEDER_PROPERTIES_FILE}
+ )
+ @Value("${" + LogFeederConstants.CACHE_DEDUP_INTERVAL_PROPERTY + ":" + LogFeederConstants.DEFAULT_CACHE_DEDUP_INTERVAL + "}")
+ private String cacheDedupInterval;
+
+ public boolean isCacheEnabled() {
+ return cacheEnabled;
+ }
+
+ public void setCacheEnabled(boolean cacheEnabled) {
+ this.cacheEnabled = cacheEnabled;
+ }
+
+ public String getCacheKeyField() {
+ return cacheKeyField;
+ }
+
+ public void setCacheKeyField(String cacheKeyField) {
+ this.cacheKeyField = cacheKeyField;
+ }
+
+ public Integer getCacheSize() {
+ return cacheSize;
+ }
+
+ public void setCacheSize(Integer cacheSize) {
+ this.cacheSize = cacheSize;
+ }
+
+ public boolean isCacheLastDedupEnabled() {
+ return cacheLastDedupEnabled;
+ }
+
+ public void setCacheLastDedupEnabled(boolean cacheLastDedupEnabled) {
+ this.cacheLastDedupEnabled = cacheLastDedupEnabled;
+ }
+
+ public String getCacheDedupInterval() {
+ return cacheDedupInterval;
+ }
+
+ public void setCacheDedupInterval(String cacheDedupInterval) {
+ this.cacheDedupInterval = cacheDedupInterval;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/conf/LogFeederProps.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/conf/LogFeederProps.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/conf/LogFeederProps.java
new file mode 100644
index 0000000..367d1cd
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/conf/LogFeederProps.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.
+ */
+package org.apache.ambari.logfeeder.conf;
+
+import org.apache.ambari.logfeeder.common.LogFeederConstants;
+import org.apache.ambari.logsearch.config.api.LogSearchPropertyDescription;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.env.AbstractEnvironment;
+import org.springframework.core.env.Environment;
+import org.springframework.core.env.MapPropertySource;
+import org.springframework.core.env.MutablePropertySources;
+import org.springframework.core.io.support.ResourcePropertySource;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Properties;
+import java.util.stream.Stream;
+
+@Configuration
+public class LogFeederProps {
+
+ @Inject
+ private Environment env;
+
+ private Properties properties;
+
+ @LogSearchPropertyDescription(
+ name = LogFeederConstants.CLUSTER_NAME_PROPERTY,
+ description = "The name of the cluster the Log Feeder program runs in.",
+ examples = {"cl1"},
+ sources = {LogFeederConstants.LOGFEEDER_PROPERTIES_FILE}
+ )
+ @Value("${" + LogFeederConstants.CLUSTER_NAME_PROPERTY + "}")
+ private String clusterName;
+
+ @LogSearchPropertyDescription(
+ name = LogFeederConstants.TMP_DIR_PROPERTY,
+ description = "The tmp dir used for creating temporary files.",
+ examples = {"/tmp/"},
+ defaultValue = "java.io.tmpdir",
+ sources = {LogFeederConstants.LOGFEEDER_PROPERTIES_FILE}
+ )
+ @Value("${"+ LogFeederConstants.TMP_DIR_PROPERTY + ":#{systemProperties['java.io.tmpdir']}}")
+ private String tmpDir;
+
+ @LogSearchPropertyDescription(
+ name = LogFeederConstants.LOG_FILTER_ENABLE_PROPERTY,
+ description = "Enables the filtering of the log entries by log level filters.",
+ examples = {"true"},
+ defaultValue = "false",
+ sources = {LogFeederConstants.LOGFEEDER_PROPERTIES_FILE}
+ )
+ @Value("${"+ LogFeederConstants.LOG_FILTER_ENABLE_PROPERTY + "}")
+ private boolean logLevelFilterEnabled;
+
+ @LogSearchPropertyDescription(
+ name = LogFeederConstants.INCLUDE_DEFAULT_LEVEL_PROPERTY,
+ description = "Comma separated list of the default log levels to be enabled by the filtering.",
+ examples = {"FATAL,ERROR,WARN"},
+ sources = {LogFeederConstants.LOGFEEDER_PROPERTIES_FILE}
+ )
+ @Value("#{'${" + LogFeederConstants.INCLUDE_DEFAULT_LEVEL_PROPERTY + ":}'.split(',')}")
+ private List<String> includeDefaultLogLevels;
+
+ @LogSearchPropertyDescription(
+ name = LogFeederConstants.CONFIG_DIR_PROPERTY,
+ description = "The directory where shipper configuration files are looked for.",
+ examples = {"/etc/ambari-logsearch-logfeeder/conf"},
+ defaultValue = "etc/ambari-logsearch-logfeeder/conf",
+ sources = {LogFeederConstants.LOGFEEDER_PROPERTIES_FILE}
+ )
+ @Value("${"+ LogFeederConstants.CONFIG_DIR_PROPERTY + ":/etc/ambari-logsearch-logfeeder/conf}")
+ private String confDir;
+
+ @LogSearchPropertyDescription(
+ name = LogFeederConstants.CONFIG_FILES_PROPERTY,
+ description = "Comma separated list of the config files containing global / output configurations.",
+ examples = {"global.json,output.json", "/etc/ambari-logsearch-logfeeder/conf/global.json"},
+ sources = {LogFeederConstants.LOGFEEDER_PROPERTIES_FILE}
+ )
+ @Value("${"+ LogFeederConstants.CONFIG_FILES_PROPERTY + ":}")
+ private String configFiles;
+
+ @LogSearchPropertyDescription(
+ name = LogFeederConstants.CHECKPOINT_EXTENSION_PROPERTY,
+ description = "The extension used for checkpoint files.",
+ examples = {"ckp"},
+ defaultValue = LogFeederConstants.DEFAULT_CHECKPOINT_EXTENSION,
+ sources = {LogFeederConstants.LOGFEEDER_PROPERTIES_FILE}
+ )
+ @Value("${" + LogFeederConstants.CHECKPOINT_EXTENSION_PROPERTY + ":" + LogFeederConstants.DEFAULT_CHECKPOINT_EXTENSION + "}")
+ private String checkPointExtension;
+
+ @LogSearchPropertyDescription(
+ name = LogFeederConstants.CHECKPOINT_FOLDER_PROPERTY,
+ description = "The folder where checkpoint files are stored.",
+ examples = {"/etc/ambari-logsearch-logfeeder/conf/checkpoints"},
+ sources = {LogFeederConstants.LOGFEEDER_PROPERTIES_FILE}
+ )
+ @Value("${" + LogFeederConstants.CHECKPOINT_FOLDER_PROPERTY + ":/etc/ambari-logsearch-logfeeder/conf/checkpoints}")
+ public String checkpointFolder;
+
+ @Inject
+ private LogEntryCacheConfig logEntryCacheConfig;
+
+ @Inject
+ private InputSimulateConfig inputSimulateConfig;
+
+ @Inject
+ private LogFeederSecurityConfig logFeederSecurityConfig;
+
+ public String getClusterName() {
+ return clusterName;
+ }
+
+ public void setClusterName(String clusterName) {
+ this.clusterName = clusterName;
+ }
+
+ public Properties getProperties() {
+ return properties;
+ }
+
+ public String getTmpDir() {
+ return tmpDir;
+ }
+
+ public boolean isLogLevelFilterEnabled() {
+ return logLevelFilterEnabled;
+ }
+
+ public List<String> getIncludeDefaultLogLevels() {
+ return includeDefaultLogLevels;
+ }
+
+ public String getConfDir() {
+ return confDir;
+ }
+
+ public void setConfDir(String confDir) {
+ this.confDir = confDir;
+ }
+
+ public String getConfigFiles() {
+ return configFiles;
+ }
+
+ public void setConfigFiles(String configFiles) {
+ this.configFiles = configFiles;
+ }
+
+ public LogEntryCacheConfig getLogEntryCacheConfig() {
+ return logEntryCacheConfig;
+ }
+
+ public void setLogEntryCacheConfig(LogEntryCacheConfig logEntryCacheConfig) {
+ this.logEntryCacheConfig = logEntryCacheConfig;
+ }
+
+ public InputSimulateConfig getInputSimulateConfig() {
+ return inputSimulateConfig;
+ }
+
+ public void setInputSimulateConfig(InputSimulateConfig inputSimulateConfig) {
+ this.inputSimulateConfig = inputSimulateConfig;
+ }
+
+ public LogFeederSecurityConfig getLogFeederSecurityConfig() {
+ return logFeederSecurityConfig;
+ }
+
+ public void setLogFeederSecurityConfig(LogFeederSecurityConfig logFeederSecurityConfig) {
+ this.logFeederSecurityConfig = logFeederSecurityConfig;
+ }
+
+ public String getCheckPointExtension() {
+ return checkPointExtension;
+ }
+
+ public void setCheckPointExtension(String checkPointExtension) {
+ this.checkPointExtension = checkPointExtension;
+ }
+
+ public String getCheckpointFolder() {
+ return checkpointFolder;
+ }
+
+ public void setCheckpointFolder(String checkpointFolder) {
+ this.checkpointFolder = checkpointFolder;
+ }
+
+ @PostConstruct
+ public void init() {
+ properties = new Properties();
+ MutablePropertySources propSrcs = ((AbstractEnvironment) env).getPropertySources();
+ ResourcePropertySource propertySource = (ResourcePropertySource) propSrcs.get("class path resource [" +
+ LogFeederConstants.LOGFEEDER_PROPERTIES_FILE + "]");
+ if (propertySource != null) {
+ Stream.of(propertySource)
+ .map(MapPropertySource::getPropertyNames)
+ .flatMap(Arrays::<String>stream)
+ .forEach(propName -> properties.setProperty(propName, env.getProperty(propName)));
+ } else {
+ throw new IllegalArgumentException("Cannot find logfeeder.properties on the classpath");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/conf/LogFeederSecurityConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/conf/LogFeederSecurityConfig.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/conf/LogFeederSecurityConfig.java
new file mode 100644
index 0000000..8a45753
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/conf/LogFeederSecurityConfig.java
@@ -0,0 +1,189 @@
+/*
+ * 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.logfeeder.conf;
+
+import org.apache.ambari.logfeeder.common.LogFeederConstants;
+import org.apache.ambari.logsearch.config.api.LogSearchPropertyDescription;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.ArrayUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+
+import javax.annotation.PostConstruct;
+import java.io.File;
+import java.nio.charset.Charset;
+
+public class LogFeederSecurityConfig {
+
+ private static final Logger LOG = LoggerFactory.getLogger(LogFeederSecurityConfig.class);
+
+ private static final String KEYSTORE_LOCATION_ARG = "javax.net.ssl.keyStore";
+ private static final String TRUSTSTORE_LOCATION_ARG = "javax.net.ssl.trustStore";
+ private static final String KEYSTORE_TYPE_ARG = "javax.net.ssl.keyStoreType";
+ private static final String TRUSTSTORE_TYPE_ARG = "javax.net.ssl.trustStoreType";
+ private static final String KEYSTORE_PASSWORD_ARG = "javax.net.ssl.keyStorePassword";
+ private static final String TRUSTSTORE_PASSWORD_ARG = "javax.net.ssl.trustStorePassword";
+ private static final String KEYSTORE_PASSWORD_PROPERTY_NAME = "logfeeder_keystore_password";
+ private static final String TRUSTSTORE_PASSWORD_PROPERTY_NAME = "logfeeder_truststore_password";
+ private static final String KEYSTORE_PASSWORD_FILE = "ks_pass.txt";
+ private static final String TRUSTSTORE_PASSWORD_FILE = "ts_pass.txt";
+
+ private static final String LOGFEEDER_CERT_DEFAULT_FOLDER = "/etc/ambari-logsearch-portal/conf/keys";
+ private static final String LOGFEEDER_STORE_DEFAULT_PASSWORD = "bigdata";
+
+ private static final String CREDENTIAL_STORE_PROVIDER_PATH_PROPERTY = "hadoop.security.credential.provider.path";
+
+ @LogSearchPropertyDescription(
+ name = CREDENTIAL_STORE_PROVIDER_PATH_PROPERTY,
+ description = "The jceks file that provides passwords.",
+ examples = {"jceks://file/etc/ambari-logsearch-logfeeder/conf/logfeeder.jceks"},
+ sources = {LogFeederConstants.LOGFEEDER_PROPERTIES_FILE}
+ )
+ @Value("${"+ CREDENTIAL_STORE_PROVIDER_PATH_PROPERTY + ":}")
+ private String credentialStoreProviderPath;
+
+ @LogSearchPropertyDescription(
+ name = LogFeederConstants.SOLR_JAAS_FILE_PROPERTY,
+ description = "The jaas file used for solr.",
+ examples = {"/etc/ambari-logsearch-logfeeder/conf/logfeeder_jaas.conf"},
+ defaultValue = LogFeederConstants.DEFAULT_SOLR_JAAS_FILE,
+ sources = {LogFeederConstants.LOGFEEDER_PROPERTIES_FILE}
+ )
+ @Value("${" + LogFeederConstants.SOLR_JAAS_FILE_PROPERTY + ":" + LogFeederConstants.DEFAULT_SOLR_JAAS_FILE + "}")
+ private String solrJaasFile;
+
+ @LogSearchPropertyDescription(
+ name = LogFeederConstants.SOLR_KERBEROS_ENABLE_PROPERTY,
+ description = "Enables using kerberos for accessing solr.",
+ examples = {"true"},
+ defaultValue = LogFeederConstants.DEFAULT_SOLR_KERBEROS_ENABLE + "",
+ sources = {LogFeederConstants.LOGFEEDER_PROPERTIES_FILE}
+ )
+ @Value("${"+ LogFeederConstants.SOLR_KERBEROS_ENABLE_PROPERTY + ":" + LogFeederConstants.DEFAULT_SOLR_KERBEROS_ENABLE + "}")
+ private Boolean solrKerberosEnabled;
+
+ public String getKeyStoreLocation() {
+ return System.getProperty(KEYSTORE_LOCATION_ARG);
+ }
+
+ public String getKeyStoreType() {
+ return System.getProperty(KEYSTORE_TYPE_ARG);
+ }
+
+ public String getKeyStorePassword() {
+ return System.getProperty(KEYSTORE_PASSWORD_ARG);
+ }
+
+ public String getTrustStoreLocation() {
+ return System.getProperty(TRUSTSTORE_LOCATION_ARG);
+ }
+
+ public String getTrustStoreType() {
+ return System.getProperty(TRUSTSTORE_TYPE_ARG);
+ }
+
+ public String getTrustStorePassword() {
+ return System.getProperty(TRUSTSTORE_PASSWORD_ARG);
+ }
+
+ public String getCredentialStoreProviderPath() {
+ return credentialStoreProviderPath;
+ }
+
+ public void setCredentialStoreProviderPath(String credentialStoreProviderPath) {
+ this.credentialStoreProviderPath = credentialStoreProviderPath;
+ }
+
+ public String getSolrJaasFile() {
+ return solrJaasFile;
+ }
+
+ public void setSolrJaasFile(String solrJaasFile) {
+ this.solrJaasFile = solrJaasFile;
+ }
+
+ public boolean isSolrKerberosEnabled() {
+ return solrKerberosEnabled;
+ }
+
+ public void setSolrKerberosEnabled(Boolean solrKerberosEnabled) {
+ this.solrKerberosEnabled = solrKerberosEnabled;
+ }
+
+ @PostConstruct
+ public void ensureStorePasswords() {
+ ensureStorePassword(KEYSTORE_LOCATION_ARG, KEYSTORE_PASSWORD_ARG, KEYSTORE_PASSWORD_PROPERTY_NAME, KEYSTORE_PASSWORD_FILE);
+ ensureStorePassword(TRUSTSTORE_LOCATION_ARG, TRUSTSTORE_PASSWORD_ARG, TRUSTSTORE_PASSWORD_PROPERTY_NAME, TRUSTSTORE_PASSWORD_FILE);
+ }
+
+ private void ensureStorePassword(String locationArg, String pwdArg, String propertyName, String fileName) {
+ if (StringUtils.isNotEmpty(System.getProperty(locationArg)) && StringUtils.isEmpty(System.getProperty(pwdArg))) {
+ String password = getPassword(propertyName, fileName);
+ System.setProperty(pwdArg, password);
+ }
+ }
+
+ private String getPassword(String propertyName, String fileName) {
+ String credentialStorePassword = getPasswordFromCredentialStore(propertyName);
+ if (credentialStorePassword != null) {
+ return credentialStorePassword;
+ }
+
+ String filePassword = getPasswordFromFile(fileName);
+ if (filePassword != null) {
+ return filePassword;
+ }
+
+ return LOGFEEDER_STORE_DEFAULT_PASSWORD;
+ }
+
+ private String getPasswordFromCredentialStore(String propertyName) {
+ try {
+ if (StringUtils.isEmpty(credentialStoreProviderPath)) {
+ return null;
+ }
+
+ org.apache.hadoop.conf.Configuration config = new org.apache.hadoop.conf.Configuration();
+ config.set(CREDENTIAL_STORE_PROVIDER_PATH_PROPERTY, credentialStoreProviderPath);
+ char[] passwordChars = config.getPassword(propertyName);
+ return (ArrayUtils.isNotEmpty(passwordChars)) ? new String(passwordChars) : null;
+ } catch (Exception e) {
+ LOG.warn(String.format("Could not load password %s from credential store, using default password", propertyName));
+ return null;
+ }
+ }
+
+ private String getPasswordFromFile(String fileName) {
+ try {
+ File pwdFile = new File(LOGFEEDER_CERT_DEFAULT_FOLDER, fileName);
+ if (!pwdFile.exists()) {
+ FileUtils.writeStringToFile(pwdFile, LOGFEEDER_STORE_DEFAULT_PASSWORD, Charset.defaultCharset());
+ return LOGFEEDER_STORE_DEFAULT_PASSWORD;
+ } else {
+ return FileUtils.readFileToString(pwdFile, Charset.defaultCharset());
+ }
+ } catch (Exception e) {
+ LOG.warn("Exception occurred during read/write password file for keystore/truststore.", e);
+ return null;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/conf/MetricsCollectorConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/conf/MetricsCollectorConfig.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/conf/MetricsCollectorConfig.java
new file mode 100644
index 0000000..4b3c6fb
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/conf/MetricsCollectorConfig.java
@@ -0,0 +1,113 @@
+/*
+ * 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.logfeeder.conf;
+
+import com.google.common.base.Splitter;
+import org.apache.ambari.logfeeder.common.LogFeederConstants;
+import org.apache.ambari.logsearch.config.api.LogSearchPropertyDescription;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+import javax.annotation.PostConstruct;
+import java.util.List;
+
+@Configuration
+public class MetricsCollectorConfig {
+
+ @LogSearchPropertyDescription(
+ name = LogFeederConstants.METRICS_COLLECTOR_HOSTS_PROPERTY,
+ description = "Comma separtaed list of metric collector hosts.",
+ examples = {"c6401.ambari.apache.org,c6402.ambari.apache.org"},
+ sources = {LogFeederConstants.LOGFEEDER_PROPERTIES_FILE}
+ )
+ @Value("${" + LogFeederConstants.METRICS_COLLECTOR_HOSTS_PROPERTY + ":}")
+ private String hostsString;
+
+ private List<String> hosts;
+
+ @LogSearchPropertyDescription(
+ name = LogFeederConstants.METRICS_COLLECTOR_PROTOCOL_PROPERTY,
+ description = "The protocol used by metric collectors.",
+ examples = {"http", "https"},
+ sources = {LogFeederConstants.LOGFEEDER_PROPERTIES_FILE}
+ )
+ @Value("${" + LogFeederConstants.METRICS_COLLECTOR_PROTOCOL_PROPERTY + ":#{NULL}}")
+ private String protocol;
+
+ @LogSearchPropertyDescription(
+ name = LogFeederConstants.METRICS_COLLECTOR_PORT_PROPERTY,
+ description = "The port used by metric collectors.",
+ examples = {"6188"},
+ sources = {LogFeederConstants.LOGFEEDER_PROPERTIES_FILE}
+ )
+ @Value("${" + LogFeederConstants.METRICS_COLLECTOR_PORT_PROPERTY + ":#{NULL}}")
+ private String port;
+
+ @LogSearchPropertyDescription(
+ name = LogFeederConstants.METRICS_COLLECTOR_PATH_PROPERTY,
+ description = "The path used by metric collectors.",
+ examples = {"/ws/v1/timeline/metrics"},
+ sources = {LogFeederConstants.LOGFEEDER_PROPERTIES_FILE}
+ )
+ @Value("${" + LogFeederConstants.METRICS_COLLECTOR_PATH_PROPERTY + ":#{NULL}}")
+ private String path;
+
+ public List<String> getHosts() {
+ return hosts;
+ }
+
+ public void setHosts(List<String> hosts) {
+ this.hosts = hosts;
+ }
+
+ public String getProtocol() {
+ return protocol;
+ }
+
+ public String getPort() {
+ return port;
+ }
+
+ public void setPort(String port) {
+ this.port = port;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ public String getHostsString() {
+ return hostsString;
+ }
+
+ @PostConstruct
+ public void init() {
+ if (StringUtils.isNotBlank(hostsString)) {
+ hosts = Splitter.on(',').splitToList(hostsString);
+ } else {
+ hosts = null;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/Filter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/Filter.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/Filter.java
index 8e8834b..a06b348 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/Filter.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/Filter.java
@@ -26,6 +26,7 @@ import java.util.Map;
import org.apache.ambari.logfeeder.common.ConfigItem;
import org.apache.ambari.logfeeder.common.LogFeederException;
+import org.apache.ambari.logfeeder.conf.LogFeederProps;
import org.apache.ambari.logfeeder.input.Input;
import org.apache.ambari.logfeeder.input.InputMarker;
import org.apache.ambari.logfeeder.mapper.Mapper;
@@ -56,12 +57,12 @@ public abstract class Filter extends ConfigItem {
}
@Override
- public void init() throws Exception {
- super.init();
+ public void init(LogFeederProps logFeederProps) throws Exception {
+ super.init(logFeederProps);
initializePostMapValues();
if (nextFilter != null) {
- nextFilter.init();
+ nextFilter.init(logFeederProps);
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterGrok.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterGrok.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterGrok.java
index fc7a565..f0ef31b 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterGrok.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterGrok.java
@@ -35,6 +35,7 @@ import oi.thekraken.grok.api.Grok;
import oi.thekraken.grok.api.exception.GrokException;
import org.apache.ambari.logfeeder.common.LogFeederException;
+import org.apache.ambari.logfeeder.conf.LogFeederProps;
import org.apache.ambari.logfeeder.input.InputMarker;
import org.apache.ambari.logfeeder.metrics.MetricData;
import org.apache.ambari.logfeeder.util.LogFeederUtil;
@@ -73,13 +74,13 @@ public class FilterGrok extends Filter {
private MetricData grokErrorMetric = new MetricData("filter.error.grok", false);
@Override
- public void init() throws Exception {
- super.init();
+ public void init(LogFeederProps logFeederProps) throws Exception {
+ super.init(logFeederProps);
try {
messagePattern = escapePattern(((FilterGrokDescriptor)filterDescriptor).getMessagePattern());
multilinePattern = escapePattern(((FilterGrokDescriptor)filterDescriptor).getMultilinePattern());
- sourceField = ((FilterGrokDescriptor)filterDescriptor).getSourceField();
+ sourceField = filterDescriptor.getSourceField();
removeSourceField = BooleanUtils.toBooleanDefaultIfNull(filterDescriptor.isRemoveSourceField(), removeSourceField);
LOG.info("init() done. grokPattern=" + messagePattern + ", multilinePattern=" + multilinePattern + ", " +
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterKeyValue.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterKeyValue.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterKeyValue.java
index 8e5aee8..adcf0a4 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterKeyValue.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/filter/FilterKeyValue.java
@@ -25,6 +25,7 @@ import java.util.Map;
import java.util.regex.Pattern;
import org.apache.ambari.logfeeder.common.LogFeederException;
+import org.apache.ambari.logfeeder.conf.LogFeederProps;
import org.apache.ambari.logfeeder.input.InputMarker;
import org.apache.ambari.logfeeder.metrics.MetricData;
import org.apache.ambari.logfeeder.util.LogFeederUtil;
@@ -41,8 +42,8 @@ public class FilterKeyValue extends Filter {
private MetricData errorMetric = new MetricData("filter.error.keyvalue", false);
@Override
- public void init() throws Exception {
- super.init();
+ public void init(LogFeederProps logFeederProps) throws Exception {
+ super.init(logFeederProps);
sourceField = filterDescriptor.getSourceField();
valueSplit = StringUtils.defaultString(((FilterKeyValueDescriptor)filterDescriptor).getValueSplit(), valueSplit);
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/AbstractInputFile.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/AbstractInputFile.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/AbstractInputFile.java
index b021c37..cf295c5 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/AbstractInputFile.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/AbstractInputFile.java
@@ -28,8 +28,8 @@ import java.util.Date;
import java.util.HashMap;
import java.util.Map;
+import org.apache.ambari.logfeeder.conf.LogFeederProps;
import org.apache.ambari.logfeeder.util.FileUtil;
-import org.apache.ambari.logfeeder.util.LogFeederPropertiesUtil;
import org.apache.ambari.logfeeder.util.LogFeederUtil;
import org.apache.ambari.logsearch.config.api.model.inputconfig.InputFileBaseDescriptor;
import org.apache.commons.lang.ObjectUtils;
@@ -55,6 +55,8 @@ public abstract class AbstractInputFile extends Input {
private Map<String, Map<String, Object>> jsonCheckPoints = new HashMap<>();
private Map<String, InputMarker> lastCheckPointInputMarkers = new HashMap<>();
+ private LogFeederProps logFeederProps;
+
@Override
protected String getStatMetricName() {
return "input.files.read_lines";
@@ -66,10 +68,11 @@ public abstract class AbstractInputFile extends Input {
}
@Override
- public void init() throws Exception {
+ public void init(LogFeederProps logFeederProps) throws Exception {
+ this.logFeederProps = logFeederProps;
LOG.info("init() called");
- checkPointExtension = LogFeederPropertiesUtil.getCheckPointExtension();
+ checkPointExtension = logFeederProps.getCheckPointExtension();
// Let's close the file and set it to true after we start monitoring it
setClosed(true);
@@ -86,7 +89,7 @@ public abstract class AbstractInputFile extends Input {
LOG.info("File to monitor " + logPath + ", tail=" + tail + ", isReady=" + isFileReady);
- super.init();
+ super.init(logFeederProps);
}
protected void processFile(File logPathFile, boolean follow) throws FileNotFoundException, IOException {
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/Input.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/Input.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/Input.java
index 972011d..7b9dcd4 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/Input.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/input/Input.java
@@ -24,6 +24,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import org.apache.ambari.logfeeder.conf.LogEntryCacheConfig;
+import org.apache.ambari.logfeeder.conf.LogFeederProps;
import org.apache.ambari.logfeeder.input.cache.LRUCache;
import org.apache.ambari.logfeeder.common.ConfigItem;
import org.apache.ambari.logfeeder.common.LogFeederException;
@@ -31,7 +33,6 @@ import org.apache.ambari.logfeeder.filter.Filter;
import org.apache.ambari.logfeeder.metrics.MetricData;
import org.apache.ambari.logfeeder.output.Output;
import org.apache.ambari.logfeeder.output.OutputManager;
-import org.apache.ambari.logfeeder.util.LogFeederPropertiesUtil;
import org.apache.ambari.logsearch.config.api.model.inputconfig.Conditions;
import org.apache.ambari.logsearch.config.api.model.inputconfig.Fields;
import org.apache.ambari.logsearch.config.api.model.inputconfig.FilterDescriptor;
@@ -49,7 +50,7 @@ public abstract class Input extends ConfigItem implements Runnable {
protected InputManager inputManager;
protected OutputManager outputManager;
- private List<Output> outputList = new ArrayList<Output>();
+ private List<Output> outputList = new ArrayList<>();
private Thread thread;
private String type;
@@ -128,15 +129,15 @@ public abstract class Input extends ConfigItem implements Runnable {
}
@Override
- public void init() throws Exception {
- super.init();
- initCache();
+ public void init(LogFeederProps logFeederProps) throws Exception {
+ super.init(logFeederProps);
+ initCache(logFeederProps.getLogEntryCacheConfig());
tail = BooleanUtils.toBooleanDefaultIfNull(inputDescriptor.isTail(), DEFAULT_TAIL);
useEventMD5 = BooleanUtils.toBooleanDefaultIfNull(inputDescriptor.isUseEventMd5AsId(), DEFAULT_USE_EVENT_MD5);
genEventMD5 = BooleanUtils.toBooleanDefaultIfNull(inputDescriptor.isGenEventMd5(), DEFAULT_GEN_EVENT_MD5);
if (firstFilter != null) {
- firstFilter.init();
+ firstFilter.init(logFeederProps);
}
}
@@ -239,28 +240,28 @@ public abstract class Input extends ConfigItem implements Runnable {
}
}
- private void initCache() {
+ private void initCache(LogEntryCacheConfig cacheConfig) {
boolean cacheEnabled = inputDescriptor.isCacheEnabled() != null
? inputDescriptor.isCacheEnabled()
- : LogFeederPropertiesUtil.isCacheEnabled();
+ : cacheConfig.isCacheEnabled();
if (cacheEnabled) {
String cacheKeyField = inputDescriptor.getCacheKeyField() != null
? inputDescriptor.getCacheKeyField()
- : LogFeederPropertiesUtil.getCacheKeyField();
+ : cacheConfig.getCacheKeyField();
setCacheKeyField(cacheKeyField);
int cacheSize = inputDescriptor.getCacheSize() != null
? inputDescriptor.getCacheSize()
- : LogFeederPropertiesUtil.getCacheSize();
+ : cacheConfig.getCacheSize();
boolean cacheLastDedupEnabled = inputDescriptor.getCacheLastDedupEnabled() != null
? inputDescriptor.getCacheLastDedupEnabled()
- : LogFeederPropertiesUtil.isCacheLastDedupEnabled();
+ : cacheConfig.isCacheLastDedupEnabled();
long cacheDedupInterval = inputDescriptor.getCacheDedupInterval() != null
? inputDescriptor.getCacheDedupInterval()
- : Long.parseLong(LogFeederPropertiesUtil.getCacheDedupInterval());
+ : Long.parseLong(cacheConfig.getCacheDedupInterval());
setCache(new LRUCache(cacheSize, filePath, cacheDedupInterval, cacheLastDedupEnabled));
}
[06/23] ambari git commit: AMBARI-22613 - Hive Queries Failing with
Missing SnappyCodec Compression Type Due to Hive's Use of MapReduce Admin Env
Property (jonathanhurley)
Posted by nc...@apache.org.
AMBARI-22613 - Hive Queries Failing with Missing SnappyCodec Compression Type Due to Hive's Use of MapReduce Admin Env Property (jonathanhurley)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/348bdd66
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/348bdd66
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/348bdd66
Branch: refs/heads/branch-feature-AMBARI-21674
Commit: 348bdd668ecf6964e2c021aeddf547b3f9bb23bf
Parents: ed327bd
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Thu Dec 7 15:51:51 2017 -0500
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Fri Dec 8 07:17:51 2017 -0500
----------------------------------------------------------------------
.../HIVE/0.12.0.2.0/package/scripts/params_linux.py | 2 ++
.../common-services/HIVE/2.1.0.3.0/package/scripts/params_linux.py | 1 +
.../YARN/2.1.0.2.0/configuration-mapred/mapred-site.xml | 2 +-
.../YARN/3.0.0.3.0/configuration-mapred/mapred-site.xml | 2 +-
.../src/main/resources/stacks/HDP/2.6/upgrades/config-upgrade.xml | 2 +-
5 files changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/348bdd66/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
index ea8beaf..20e61d3 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
@@ -109,7 +109,9 @@ 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
+# used to render hadoop configurations, such as writing out its own mapreduce2 configs
hadoop_home = stack_select.get_hadoop_dir("home")
+hadoop_lib_home = stack_select.get_hadoop_dir("lib")
hive_bin = format('{stack_root}/current/{component_directory}/bin')
hive_cmd = os.path.join(hive_bin, "hive")
http://git-wip-us.apache.org/repos/asf/ambari/blob/348bdd66/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 088a540..8bff1c9 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
@@ -106,6 +106,7 @@ component_directory = status_params.component_directory
component_directory_interactive = status_params.component_directory_interactive
hadoop_home = stack_select.get_hadoop_dir("home")
+hadoop_lib_home = stack_select.get_hadoop_dir("lib")
hive_bin = format('{stack_root}/current/{component_directory}/bin')
hive_cmd = os.path.join(hive_bin, "hive")
http://git-wip-us.apache.org/repos/asf/ambari/blob/348bdd66/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 398c9d7..d2359f3 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=./mr-framework/hadoop/lib/native:./mr-framework/hadoop/lib/native/Linux-{{architecture}}-64:{{hadoop_lib_home}}/native/Linux-{{architecture}}-64</value>
+ <value>LD_LIBRARY_PATH=./mr-framework/hadoop/lib/native:./mr-framework/hadoop/lib/native/Linux-{{architecture}}-64:{{hadoop_lib_home}}/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/348bdd66/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 3b31db1..5498321 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=./mr-framework/hadoop/lib/native:./mr-framework/hadoop/lib/native/Linux-{{architecture}}-64:{{hadoop_lib_home}}/native/Linux-{{architecture}}-64</value>
+ <value>LD_LIBRARY_PATH=./mr-framework/hadoop/lib/native:./mr-framework/hadoop/lib/native/Linux-{{architecture}}-64:{{hadoop_lib_home}}/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/348bdd66/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 9311877..9c3d0dd 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
@@ -285,7 +285,7 @@
<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:./mr-framework/hadoop/lib/native/Linux-{{architecture}}-64:{{hadoop_lib_home}}/native/Linux-{{architecture}}-64"/>
+ <set key="mapreduce.admin.user.env" value="LD_LIBRARY_PATH=./mr-framework/hadoop/lib/native:./mr-framework/hadoop/lib/native/Linux-{{architecture}}-64:{{hadoop_lib_home}}/native:{{hadoop_lib_home}}/native/Linux-{{architecture}}-64"/>
</definition>
</changes>
</component>
[19/23] ambari git commit: AMBARI-22639. Log Feeder refactor:
integrate with spring boot (oleewere)
Posted by nc...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/logconfig/LogConfigHandlerTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/logconfig/LogConfigHandlerTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/logconfig/LogConfigHandlerTest.java
deleted file mode 100644
index 46abc63..0000000
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/logconfig/LogConfigHandlerTest.java
+++ /dev/null
@@ -1,148 +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.
- */
-
-package org.apache.ambari.logfeeder.logconfig;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Date;
-
-import static org.easymock.EasyMock.*;
-import static org.junit.Assert.*;
-
-import org.apache.ambari.logfeeder.input.Input;
-import org.apache.ambari.logfeeder.input.InputMarker;
-import org.apache.ambari.logfeeder.loglevelfilter.FilterLogData;
-import org.apache.ambari.logfeeder.loglevelfilter.LogLevelFilterHandler;
-import org.apache.ambari.logfeeder.util.LogFeederPropertiesUtil;
-import org.apache.ambari.logsearch.config.api.LogSearchConfig;
-import org.apache.ambari.logsearch.config.api.model.loglevelfilter.LogLevelFilter;
-import org.apache.commons.lang.time.DateUtils;
-import org.apache.ambari.logsearch.config.zookeeper.model.inputconfig.impl.InputDescriptorImpl;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class LogConfigHandlerTest {
-
- private static InputMarker inputMarkerAudit;
- private static InputMarker inputMarkerService;
- static {
- InputDescriptorImpl auditInputDescriptor = new InputDescriptorImpl() {};
- auditInputDescriptor.setRowtype("audit");
-
- Input auditInput = strictMock(Input.class);
- expect(auditInput.getInputDescriptor()).andReturn(auditInputDescriptor).anyTimes();
- inputMarkerAudit = new InputMarker(auditInput, null, 0);
-
- InputDescriptorImpl serviceInputDescriptor = new InputDescriptorImpl() {};
- serviceInputDescriptor.setRowtype("service");
-
- Input serviceInput = strictMock(Input.class);
- expect(serviceInput.getInputDescriptor()).andReturn(serviceInputDescriptor).anyTimes();
- inputMarkerService = new InputMarker(serviceInput, null, 0);
-
- replay(auditInput, serviceInput);
- }
-
- @BeforeClass
- public static void init() throws Exception {
- LogFeederPropertiesUtil.loadProperties("logfeeder.properties");
-
- LogSearchConfig config = strictMock(LogSearchConfig.class);
- config.createLogLevelFilter(anyString(), anyString(), anyObject(LogLevelFilter.class));
- expectLastCall().anyTimes();
- LogLevelFilterHandler.init(config);
-
- LogLevelFilter logLevelFilter1 = new LogLevelFilter();
- logLevelFilter1.setHosts(Collections.<String> emptyList());
- logLevelFilter1.setDefaultLevels(Arrays.asList("FATAL", "ERROR", "WARN", "INFO"));
- logLevelFilter1.setOverrideLevels(Collections.<String> emptyList());
-
- LogLevelFilter logLevelFilter2 = new LogLevelFilter();
- logLevelFilter2.setHosts(Arrays.asList("host1"));
- logLevelFilter2.setDefaultLevels(Arrays.asList("FATAL", "ERROR", "WARN", "INFO"));
- logLevelFilter2.setOverrideLevels(Arrays.asList("FATAL", "ERROR", "WARN", "INFO", "DEBUG", "TRACE"));
- logLevelFilter2.setExpiryTime(DateUtils.addDays(new Date(), 1));
-
- LogLevelFilter logLevelFilter3 = new LogLevelFilter();
- logLevelFilter3.setHosts(Arrays.asList("host1"));
- logLevelFilter3.setDefaultLevels(Arrays.asList("FATAL", "ERROR", "WARN", "INFO"));
- logLevelFilter3.setOverrideLevels(Arrays.asList("FATAL", "ERROR", "WARN", "INFO", "DEBUG", "TRACE"));
- logLevelFilter3.setExpiryTime(DateUtils.addDays(new Date(), -1));
-
- LogLevelFilterHandler h = new LogLevelFilterHandler();
- h.setLogLevelFilter("configured_log_file1", logLevelFilter1);
- h.setLogLevelFilter("configured_log_file2", logLevelFilter2);
- h.setLogLevelFilter("configured_log_file3", logLevelFilter3);
- }
-
- @Test
- public void testLogConfigHandler_auditAllowed() throws Exception {
- assertTrue(FilterLogData.INSTANCE.isAllowed("{'host':'host1', 'type':'configured_log_file1', 'level':'DEBUG'}",
- inputMarkerAudit));
- }
-
- @Test
- public void testLogConfigHandler_emptyDataAllowed() throws Exception {
- assertTrue(FilterLogData.INSTANCE.isAllowed((String)null, inputMarkerService));
- assertTrue(FilterLogData.INSTANCE.isAllowed("", inputMarkerService));
- assertTrue(FilterLogData.INSTANCE.isAllowed(Collections.<String, Object> emptyMap(), inputMarkerService));
- }
-
- @Test
- public void testLogConfigHandler_notConfiguredLogAllowed() throws Exception {
- assertTrue(FilterLogData.INSTANCE.isAllowed("{'host':'host1', 'type':'not_configured_log_file1', 'level':'WARN'}",
- inputMarkerService));
- }
-
- @Test
- public void testLogConfigHandler_notConfiguredLogNotAllowed() throws Exception {
- assertFalse(FilterLogData.INSTANCE.isAllowed("{'host':'host1', 'type':'not_configured_log_file1', 'level':'TRACE'}",
- inputMarkerService));
- }
-
- @Test
- public void testLogConfigHandler_configuredDataAllow() throws Exception {
- assertTrue(FilterLogData.INSTANCE.isAllowed("{'host':'host1', 'type':'configured_log_file1', 'level':'INFO'}",
- inputMarkerService));
- }
-
- @Test
- public void testLogConfigHandler_configuredDataDontAllow() throws Exception {
- assertFalse(FilterLogData.INSTANCE.isAllowed("{'host':'host1', 'type':'configured_log_file1', 'level':'DEBUG'}",
- inputMarkerService));
- }
-
- @Test
- public void testLogConfigHandler_overridenConfiguredData() throws Exception {
- assertTrue(FilterLogData.INSTANCE.isAllowed("{'host':'host1', 'type':'configured_log_file2', 'level':'DEBUG'}",
- inputMarkerService));
- }
-
- @Test
- public void testLogConfigHandler_overridenConfiguredDataDifferentHost() throws Exception {
- assertFalse(FilterLogData.INSTANCE.isAllowed("{'host':'host2', 'type':'configured_log_file2', 'level':'DEBUG'}",
- inputMarkerService));
- }
-
- @Test
- public void testLogConfigHandler_overridenConfiguredDataExpired() throws Exception {
- assertFalse(FilterLogData.INSTANCE.isAllowed("{'host':'host1', 'type':'configured_log_file3', 'level':'DEBUG'}",
- inputMarkerService));
- }
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/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 f74a80e..da8fff7 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
@@ -29,11 +29,9 @@ import java.util.Arrays;
import java.util.List;
import java.util.TreeMap;
-import org.apache.ambari.logfeeder.util.LogFeederPropertiesUtil;
import org.apache.hadoop.metrics2.sink.timeline.TimelineMetric;
import org.apache.hadoop.metrics2.sink.timeline.TimelineMetrics;
import org.junit.Before;
-import org.junit.BeforeClass;
import org.junit.Test;
public class MetricsManagerTest {
@@ -42,11 +40,6 @@ public class MetricsManagerTest {
private LogFeederAMSClient mockClient;
private Capture<TimelineMetrics> capture;
- @BeforeClass
- public static void loadProperties() throws Exception {
- LogFeederPropertiesUtil.loadProperties("logfeeder.properties");
- }
-
@Before
public void init() throws Exception {
manager = new MetricsManager();
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputKafkaTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputKafkaTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputKafkaTest.java
index 38d4b8b..c0babc4 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputKafkaTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputKafkaTest.java
@@ -23,6 +23,7 @@ import java.util.Map;
import java.util.Properties;
import java.util.concurrent.Future;
+import org.apache.ambari.logfeeder.conf.LogFeederProps;
import org.apache.ambari.logfeeder.input.Input;
import org.apache.ambari.logfeeder.input.InputMarker;
import org.apache.ambari.logfeeder.output.OutputKafka.KafkaCallBack;
@@ -69,7 +70,7 @@ public class OutputKafkaTest {
config.put("topic", TEST_TOPIC);
outputKafka.loadConfig(config);
- outputKafka.init();
+ outputKafka.init(new LogFeederProps());
@SuppressWarnings("unchecked")
Future<RecordMetadata> mockFuture = EasyMock.mock(Future.class);
@@ -103,7 +104,7 @@ public class OutputKafkaTest {
config.put("topic", TEST_TOPIC);
outputKafka.loadConfig(config);
- outputKafka.init();
+ outputKafka.init(new LogFeederProps());
}
@Test
@@ -117,7 +118,7 @@ public class OutputKafkaTest {
config.put("broker_list", "some broker list");
outputKafka.loadConfig(config);
- outputKafka.init();
+ outputKafka.init(new LogFeederProps());
}
@After
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputManagerTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputManagerTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputManagerTest.java
index 5abb720..49f5a11 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputManagerTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputManagerTest.java
@@ -29,8 +29,10 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.apache.ambari.logfeeder.conf.LogFeederProps;
import org.apache.ambari.logfeeder.input.Input;
import org.apache.ambari.logfeeder.input.InputMarker;
+import org.apache.ambari.logfeeder.loglevelfilter.LogLevelFilterHandler;
import org.apache.ambari.logfeeder.metrics.MetricData;
import org.apache.ambari.logsearch.config.zookeeper.model.inputconfig.impl.InputDescriptorImpl;
import org.junit.Test;
@@ -63,10 +65,11 @@ public class OutputManagerTest {
Output output1 = strictMock(Output.class);
Output output2 = strictMock(Output.class);
Output output3 = strictMock(Output.class);
-
- output1.init(); expectLastCall();
- output2.init(); expectLastCall();
- output3.init(); expectLastCall();
+
+ LogFeederProps logFeederProps = new LogFeederProps();
+ output1.init(logFeederProps); expectLastCall();
+ output2.init(logFeederProps); expectLastCall();
+ output3.init(logFeederProps); expectLastCall();
replay(output1, output2, output3);
@@ -74,6 +77,7 @@ public class OutputManagerTest {
manager.add(output1);
manager.add(output2);
manager.add(output3);
+ manager.setLogFeederProps(logFeederProps);
manager.init();
@@ -98,11 +102,14 @@ public class OutputManagerTest {
Output output1 = strictMock(Output.class);
Output output2 = strictMock(Output.class);
Output output3 = strictMock(Output.class);
+
+ LogLevelFilterHandler mockFilter = strictMock(LogLevelFilterHandler.class);
expect(mockInput.getInputDescriptor()).andReturn(inputDescriptor);
- expect(mockInput.isUseEventMD5()).andReturn(false);
- expect(mockInput.isGenEventMD5()).andReturn(false);
- expect(mockInput.getInputDescriptor()).andReturn(inputDescriptor);
+ expect(mockInput.isUseEventMD5()).andReturn(false).anyTimes();
+ expect(mockInput.isGenEventMD5()).andReturn(false).anyTimes();
+ expect(mockInput.getInputDescriptor()).andReturn(inputDescriptor).anyTimes();
+ expect(mockFilter.isAllowed(jsonObj, inputMarker)).andReturn(true).anyTimes();
expect(mockInput.getCache()).andReturn(null);
expect(mockInput.getOutputList()).andReturn(Arrays.asList(output1, output2, output3));
@@ -110,9 +117,10 @@ public class OutputManagerTest {
output2.write(jsonObj, inputMarker); expectLastCall();
output3.write(jsonObj, inputMarker); expectLastCall();
- replay(output1, output2, output3, mockInput);
+ replay(output1, output2, output3, mockFilter, mockInput);
OutputManager manager = new OutputManager();
+ manager.setLogLevelFilterHandler(mockFilter);
manager.add(output1);
manager.add(output2);
manager.add(output3);
@@ -133,17 +141,21 @@ public class OutputManagerTest {
Output output1 = strictMock(Output.class);
Output output2 = strictMock(Output.class);
Output output3 = strictMock(Output.class);
+
+ LogLevelFilterHandler mockFilter = strictMock(LogLevelFilterHandler.class);
- expect(mockInput.getInputDescriptor()).andReturn(inputDescriptor);
+ expect(mockInput.getInputDescriptor()).andReturn(inputDescriptor).anyTimes();
+ expect(mockFilter.isAllowed(jsonString, inputMarker)).andReturn(true).anyTimes();
expect(mockInput.getOutputList()).andReturn(Arrays.asList(output1, output2, output3));
output1.write(jsonString, inputMarker); expectLastCall();
output2.write(jsonString, inputMarker); expectLastCall();
output3.write(jsonString, inputMarker); expectLastCall();
- replay(output1, output2, output3, mockInput);
+ replay(output1, output2, output3, mockInput, mockFilter);
OutputManager manager = new OutputManager();
+ manager.setLogLevelFilterHandler(mockFilter);
manager.add(output1);
manager.add(output2);
manager.add(output3);
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputS3FileTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputS3FileTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputS3FileTest.java
index 7c6aca2..78cf014 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputS3FileTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputS3FileTest.java
@@ -18,6 +18,7 @@
package org.apache.ambari.logfeeder.output;
+import org.apache.ambari.logfeeder.conf.LogFeederProps;
import org.apache.ambari.logfeeder.input.Input;
import org.apache.ambari.logfeeder.input.InputMarker;
import org.apache.ambari.logfeeder.output.spool.LogSpooler;
@@ -93,7 +94,7 @@ public class OutputS3FileTest {
}
};
outputS3File.loadConfig(configMap);
- outputS3File.init();
+ outputS3File.init(new LogFeederProps());
outputS3File.write("log event block", inputMarker);
verify(spooler);
}
@@ -130,7 +131,7 @@ public class OutputS3FileTest {
}
};
outputS3File.loadConfig(configMap);
- outputS3File.init();
+ outputS3File.init(new LogFeederProps());
outputS3File.write("log event block1", inputMarker);
outputS3File.write("log event block2", inputMarker);
verify(spooler);
@@ -149,7 +150,7 @@ public class OutputS3FileTest {
OutputS3File outputS3File = new OutputS3File();
configMap.put(S3OutputConfiguration.ROLLOVER_SIZE_THRESHOLD_BYTES_KEY, thresholdSize);
outputS3File.loadConfig(configMap);
- outputS3File.init();
+ outputS3File.init(new LogFeederProps());
assertTrue(outputS3File.shouldRollover(logSpoolerContext));
}
@@ -166,7 +167,7 @@ public class OutputS3FileTest {
OutputS3File outputS3File = new OutputS3File();
configMap.put(S3OutputConfiguration.ROLLOVER_SIZE_THRESHOLD_BYTES_KEY, thresholdSize);
outputS3File.loadConfig(configMap);
- outputS3File.init();
+ outputS3File.init(new LogFeederProps());
assertFalse(outputS3File.shouldRollover(logSpoolerContext));
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/31e8e55a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputSolrTest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputSolrTest.java b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputSolrTest.java
index 5ab271a..70d5c8f 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputSolrTest.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/output/OutputSolrTest.java
@@ -26,6 +26,8 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
+import org.apache.ambari.logfeeder.conf.LogFeederProps;
+import org.apache.ambari.logfeeder.conf.LogFeederSecurityConfig;
import org.apache.ambari.logfeeder.input.Input;
import org.apache.ambari.logfeeder.input.InputMarker;
import org.apache.ambari.logsearch.config.api.LogSearchConfigLogFeeder;
@@ -52,12 +54,16 @@ public class OutputSolrTest {
private OutputSolr outputSolr;
private LogSearchConfigLogFeeder logSearchConfigMock;
private Map<Integer, SolrInputDocument> receivedDocs = new ConcurrentHashMap<>();
+ private LogFeederProps logFeederProps = new LogFeederProps();
@Rule
public ExpectedException expectedException = ExpectedException.none();
@Before
public void init() throws Exception {
+ LogFeederSecurityConfig logFeederSecurityConfig = new LogFeederSecurityConfig();
+ logFeederSecurityConfig.setSolrKerberosEnabled(false);
+ logFeederProps.setLogFeederSecurityConfig(logFeederSecurityConfig);
outputSolr = new OutputSolr() {
@SuppressWarnings("deprecation")
@Override
@@ -97,7 +103,7 @@ public class OutputSolrTest {
config.put("type", "service");
outputSolr.loadConfig(config);
- outputSolr.init();
+ outputSolr.init(logFeederProps);
Map<Integer, SolrInputDocument> expectedDocs = new HashMap<>();
@@ -166,7 +172,7 @@ public class OutputSolrTest {
config.put("type", "service");
outputSolr.loadConfig(config);
- outputSolr.init();
+ outputSolr.init(logFeederProps);
}
@After
[08/23] ambari git commit: AMBARI-22617. Install Wizard Customize
Services step has no vertical scroll (akovalenko)
Posted by nc...@apache.org.
AMBARI-22617. Install Wizard Customize Services step has no vertical scroll (akovalenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ee506295
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ee506295
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ee506295
Branch: refs/heads/branch-feature-AMBARI-21674
Commit: ee506295d3d911c4bc9b00233481a1db97cd9289
Parents: 1ed7c08
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Fri Dec 8 17:41:13 2017 +0200
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Fri Dec 8 17:41:13 2017 +0200
----------------------------------------------------------------------
ambari-web/app/styles/application.less | 7 ++++---
.../app/templates/common/configs/service_config_wizard.hbs | 8 ++++----
ambari-web/app/templates/main/host/configs_service.hbs | 2 +-
ambari-web/app/templates/main/service/info/configs.hbs | 2 +-
4 files changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/ee506295/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index 7629355..b7c7635 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -602,9 +602,10 @@ h1 {
}
#serviceConfig {
- background: white;
- padding: 15px;
-
+ &.non-wizard {
+ background: white;
+ padding: 15px;
+ }
.alert{
.glyphicon-refresh{
margin-left:10px;
http://git-wip-us.apache.org/repos/asf/ambari/blob/ee506295/ambari-web/app/templates/common/configs/service_config_wizard.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/configs/service_config_wizard.hbs b/ambari-web/app/templates/common/configs/service_config_wizard.hbs
index 57bf5ee..3abd5eb 100644
--- a/ambari-web/app/templates/common/configs/service_config_wizard.hbs
+++ b/ambari-web/app/templates/common/configs/service_config_wizard.hbs
@@ -19,9 +19,9 @@
{{#if view.supportsHostOverrides}}
<div class="alert alert-info config-manage-nav">
{{t common.group}}
- <span class="btn-group config-groups-dropdown">
- <button {{bindAttr disabled="controller.isHostsConfigsPage"}} class="btn btn-default dropdown-toggle first" data-toggle="dropdown">{{selectedConfigGroup.displayNameHosts}}</button>
- <button {{bindAttr disabled="controller.isHostsConfigsPage"}} class="btn btn-default dropdown-toggle" data-toggle="dropdown">
+ <div class="btn-group config-groups-dropdown">
+ <button {{bindAttr disabled="controller.isHostsConfigsPage"}} class="btn btn-default dropdown-toggle first" data-toggle="dropdown">
+ {{selectedConfigGroup.displayNameHosts}}
<span class="caret"></span>
</button>
<ul class="dropdown-menu config-groups-dropdown-menu">
@@ -34,7 +34,7 @@
</li>
{{/each}}
</ul>
- </span>
+ </div>
{{#isAuthorized "SERVICE.MANAGE_CONFIG_GROUPS"}}
{{#if controller.isHostsConfigsPage}}
<a href="#" {{action "switchHostGroup" target="controller"}}>{{t common.change}}</a>
http://git-wip-us.apache.org/repos/asf/ambari/blob/ee506295/ambari-web/app/templates/main/host/configs_service.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/host/configs_service.hbs b/ambari-web/app/templates/main/host/configs_service.hbs
index 46d7ab5..afeb4b6 100644
--- a/ambari-web/app/templates/main/host/configs_service.hbs
+++ b/ambari-web/app/templates/main/host/configs_service.hbs
@@ -16,7 +16,7 @@
* limitations under the License.
}}
-<div id="serviceConfig">
+<div id="serviceConfig non-wizard">
{{#if dataIsLoaded}}
<div class="clearfix"></div>
{{view App.ServiceConfigView canEditBinding="view.isConfigsEditable" filterBinding="controller.filter" columnsBinding="controller.filterColumns"}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/ee506295/ambari-web/app/templates/main/service/info/configs.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/service/info/configs.hbs b/ambari-web/app/templates/main/service/info/configs.hbs
index 738893c..3636ec7 100644
--- a/ambari-web/app/templates/main/service/info/configs.hbs
+++ b/ambari-web/app/templates/main/service/info/configs.hbs
@@ -16,7 +16,7 @@
* limitations under the License.
}}
-<div id="serviceConfig">
+<div id="serviceConfig" class="non-wizard">
{{#if dataIsLoaded}}
{{#if controller.content.isRestartRequired}}
{{#isAuthorized "SERVICE.START_STOP"}}
[18/23] ambari git commit: AMBARI-22635. Ambari should create a dummy
core-site.xml for Ranger plugins when namenode is not installed. (Vishal
Suvagia via swagle)
Posted by nc...@apache.org.
AMBARI-22635. Ambari should create a dummy core-site.xml for Ranger plugins when namenode is not installed. (Vishal Suvagia via swagle)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a3d4c3da
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a3d4c3da
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a3d4c3da
Branch: refs/heads/branch-feature-AMBARI-21674
Commit: a3d4c3da56eeec22e864978a7a8be39586948ff5
Parents: e46575a
Author: Siddharth Wagle <sw...@hortonworks.com>
Authored: Wed Dec 13 13:41:33 2017 -0800
Committer: Siddharth Wagle <sw...@hortonworks.com>
Committed: Wed Dec 13 13:41:33 2017 -0800
----------------------------------------------------------------------
.../libraries/functions/setup_ranger_plugin_xml.py | 14 +++++++-------
.../package/scripts/setup_ranger_kafka.py | 14 +++++++++++---
.../0.8.1/package/scripts/setup_ranger_kafka.py | 15 ++++++++++++---
.../0.5.0.2.2/package/scripts/setup_ranger_knox.py | 16 ++++++++++++----
.../0.5.0.3.0/package/scripts/setup_ranger_knox.py | 16 ++++++++++++----
.../0.9.1/package/scripts/setup_ranger_storm.py | 15 ++++++++++++---
.../1.0.1.3.0/package/scripts/setup_ranger_storm.py | 15 ++++++++++++---
7 files changed, 78 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/a3d4c3da/ambari-common/src/main/python/resource_management/libraries/functions/setup_ranger_plugin_xml.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/setup_ranger_plugin_xml.py b/ambari-common/src/main/python/resource_management/libraries/functions/setup_ranger_plugin_xml.py
index 485c1a6..78692cb 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/setup_ranger_plugin_xml.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/setup_ranger_plugin_xml.py
@@ -240,14 +240,14 @@ def setup_ranger_plugin_keystore(service_name, audit_db_is_enabled, stack_versio
mode = 0640
)
-def setup_core_site_for_required_plugins(component_user, component_group, create_core_site_path, config):
+def setup_core_site_for_required_plugins(component_user, component_group, create_core_site_path, configurations = {}, configuration_attributes = {}):
XmlConfig('core-site.xml',
- conf_dir=create_core_site_path,
- configurations=config['configurations']['core-site'],
- configuration_attributes=config['configuration_attributes']['core-site'],
- owner=component_user,
- group=component_group,
- mode=0644
+ conf_dir = create_core_site_path,
+ configurations = configurations,
+ configuration_attributes = configuration_attributes,
+ owner = component_user,
+ group = component_group,
+ mode = 0644
)
def get_audit_configs(config):
http://git-wip-us.apache.org/repos/asf/ambari/blob/a3d4c3da/ambari-server/src/main/resources/common-services/KAFKA/0.10.0.3.0/package/scripts/setup_ranger_kafka.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KAFKA/0.10.0.3.0/package/scripts/setup_ranger_kafka.py b/ambari-server/src/main/resources/common-services/KAFKA/0.10.0.3.0/package/scripts/setup_ranger_kafka.py
index e9719aa..3a0b991 100644
--- a/ambari-server/src/main/resources/common-services/KAFKA/0.10.0.3.0/package/scripts/setup_ranger_kafka.py
+++ b/ambari-server/src/main/resources/common-services/KAFKA/0.10.0.3.0/package/scripts/setup_ranger_kafka.py
@@ -81,9 +81,17 @@ def setup_ranger_kafka():
group = params.user_group,
mode = 0755
)
- if params.stack_supports_core_site_for_ranger_plugin and params.enable_ranger_kafka and params.has_namenode and params.security_enabled:
- Logger.info("Stack supports core-site.xml creation for Ranger plugin, creating create core-site.xml from namenode configuraitions")
- setup_core_site_for_required_plugins(component_user=params.kafka_user,component_group=params.user_group,create_core_site_path = params.conf_dir, config = params.config)
+ if params.stack_supports_core_site_for_ranger_plugin and params.enable_ranger_kafka and params.security_enabled:
+ if params.has_namenode:
+ Logger.info("Stack supports core-site.xml creation for Ranger plugin and Namenode is installed, creating create core-site.xml from namenode configurations")
+ setup_core_site_for_required_plugins(component_user = params.kafka_user, component_group = params.user_group,
+ create_core_site_path = params.conf_dir, configurations = params.config['configurations']['core-site'],
+ configuration_attributes = params.config['configuration_attributes']['core-site'])
+ else:
+ Logger.info("Stack supports core-site.xml creation for Ranger plugin and Namenode is not installed, creating create core-site.xml from default configurations")
+ setup_core_site_for_required_plugins(component_user = params.kafka_user, component_group = params.user_group,
+ create_core_site_path = params.conf_dir, configurations = { 'hadoop.security.authentication' : 'kerberos' if params.security_enabled else 'simple' },
+ configuration_attributes = {})
else:
Logger.info("Stack does not support core-site.xml creation for Ranger plugin, skipping core-site.xml configurations")
else:
http://git-wip-us.apache.org/repos/asf/ambari/blob/a3d4c3da/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/setup_ranger_kafka.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/setup_ranger_kafka.py b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/setup_ranger_kafka.py
index 9aa09df..e2cfbcf 100644
--- a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/setup_ranger_kafka.py
+++ b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/setup_ranger_kafka.py
@@ -81,9 +81,18 @@ def setup_ranger_kafka():
group = params.user_group,
mode = 0755
)
- if params.stack_supports_core_site_for_ranger_plugin and params.enable_ranger_kafka and params.has_namenode and params.kerberos_security_enabled:
- Logger.info("Stack supports core-site.xml creation for Ranger plugin, creating create core-site.xml from namenode configuraitions")
- setup_core_site_for_required_plugins(component_user=params.kafka_user,component_group=params.user_group,create_core_site_path = params.conf_dir, config = params.config)
+ if params.stack_supports_core_site_for_ranger_plugin and params.enable_ranger_kafka and params.kerberos_security_enabled:
+ if params.has_namenode:
+ Logger.info("Stack supports core-site.xml creation for Ranger plugin and Namenode is installed, creating create core-site.xml from namenode configurations")
+ setup_core_site_for_required_plugins(component_user = params.kafka_user, component_group = params.user_group,
+ create_core_site_path = params.conf_dir, configurations = params.config['configurations']['core-site'],
+ configuration_attributes = params.config['configuration_attributes']['core-site'])
+ else:
+ Logger.info("Stack supports core-site.xml creation for Ranger plugin and Namenode is not installed, creating create core-site.xml from default configurations")
+ setup_core_site_for_required_plugins(component_user = params.kafka_user, component_group = params.user_group,
+ create_core_site_path = params.conf_dir, configurations = { 'hadoop.security.authentication' : 'kerberos' if params.security_enabled else 'simple' },
+ configuration_attributes = {})
+
else:
Logger.info("Stack does not support core-site.xml creation for Ranger plugin, skipping core-site.xml configurations")
else:
http://git-wip-us.apache.org/repos/asf/ambari/blob/a3d4c3da/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/setup_ranger_knox.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/setup_ranger_knox.py b/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/setup_ranger_knox.py
index c486ef7..67fec40 100644
--- a/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/setup_ranger_knox.py
+++ b/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/setup_ranger_knox.py
@@ -108,12 +108,20 @@ def setup_ranger_knox(upgrade_type=None):
plugin_security_properties=params.config['configurations']['ranger-knox-security'], plugin_security_attributes=params.config['configuration_attributes']['ranger-knox-security'],
plugin_policymgr_ssl_properties=params.config['configurations']['ranger-knox-policymgr-ssl'], plugin_policymgr_ssl_attributes=params.config['configuration_attributes']['ranger-knox-policymgr-ssl'],
component_list=['knox-server'], audit_db_is_enabled=params.xa_audit_db_is_enabled,
- credential_file=params.credential_file, xa_audit_db_password=params.xa_audit_db_password,
+ credential_file=params.credential_file, xa_audit_db_password=params.xa_audit_db_password,
ssl_truststore_password=params.ssl_truststore_password, ssl_keystore_password=params.ssl_keystore_password,
stack_version_override = stack_version, skip_if_rangeradmin_down= not params.retryAble)
- if params.stack_supports_core_site_for_ranger_plugin and params.enable_ranger_knox and params.has_namenode and params.security_enabled:
- Logger.info("Stack supports core-site.xml creation for Ranger plugin, creating core-site.xml from namenode configuraitions")
- setup_core_site_for_required_plugins(component_user=params.knox_user, component_group=params.knox_group,create_core_site_path = params.knox_conf_dir, config = params.config)
+ if params.stack_supports_core_site_for_ranger_plugin and params.enable_ranger_knox and params.security_enabled:
+ if params.has_namenode:
+ Logger.info("Stack supports core-site.xml creation for Ranger plugin and Namenode is installed, creating create core-site.xml from namenode configurations")
+ setup_core_site_for_required_plugins(component_user = params.knox_user, component_group = params.knox_group,
+ create_core_site_path = params.knox_conf_dir, configurations = params.config['configurations']['core-site'],
+ configuration_attributes = params.config['configuration_attributes']['core-site'])
+ else:
+ Logger.info("Stack supports core-site.xml creation for Ranger plugin and Namenode is not installed, creating create core-site.xml from default configurations")
+ setup_core_site_for_required_plugins(component_user = params.knox_user, component_group = params.knox_group,
+ create_core_site_path = params.knox_conf_dir, configurations = { 'hadoop.security.authentication' : 'kerberos' if params.security_enabled else 'simple' },
+ configuration_attributes = {})
else:
Logger.info("Stack does not support core-site.xml creation for Ranger plugin, skipping core-site.xml configurations")
http://git-wip-us.apache.org/repos/asf/ambari/blob/a3d4c3da/ambari-server/src/main/resources/common-services/KNOX/0.5.0.3.0/package/scripts/setup_ranger_knox.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KNOX/0.5.0.3.0/package/scripts/setup_ranger_knox.py b/ambari-server/src/main/resources/common-services/KNOX/0.5.0.3.0/package/scripts/setup_ranger_knox.py
index c486ef7..67fec40 100644
--- a/ambari-server/src/main/resources/common-services/KNOX/0.5.0.3.0/package/scripts/setup_ranger_knox.py
+++ b/ambari-server/src/main/resources/common-services/KNOX/0.5.0.3.0/package/scripts/setup_ranger_knox.py
@@ -108,12 +108,20 @@ def setup_ranger_knox(upgrade_type=None):
plugin_security_properties=params.config['configurations']['ranger-knox-security'], plugin_security_attributes=params.config['configuration_attributes']['ranger-knox-security'],
plugin_policymgr_ssl_properties=params.config['configurations']['ranger-knox-policymgr-ssl'], plugin_policymgr_ssl_attributes=params.config['configuration_attributes']['ranger-knox-policymgr-ssl'],
component_list=['knox-server'], audit_db_is_enabled=params.xa_audit_db_is_enabled,
- credential_file=params.credential_file, xa_audit_db_password=params.xa_audit_db_password,
+ credential_file=params.credential_file, xa_audit_db_password=params.xa_audit_db_password,
ssl_truststore_password=params.ssl_truststore_password, ssl_keystore_password=params.ssl_keystore_password,
stack_version_override = stack_version, skip_if_rangeradmin_down= not params.retryAble)
- if params.stack_supports_core_site_for_ranger_plugin and params.enable_ranger_knox and params.has_namenode and params.security_enabled:
- Logger.info("Stack supports core-site.xml creation for Ranger plugin, creating core-site.xml from namenode configuraitions")
- setup_core_site_for_required_plugins(component_user=params.knox_user, component_group=params.knox_group,create_core_site_path = params.knox_conf_dir, config = params.config)
+ if params.stack_supports_core_site_for_ranger_plugin and params.enable_ranger_knox and params.security_enabled:
+ if params.has_namenode:
+ Logger.info("Stack supports core-site.xml creation for Ranger plugin and Namenode is installed, creating create core-site.xml from namenode configurations")
+ setup_core_site_for_required_plugins(component_user = params.knox_user, component_group = params.knox_group,
+ create_core_site_path = params.knox_conf_dir, configurations = params.config['configurations']['core-site'],
+ configuration_attributes = params.config['configuration_attributes']['core-site'])
+ else:
+ Logger.info("Stack supports core-site.xml creation for Ranger plugin and Namenode is not installed, creating create core-site.xml from default configurations")
+ setup_core_site_for_required_plugins(component_user = params.knox_user, component_group = params.knox_group,
+ create_core_site_path = params.knox_conf_dir, configurations = { 'hadoop.security.authentication' : 'kerberos' if params.security_enabled else 'simple' },
+ configuration_attributes = {})
else:
Logger.info("Stack does not support core-site.xml creation for Ranger plugin, skipping core-site.xml configurations")
http://git-wip-us.apache.org/repos/asf/ambari/blob/a3d4c3da/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/setup_ranger_storm.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/setup_ranger_storm.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/setup_ranger_storm.py
index c04496e..57bfc90 100644
--- a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/setup_ranger_storm.py
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/setup_ranger_storm.py
@@ -111,9 +111,18 @@ def setup_ranger_storm(upgrade_type=None):
cd_access = 'a'
)
- if params.stack_supports_core_site_for_ranger_plugin and params.enable_ranger_storm and params.has_namenode and params.security_enabled:
- Logger.info("Stack supports core-site.xml creation for Ranger plugin, creating create core-site.xml from namenode configuraitions")
- setup_core_site_for_required_plugins(component_user=params.storm_user,component_group=params.user_group,create_core_site_path = site_files_create_path, config = params.config)
+ if params.stack_supports_core_site_for_ranger_plugin and params.enable_ranger_storm and params.security_enabled:
+ if params.has_namenode:
+ Logger.info("Stack supports core-site.xml creation for Ranger plugin and Namenode is installed, creating create core-site.xml from namenode configurations")
+ setup_core_site_for_required_plugins(component_user = params.storm_user, component_group = params.user_group,
+ create_core_site_path = site_files_create_path, configurations = params.config['configurations']['core-site'],
+ configuration_attributes = params.config['configuration_attributes']['core-site'])
+ else:
+ Logger.info("Stack supports core-site.xml creation for Ranger plugin and Namenode is not installed, creating create core-site.xml from default configurations")
+ setup_core_site_for_required_plugins(component_user = params.storm_user, component_group = params.user_group,
+ create_core_site_path = site_files_create_path, configurations = { 'hadoop.security.authentication' : 'kerberos' if params.security_enabled else 'simple' },
+ configuration_attributes = {})
+
if len(params.namenode_hosts) > 1:
Logger.info('Ranger Storm plugin is enabled along with security and NameNode is HA , creating hdfs-site.xml')
XmlConfig("hdfs-site.xml",
http://git-wip-us.apache.org/repos/asf/ambari/blob/a3d4c3da/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/setup_ranger_storm.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/setup_ranger_storm.py b/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/setup_ranger_storm.py
index c04496e..57bfc90 100644
--- a/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/setup_ranger_storm.py
+++ b/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/setup_ranger_storm.py
@@ -111,9 +111,18 @@ def setup_ranger_storm(upgrade_type=None):
cd_access = 'a'
)
- if params.stack_supports_core_site_for_ranger_plugin and params.enable_ranger_storm and params.has_namenode and params.security_enabled:
- Logger.info("Stack supports core-site.xml creation for Ranger plugin, creating create core-site.xml from namenode configuraitions")
- setup_core_site_for_required_plugins(component_user=params.storm_user,component_group=params.user_group,create_core_site_path = site_files_create_path, config = params.config)
+ if params.stack_supports_core_site_for_ranger_plugin and params.enable_ranger_storm and params.security_enabled:
+ if params.has_namenode:
+ Logger.info("Stack supports core-site.xml creation for Ranger plugin and Namenode is installed, creating create core-site.xml from namenode configurations")
+ setup_core_site_for_required_plugins(component_user = params.storm_user, component_group = params.user_group,
+ create_core_site_path = site_files_create_path, configurations = params.config['configurations']['core-site'],
+ configuration_attributes = params.config['configuration_attributes']['core-site'])
+ else:
+ Logger.info("Stack supports core-site.xml creation for Ranger plugin and Namenode is not installed, creating create core-site.xml from default configurations")
+ setup_core_site_for_required_plugins(component_user = params.storm_user, component_group = params.user_group,
+ create_core_site_path = site_files_create_path, configurations = { 'hadoop.security.authentication' : 'kerberos' if params.security_enabled else 'simple' },
+ configuration_attributes = {})
+
if len(params.namenode_hosts) > 1:
Logger.info('Ranger Storm plugin is enabled along with security and NameNode is HA , creating hdfs-site.xml')
XmlConfig("hdfs-site.xml",
[12/23] ambari git commit: AMBARI-22624 Modify display of compare of
config versions, second patch. (atkach)
Posted by nc...@apache.org.
AMBARI-22624 Modify display of compare of config versions, second patch. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4be18df8
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4be18df8
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4be18df8
Branch: refs/heads/branch-feature-AMBARI-21674
Commit: 4be18df873a055f343c3d3cdf6355e33c090c67f
Parents: 0967264
Author: Andrii Tkach <at...@apache.org>
Authored: Mon Dec 11 17:50:21 2017 +0200
Committer: Andrii Tkach <at...@apache.org>
Committed: Mon Dec 11 17:50:21 2017 +0200
----------------------------------------------------------------------
ambari-web/app/styles/application.less | 241 -------------------
.../app/styles/service_configurations.less | 6 +-
.../configs/config_versions_control_view.js | 4 +
3 files changed, 8 insertions(+), 243 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/4be18df8/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index b8ad4ac..43fead6 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -601,247 +601,6 @@ h1 {
}
}
-#serviceConfig {
- &.non-wizard {
- background: white;
- padding: 15px;
- }
- .alert{
- .glyphicon-refresh{
- margin-left:10px;
- }
- .glyphicon-warning-sign {
- color: @health-status-yellow;
- }
- }
- .collapsable {
- cursor: pointer;
- }
- .directories {
- min-width: 280px;
- }
- .panel-heading {
- cursor: pointer;
- }
- .panel-group {
-
- .control-label {
- text-align: left;
- word-wrap: break-word;
- font-weight: 500;
- }
- .service-config-section{
- .overridden-property{
- background-color: rgba(211, 237, 247, 0.39);
- padding: 5px;
- margin-left: -5px;
- }
- .checkbox {
- line-height: 0.8em;
- &.list-inline {
- vertical-align: baseline;
- &>.ember-checkbox{
- margin-left: -14px;
- }
- }
- }
- }
- .entry-row.indent-1 {
- margin-left: 2em;
- }
- .entry-row.indent-2 {
- margin-left: 4em;
- }
- .entry-row {
- margin: 0;
- .glyphicon-lock {
- color: #008000;
- }
- .action{
- margin-left: 3px;
- margin-right: 1px;
- font-size: 13px;
- white-space: nowrap;
- }
- input[type="radio"] {
- margin-right: 5px;
- margin-left: -20px;
- }
- .control-group {
- margin: 0;
- .overrideField {
- display: block;
- margin-top: 5px;
- margin-bottom: 5px;
- }
- .overridden-hosts-view {
- display: inline-block;
- }
- &>.ember-checkbox{
- margin-bottom: 5px;
- }
- }
- }
- form {
- margin-bottom: 0;
- }
- }
- .badge {
- margin-left: 4px;
- }
-
- .master-host, .master-hosts, .slave-hosts {
- padding-top: 5px;
- line-height: 20px;
- }
-
- .enhanced-config-tab-content {
- .action {
- display: inline-block;
- }
- }
- .common-config-category, .enhanced-config-tab-content {
- .panel-title {
- line-height: 16px;
- }
- .action {
- cursor: pointer;
- }
- .a-icon(@color) {
- color: @color;
- margin-right: 2px;
- }
- .glyphicon-plus-sign {
- .a-icon(@health-status-green);
- }
- .glyphicon-minus-sign {
- .a-icon(#FF4B4B);
- }
- .icon-undo {
- .a-icon(rgb(243, 178, 11));
- }
- .btn-final{
- background: transparent repeat scroll 0 0 #fff;
- }
- .btn-final .glyphicon-lock{
- color: #a6a6a6;
- cursor: inherit;
- }
- .btn-final.active .glyphicon-lock {
- color: blue;
- }
- .btn-final.active { //copied from Bootstrap .btn.active
- background-color: #e6e6e6;
- background-color: #d9d9d9 \9;
- background-image: none;
- outline: 0;
- box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
- }
- .btn-final.active[disabled] {
- cursor: not-allowed;
- }
- a.panel-toggle:hover {
- text-decoration: none;
- .category-name {
- color: #337ab7;
- text-decoration: underline;
- }
- }
- }
-
- .enhanced-config-tab-content
- {
- .action-button {
- margin-left: 3px;
- }
- }
-
- .capacity-scheduler {
- .header {
- margin-bottom: 10px;
- .col-md-1 {
- padding-top: 10px;
- font-weight: bold;
- }
- }
- form.form-horizontal {
- margin-left: 20px;
- .control-label-span {
- word-wrap: break-word;
- }
- }
- table tr, svg {
- cursor: pointer;
- }
- .marker {
- margin: 0 5px;
- display: inline-block;
- width: 12px;
- height: 12px;
- }
-
- .frame{
- position:relative;
- width: 200px;
- height: 200px;
- }
- }
- .nav-tabs > li > a {
- padding-left: 8px;
- padding-right: 8px;
- &.new {
- font-weight: 700;
- }
- }
- .with-unit{
- float: left;
- .input-group-addon{
- overflow: hidden;
- max-width:250px;
- }
- }
- .dropdown-menu > li > a:hover {
- text-shadow: none;
- }
- .db-connection {
- .spinner {
- width: @spinner-small-width;
- height: @spinner-small-height;
- background-size: cover;
- i {
- font-size: 1em;
- }
- }
- .glyphicon-ok-sign, .glyphicon-warning-sign {
- font-size: 27px;
- line-height: 30px;
- }
- .glyphicon-warning-sign {
- color: @health-status-red;
- }
- .connection-result {
- font-size: 15px;
- line-height: 30px;
- }
- a.mute {
- color: #333;
- &:hover {
- text-decoration: none;
- color: #333;
- }
- }
- }
- .help-block {
- display: inline-block;
- }
- .long-input {
- width: 75%;
- }
- .config-controls {
- line-height: 34px;
- }
-}
-
a:focus {
outline: none;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/4be18df8/ambari-web/app/styles/service_configurations.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/service_configurations.less b/ambari-web/app/styles/service_configurations.less
index 5c5abe47..6da3c04 100644
--- a/ambari-web/app/styles/service_configurations.less
+++ b/ambari-web/app/styles/service_configurations.less
@@ -52,8 +52,10 @@
}
#serviceConfig {
- background: white;
- padding: 15px;
+ &.non-wizard {
+ background: white;
+ padding: 15px;
+ }
.alert{
.glyphicon-refresh{
http://git-wip-us.apache.org/repos/asf/ambari/blob/4be18df8/ambari-web/app/views/common/configs/config_versions_control_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/config_versions_control_view.js b/ambari-web/app/views/common/configs/config_versions_control_view.js
index 0b9fb2f..8ee4e19 100644
--- a/ambari-web/app/views/common/configs/config_versions_control_view.js
+++ b/ambari-web/app/views/common/configs/config_versions_control_view.js
@@ -137,6 +137,10 @@ App.ConfigVersionsControlView = Em.View.extend({
controller.loadCompareVersionConfigs(controller.get('allConfigs')).done(function() {
controller.onLoadOverrides(controller.get('allConfigs'));
});
+ if ($(event.currentTarget).hasClass('compare-button')) {
+ // after entering Compare mode compare button should be destroyed before "focusOut" event, otherwise JS error will be thrown
+ event.view.destroy();
+ }
},
removeCompareVersionBar: function () {
[15/23] ambari git commit: AMBARI-22636. UI Changes for Kerberos
Wizard (alexantonenko)
Posted by nc...@apache.org.
AMBARI-22636. UI Changes for Kerberos Wizard (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8e23fa28
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8e23fa28
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8e23fa28
Branch: refs/heads/branch-feature-AMBARI-21674
Commit: 8e23fa28ca33e57855301ad0255af44dc6068d0b
Parents: 8e90d59
Author: Alex Antonenko <aa...@hortonworks.com>
Authored: Tue Dec 12 20:13:43 2017 +0300
Committer: Alex Antonenko <aa...@hortonworks.com>
Committed: Tue Dec 12 20:13:43 2017 +0300
----------------------------------------------------------------------
ambari-web/app/styles/modal_popups.less | 8 +++++++-
.../app/styles/service_configurations.less | 5 ++++-
ambari-web/app/styles/wizard.less | 19 ++++++++++++++++++-
.../common/configs/service_config_category.hbs | 8 +++++---
4 files changed, 34 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/8e23fa28/ambari-web/app/styles/modal_popups.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/modal_popups.less b/ambari-web/app/styles/modal_popups.less
index abe1c63..dc951c9 100644
--- a/ambari-web/app/styles/modal_popups.less
+++ b/ambari-web/app/styles/modal_popups.less
@@ -329,6 +329,12 @@
}
.host-progress-popup {
+ .modal.with-footer{
+ padding-right: 0;
+ .modal-lg.modal-dialog{
+ width: 98%;
+ }
+ }
.task-detail-info {
.task-detail-log-info {
@@ -425,4 +431,4 @@
word-wrap:break-word;
overflow: auto;
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/8e23fa28/ambari-web/app/styles/service_configurations.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/service_configurations.less b/ambari-web/app/styles/service_configurations.less
index 6da3c04..e4811d0 100644
--- a/ambari-web/app/styles/service_configurations.less
+++ b/ambari-web/app/styles/service_configurations.less
@@ -91,7 +91,6 @@
margin-left: -5px;
}
.checkbox {
- line-height: 0.8em;
&.list-inline {
vertical-align: baseline;
&>.ember-checkbox{
@@ -291,4 +290,8 @@
.config-controls {
line-height: 34px;
}
+ .clear-left{
+ clear:left;
+ padding-top: 5px;
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/8e23fa28/ambari-web/app/styles/wizard.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/wizard.less b/ambari-web/app/styles/wizard.less
index cb9eb92..7d425d9 100644
--- a/ambari-web/app/styles/wizard.less
+++ b/ambari-web/app/styles/wizard.less
@@ -237,8 +237,25 @@
opacity: 0.2;
}
}
+ #confirm-configuration{
+ .pre-scrollable{
+ margin-top: 10px;
+ }
+ }
+ #kerberos-wizard-step6, #kerberos-wizard-step8{
+ #common-progress-page{
+ .item{
+ i{
+ position:relative;
+ top: 5px;
+ &.glyphicon-ok{
+ top: 3px;
+ }
+ }
+ }
+ }
+ }
#deploy {
-
.page-bar {
border: none;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/8e23fa28/ambari-web/app/templates/common/configs/service_config_category.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/configs/service_config_category.hbs b/ambari-web/app/templates/common/configs/service_config_category.hbs
index 930e65d..9b86c1f 100644
--- a/ambari-web/app/templates/common/configs/service_config_category.hbs
+++ b/ambari-web/app/templates/common/configs/service_config_category.hbs
@@ -54,14 +54,16 @@
<span class="control-group control-label-span col-md-3"> </span>
{{/unless}}
{{/if}}
+ {{#if configData.isOriginalSCP}}
+ {{#if configData.rightSideLabel}}
+ <span {{bindAttr class="configData.isEditable::muted :col-md-3 :clear-left :form-group :control-label-span"}}>{{formatWordBreak configData.displayName}}</span>
+ {{/if}}
+ {{/if}}
<div class="col-md-9">
{{! Here serviceConfigBinding should ideally be serviceConfigPropertyBinding }}
{{#if configData.isOriginalSCP}}
<div {{bindAttr class="configData.errorMessage:has-error: configData.warnMessage:has-warning: :form-group"}} {{QAAttr "property-form-group"}}>
{{view configData.viewClass serviceConfigBinding="configData" categoryConfigsAllBinding="view.categoryConfigsAll" }}
- {{#if configData.rightSideLabel}}
- <span {{bindAttr class="configData.isEditable::muted"}}>{{formatWordBreak configData.displayName}}</span>
- {{/if}}
{{#if configData.hintMessage}}
<a class="icon-question-sign glyphicon glyphicon-blue" href="#"
data-toggle="tooltip" {{bindAttr data-original-title="configData.hintMessage"}}></a>
[22/23] ambari git commit: AMBARI-22651 Unable to add/change role for
user. (atkach)
Posted by nc...@apache.org.
AMBARI-22651 Unable to add/change role for user. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/dc31e516
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/dc31e516
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/dc31e516
Branch: refs/heads/branch-feature-AMBARI-21674
Commit: dc31e516d95a6636a27d5fbadb9b5529983587c2
Parents: 31e8e55
Author: Andrii Tkach <at...@apache.org>
Authored: Thu Dec 14 12:45:09 2017 +0200
Committer: Andrii Tkach <at...@apache.org>
Committed: Thu Dec 14 12:45:24 2017 +0200
----------------------------------------------------------------------
.../ui/admin-web/app/views/userManagement/groupEdit.html | 2 +-
.../ui/admin-web/app/views/userManagement/modals/groupCreate.html | 2 +-
.../ui/admin-web/app/views/userManagement/modals/userCreate.html | 3 ++-
.../resources/ui/admin-web/app/views/userManagement/userEdit.html | 2 +-
4 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/dc31e516/ambari-admin/src/main/resources/ui/admin-web/app/views/userManagement/groupEdit.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/userManagement/groupEdit.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/userManagement/groupEdit.html
index 3eca354..4688eb5 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/userManagement/groupEdit.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/userManagement/groupEdit.html
@@ -50,7 +50,7 @@
<editable-list items-source="group.editingUsers" resource-type="User" editable="group.group_type == 'LOCAL'"></editable-list>
</div>
</div>
- <div class="form-group">
+ <div class="form-group" ng-show="cluster">
<label for="role" class="col-sm-2 roles-label">
{{'groups.role' | translate}}
<i class="fa fa-question-circle" aria-hidden="true" ng-click="showHelpPage()"></i>
http://git-wip-us.apache.org/repos/asf/ambari/blob/dc31e516/ambari-admin/src/main/resources/ui/admin-web/app/views/userManagement/modals/groupCreate.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/userManagement/modals/groupCreate.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/userManagement/modals/groupCreate.html
index 7692a68..8ea1b37 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/userManagement/modals/groupCreate.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/userManagement/modals/groupCreate.html
@@ -58,7 +58,7 @@
</div>
</div>
- <div class="row">
+ <div class="row" ng-show="cluster">
<div class="form-group col-sm-6"
ng-class="{ 'has-error': form.groupCreateForm.role.$error.required && form.groupCreateForm.submitted }">
<label for="role" class="nowrap roles-label">
http://git-wip-us.apache.org/repos/asf/ambari/blob/dc31e516/ambari-admin/src/main/resources/ui/admin-web/app/views/userManagement/modals/userCreate.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/userManagement/modals/userCreate.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/userManagement/modals/userCreate.html
index b1b5876..2e5bba6 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/userManagement/modals/userCreate.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/userManagement/modals/userCreate.html
@@ -38,6 +38,7 @@
tooltip="{{'users.userNameTip' | translate}}"
autocomplete="off"
tooltip-trigger="focus"
+ tooltip-placement="top"
class="form-control"
ng-model="formData.userName"
name="userName"
@@ -98,7 +99,7 @@
</div>
</div>
- <div class="row">
+ <div class="row" ng-show="cluster">
<div class="form-group col-sm-6"
ng-class="{ 'has-error': form.userCreateForm.role.$error.required && form.userCreateForm.submitted }">
<label for="role" class="nowrap roles-label">
http://git-wip-us.apache.org/repos/asf/ambari/blob/dc31e516/ambari-admin/src/main/resources/ui/admin-web/app/views/userManagement/userEdit.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/userManagement/userEdit.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/userManagement/userEdit.html
index 300046d..80e2196 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/userManagement/userEdit.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/userManagement/userEdit.html
@@ -70,7 +70,7 @@
</div>
</div>
- <div class="form-group">
+ <div class="form-group" ng-show="cluster">
<label for="role" class="col-sm-2 roles-label">
{{'users.role' | translate}}
<i class="fa fa-question-circle" aria-hidden="true" ng-click="showHelpPage()"></i>
[10/23] ambari git commit: AMBARI-22624 Modify display of compare of
config versions. (atkach)
Posted by nc...@apache.org.
AMBARI-22624 Modify display of compare of config versions. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/45f2a6e4
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/45f2a6e4
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/45f2a6e4
Branch: refs/heads/branch-feature-AMBARI-21674
Commit: 45f2a6e44c1b92b1f841fbe5fde762783e41be35
Parents: b1fd131
Author: Andrii Tkach <at...@apache.org>
Authored: Mon Dec 11 14:23:44 2017 +0200
Committer: Andrii Tkach <at...@apache.org>
Committed: Mon Dec 11 14:23:44 2017 +0200
----------------------------------------------------------------------
.../controllers/main/service/info/configs.js | 46 ++-
ambari-web/app/messages.js | 1 +
.../mixins/common/configs/configs_comparator.js | 1 -
.../app/mixins/common/configs/configs_loader.js | 8 +-
ambari-web/app/models/configs/config_group.js | 8 +
ambari-web/app/styles/application.less | 3 +
ambari-web/app/styles/common.less | 1 +
.../app/styles/service_configurations.less | 292 +++++++++++++++++++
ambari-web/app/styles/widgets.less | 7 +-
ambari-web/app/templates.js | 2 +
.../common/configs/compare_property.hbs | 38 ---
.../common/configs/configs_comparison_cell.hbs | 26 ++
.../common/configs/configs_comparison_row.hbs | 79 +++++
.../app/templates/common/configs/controls.hbs | 12 +-
.../templates/common/configs/service_config.hbs | 30 +-
.../common/configs/service_config_category.hbs | 120 ++++----
.../service_config_layout_tab_compare.hbs | 80 +++++
.../comparison/config_widget_comparison.hbs | 37 ---
.../common/configs/widgets/controls.hbs | 15 -
.../templates/common/filter_combo_cleanable.hbs | 7 +-
ambari-web/app/views.js | 3 +-
.../common/configs/compare_property_view.js | 25 --
.../configs/config_versions_control_view.js | 35 +--
.../configs/overriddenPropertyRow_view.js | 31 --
.../service_config_layout_tab_compare_view.js | 31 ++
.../views/common/configs/service_config_view.js | 7 +-
.../configs/service_configs_by_category_view.js | 17 +-
.../comparison/config_widget_comparison_view.js | 23 --
.../app/views/common/filter_combo_cleanable.js | 6 +-
.../common/configs/configs_comparator_test.js | 5 -
.../config_versions_control_view_test.js | 1 -
.../configs/overriddenProperty_view_test.js | 42 ---
.../service_configs_by_category_view_test.js | 18 +-
33 files changed, 699 insertions(+), 358 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/controllers/main/service/info/configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js
index a3a4206..e143da8 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -43,11 +43,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.AddSecurityConfi
selectedConfigGroup: null,
- /**
- * currently displayed service config version
- */
- displayedVersion: null,
-
groupsStore: App.ServiceConfigGroup.find(),
/**
@@ -75,6 +70,14 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.AddSecurityConfi
return this.get('groupsStore').filterProperty('serviceName', this.get('content.serviceName'));
}.property('content.serviceName', 'groupsStore.@each.serviceName'),
+ defaultGroup: function() {
+ return this.get('configGroups').findProperty('isDefault');
+ }.property('configGroups'),
+
+ isNonDefaultGroupSelectedInCompare: function() {
+ return this.get('isCompareMode') && this.get('selectedConfigGroup') && !this.get('selectedConfigGroup.isDefault');
+ }.property('selectedConfigGroup', 'isCompareMode'),
+
dependentConfigGroups: function() {
if (this.get('dependentServiceNames.length') === 0) return [];
return this.get('groupsStore').filter(function(group) {
@@ -105,6 +108,14 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.AddSecurityConfi
selectedVersion: null,
/**
+ * currently displayed service config version
+ * @type {App.ServiceConfigVersion}
+ */
+ selectedVersionRecord: function() {
+ return App.ServiceConfigVersion.find().findProperty('version', this.get('selectedVersion'));
+ }.property('selectedVersion'),
+
+ /**
* note passed on configs save
* @type {string}
*/
@@ -187,7 +198,9 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.AddSecurityConfi
{
attributeName: 'isOverridden',
attributeValue: true,
- caption: 'common.combobox.dropdown.overridden'
+ caption: 'common.combobox.dropdown.overridden',
+ dependentOn: 'isNonDefaultGroupSelectedInCompare',
+ disabledOnCondition: 'isNonDefaultGroupSelectedInCompare'
},
{
attributeName: 'isFinal',
@@ -198,7 +211,8 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.AddSecurityConfi
attributeName: 'hasCompareDiffs',
attributeValue: true,
caption: 'common.combobox.dropdown.changed',
- dependentOn: 'isCompareMode'
+ dependentOn: 'isCompareMode',
+ canBeExcluded: true
},
{
attributeName: 'hasIssues',
@@ -215,17 +229,19 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.AddSecurityConfi
var filterColumns = [];
this.get('propertyFilters').forEach(function(filter) {
- if (Em.isNone(filter.dependentOn) || this.get(filter.dependentOn)) {
- filterColumns.push(Ember.Object.create({
- attributeName: filter.attributeName,
- attributeValue: filter.attributeValue,
- name: this.t(filter.caption),
- selected: filter.dependentOn ? this.get(filter.dependentOn) : false
- }));
+ if (this.get('canBeExcluded') && !(Em.isNone(filter.dependentOn) || this.get(filter.dependentOn))) {
+ return; // exclude column
}
+ filterColumns.push(Ember.Object.create({
+ attributeName: filter.attributeName,
+ attributeValue: filter.attributeValue,
+ name: this.t(filter.caption),
+ selected: filter.dependentOn ? this.get(filter.dependentOn) : false,
+ isDisabled: filter.disabledOnCondition ? this.get(filter.disabledOnCondition) : false
+ }));
}, this);
return filterColumns;
- }.property('propertyFilters', 'isCompareMode'),
+ }.property('propertyFilters', 'isCompareMode', 'isNonDefaultGroupSelectedInCompare'),
/**
* Detects of some of the `password`-configs has not default value
http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 74c050f..57999a8 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -361,6 +361,7 @@ Em.I18n.translations = {
'common.views': 'Views',
'common.critical.error': 'Critical',
'common.with': 'with',
+ 'common.propertyName': 'Property Name',
'models.alert_instance.tiggered.verbose': "Occurred on {0} <br> Checked on {1}",
'models.alert_definition.triggered.verbose': "Occurred on {0}",
http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/mixins/common/configs/configs_comparator.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/configs/configs_comparator.js b/ambari-web/app/mixins/common/configs/configs_comparator.js
index 45cd106..0af60ce 100644
--- a/ambari-web/app/mixins/common/configs/configs_comparator.js
+++ b/ambari-web/app/mixins/common/configs/configs_comparator.js
@@ -50,7 +50,6 @@ App.ConfigsComparator = Em.Mixin.create({
this.getCompareVersionConfigs(compareServiceVersions).done(function (json) {
allConfigs.setEach('isEditable', false);
self.initCompareConfig(allConfigs, json);
- self.set('compareServiceVersion', null);
dfd.resolve(true);
}).fail(function () {
self.set('compareServiceVersion', null);
http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/mixins/common/configs/configs_loader.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/configs/configs_loader.js b/ambari-web/app/mixins/common/configs/configs_loader.js
index 403b871..eb9c512 100644
--- a/ambari-web/app/mixins/common/configs/configs_loader.js
+++ b/ambari-web/app/mixins/common/configs/configs_loader.js
@@ -104,6 +104,7 @@ App.ConfigsLoader = Em.Mixin.create(App.GroupsMappingMixin, {
*/
loadCurrentVersions: function() {
this.set('isCompareMode', false);
+ this.set('compareServiceVersion', null);
this.set('versionLoaded', false);
this.set('selectedVersion', this.get('currentDefaultVersion'));
this.set('preSelectedConfigVersion', null);
@@ -144,8 +145,11 @@ App.ConfigsLoader = Em.Mixin.create(App.GroupsMappingMixin, {
* loads selected versions of current service
* @method loadSelectedVersion
*/
- loadSelectedVersion: function (version, switchToGroup) {
- this.set('isCompareMode', false);
+ loadSelectedVersion: function (version, switchToGroup, stayInCompare) {
+ if (!stayInCompare) {
+ this.set('isCompareMode', false);
+ this.set('compareServiceVersion', null);
+ }
this.set('versionLoaded', false);
version = version || this.get('currentDefaultVersion');
this.clearRecommendationsInfo();
http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/models/configs/config_group.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/configs/config_group.js b/ambari-web/app/models/configs/config_group.js
index e2993d8..6cdfb47 100644
--- a/ambari-web/app/models/configs/config_group.js
+++ b/ambari-web/app/models/configs/config_group.js
@@ -101,6 +101,14 @@ App.ServiceConfigGroup = DS.Model.extend({
*/
displayNameHosts: Em.computed.format('{0} ({1})', 'displayName', 'hosts.length'),
+ switchGroupTextShort: function() {
+ return Em.I18n.t('services.service.config_groups.switchGroupTextShort').format(this.get('displayName'));
+ }.property('displayName'),
+
+ switchGroupTextFull: function() {
+ return Em.I18n.t('services.service.config_groups.switchGroupTextFull').format(this.get('displayName'));
+ }.property('displayName'),
+
/**
* Provides hosts which are available for inclusion in
* non-default configuration groups.
http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index b7c7635..b8ad4ac 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -2072,6 +2072,9 @@ i.glyphicon-asterisks {
right:0;
}
}
+ i.disabled {
+ color: @gray-text;
+ }
}
input[type="radio"].align-checkbox, input[type="checkbox"].align-checkbox {
http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/styles/common.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/common.less b/ambari-web/app/styles/common.less
index 7202342..4a4f9ec 100644
--- a/ambari-web/app/styles/common.less
+++ b/ambari-web/app/styles/common.less
@@ -41,6 +41,7 @@
@health-status-yellow: #FFD13D;
@health-status-orange: #e98a41;
@maintenance-black: #000;
+@gray-text: #666;
/************************************************************************
* Health status(service/host/host component health)icon colors ends
***********************************************************************/
http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/styles/service_configurations.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/service_configurations.less b/ambari-web/app/styles/service_configurations.less
new file mode 100644
index 0000000..5c5abe47
--- /dev/null
+++ b/ambari-web/app/styles/service_configurations.less
@@ -0,0 +1,292 @@
+/**
+ * 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 'common.less';
+
+.settings-compare-layout {
+ .accordion .panel-group .panel {
+ padding: 0;
+ }
+
+ .comparison-table-header {
+ margin: 0 0 10px 0;
+ line-height: 25px;
+ }
+
+ .property-name-column {
+ width: 25%
+ }
+
+ .property-value-column {
+ overflow: auto;
+ max-height: 300px;
+ }
+
+ .comparison-row {
+ margin-left: -25px;
+ padding: 10px 0;
+ }
+
+ .undefined {
+ font-style: italic;
+ color: @gray-text;
+ }
+
+ .has-compare-diffs {
+ background-color: rgba(211, 237, 247, 0.39);
+ }
+}
+
+#serviceConfig {
+ background: white;
+ padding: 15px;
+
+ .alert{
+ .glyphicon-refresh{
+ margin-left:10px;
+ }
+ .glyphicon-warning-sign {
+ color: @health-status-yellow;
+ }
+ }
+ .collapsable {
+ cursor: pointer;
+ }
+ .directories {
+ min-width: 280px;
+ }
+ .panel-heading {
+ cursor: pointer;
+ }
+ .panel-group {
+
+ .control-label {
+ text-align: left;
+ word-wrap: break-word;
+ font-weight: 500;
+ .glyphicon-lock {
+ color: #008000;
+ }
+ }
+ .service-config-section{
+ .overridden-property{
+ background-color: rgba(211, 237, 247, 0.39);
+ padding: 5px;
+ margin-left: -5px;
+ }
+ .checkbox {
+ line-height: 0.8em;
+ &.list-inline {
+ vertical-align: baseline;
+ &>.ember-checkbox{
+ margin-left: -14px;
+ }
+ }
+ }
+ }
+ .entry-row.indent-1 {
+ margin-left: 2em;
+ }
+ .entry-row.indent-2 {
+ margin-left: 4em;
+ }
+ .entry-row {
+ margin: 0;
+ .action{
+ margin-left: 3px;
+ margin-right: 1px;
+ font-size: 13px;
+ white-space: nowrap;
+ }
+ input[type="radio"] {
+ margin-right: 5px;
+ margin-left: -20px;
+ }
+ .control-group {
+ margin: 0;
+ .overrideField {
+ display: block;
+ margin-top: 5px;
+ margin-bottom: 5px;
+ }
+ .overridden-hosts-view {
+ display: inline-block;
+ }
+ &>.ember-checkbox{
+ margin-bottom: 5px;
+ }
+ }
+ }
+ form {
+ margin-bottom: 0;
+ }
+ }
+ .badge {
+ margin-left: 4px;
+ }
+
+ .master-host, .master-hosts, .slave-hosts {
+ padding-top: 5px;
+ line-height: 20px;
+ }
+
+ .enhanced-config-tab-content {
+ .action {
+ display: inline-block;
+ }
+ }
+ .common-config-category, .enhanced-config-tab-content {
+ .panel-title {
+ line-height: 16px;
+ }
+ .action {
+ cursor: pointer;
+ }
+ .a-icon(@color) {
+ color: @color;
+ margin-right: 2px;
+ }
+ .glyphicon-plus-sign {
+ .a-icon(@health-status-green);
+ }
+ .glyphicon-minus-sign {
+ .a-icon(#FF4B4B);
+ }
+ .icon-undo {
+ .a-icon(rgb(243, 178, 11));
+ }
+ .btn-final{
+ background: transparent repeat scroll 0 0 #fff;
+ }
+ .btn-final .glyphicon-lock{
+ color: #a6a6a6;
+ cursor: inherit;
+ }
+ .btn-final.active .glyphicon-lock {
+ color: blue;
+ }
+ .btn-final.active { //copied from Bootstrap .btn.active
+ background-color: #e6e6e6;
+ background-color: #d9d9d9 \9;
+ background-image: none;
+ outline: 0;
+ box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
+ }
+ .btn-final.active[disabled] {
+ cursor: not-allowed;
+ }
+ a.panel-toggle:hover {
+ text-decoration: none;
+ .category-name {
+ color: #337ab7;
+ text-decoration: underline;
+ }
+ }
+ }
+
+ .enhanced-config-tab-content
+ {
+ .action-button {
+ margin-left: 3px;
+ }
+ }
+
+ .capacity-scheduler {
+ .header {
+ margin-bottom: 10px;
+ .col-md-1 {
+ padding-top: 10px;
+ font-weight: bold;
+ }
+ }
+ form.form-horizontal {
+ margin-left: 20px;
+ .control-label-span {
+ word-wrap: break-word;
+ }
+ }
+ table tr, svg {
+ cursor: pointer;
+ }
+ .marker {
+ margin: 0 5px;
+ display: inline-block;
+ width: 12px;
+ height: 12px;
+ }
+
+ .frame{
+ position:relative;
+ width: 200px;
+ height: 200px;
+ }
+ }
+ .nav-tabs > li > a {
+ padding-left: 8px;
+ padding-right: 8px;
+ &.new {
+ font-weight: 700;
+ }
+ }
+ .with-unit{
+ float: left;
+ .input-group-addon{
+ overflow: hidden;
+ max-width:250px;
+ }
+ }
+ .dropdown-menu > li > a:hover {
+ text-shadow: none;
+ }
+ .db-connection {
+ .spinner {
+ width: @spinner-small-width;
+ height: @spinner-small-height;
+ background-size: cover;
+ i {
+ font-size: 1em;
+ }
+ }
+ .glyphicon-ok-sign, .glyphicon-warning-sign {
+ font-size: 27px;
+ line-height: 30px;
+ }
+ .glyphicon-warning-sign {
+ color: @health-status-red;
+ }
+ .connection-result {
+ font-size: 15px;
+ line-height: 30px;
+ }
+ a.mute {
+ color: #333;
+ &:hover {
+ text-decoration: none;
+ color: #333;
+ }
+ }
+ }
+ .help-block {
+ display: inline-block;
+ }
+ .long-input {
+ width: 75%;
+ }
+ .config-controls {
+ line-height: 34px;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/styles/widgets.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/widgets.less b/ambari-web/app/styles/widgets.less
index a11c30f..3f4a707 100644
--- a/ambari-web/app/styles/widgets.less
+++ b/ambari-web/app/styles/widgets.less
@@ -28,6 +28,7 @@
@slider-widget-border-color: #999;
@slider-widget-width: 220px;
+@slider-widget-wrapper-width: 68%;
@slider-widget-tooltip-background-color: @green;
@slider-widget-selection-background-color: @slider-dark-grey;
@slider-widget-body-height: 10px;
@@ -158,7 +159,7 @@
.directory-textarea-wrapper {
float: left;
- width: 80%;
+ width: @slider-widget-wrapper-width;
}
.list-widget {
@@ -283,9 +284,9 @@
.ui-slider-wrapper {
.ui-slider-wrapper-inner {
- width: 68%;
+ width: @slider-widget-wrapper-width;
width: calc(~"100% - 30px -"@controls-min-width);
- max-width: 68%;
+ max-width: @slider-widget-wrapper-width;
padding-left: 10px;
.slider.slider-horizontal {
width: 100%;
http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/templates.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates.js b/ambari-web/app/templates.js
index 80a3176..b18cc73 100644
--- a/ambari-web/app/templates.js
+++ b/ambari-web/app/templates.js
@@ -28,3 +28,5 @@ require("templates/main/service/widgets/create/step2_template");
require("templates/main/service/widgets/create/step2_graph");
require('templates/common/configs/widgets/controls');
require('templates/common/configs/widgets/config_label');
+require('templates/common/configs/configs_comparison_row');
+require('templates/common/configs/configs_comparison_cell');
http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/templates/common/configs/compare_property.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/configs/compare_property.hbs b/ambari-web/app/templates/common/configs/compare_property.hbs
deleted file mode 100644
index 6d84913..0000000
--- a/ambari-web/app/templates/common/configs/compare_property.hbs
+++ /dev/null
@@ -1,38 +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.
-}}
-
-{{#each compareConfig in view.serviceConfigProperty.compareConfigs}}
- <div {{bindAttr class=":form-group :overrideField"}}>
- <div class="row">
- <div class="col-md-9">
- {{view compareConfig.viewClass serviceConfigBinding="compareConfig" versionBinding="compareConfig.serviceVersion.version" categoryConfigsAllBinding="view.parentView.categoryConfigsAll"}}
- <span class="label label-info config-controls">{{compareConfig.serviceVersion.versionText}}</span>
- {{#if compareConfig.serviceVersion.isCurrent}}
- <span class="label label-success config-controls">{{t common.current}}</span>
- {{/if}}
- {{#unless compareConfig.isMock}}
- {{#if compareConfig.supportsFinal}}
- <a disabled="disabled" {{bindAttr class=":btn-sm :btn-final compareConfig.isFinal:active compareConfig.hideFinalIcon:hidden" }}>
- <i class="glyphicon glyphicon-lock"></i>
- </a>
- {{/if}}
- {{/unless}}
- </div>
- </div>
- </div>
-{{/each}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/templates/common/configs/configs_comparison_cell.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/configs/configs_comparison_cell.hbs b/ambari-web/app/templates/common/configs/configs_comparison_cell.hbs
new file mode 100644
index 0000000..450d5f7
--- /dev/null
+++ b/ambari-web/app/templates/common/configs/configs_comparison_cell.hbs
@@ -0,0 +1,26 @@
+{{!
+* 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.
+}}
+
+<span {{bindAttr class="compareConfig.isMock:undefined"}}>
+ {{compareConfig.value}} {{compareConfig.unit}}
+</span>
+{{#unless compareConfig.isMock}}
+ {{#if compareConfig.supportsFinal}}
+ <i {{bindAttr class=":glyphicon :glyphicon-lock compareConfig.isFinal::hidden" }}></i>
+ {{/if}}
+{{/unless}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/templates/common/configs/configs_comparison_row.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/configs/configs_comparison_row.hbs b/ambari-web/app/templates/common/configs/configs_comparison_row.hbs
new file mode 100644
index 0000000..c9264ee
--- /dev/null
+++ b/ambari-web/app/templates/common/configs/configs_comparison_row.hbs
@@ -0,0 +1,79 @@
+{{!
+* 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 {{bindAttr class=":row :comparison-row :bottom-border configData.isHiddenByFilter:hide configData.hasCompareDiffs:has-compare-diffs"}} {{QAAttr "property-row"}}>
+ <div class="col-md-3 property-name-column">
+ {{#if configData.showLabel}}
+ <span class="control-label">
+ {{formatWordBreak configData.displayName}}
+ {{#if configData.isSecureConfig}}
+ <a href="javascript:void(null);">
+ <i class="glyphicon glyphicon-lock" rel="tooltip" data-toggle="tooltip" title="security knob"></i>
+ </a>
+ {{/if}}
+ </span>
+ {{/if}}
+ </div>
+ <div class="col-md-4 property-value-column">
+ {{#if controller.selectedConfigGroup.isDefault}}
+ {{! Comparing config-versions from Default config-group}}
+ <span {{bindAttr class="configData.isMock:undefined"}}>{{configData.value}} {{configData.unit}}</span>
+ {{#unless configData.isMock}}
+ {{#if configData.supportsFinal}}
+ <i {{bindAttr class=":glyphicon :glyphicon-lock configData.isFinal::hidden" }}></i>
+ {{/if}}
+ {{/unless}}
+ {{else}}
+ {{#if configData.hasCompareDiffs}}
+ {{! Comparing config-versions from Non-Default config-group}}
+ {{#each compareConfig in configData.compareConfigs}}
+ {{#if compareConfig.isComparison}}
+ {{template "templates/common/configs/configs_comparison_cell"}}
+ {{/if}}
+ {{/each}}
+ {{else}}
+ {{! If config values of non-default group haven't been changed then show their values}}
+ {{#each compareConfig in configData.overrides}}
+ {{template "templates/common/configs/configs_comparison_cell"}}
+ {{/each}}
+ {{/if}}
+ {{/if}}
+ </div>
+ <div class="col-md-4 col-md-offset-1 property-value-column">
+ {{#if controller.selectedConfigGroup.isDefault}}
+ {{! Comparing config-versions from Default config-group}}
+ {{#each compareConfig in configData.compareConfigs}}
+ {{template "templates/common/configs/configs_comparison_cell"}}
+ {{/each}}
+ {{else}}
+ {{#if configData.hasCompareDiffs}}
+ {{! Comparing config-versions from Non-Default config-group}}
+ {{#each compareConfig in configData.compareConfigs}}
+ {{#if compareConfig.isOriginalSCP}}
+ {{template "templates/common/configs/configs_comparison_cell"}}
+ {{/if}}
+ {{/each}}
+ {{else}}
+ {{! If config values of non-default group haven't been changed then show their values}}
+ {{#each compareConfig in configData.overrides}}
+ {{template "templates/common/configs/configs_comparison_cell"}}
+ {{/each}}
+ {{/if}}
+ {{/if}}
+ </div>
+</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/templates/common/configs/controls.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/configs/controls.hbs b/ambari-web/app/templates/common/configs/controls.hbs
index db12e3c..84e50ad 100644
--- a/ambari-web/app/templates/common/configs/controls.hbs
+++ b/ambari-web/app/templates/common/configs/controls.hbs
@@ -17,40 +17,40 @@
}}
{{#if view.showSwitchToGroup}}
- {{view App.SwitchToGroupView controllerBinding="controller" groupBinding="this.group"}}
+ {{view App.SwitchToGroupView controllerBinding="controller" groupBinding="view.serviceConfigProperty.group"}}
{{else}}
{{#if view.showIsFinal}}
<a href="#" data-toggle="tooltip"
{{bindAttr class=":btn-sm :btn-final view.serviceConfigProperty.isFinal:active view.serviceConfigProperty.hideFinalIcon:hidden" disabled="view.serviceConfigProperty.isNotEditable"}}
- {{action "toggleFinalFlag" this target="view.parentView"}}
+ {{action "toggleFinalFlag" view.serviceConfigProperty target="view.parentView"}}
{{translateAttr data-original-title="services.service.config.final"}}>
<i class="glyphicon glyphicon-lock"></i>
</a>
{{/if}}
{{#if view.showOverride}}
<a href="#" data-toggle="tooltip" class="btn-sm"
- {{action "createOverrideProperty" this target="view.parentView"}}
+ {{action "createOverrideProperty" view.serviceConfigProperty target="view.parentView"}}
{{translateAttr data-original-title="common.override"}}>
<i class="glyphicon glyphicon-plus-sign"></i>
</a>
{{/if}}
{{#if view.showUndo}}
<a href="#" data-toggle="tooltip" class="btn-sm"
- {{action "doRestoreDefaultValue" this target="view.parentView"}}
+ {{action "doRestoreDefaultValue" view.serviceConfigProperty target="view.parentView"}}
{{translateAttr data-original-title="common.undo"}}>
<i class="icon-undo"></i>
</a>
{{/if}}
{{#if view.showRemove}}
<a href="#" data-toggle="tooltip" class="btn-sm remove-config-property-button"
- {{action "removeProperty" this target="view.parentView"}}
+ {{action "removeProperty" view.serviceConfigProperty target="view.parentView"}}
{{translateAttr data-original-title="common.remove"}}>
<i class="glyphicon glyphicon-minus-sign"></i>
</a>
{{/if}}
{{#if view.showSetRecommended}}
<a href="#" data-toggle="tooltip" class="btn-sm"
- {{action "setRecommendedValue" this target="view.parentView"}}
+ {{action "setRecommendedValue" view.serviceConfigProperty target="view.parentView"}}
{{translateAttr data-original-title="services.service.config.setRecommendedValue"}}>
<i class="glyphicon glyphicon-repeat"></i>
</a>
http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/templates/common/configs/service_config.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/configs/service_config.hbs b/ambari-web/app/templates/common/configs/service_config.hbs
index b097b16..34ac602 100644
--- a/ambari-web/app/templates/common/configs/service_config.hbs
+++ b/ambari-web/app/templates/common/configs/service_config.hbs
@@ -58,7 +58,7 @@
{{/if}}
</div>
{{#if view.supportsHostOverrides}}
- <div {{bindAttr class="controller.isCompareMode:pull-bottom :pull-top :config-manage-nav :pull-right"}}>
+ <div {{bindAttr class="controller.isCompareMode:pull-bottom :pull-top controller.isHostsConfigsPage:pull-bottom :config-manage-nav :pull-right"}}>
{{#if controller.isHostsConfigsPage}}
{{#isAuthorized "SERVICE.MANAGE_CONFIG_GROUPS"}}
<a href="#" {{action "switchHostGroup" target="controller"}}>{{t common.change}}</a>
@@ -138,16 +138,40 @@
</ul>
<div class="tab-content service-config-tab-content">
{{#each tab in view.tabs}}
- <div {{bindAttr class=":tab-pane tab.isActive:active tab.id"}}>
+ <div {{bindAttr class=":tab-pane tab.isActive:active isCompareMode:settings-compare-layout tab.id"}}>
{{#if tab.isAdvanced}}
{{#if tab.isRendered}}
+ {{#if isCompareMode}}
+ <div class="row bottom-border comparison-table-header">
+ <div class="col-md-3 property-name-column">{{t common.propertyName}}</div>
+ <div class="col-md-4 property-value-column">
+ {{t common.version}} {{selectedVersionRecord.version}}
+ {{#if selectedVersionRecord.isCurrent}}
+ <span class="label label-success">{{t common.current}}</span>
+ {{/if}}
+ </div>
+ <div class="col-md-4 col-md-offset-1 property-value-column">
+ {{t common.version}} {{compareServiceVersion.version}}
+ {{#if compareServiceVersion.isCurrent}}
+ <span class="label label-success">{{t common.current}}</span>
+ {{/if}}
+ </div>
+ </div>
+ {{/if}}
{{view App.ConfigCategoryContainerView categoriesBinding="selectedService.configCategories" canEditBinding="view.canEdit" serviceBinding="selectedService" serviceConfigsBinding="selectedService.configs" supportsHostOverridesBinding="view.supportsHostOverrides"}}
{{else}}
{{view App.SpinnerView}}
{{/if}}
{{else}}
{{! Render Enhanced Config Section }}
- {{view App.ServiceConfigLayoutTabView contentBinding="tab" canEditBinding="view.canEdit" }}
+ {{#if isCompareMode}}
+ {{view App.ServiceConfigLayoutTabCompareView
+ contentBinding="tab"
+ primaryCompareVersionBinding="selectedVersionRecord"
+ secondaryCompareVersionBinding="compareServiceVersion"}}
+ {{else}}
+ {{view App.ServiceConfigLayoutTabView contentBinding="tab" canEditBinding="view.canEdit" }}
+ {{/if}}
{{/if}}
</div>
{{/each}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/templates/common/configs/service_config_category.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/configs/service_config_category.hbs b/ambari-web/app/templates/common/configs/service_config_category.hbs
index 87a716c..930e65d 100644
--- a/ambari-web/app/templates/common/configs/service_config_category.hbs
+++ b/ambari-web/app/templates/common/configs/service_config_category.hbs
@@ -31,86 +31,64 @@
<div class="panel-body collapse in" {{bindAttr style="view.isCategoryBodyVisible"}} {{QAAttr "panel-body"}}>
<div class="service-config-section">
<form class="form-horizontal" autocomplete="off">
- {{#each view.categoryConfigs}}
- {{#unless widget}} {{! configs with widgets should be shown only on the EnhancedConfigs tabs }}
- <div {{bindAttr class=":entry-row :form-group isHiddenByFilter:hide isOverridden:overridden-property hasCompareDiffs:overridden-property"}} {{QAAttr "property-row"}}>
- {{#if showLabel}}
- {{#unless rightSideLabel}}
- <span {{bindAttr class="errorMessage:has-error: :form-group :control-label-span :col-md-3"}}>
+ {{#each configData in view.categoryConfigs}}
+ {{#unless configData.widget}} {{! configs with widgets should be shown only on the EnhancedConfigs tabs }}
+ {{#if configData.isComparison}}
+ {{template "templates/common/configs/configs_comparison_row"}}
+ {{else}}
+ {{#unless controller.isCompareMode}}
+ <div {{bindAttr class=":entry-row :form-group configData.isHiddenByFilter:hide configData.isOverridden:overridden-property configData.hasCompareDiffs:overridden-property"}} {{QAAttr "property-row"}}>
+ {{#if configData.showLabel}}
+ {{#unless configData.rightSideLabel}}
+ <span {{bindAttr class="configData.errorMessage:has-error: :form-group :control-label-span :col-md-3"}}>
<label class="control-label" {{QAAttr "control-label"}}>
- {{formatWordBreak displayName}}
- {{#if isSecureConfig}}
- <a href="javascript:void(null);"><i class="glyphicon glyphicon-lock" rel="tooltip" data-toggle="tooltip"
- title="security knob"></i></a>
+ {{formatWordBreak configData.displayName}}
+ {{#if configData.isSecureConfig}}
+ <a href="javascript:void(null);">
+ <i class="glyphicon glyphicon-lock" rel="tooltip" data-toggle="tooltip" title="security knob"></i>
+ </a>
{{/if}}
</label>
</span>
- {{else}}
- <span class="control-group control-label-span col-md-3"> </span>
- {{/unless}}
- {{/if}}
- <div class="col-md-9">
- {{! Here serviceConfigBinding should ideally be serviceConfigPropertyBinding }}
- {{#if this.isOriginalSCP}}
- <div {{bindAttr class="errorMessage:has-error: warnMessage:has-warning: :form-group"}} {{QAAttr "property-form-group"}}>
- {{view viewClass serviceConfigBinding="this" categoryConfigsAllBinding="view.categoryConfigsAll" }}
- {{#if rightSideLabel}}
- <span {{bindAttr class="isEditable::muted"}}>{{formatWordBreak displayName}}</span>
- {{/if}}
- {{#if hintMessage}}
- <a class="icon-question-sign glyphicon glyphicon-blue" href="#"
- data-toggle="tooltip" {{bindAttr data-original-title="hintMessage"}}></a>
- {{/if}}
- {{#if this.isComparison}}
- {{#if controller.selectedConfigGroup.isDefault}}
- <span
- class="label label-info config-controls">{{t dashboard.configHistory.table.version.prefix}}{{controller.selectedVersion}}</span>
- {{#if controller.isCurrentSelected}}
- <span class="label label-success config-controls">{{t common.current}}</span>
+ {{else}}
+ <span class="control-group control-label-span col-md-3"> </span>
+ {{/unless}}
+ {{/if}}
+ <div class="col-md-9">
+ {{! Here serviceConfigBinding should ideally be serviceConfigPropertyBinding }}
+ {{#if configData.isOriginalSCP}}
+ <div {{bindAttr class="configData.errorMessage:has-error: configData.warnMessage:has-warning: :form-group"}} {{QAAttr "property-form-group"}}>
+ {{view configData.viewClass serviceConfigBinding="configData" categoryConfigsAllBinding="view.categoryConfigsAll" }}
+ {{#if configData.rightSideLabel}}
+ <span {{bindAttr class="configData.isEditable::muted"}}>{{formatWordBreak configData.displayName}}</span>
{{/if}}
- {{else}}
- <span class="label label-info config-controls">{{t common.default}}
- {{t services.service.config.configHistory.configGroup}}</span>
- {{/if}}
- {{/if}}
- {{view App.ControlsView serviceConfigPropertyBinding="this"}}
- {{#if errorMessage}}
- <span class="help-block validation-block" {{QAAttr "validation-block"}}>{{errorMessage}}</span>
- {{/if}}
- {{#if warnMessage}}
- <span class="has-warning">
- <span class="help-block validation-block" {{QAAttr "validation-block"}}>{{warnMessage}}</span>
+ {{#if configData.hintMessage}}
+ <a class="icon-question-sign glyphicon glyphicon-blue" href="#"
+ data-toggle="tooltip" {{bindAttr data-original-title="configData.hintMessage"}}></a>
+ {{/if}}
+ {{view App.ControlsView serviceConfigPropertyBinding="configData"}}
+ {{#if configData.errorMessage}}
+ <span class="help-block validation-block" {{QAAttr "validation-block"}}>{{configData.errorMessage}}</span>
+ {{/if}}
+ {{#if configData.warnMessage}}
+ <span class="has-warning">
+ <span class="help-block validation-block" {{QAAttr "validation-block"}}>{{configData.warnMessage}}</span>
</span>
+ {{/if}}
+ </div>
{{/if}}
- </div>
- {{/if}}
- {{#if this.isComparison}}
- {{#unless this.isOriginalSCP}}
- {{view viewClass serviceConfigBinding="this" categoryConfigsAllBinding="view.categoryConfigsAll" }}
- {{#if controller.selectedConfigGroup.isDefault}}
- <span
- class="label label-info config-controls">{{t dashboard.configHistory.table.version.prefix}}{{controller.selectedVersion}}</span>
- {{#if controller.isCurrentSelected}}
- <span class="label label-success config-controls">{{t common.current}}</span>
- {{/if}}
- {{else}}
- <span class="label label-info config-controls">{{t common.default}}
- {{t services.service.config.configHistory.configGroup}}</span>
+ {{#if configData.isOverridden}}
+ {{view App.ServiceConfigView.SCPOverriddenRowsView
+ serviceConfigPropertyBinding="configData"
+ isDefaultGroupSelectedBinding="controller.selectedConfigGroup.isDefault"
+ }}
{{/if}}
- {{/unless}}
- {{view App.ServiceConfigView.SCPComparisonRowsView serviceConfigPropertyBinding="this"}}
- {{else}}
- {{#if this.isOverridden}}
- {{view App.ServiceConfigView.SCPOverriddenRowsView
- serviceConfigPropertyBinding="this"
- isDefaultGroupSelectedBinding="controller.selectedConfigGroup.isDefault"
- }}
- {{/if}}
+ </div>
+ </div>
+ {{#if configData.additionalView}}
+ {{view configData.additionalView}}
{{/if}}
- </div>
- </div>
- {{#if this.additionalView}}
- {{view additionalView}}
+ {{/unless}}
{{/if}}
{{/unless}}
{{/each}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/templates/common/configs/service_config_layout_tab_compare.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/configs/service_config_layout_tab_compare.hbs b/ambari-web/app/templates/common/configs/service_config_layout_tab_compare.hbs
new file mode 100644
index 0000000..ccf47f3
--- /dev/null
+++ b/ambari-web/app/templates/common/configs/service_config_layout_tab_compare.hbs
@@ -0,0 +1,80 @@
+{{!
+* 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.
+}}
+
+{{#if view.dataIsReady}}
+ {{#unless tab.isHiddenByFilter}}
+ <div class="row bottom-border comparison-table-header">
+ <div class="col-md-3 property-name-column">{{t common.propertyName}}</div>
+ <div class="col-md-4 property-value-column">
+ {{t common.version}} {{view.primaryCompareVersion.version}}
+ {{#if view.primaryCompareVersion.isCurrent}}
+ <span class="label label-success">{{t common.current}}</span>
+ {{/if}}
+ </div>
+ <div class="col-md-4 col-md-offset-1 property-value-column">
+ {{t common.version}} {{view.secondaryCompareVersion.version}}
+ {{#if view.secondaryCompareVersion.isCurrent}}
+ <span class="label label-success">{{t common.current}}</span>
+ {{/if}}
+ </div>
+ </div>
+
+ <div class="accordion">
+ {{#each row in tab.sectionRows}}
+ {{#each section in row}}
+ <div class="panel-group">
+ <div class="panel panel-default">
+ <div class="panel-heading" {{action "onToggleBlock" section target="view"}}>
+ <h3 class="panel-title">
+ <i {{bindAttr class=":pull-right :panel-toggle section.isCollapsed:icon-angle-down:icon-angle-up"}}></i>
+ <a class="panel-toggle category-header" {{QAAttr "category-header"}}>
+ <span class="category-name" {{QAAttr "category-name"}}>{{section.displayName}}</span>
+ </a>
+ </h3>
+ </div>
+ <div class="panel-body collapse in" {{bindAttr class="section.isCollapsed:hide"}} {{QAAttr "panel-body"}}>
+ <div class="service-config-section">
+ {{#each subRow in section.subsectionRows}}
+ {{#each subsection in subRow}}
+ {{#each configData in subsection.configs}}
+ {{#if configData.widget}}
+ {{#if configData.isVisible}}
+ {{template "templates/common/configs/configs_comparison_row"}}
+ {{/if}}
+ {{/if}}
+ {{/each}}
+ {{#if subsection.showTabs}}
+ {{#each subSectionTab in subsection.subSectionTabs}}
+ {{#each configData in subSectionTab.configs}}
+ {{#if configData.isVisible}}
+ {{template "templates/common/configs/configs_comparison_row"}}
+ {{/if}}
+ {{/each}}
+ {{/each}}
+ {{/if}}
+ {{/each}}
+ {{/each}}
+ </div>
+ </div>
+ </div>
+ </div>
+ {{/each}}
+ {{/each}}
+ </div>
+ {{/unless}}
+{{/if}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/templates/common/configs/widgets/comparison/config_widget_comparison.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/configs/widgets/comparison/config_widget_comparison.hbs b/ambari-web/app/templates/common/configs/widgets/comparison/config_widget_comparison.hbs
deleted file mode 100644
index b692550..0000000
--- a/ambari-web/app/templates/common/configs/widgets/comparison/config_widget_comparison.hbs
+++ /dev/null
@@ -1,37 +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.
-}}
-
-{{#each compareConfig in view.serviceConfigProperty.compareConfigs}}
- <div class="clearfix"></div>
- <div {{bindAttr class=":form-group :overrideField :widget-config-comparison"}}>
- {{view view.serviceConfigProperty.widget canEditBinding="view.canEdit" configBinding="compareConfig"
- isBeingComparedBinding="view.isBeingCompared" categoryConfigsAllBinding="view.parentView.categoryConfigsAll" isPopoverEnabled="false"}}
- <div class="widget-config-controls version-labels">
- <span class="label label-info">{{compareConfig.serviceVersion.versionText}}</span>
- {{#if compareConfig.serviceVersion.isCurrent}}
- <span class="label label-success">{{t common.current}}</span>
- {{/if}}
- {{#unless compareConfig.isMock}}
- {{#if compareConfig.supportsFinal}}
- <i {{bindAttr class=":glyphicon :glyphicon-lock compareConfig.isFinal::hidden" }}></i>
- {{/if}}
- {{/unless}}
- </div>
- </div>
-{{/each}}
- <div class="clearfix"></div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/templates/common/configs/widgets/controls.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/configs/widgets/controls.hbs b/ambari-web/app/templates/common/configs/widgets/controls.hbs
index b7aff8e..d9a3bb2 100644
--- a/ambari-web/app/templates/common/configs/widgets/controls.hbs
+++ b/ambari-web/app/templates/common/configs/widgets/controls.hbs
@@ -123,16 +123,6 @@
{{t services.service.config.configHistory.configGroup}}</span>
{{/if}}
</div>
-{{else}}
- {{#unless view.isBeingCompared}} {{! subview(ConfigWidgetComparisonView) will take care of config being compared}}
- {{#unless view.canEdit}}
- {{#if view.config.supportsFinal}}
- <div class="widget-config-controls version-labels">
- <i {{bindAttr class=":glyphicon :glyphicon-lock view.config.isFinal::hidden" }}></i>
- </div>
- {{/if}}
- {{/unless}}
- {{/unless}}
{{/if}}
@@ -145,8 +135,3 @@
}}
{{/unless}}
{{/if}}
-
-{{#if view.isComparison}}
- <div class="clearfix"></div>
- {{view App.ConfigWidgetComparisonView serviceConfigPropertyBinding="view.config"}}
-{{/if}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/templates/common/filter_combo_cleanable.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/filter_combo_cleanable.hbs b/ambari-web/app/templates/common/filter_combo_cleanable.hbs
index 18f3322..1dab482 100644
--- a/ambari-web/app/templates/common/filter_combo_cleanable.hbs
+++ b/ambari-web/app/templates/common/filter_combo_cleanable.hbs
@@ -30,9 +30,10 @@
</button>
<ul class="dropdown-menu">
{{#each column in view.columns}}
- <li>
- <a href="#" {{action selectFilterColumn column target="view"}}>
- <i {{bindAttr class="column.selected:glyphicon-ok-sign:glyphicon-placeholder :glyphicon :text-success"}}></i>
+ <li {{bindAttr class="column.isDisabled:disabled"}}>
+ <a href="#" {{action selectFilterColumn column target="view"}}
+ {{bindAttr class="column.isDisabled:disabled"}}>
+ <i {{bindAttr class="column.isDisabled:disabled column.selected:glyphicon-ok-sign:glyphicon-placeholder :glyphicon :text-success"}}></i>
{{column.name}}
</a>
</li>
http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/views.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views.js b/ambari-web/app/views.js
index e18182f..ec4675e 100644
--- a/ambari-web/app/views.js
+++ b/ambari-web/app/views.js
@@ -74,7 +74,6 @@ require('views/common/configs/service_config_tab_view');
require('views/common/configs/config_category_container_view');
require('views/common/configs/overriddenPropertyRow_view');
require('views/common/configs/overriddenProperty_view');
-require('views/common/configs/compare_property_view');
require('views/common/configs/config_versions_control_view');
require('views/common/configs/config_versions_dropdown_view');
require('views/common/configs/selectable_popup_body_view');
@@ -98,8 +97,8 @@ require('views/common/configs/widgets/toggle_config_widget_view');
require('views/common/configs/widgets/label_config_widget_view');
require('views/common/configs/widgets/test_db_connection_widget_view');
require('views/common/configs/widgets/overrides/config_widget_override_view');
-require('views/common/configs/widgets/comparison/config_widget_comparison_view');
require('views/common/configs/service_config_layout_tab_view');
+require('views/common/configs/service_config_layout_tab_compare_view');
require('views/common/filter_combobox');
require('views/common/filter_combo_cleanable');
require('views/common/pagination_view');
http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/views/common/configs/compare_property_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/compare_property_view.js b/ambari-web/app/views/common/configs/compare_property_view.js
deleted file mode 100644
index b8b022d..0000000
--- a/ambari-web/app/views/common/configs/compare_property_view.js
+++ /dev/null
@@ -1,25 +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.
- */
-// SCP means ServiceConfigProperty
-
-var App = require('app');
-
-App.ServiceConfigView.SCPComparisonRowsView = Ember.View.extend({
- classNames: ['compare-value'],
- templateName: require('templates/common/configs/compare_property'),
- serviceConfigProperty: null
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/views/common/configs/config_versions_control_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/config_versions_control_view.js b/ambari-web/app/views/common/configs/config_versions_control_view.js
index d5f8807..0b9fb2f 100644
--- a/ambari-web/app/views/common/configs/config_versions_control_view.js
+++ b/ambari-web/app/views/common/configs/config_versions_control_view.js
@@ -23,14 +23,9 @@ App.ConfigVersionsControlView = Em.View.extend({
serviceName: Em.computed.alias('controller.content.serviceName'),
- /**
- * @type {?App.ServiceConfigVersion}
- */
- compareServiceVersion: null,
-
displayedServiceVersion: Em.computed.findBy('serviceVersions', 'isDisplayed', true),
- isCompareMode: Em.computed.notEqual('compareServiceVersion', null),
+ isCompareMode: Em.computed.notEqual('controller.compareServiceVersion', null),
allServiceVersions: function() {
return App.ServiceConfigVersion.find().filterProperty('serviceName', this.get('serviceName'));
@@ -40,12 +35,8 @@ App.ConfigVersionsControlView = Em.View.extend({
const isDefaultGroupSelected = this.get('controller.selectedConfigGroup.isDefault');
const groupId = this.get('controller.selectedConfigGroup.id');
- this.get('allServiceVersions').forEach(function (version) {
- version.set('isDisabled', !(version.get('groupId') === groupId || isDefaultGroupSelected && version.get('groupName') === App.ServiceConfigGroup.defaultGroupName));
- }, this);
-
const serviceVersions = this.get('allServiceVersions').filter(function(s) {
- return s.get('groupId') === groupId || s.get('groupName') === App.ServiceConfigGroup.defaultGroupName;
+ return (s.get('groupId') === groupId || isDefaultGroupSelected && s.get('groupName') === App.ServiceConfigGroup.defaultGroupName);
});
if (!serviceVersions.findProperty('isDisplayed')) {
@@ -59,11 +50,11 @@ App.ConfigVersionsControlView = Em.View.extend({
}.property('serviceName', 'controller.selectedConfigGroup.name'),
primaryServiceVersionsInCompare: function() {
- return this.get('serviceVersions').filter((sv) => sv.get('version') !== this.get('compareServiceVersion.version'));
- }.property('serviceVersions', 'compareServiceVersion'),
+ return this.get('serviceVersions').filter((sv) => sv.get('version') !== this.get('controller.compareServiceVersion.version'));
+ }.property('serviceVersions', 'controller.compareServiceVersion'),
secondaryServiceVersionsInCompare: function() {
- if (this.get('compareServiceVersion')) {
+ if (this.get('controller.compareServiceVersion')) {
return this.get('serviceVersions')
.filter((serviceVersion) => !serviceVersion.get('isDisplayed'))
.map((serviceVersion) => {
@@ -75,13 +66,13 @@ App.ConfigVersionsControlView = Em.View.extend({
fullNotes: serviceVersion.get('fullNotes'),
isCurrent: serviceVersion.get('isCurrent'),
});
- copy.set('isDisplayed', serviceVersion.get('version') === this.get('compareServiceVersion.version'));
+ copy.set('isDisplayed', serviceVersion.get('version') === this.get('controller.compareServiceVersion.version'));
return copy;
});
} else {
return [];
}
- }.property('serviceVersions', 'compareServiceVersion'),
+ }.property('serviceVersions', 'controller.compareServiceVersion'),
willInsertElement: function () {
this.setDisplayVersion();
@@ -93,7 +84,6 @@ App.ConfigVersionsControlView = Em.View.extend({
serviceVersions.forEach(function (serviceVersion) {
serviceVersion.set('isDisplayed', selectedVersion === serviceVersion.get('version'));
});
- this.set('controller.displayedVersion', this.get('serviceVersions').findProperty('isDisplayed'));
},
onChangeConfigGroup: function () {
@@ -118,7 +108,7 @@ App.ConfigVersionsControlView = Em.View.extend({
/**
* switch configs view version to chosen
*/
- switchVersion: function (event) {
+ switchVersion: function (event, stayInCompare) {
const version = event.contexts[0];
if (this.get('serviceVersions').filterProperty('isDisplayed').someProperty('version', version)) {
return;
@@ -127,13 +117,11 @@ App.ConfigVersionsControlView = Em.View.extend({
this.get('serviceVersions').forEach(function (serviceVersion) {
serviceVersion.set('isDisplayed', serviceVersion.get('version') === version);
});
- this.get('controller').loadSelectedVersion(version);
- this.set('controller.displayedVersion', this.get('serviceVersions').findProperty('isDisplayed'));
+ this.get('controller').loadSelectedVersion(version, null, true);
},
switchPrimaryInCompare: function(event) {
- this.switchVersion({contexts: [event.contexts[0].get('version')]});
- this.set('controller.compareServiceVersion', this.get('compareServiceVersion'));
+ this.switchVersion({contexts: [event.contexts[0].get('version')]}, true);
},
/**
@@ -143,7 +131,6 @@ App.ConfigVersionsControlView = Em.View.extend({
compare: function (event) {
const serviceConfigVersion = event.contexts[0];
this.set('controller.compareServiceVersion', serviceConfigVersion);
- this.set('compareServiceVersion', serviceConfigVersion);
const controller = this.get('controller');
controller.get('stepConfigs').clear();
@@ -155,8 +142,6 @@ App.ConfigVersionsControlView = Em.View.extend({
removeCompareVersionBar: function () {
const displayedVersion = this.get('displayedServiceVersion.version');
- this.set('compareServiceVersion', null);
- this.set('controller.compareServiceVersion', null);
this.get('serviceVersions').forEach(function (serviceVersion) {
serviceVersion.set('isDisplayed', serviceVersion.get('version') === displayedVersion);
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/views/common/configs/overriddenPropertyRow_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/overriddenPropertyRow_view.js b/ambari-web/app/views/common/configs/overriddenPropertyRow_view.js
index 96c1fb1..fba3277 100644
--- a/ambari-web/app/views/common/configs/overriddenPropertyRow_view.js
+++ b/ambari-web/app/views/common/configs/overriddenPropertyRow_view.js
@@ -25,37 +25,6 @@ App.ServiceConfigView.SCPOverriddenRowsView = Ember.View.extend({
// we are declaring this from configs.hbs ( we are initializing this from UI )
categoryConfigs: null, // just declared as viewClass need it
- init: function () {
- this._super();
- if (this.get('controller.name') != 'mainServiceInfoConfigsController') {
- this.addObserver('isDefaultGroupSelected', this, 'setSwitchText');
- }
- },
-
- didInsertElement: function () {
- this.setSwitchText();
- },
-
- willDestroyElement: function () {
- if (this.get('controller.name') != 'mainServiceInfoConfigsController') {
- this.removeObserver('isDefaultGroupSelected', this, 'setSwitchText');
- }
- },
-
- setSwitchText: function () {
- if (this.get('isDefaultGroupSelected')) {
- var overrides = this.get('serviceConfigProperty.overrides');
- if (!overrides) return;
- overrides.forEach(function(overriddenSCP) {
- overriddenSCP.get('group').set('switchGroupTextShort',
- Em.I18n.t('services.service.config_groups.switchGroupTextShort').format(overriddenSCP.get('group.displayName')));
- overriddenSCP.get('group').set('switchGroupTextFull',
- Em.I18n.t('services.service.config_groups.switchGroupTextFull').format(overriddenSCP.get('group.displayName')));
- });
- this.set('serviceConfigProperty.overrides', overrides);
- }
- },
-
toggleFinalFlag: function (event) {
var override = event.contexts[0];
if (override.get('isNotEditable')) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/views/common/configs/service_config_layout_tab_compare_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/service_config_layout_tab_compare_view.js b/ambari-web/app/views/common/configs/service_config_layout_tab_compare_view.js
new file mode 100644
index 0000000..ee4f751
--- /dev/null
+++ b/ambari-web/app/views/common/configs/service_config_layout_tab_compare_view.js
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+App.ServiceConfigLayoutTabCompareView = App.ServiceConfigLayoutTabView.extend({
+ templateName: require('templates/common/configs/service_config_layout_tab_compare'),
+
+ canEdit: false,
+ primaryCompareVersion: null,
+ secondaryCompareVersion: null,
+
+ onToggleBlock: function(event) {
+ event.context.toggleProperty('isCollapsed');
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/views/common/configs/service_config_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/service_config_view.js b/ambari-web/app/views/common/configs/service_config_view.js
index 50f7418..5e4253f 100644
--- a/ambari-web/app/views/common/configs/service_config_view.js
+++ b/ambari-web/app/views/common/configs/service_config_view.js
@@ -63,8 +63,11 @@ App.ServiceConfigView = Em.View.extend({
}.property('controller.name', 'controller.selectedService'),
showSavePanel: function() {
- return this.get('isOnTheServicePage') && !this.get('controller.isCompareMode') && this.get('controller.displayedVersion.isCurrent');
- }.property('isOnTheServicePage', 'controller.isCompareMode', 'controller.displayedVersion.isCurrent'),
+ return this.get('isOnTheServicePage') &&
+ !this.get('controller.isCompareMode') &&
+ this.get('controller.selectedVersionRecord.isCurrent') &&
+ !this.get('controller.isHostsConfigsPage');
+ }.property('isOnTheServicePage', 'controller.isCompareMode', 'controller.selectedVersionRecord.isCurrent', 'controller.isHostsConfigsPage'),
/**
* Determines if user is on the service configs page
http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/views/common/configs/service_configs_by_category_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/service_configs_by_category_view.js b/ambari-web/app/views/common/configs/service_configs_by_category_view.js
index 2e7de36..4726c61 100644
--- a/ambari-web/app/views/common/configs/service_configs_by_category_view.js
+++ b/ambari-web/app/views/common/configs/service_configs_by_category_view.js
@@ -188,13 +188,22 @@ App.ServiceConfigsByCategoryView = Em.View.extend(App.Persist, App.ConfigOverrid
* @type {boolean}
*/
isShowBlock: function () {
- var isCustomPropertiesCategory = this.get('category.customCanAddProperty');
- var hasFilteredAdvancedConfigs = this.get('categoryConfigs').filter(function (config) {
+ const isFilterEmpty = this.get('controller.filter') === '';
+ const isFilterActive = this.get('mainView.columns').someProperty('selected');
+ const isCustomPropertiesCategory = this.get('category.customCanAddProperty');
+ const isCompareMode = this.get('controller.isCompareMode');
+ const hasFilteredAdvancedConfigs = this.get('categoryConfigs').filter(function (config) {
return config.get('isHiddenByFilter') === false && Em.isNone(config.get('widget'));
}, this).length > 0;
- return (isCustomPropertiesCategory && this.get('controller.filter') === '' && !this.get('mainView.columns').someProperty('selected')) ||
+ return (isCustomPropertiesCategory && !isCompareMode && isFilterEmpty && !isFilterActive) ||
hasFilteredAdvancedConfigs;
- }.property('category.customCanAddProperty', 'categoryConfigs.@each.isHiddenByFilter', 'categoryConfigs.@each.widget', 'controller.filter', 'mainView.columns.@each.selected'),
+ }.property(
+ 'category.customCanAddProperty',
+ 'categoryConfigs.@each.isHiddenByFilter',
+ 'categoryConfigs.@each.widget',
+ 'controller.filter',
+ 'controller.isCompareMode',
+ 'mainView.columns.@each.selected'),
/**
* Re-order the configs to list content displayType properties at last in the category
http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/views/common/configs/widgets/comparison/config_widget_comparison_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/widgets/comparison/config_widget_comparison_view.js b/ambari-web/app/views/common/configs/widgets/comparison/config_widget_comparison_view.js
deleted file mode 100644
index 1461b87..0000000
--- a/ambari-web/app/views/common/configs/widgets/comparison/config_widget_comparison_view.js
+++ /dev/null
@@ -1,23 +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.
- */
-
-var App = require('app');
-
-App.ConfigWidgetComparisonView = App.ServiceConfigView.SCPComparisonRowsView.extend({
- isBeingCompared: true,
- templateName: require('templates/common/configs/widgets/comparison/config_widget_comparison')
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/app/views/common/filter_combo_cleanable.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/filter_combo_cleanable.js b/ambari-web/app/views/common/filter_combo_cleanable.js
index f26fc51..27ce6c5 100644
--- a/ambari-web/app/views/common/filter_combo_cleanable.js
+++ b/ambari-web/app/views/common/filter_combo_cleanable.js
@@ -49,7 +49,9 @@ App.FilterComboCleanableView = Ember.View.extend({
*/
selectFilterColumn: function(event){
var column = event.context;
- column.set('selected', !column.get('selected'));
+ if (!column.get('isDisabled')) {
+ column.set('selected', !column.get('selected'));
+ }
},
filterNotEmpty: Em.computed.gt('filter.length', 0),
@@ -66,7 +68,7 @@ App.FilterComboCleanableView = Ember.View.extend({
* @method clearFilterColumn
*/
clearFilterColumn: function() {
- this.get('columns').setEach('selected', false);
+ this.get('columns').filterProperty('isDisabled', false).setEach('selected', false);
},
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/test/mixins/common/configs/configs_comparator_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/configs/configs_comparator_test.js b/ambari-web/test/mixins/common/configs/configs_comparator_test.js
index 263cd96..5d1089a 100644
--- a/ambari-web/test/mixins/common/configs/configs_comparator_test.js
+++ b/ambari-web/test/mixins/common/configs/configs_comparator_test.js
@@ -109,11 +109,6 @@ describe('App.ConfigsComparator', function() {
expect(mixin.initCompareConfig.calledWith([config], {})).to.be.true;
});
- it("compareServiceVersion should be null", function() {
- mixin.loadCompareVersionConfigs([config]);
- expect(mixin.get('compareServiceVersion')).to.be.null;
- });
-
it("isCompareMode should be true", function() {
mixin.loadCompareVersionConfigs([config]);
expect(mixin.get('isCompareMode')).to.be.true;
http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/test/views/common/configs/config_versions_control_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/config_versions_control_view_test.js b/ambari-web/test/views/common/configs/config_versions_control_view_test.js
index 9f72fc5..f881872 100644
--- a/ambari-web/test/views/common/configs/config_versions_control_view_test.js
+++ b/ambari-web/test/views/common/configs/config_versions_control_view_test.js
@@ -54,7 +54,6 @@ describe('App.ConfigVersionsControlView', function () {
view.switchVersion(event);
expect(view.get('serviceVersions').mapProperty('isDisplayed')).to.eql([false, true]);
expect(view.get('controller').loadSelectedVersion.calledWith(2)).to.be.true;
- expect(view.get('controller.displayedVersion')).to.be.eql(view.get('serviceVersions')[1]);
});
it('Choose displayed version', function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/test/views/common/configs/overriddenProperty_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/overriddenProperty_view_test.js b/ambari-web/test/views/common/configs/overriddenProperty_view_test.js
index 16ab7e4..426dc81 100644
--- a/ambari-web/test/views/common/configs/overriddenProperty_view_test.js
+++ b/ambari-web/test/views/common/configs/overriddenProperty_view_test.js
@@ -26,58 +26,16 @@ describe('App.ServiceConfigView.SCPOverriddenRowsView', function () {
describe('#didInsertElement', function () {
beforeEach(function () {
- sinon.spy(view, 'setSwitchText');
sinon.stub(App, 'tooltip', Em.K);
});
afterEach(function () {
- view.setSwitchText.restore();
App.tooltip.restore();
});
it('setSwitchLinks method should be executed', function () {
view.didInsertElement();
- expect(view.setSwitchText.calledOnce).to.be.true;
});
});
-
- describe('#setSwitchText', function () {
-
- view = App.ServiceConfigView.SCPOverriddenRowsView.create({
- serviceConfigProperty: {
- overrides: [
- Em.Object.create({
- group: Em.Object.create({
- displayName: 'hcg',
- switchGroupTextShort: 'short',
- switchGroupTextFull: 'full'
- })
- })
- ]
- }
- });
-
- beforeEach(function () {
- sinon.stub(App, 'tooltip', Em.K);
- });
-
- afterEach(function () {
- App.tooltip.restore();
- });
-
- it('should not modify overrides', function () {
- view.set('isDefaultGroupSelected', false);
- expect(view.get('serviceConfigProperty.overrides.firstObject.group.switchGroupTextShort')).to.equal('short');
- expect(view.get('serviceConfigProperty.overrides.firstObject.group.switchGroupTextFull')).to.equal('full');
- });
-
- it('should set switchGroupTextShort and switchGroupTextFull', function () {
- view.set('isDefaultGroupSelected', true);
- expect(view.get('serviceConfigProperty.overrides.firstObject.group.switchGroupTextShort')).to.equal(Em.I18n.t('services.service.config_groups.switchGroupTextShort').format('hcg'));
- expect(view.get('serviceConfigProperty.overrides.firstObject.group.switchGroupTextFull')).to.equal(Em.I18n.t('services.service.config_groups.switchGroupTextFull').format('hcg'));
- });
-
- });
-
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/45f2a6e4/ambari-web/test/views/common/configs/service_configs_by_category_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/service_configs_by_category_view_test.js b/ambari-web/test/views/common/configs/service_configs_by_category_view_test.js
index 5c91220..8868ec4 100644
--- a/ambari-web/test/views/common/configs/service_configs_by_category_view_test.js
+++ b/ambari-web/test/views/common/configs/service_configs_by_category_view_test.js
@@ -176,6 +176,15 @@ describe('App.ServiceConfigsByCategoryView', function () {
category: Em.Object.create({ customCanAddProperty: false }),
m: 'Category contains mixed properties. Properties are visible. Panel should be shown',
e: true
+ },
+ {
+ categoryConfigs: Em.A([
+ Em.Object.create({ widget: {someProp: 'a'} })
+ ]),
+ isCompareMode: true,
+ category: Em.Object.create({ customCanAddProperty: true }),
+ m: 'Should hide block in compare mode',
+ e: false
}
];
@@ -195,10 +204,15 @@ describe('App.ServiceConfigsByCategoryView', function () {
it(test.m, function() {
this._view.reopen({
category: test.category,
- categoryConfigs: test.categoryConfigs
+ categoryConfigs: test.categoryConfigs,
+ mainView: Em.Object.create({
+ columns: []
+ }),
+ controller: Em.Object.create({
+ isCompareMode: test.isCompareMode
+ })
});
expect(this._view.get('isShowBlock')).to.be.eql(test.e);
-
});
});
});