You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by rl...@apache.org on 2018/01/05 23:03:57 UTC
[01/50] [abbrv] ambari git commit: AMBARI-22700 Post-install: UI
style fixes. (atkach)
Repository: ambari
Updated Branches:
refs/heads/branch-feature-AMBARI-20859 068b2fe22 -> 7ff4a96ca
AMBARI-22700 Post-install: UI style fixes. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/02887284
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/02887284
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/02887284
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 02887284a1d19666e52b61884ad9daf8db040e68
Parents: 935ea92
Author: Andrii Tkach <at...@apache.org>
Authored: Wed Dec 27 17:31:03 2017 +0200
Committer: Andrii Tkach <at...@apache.org>
Committed: Wed Dec 27 18:18:09 2017 +0200
----------------------------------------------------------------------
ambari-web/app/styles/application.less | 2 +-
.../app/styles/config_versions_control.less | 6 +-
.../app/styles/enhanced_service_dashboard.less | 4 +-
ambari-web/app/styles/modal_popups.less | 19 ++-
ambari-web/app/templates/application.hbs | 6 +-
.../common/configs/config_versions_dropdown.hbs | 2 +-
.../service_config_layout_tab_compare.hbs | 6 +-
.../templates/common/host_progress_popup.hbs | 115 ++++++++++---------
.../app/templates/main/service/menu_item.hbs | 6 +-
.../service_config_layout_tab_compare_view.js | 10 ++
.../common/host_progress_popup_body_view.js | 12 ++
11 files changed, 116 insertions(+), 72 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/02887284/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index c12864a..670ae7d 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -1140,7 +1140,7 @@ a.services-menu-blocks{
color: @health-status-red;
}
.menu-item-name.UNKNOWN {
- color: @health-status-orange;
+ color: @health-status-yellow;
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/02887284/ambari-web/app/styles/config_versions_control.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/config_versions_control.less b/ambari-web/app/styles/config_versions_control.less
index e7375d6..5b947a4 100644
--- a/ambari-web/app/styles/config_versions_control.less
+++ b/ambari-web/app/styles/config_versions_control.less
@@ -23,6 +23,7 @@
#config-versions-control {
.dropdown-menu {
min-width: 600px;
+ padding-bottom: 20px;
li {
padding: 3px 20px;
}
@@ -109,8 +110,9 @@
padding: 10px;
}
.caret {
- float: right;
- margin-top: 5px;
+ position: absolute;
+ top: 15px;
+ right: 10px;
}
}
.filter-combobox {
http://git-wip-us.apache.org/repos/asf/ambari/blob/02887284/ambari-web/app/styles/enhanced_service_dashboard.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/enhanced_service_dashboard.less b/ambari-web/app/styles/enhanced_service_dashboard.less
index 00b46a8..4c97539 100644
--- a/ambari-web/app/styles/enhanced_service_dashboard.less
+++ b/ambari-web/app/styles/enhanced_service_dashboard.less
@@ -88,7 +88,7 @@
margin: 55px auto;
}
.title {
- padding: 4px 0 0 1px;
+ padding: 4px 0 0 8px;
font-size: 14px;
color: #666666;
line-height: 17px;
@@ -135,7 +135,7 @@
.frame;
.content {
padding-top: 45px;
- width: 99%;
+ width: 100%;
}
.screensaver{ // graph onload wait
width: 90%;
http://git-wip-us.apache.org/repos/asf/ambari/blob/02887284/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 dc951c9..b26bf1a 100644
--- a/ambari-web/app/styles/modal_popups.less
+++ b/ambari-web/app/styles/modal_popups.less
@@ -33,6 +33,7 @@
}
.host-component-popup-wrap {
+ min-height: 220px;
.task-top-wrap {
.operation-name-top {
width: 36%;
@@ -70,6 +71,22 @@
}
}
}
+ .status-dropdown {
+ .btn.dropdown-toggle:first-child {
+ min-width: 150px;
+ padding: 10px;
+ position: relative;
+ text-align: left;
+ .caret {
+ position: absolute;
+ top: 15px;
+ right: 10px;
+ }
+ }
+ ul.dropdown-menu {
+ min-width: 150px;
+ }
+ }
}
.modal {
@@ -395,7 +412,7 @@
}
.modal-xlg {
- width: 100%;
+ width: 98%;
.wizard {
.container {
width: 1236px;
http://git-wip-us.apache.org/repos/asf/ambari/blob/02887284/ambari-web/app/templates/application.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/application.hbs b/ambari-web/app/templates/application.hbs
index 5c47406..adedde1 100644
--- a/ambari-web/app/templates/application.hbs
+++ b/ambari-web/app/templates/application.hbs
@@ -174,15 +174,13 @@
</div>
<div class="navbar-nav navbar-text navbar-right brand-wrapper">
- {{#if enableLinks}}
{{! cluster name }}
- <a href="#" {{bindAttr title="clusterName"}} {{action "showPopup" target="App.router.backgroundOperationsController"}} class="cluster-name">
+ <div {{bindAttr title="clusterName"}} class="cluster-name">
{{#unless App.isClusterUser}}
<span>{{clusterDisplayName}}</span>
{{/unless}}
- </a>
+ </div>
{{! cluster name end }}
- {{/if}}
</div>
</div>
</nav>
http://git-wip-us.apache.org/repos/asf/ambari/blob/02887284/ambari-web/app/templates/common/configs/config_versions_dropdown.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/configs/config_versions_dropdown.hbs b/ambari-web/app/templates/common/configs/config_versions_dropdown.hbs
index 18083f9..1442145 100644
--- a/ambari-web/app/templates/common/configs/config_versions_dropdown.hbs
+++ b/ambari-web/app/templates/common/configs/config_versions_dropdown.hbs
@@ -19,7 +19,7 @@
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="false">
{{t common.version}}:
- <span class="pull-right"><strong>{{view.displayedServiceVersion.version}}</strong><span class="caret"></span></span>
+ <span><strong>{{view.displayedServiceVersion.version}}</strong><span class="caret"></span></span>
</button>
<div class="dropdown-menu">
<li class="input-group search-input">
http://git-wip-us.apache.org/repos/asf/ambari/blob/02887284/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
index ccf47f3..7cf6dcf 100644
--- 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
@@ -17,7 +17,7 @@
}}
{{#if view.dataIsReady}}
- {{#unless tab.isHiddenByFilter}}
+ {{#unless view.content.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">
@@ -35,7 +35,7 @@
</div>
<div class="accordion">
- {{#each row in tab.sectionRows}}
+ {{#each row in view.content.sectionRows}}
{{#each section in row}}
<div class="panel-group">
<div class="panel panel-default">
@@ -47,7 +47,7 @@
</a>
</h3>
</div>
- <div class="panel-body collapse in" {{bindAttr class="section.isCollapsed:hide"}} {{QAAttr "panel-body"}}>
+ <div class="panel-body collapse in" {{bindAttr style="view.isCategoryBodyVisible"}} {{QAAttr "panel-body"}}>
<div class="service-config-section">
{{#each subRow in section.subsectionRows}}
{{#each subsection in subRow}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/02887284/ambari-web/app/templates/common/host_progress_popup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/host_progress_popup.hbs b/ambari-web/app/templates/common/host_progress_popup.hbs
index 31358e4..cc2f073 100644
--- a/ambari-web/app/templates/common/host_progress_popup.hbs
+++ b/ambari-web/app/templates/common/host_progress_popup.hbs
@@ -16,24 +16,25 @@
* limitations under the License.
}}
-<div class="host-component-popup-wrap col-sm-12">
+<div class="host-component-popup-wrap">
{{#if view.parentView.isLoaded}}
{{!-- OPERATIONS --}}
<div {{bindAttr class="view.parentView.isServiceListHidden:hidden :task-list-main-wrap :table-body-wrap"}}>
- <div class="row top-wrap">
- <h2 class="table-title col-sm-6">{{view view.parentView.titleClass}}</h2>
- <div class="table-controls row col-sm-6 pull-right">
- <div class="col-sm-12">
- <div class="btn-group pull-right">
- {{view Ember.Select
- contentBinding="view.categories"
- optionValuePath="content.value"
- optionLabelPath="content.label"
- selectionBinding="view.serviceCategory"
- classNames="form-control"
- }}
+ <div class="top-wrap">
+ <div class="row">
+ <h2 class="table-title col-sm-6">{{view view.parentView.titleClass}}</h2>
+ <div class="table-controls col-sm-6">
+ <div class="btn-group pull-right status-dropdown">
+ <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+ {{view.serviceCategory.label}} <span class="caret"></span>
+ </button>
+ <ul class="dropdown-menu">
+ {{#each category in view.categories}}
+ <li><a href="#" {{action selectServiceCategory category target="view"}}>{{category.label}}</a></li>
+ {{/each}}
+ </ul>
</div>
</div>
</div>
@@ -104,18 +105,19 @@
{{!-- HOSTS ---}}
<div {{bindAttr class="view.parentView.isHostListHidden:hidden :task-list-main-wrap :table-body-wrap"}}>
- <div class="row top-wrap">
- <h2 class="table-title col-sm-2">{{t common.hosts}}</h2>
- <div class="table-controls row col-sm-10 pull-right">
- <div class="col-sm-12">
- <div class="btn-group pull-right">
- {{view Ember.Select
- contentBinding="view.categories"
- optionValuePath="content.value"
- optionLabelPath="content.label"
- selectionBinding="view.hostCategory"
- classNames="form-control"
- }}
+ <div class="top-wrap">
+ <div class="row">
+ <h2 class="table-title col-sm-2">{{t common.hosts}}</h2>
+ <div class="table-controls col-sm-10">
+ <div class="btn-group pull-right status-dropdown">
+ <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+ {{view.hostCategory.label}} <span class="caret"></span>
+ </button>
+ <ul class="dropdown-menu">
+ {{#each category in view.categories}}
+ <li><a href="#" {{action selectHostCategory category target="view"}}>{{category.label}}</a></li>
+ {{/each}}
+ </ul>
</div>
</div>
</div>
@@ -188,19 +190,19 @@
{{!-- TASKS ---}}
<div {{bindAttr class="view.parentView.isTaskListHidden:hidden :task-list-main-wrap :table-body-wrap"}}>
- <div class="row top-wrap">
- <h2 class="table-title col-sm-2">{{t common.tasks}}</h2>
- <div class="table-controls row col-sm-10 pull-right">
- <div class="col-sm-12">
- <div class="btn-group pull-right">
- {{view Ember.Select
- class="form-control"
- contentBinding="view.categories"
- optionValuePath="content.value"
- optionLabelPath="content.label"
- selectionBinding="view.taskCategory"
- classNames="form-control"
- }}
+ <div class="top-wrap">
+ <div class="row">
+ <h2 class="table-title col-sm-2">{{t common.tasks}}</h2>
+ <div class="table-controls col-sm-10">
+ <div class="btn-group pull-right status-dropdown">
+ <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+ {{view.taskCategory.label}} <span class="caret"></span>
+ </button>
+ <ul class="dropdown-menu">
+ {{#each category in view.categories}}
+ <li><a href="#" {{action selectTaskCategory category target="view"}}>{{category.label}}</a></li>
+ {{/each}}
+ </ul>
</div>
</div>
</div>
@@ -252,24 +254,27 @@
<div class="task-top-wrap top-wrap">
<div {{bindAttr class="view.hostComponentLogsExists:task-detail-log-nav-actions :row"}}>
<h2 class="table-title col-sm-5">{{t common.taskLog}}</h2>
- <div class="table-controls row col-sm-7 pull-right">
- <div class="col-sm-12">
- {{#if App.supports.logSearch}}
- {{#if view.isLogSearchInstalled}}
- {{#havePermissions "SERVICE.VIEW_OPERATIONAL_LOGS"}}
- <button type="button" class="btn btn-link pull-right" {{action navigateToHostLogs target="view"}} {{bindAttr class="view.isLogsLinkVisible::hidden" disabled="App.router.wizardWatcherController.isNonWizardUser"}}>
- <i class="glyphicon glyphicon-file"></i> {{t common.host}} {{t common.logs}}
- </button>
- {{/havePermissions}}
- {{/if}}
+ <div class="table-controls col-sm-7 pull-right">
+ {{#if App.supports.logSearch}}
+ {{#if view.isLogSearchInstalled}}
+ {{#havePermissions "SERVICE.VIEW_OPERATIONAL_LOGS"}}
+ <button type="button" class="btn btn-link pull-right" {{action navigateToHostLogs target="view"}}
+ {{bindAttr class="view.isLogsLinkVisible::hidden" disabled="App.router.wizardWatcherController.isNonWizardUser"}}>
+ <i class="glyphicon glyphicon-file"></i> {{t common.host}} {{t common.logs}}
+ </button>
+ {{/havePermissions}}
{{/if}}
- <button type="button" class="btn btn-link pull-right" {{translateAttr title="common.openNewWindow"}} {{action openTaskLogInDialog}}>
- <i class="icon icon-external-link"></i> {{t common.open}}
- </button>
- <button type="button" class="btn btn-link pull-right copy-clipboard" {{translateAttr title="common.fullLogPopup.clickToCopy"}} {{action "textTrigger" taskInfo target="view"}}>
- <i class="glyphicon glyphicon-copy"></i> {{t common.copy}}
- </button>
- </div>
+ {{/if}}
+ <button type="button" class="btn btn-link pull-right"
+ {{translateAttr title="common.openNewWindow"}}
+ {{action openTaskLogInDialog}}>
+ <i class="icon icon-external-link"></i> {{t common.open}}
+ </button>
+ <button type="button" class="btn btn-link pull-right copy-clipboard"
+ {{translateAttr title="common.fullLogPopup.clickToCopy"}}
+ {{action "textTrigger" taskInfo target="view"}}>
+ <i class="glyphicon glyphicon-copy"></i> {{t common.copy}}
+ </button>
</div>
</div>
<ul {{bindAttr class="view.hostComponentLogsExists::hide :nav :nav-tabs :task-detail-nav"}}>
http://git-wip-us.apache.org/repos/asf/ambari/blob/02887284/ambari-web/app/templates/main/service/menu_item.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/service/menu_item.hbs b/ambari-web/app/templates/main/service/menu_item.hbs
index 723f4f6..6d5bb5c 100644
--- a/ambari-web/app/templates/main/service/menu_item.hbs
+++ b/ambari-web/app/templates/main/service/menu_item.hbs
@@ -17,12 +17,12 @@
}}
<a class="services-menu-blocks" {{bindAttr href="view.link" data-href="view.dataHref"}}>
- {{#if view.content.alertsCount}}
- <span {{bindAttr class=":icon-circle view.hasCriticalAlerts:service-alerts-critical:service-alerts-warning"}}></span>
- {{/if}}
<span class="pull-right">
<i rel="tooltip" {{action goToConfigs target="view"}} {{bindAttr class=":glyphicon :glyphicon-refresh :restart-required-service view.content.isRestartRequired::hidden" data-original-title="view.restartRequiredMessage"}}></i>
</span>
+ {{#if view.content.alertsCount}}
+ <span {{bindAttr class=":icon-circle view.hasCriticalAlerts:service-alerts-critical:service-alerts-warning"}}></span>
+ {{/if}}
<span {{bindAttr class=":menu-item-name view.content.workStatus" data-original-title="view.content.toolTipContent"}} rel="serviceHealthTooltip">
{{unbound view.content.displayName}}
</span>
http://git-wip-us.apache.org/repos/asf/ambari/blob/02887284/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
index ee4f751..5e84ae5 100644
--- 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
@@ -27,5 +27,15 @@ App.ServiceConfigLayoutTabCompareView = App.ServiceConfigLayoutTabView.extend({
onToggleBlock: function(event) {
event.context.toggleProperty('isCollapsed');
+ $(event.currentTarget).siblings('.panel-body').slideToggle(500);
+ },
+
+ didInsertElement: function() {
+ this._super();
+ this.get('content.sectionRows').forEach(function(row) {
+ row.setEach('isCollapsed', false);
+ row.setEach('isCategoryBodyVisible', Em.computed.ifThenElse('isCollapsed', 'display: none;', 'display: block;'));
+ });
}
+
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/02887284/ambari-web/app/views/common/host_progress_popup_body_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/host_progress_popup_body_view.js b/ambari-web/app/views/common/host_progress_popup_body_view.js
index 49d7dea..3674ec5 100644
--- a/ambari-web/app/views/common/host_progress_popup_body_view.js
+++ b/ambari-web/app/views/common/host_progress_popup_body_view.js
@@ -290,6 +290,18 @@ App.HostProgressPopupBodyView = App.TableView.extend({
this.unsubscribeResize();
},
+ selectServiceCategory: function (e) {
+ this.set('serviceCategory', e.context);
+ },
+
+ selectHostCategory: function (e) {
+ this.set('hostCategory', e.context);
+ },
+
+ selectTaskCategory: function (e) {
+ this.set('taskCategory', e.context);
+ },
+
/**
* Subscribe for window <code>resize</code> event.
*
[07/50] [abbrv] ambari git commit: AMBARI-22714 Log Search UI:
implement Summary tab for Access Logs page. (ababiichuk)
Posted by rl...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/services/utils.service.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/services/utils.service.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/services/utils.service.spec.ts
index 23d3726..f89462d 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/services/utils.service.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/services/utils.service.spec.ts
@@ -300,4 +300,121 @@ describe('UtilsService', () => {
});
});
});
+
+ describe('#isEmptyObject()', () => {
+ const cases = [
+ {
+ obj: {},
+ result: true,
+ title: 'empty object'
+ },
+ {
+ obj: {
+ p: 'v'
+ },
+ result: false,
+ title: 'not empty object'
+ },
+ {
+ obj: null,
+ result: false,
+ title: 'null'
+ },
+ {
+ obj: undefined,
+ result: false,
+ title: 'undefined'
+ },
+ {
+ obj: '',
+ result: false,
+ title: 'empty string'
+ },
+ {
+ obj: 0,
+ result: false,
+ title: 'zero'
+ },
+ {
+ obj: false,
+ result: false,
+ title: 'false'
+ },
+ {
+ obj: NaN,
+ result: false,
+ title: 'NaN'
+ },
+ {
+ obj: [],
+ result: false,
+ title: 'empty array'
+ },
+ {
+ obj: '123',
+ result: false,
+ title: 'not empty primitive'
+ }
+ ];
+
+ cases.forEach(test => {
+ it(test.title, inject([UtilsService], (service: UtilsService) => {
+ expect(service.isEmptyObject(test.obj)).toEqual(test.result);
+ }));
+ });
+ });
+
+ describe('#getMaxNumberInObject()', () => {
+ const cases = [
+ {
+ obj: {
+ a: 1,
+ b: -1,
+ c: 0
+ },
+ max: 1,
+ title: 'basic case'
+ },
+ {
+ obj: {
+ a: 1
+ },
+ max: 1,
+ title: 'single-item object'
+ },
+ {
+ obj: {
+ a: -Infinity,
+ b: 0,
+ c: 1
+ },
+ max: 1,
+ title: 'object with -Infinity'
+ },
+ {
+ obj: {
+ a: Infinity,
+ b: 0,
+ c: 1
+ },
+ max: Infinity,
+ title: 'object with Infinity'
+ },
+ {
+ obj: {
+ a: NaN,
+ b: 0,
+ c: 1
+ },
+ max: 1,
+ title: 'object with NaN'
+ }
+ ];
+
+ cases.forEach(test => {
+ it(test.title, inject([UtilsService], (service: UtilsService) => {
+ expect(service.getMaxNumberInObject(test.obj)).toEqual(test.max);
+ }));
+ });
+ });
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/services/utils.service.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/services/utils.service.ts b/ambari-logsearch/ambari-logsearch-web/src/app/services/utils.service.ts
index dd9075c..514837c 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/services/utils.service.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/services/utils.service.ts
@@ -18,6 +18,7 @@
import {Injectable} from '@angular/core';
import * as moment from 'moment-timezone';
+import {HomogeneousObject} from '@app/classes/object';
@Injectable()
export class UtilsService {
@@ -93,4 +94,15 @@ export class UtilsService {
});
}
+ isEmptyObject(obj: any): boolean {
+ return this.isEqual(obj, {});
+ }
+
+ getMaxNumberInObject(obj: HomogeneousObject<number>): number {
+ const keys = Object.keys(obj);
+ return keys.reduce((currentMax: number, currentKey: string): number => {
+ return isNaN(obj[currentKey]) ? currentMax : Math.max(currentMax, obj[currentKey]);
+ }, 0);
+ }
+
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/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 9561ca0..48c1d88 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/assets/i18n/en.json
+++ b/ambari-logsearch/ambari-logsearch-web/src/assets/i18n/en.json
@@ -1,9 +1,9 @@
{
"common.title": "Log Search",
- "common.hide": "Hide",
- "common.show": "Show",
"common.serviceLogs": "Service Logs",
"common.auditLogs": "Audit Logs",
+ "common.summary": "Summary",
+ "common.logs": "Logs",
"modal.submit": "OK",
"modal.cancel": "Cancel",
@@ -159,6 +159,8 @@
"logs.noEventFound": "No event found",
"logs.hideGraph": "Hide Graph",
"logs.showGraph": "Show Graph",
+ "logs.topUsers": "Top {{number}} Users",
+ "logs.topResources": "Top {{number}} Resources",
"histogram.gap": "gap",
"histogram.gaps": "gaps",
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/styles.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/styles.less b/ambari-logsearch/ambari-logsearch-web/src/styles.less
index 5d5f1e3..d58b1eb 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/styles.less
+++ b/ambari-logsearch/ambari-logsearch-web/src/styles.less
@@ -15,3 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
+.initial-color {
+ color: initial;
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/vendor/css/bootstrap-logsearch.min.css
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/vendor/css/bootstrap-logsearch.min.css b/ambari-logsearch/ambari-logsearch-web/src/vendor/css/bootstrap-logsearch.min.css
index 177d7df..1ceb968 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/vendor/css/bootstrap-logsearch.min.css
+++ b/ambari-logsearch/ambari-logsearch-web/src/vendor/css/bootstrap-logsearch.min.css
@@ -15,4 +15,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-.btn-group.open .dropdown-menu,.dropdown.open .dropdown-menu,.font-mixin{font-family:Roboto,sans-serif;font-style:normal;font-weight:400}.pagination-block .pagination-block-item a,.pagination-block .pagination-block-item a:focus,.pagination-block .pagination-block-item a:visited,.table.table-hover .action:hover,a,a:focus,a:visited{text-decoration:none}@font-face{font-family:Roboto;font-weight:400;font-style:normal;src:url(fonts/Roboto-Regular-webfont.eot);src:url(fonts/Roboto-Regular-webfont.eot?#iefix) format('embedded-opentype'),url(fonts/Roboto-Regular-webfont.woff) format('woff'),url(fonts/Roboto-Regular-webfont.ttf) format('truetype'),url(fonts/Roboto-Regular-webfont.svg#robotoregular) format('svg')} .font-mixin{line-height:1;color:#333} .btn,.btn:focus{outline:0;font-family:Roboto,sans-serif;text-transform:uppercase;height:34px;font-size:14px;padding:10px 20px;line-height:14px} .btn .glyphicon,.btn:focus .glyphicon{top:-1px;float:left} .box-shadow{box-shadow:0 0 2px 0 #139
1c1} .btn-default-disabled,.btn-disabled{box-shadow:none;opacity:.6} .btn-default-disabled{color:#FFF;background-color:#808793;border:none} .btn-default,.btn-default:focus{color:#666;background-color:#FFF;border:1px solid #CFD3D7} .btn-default:focus:hover,.btn-default:hover{color:#FFF;background-color:#808793} .btn-default:active,.btn-default:focus:active{color:#666;background-color:#FFF;border:1px solid #CFD3D7;box-shadow:0 0 2px 0 #1391c1} .btn-default.disabled,.btn-default.disabled.active,.btn-default.disabled:active,.btn-default.disabled:hover,.btn-default:focus.disabled,.btn-default:focus.disabled.active,.btn-default:focus.disabled:active,.btn-default:focus.disabled:hover,.btn-default:focus[disabled],.btn-default:focus[disabled].active,.btn-default:focus[disabled]:active,.btn-default:focus[disabled]:hover,.btn-default[disabled],.btn-default[disabled].active,.btn-default[disabled]:active,.btn-default[disabled]:hover{opacity:.6;box-shadow:none;color:#FFF;background-color:#8
08793;border:none} .btn-primary-disabled{opacity:.6;box-shadow:none;color:#D1E8D1;background-color:#3FAE2A;border:1px solid #3FAE2A} .btn-primary,.btn-primary:focus{color:#FFF;background-color:#3FAE2A;border:1px solid #3FAE2A} .btn-primary:focus:hover,.btn-primary:hover{color:#FFF;background-color:#429929;border:1px solid #429929} .btn-primary.active,.btn-primary:active,.btn-primary:focus.active,.btn-primary:focus:active{color:#FFF;background-color:#3FAE2A;border:1px solid #3FAE2A;box-shadow:0 0 2px 0 #1391c1} .btn-primary.disabled,.btn-primary.disabled.active,.btn-primary.disabled:active,.btn-primary.disabled:hover,.btn-primary:focus.disabled,.btn-primary:focus.disabled.active,.btn-primary:focus.disabled:active,.btn-primary:focus.disabled:hover,.btn-primary:focus[disabled],.btn-primary:focus[disabled].active,.btn-primary:focus[disabled]:active,.btn-primary:focus[disabled]:hover,.btn-primary[disabled],.btn-primary[disabled].active,.btn-primary[disabled]:active,.btn-primary[disa
bled]:hover{opacity:.6;box-shadow:none;color:#D1E8D1;background-color:#3FAE2A;border:1px solid #3FAE2A} .btn-secondary-disabled{opacity:.6;box-shadow:none;color:#D1E8D1;background-color:#429929;border:1px solid #3FAE2A} .btn-secondary,.btn-secondary:focus{color:#429929;background-color:#FFF;border:1px solid #3FAE2A} .btn-secondary:focus:hover,.btn-secondary:hover{color:#FFF;background-color:#429929} .btn-secondary:active,.btn-secondary:focus:active{color:#429929;background-color:#FFF;box-shadow:0 0 2px 0 #1391c1} .btn-secondary.disabled,.btn-secondary.disabled.active,.btn-secondary.disabled:active,.btn-secondary.disabled:hover,.btn-secondary:focus.disabled,.btn-secondary:focus.disabled.active,.btn-secondary:focus.disabled:active,.btn-secondary:focus.disabled:hover,.btn-secondary:focus[disabled],.btn-secondary:focus[disabled].active,.btn-secondary:focus[disabled]:active,.btn-secondary:focus[disabled]:hover,.btn-secondary[disabled],.btn-secondary[disabled].active,.btn-secondary[d
isabled]:active,.btn-secondary[disabled]:hover{opacity:.6;box-shadow:none;color:#D1E8D1;background-color:#429929;border:1px solid #3FAE2A} .btn-success{border:none} .btn-regular-default-state{background-color:#FFF;color:#666;border:1px solid #cfd3d7} .btn-primary-default-state{background-color:#3FAE2A;border:1px solid #3FAE2A;color:#FFF} .btn-group.open .btn.dropdown-toggle,.dropdown.open .btn.dropdown-toggle{box-shadow:inset 0 0 3px 0 #1391c1} .btn-group.open .btn.dropdown-toggle,.btn-group.open .btn.dropdown-toggle.btn-default,.btn-group.open .btn.dropdown-toggle.btn-default:hover,.btn-group.open .btn.dropdown-toggle:hover,.dropdown.open .btn.dropdown-toggle,.dropdown.open .btn.dropdown-toggle.btn-default,.dropdown.open .btn.dropdown-toggle.btn-default:hover,.dropdown.open .btn.dropdown-toggle:hover{background-color:#FFF;color:#666;border:1px solid #cfd3d7} .btn-group.open .btn.dropdown-toggle+.dropdown-menu>li>a:hover,.btn-group.open .btn.dropdown-toggle.btn-default+.dropdo
wn-menu>li>a:hover,.dropdown.open .btn.dropdown-toggle+.dropdown-menu>li>a:hover,.dropdown.open .btn.dropdown-toggle.btn-default+.dropdown-menu>li>a:hover{background-color:#808793;color:#FFF} .btn-group.open .btn.dropdown-toggle.btn-primary,.btn-group.open .btn.dropdown-toggle.btn-primary:hover,.dropdown.open .btn.dropdown-toggle.btn-primary,.dropdown.open .btn.dropdown-toggle.btn-primary:hover{background-color:#3FAE2A;border:1px solid #3FAE2A;color:#FFF} .btn-group.open .btn.dropdown-toggle.btn-primary+.dropdown-menu>li>a:hover,.dropdown.open .btn.dropdown-toggle.btn-primary+.dropdown-menu>li>a:hover{background-color:#429929;color:#FFF} .btn-group.open .dropdown-menu,.dropdown.open .dropdown-menu{line-height:1;border-radius:2px;font-size:14px;min-width:200px;background:#FFF;color:#666;border:1px solid #cfd3d7} .btn-group.open .dropdown-menu>li,.dropdown.open .dropdown-menu>li{margin-bottom:1px} .btn-group.open .dropdown-menu>li>a,.dropdown.open .dropdown-menu>li>a{height:24px}
.btn-group .btn.dropdown-toggle:first-child,.dropdown .btn.dropdown-toggle:first-child{min-width:80px} .btn-group .btn.dropdown-toggle.disabled,.btn-group .btn.dropdown-toggle[disabled],.dropdown .btn.dropdown-toggle.disabled,.dropdown .btn.dropdown-toggle[disabled]{opacity:.6} input.form-control{font-size:14px;border-radius:2px;color:#666;border:1px solid #CFD3D7;height:34px;padding:10px} input.form-control:focus{border-color:#1291c1;box-shadow:none} .help-block{color:#999;font-size:14px} .help-block.validation-block{color:#999;margin-top:10px} .help-block.validation-block::before{position:relative;top:2px;margin-right:5px;font-family:'Glyphicons Halflings'} .wizard .wizard-body .wizard-content .step-description,.wizard .wizard-body .wizard-content .step-title,.wizard .wizard-header h3,h2.table-title{font-family:Roboto,sans-serif;font-style:normal} .has-success input.form-control{color:#666;border:1px solid #1EB475} .has-success input.form-control:focus{border-color:#1EB
475;box-shadow:none} .has-success .help-block.validation-block::before{content:'\e084';color:#1EB475} .has-error input.form-control{color:#666;border:1px solid #EF6162} .has-error input.form-control:focus{border-color:#EF6162;box-shadow:none} .has-error .help-block.validation-block::before{content:'\e083';color:#EF6162} .has-warning input.form-control{color:#666;border:1px solid #E98A40} .has-warning input.form-control:focus{border-color:#E98A40;box-shadow:none} .has-warning .help-block.validation-block::before{content:'\e101';color:#E98A40} .form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{color:#999;border-color:#ccc;background-color:#ddd} h2.table-title{font-weight:400;line-height:1;color:#333;margin-top:10px;font-size:20px} .table{color:#666;font-size:13px} .table tfoot,.table thead{color:#999} .table input[type=checkbox]+label{position:relative;line-height:1.3em;font-size:initial;top:4px;margin-bottom:0} .table thead>tr>th{border-bott
om-color:#EEE} .table tfoot>tr:first-of-type>td{border-top-width:2px;border-top-color:#EEE} .table>tbody>tr>td{border-top-color:#EEE} .table>tbody>tr.active,.table>tbody>tr.active>td{background-color:#EEE} .table.table-hover .action{visibility:hidden;padding:0;line-height:1} .table.table-hover>tbody>tr{border-width:0 1px 1px;border-style:solid;border-color:#EEE transparent} .table.table-hover>tbody>tr>td{border-width:0} .table.table-hover>tbody>tr:hover{border-color:#A7DFF2;background-color:#E7F6FC} .table.table-hover>tbody>tr:hover>td{border-top:1px solid #A7DFF2;background-color:#E7F6FC} .table.table-hover>tbody>tr:hover>td .action{visibility:visible} .table.table-hover>tbody>tr:first-of-type>td{border-top:1px solid transparent} .table.table-hover>tbody>tr:first-of-type:hover>td{border-color:#A7DFF2} .pagination-block .pagination-block-item{float:left;padding:0 5px} .pagination-block .pagination-block-item select{border:none;background-color:transparent;color:#1491C1}
.nav.nav-tabs{border:none;margin-bottom:20px} .nav.nav-tabs li a{border-width:0;border-radius:0;border-bottom:2px solid transparent;color:#666;text-transform:uppercase} .nav.nav-tabs li a:active,.nav.nav-tabs li a:focus,.nav.nav-tabs li a:hover{color:#333;border-top-width:0;border-left-width:0;border-right-width:0;background:0 0} .nav.nav-tabs li a .badge.badge-important{display:inline} .nav.nav-tabs li.active a{color:#333;border-bottom:2px solid #3FAE2A} .nav-tabs-left li,.nav-tabs-right li{float:none;margin-bottom:2px} .nav-tabs-left li a,.nav-tabs-right li a{margin-right:0} .nav-tabs-left li{margin-right:-1px} .nav-tabs-left li a{border:2px solid transparent!important} .nav-tabs-left li.active a,.nav-tabs-left li.active a:active,.nav-tabs-left li.active a:focus,.nav-tabs-left li.active a:hover{border-right:2px solid #3FAE2A!important} .nav-tabs-right li{margin-left:-1px} .nav-tabs-right li a{border:2px solid transparent!important} .nav-tabs-right li.active a,.nav-ta
bs-right li.active a:active,.nav-tabs-right li.active a:focus,.nav-tabs-right li.active a:hover{border-left:2px solid #3FAE2A!important} .wizard{border:2px solid #ebecf1} .wizard .wizard-header h3{font-weight:400;line-height:1;font-size:20px;color:#333;margin:15px 20px} .wizard .wizard-body{overflow:hidden;margin:0} .wizard .wizard-body .wizard-content{background:#ebecf1;padding-top:25px;float:left;margin-bottom:-99999px;padding-bottom:99999px} .wizard .wizard-body .wizard-content .step-title{line-height:1;font-weight:700;font-size:18px;color:#666} .wizard .wizard-body .wizard-content .step-description{font-weight:400;font-size:14px;line-height:1.4;color:#999} .wizard .wizard-body .wizard-content .panel.panel-default{border:none;box-shadow:none;margin-top:20px} .wizard .wizard-body .wizard-content .panel.panel-default .panel-body{padding:30px 20px} .wizard .wizard-body .wizard-nav{min-height:550px;padding-top:25px;background-color:#323544;float:left;margin-bottom:-99999px;p
adding-bottom:99999px} .wizard .wizard-body .wizard-nav .nav li{padding:0 15px} .wizard .wizard-body .wizard-nav .nav li a{height:48px;padding:0 5px;display:table-cell;vertical-align:middle} .wizard .wizard-body .wizard-nav .nav li .step-marker{position:absolute;top:9px;line-height:16px;text-align:center;width:20px;height:20px;border:2px solid #1EB475;border-radius:50%;font-size:12px;font-style:inherit;color:#1EB475;background-color:#323544} .wizard .wizard-body .wizard-nav .nav li .step-description,.wizard .wizard-body .wizard-nav .nav li .step-name{font-family:Roboto,sans-serif;font-weight:400;color:#999;margin-left:30px;font-style:normal} .wizard .wizard-body .wizard-nav .nav li .step-name{line-height:1;font-size:14px} .wizard .wizard-body .wizard-nav .nav li .step-index{line-height:18px} .wizard .wizard-body .wizard-nav .nav li .step-description{line-height:1;font-size:12px} .wizard .wizard-body .wizard-nav .nav li.completed .step-marker{background-color:#1EB475;color:#f
ff;font-size:10px;padding-left:2px} .wizard .wizard-body .wizard-nav .nav li.completed .step-marker .step-index{display:none} .wizard .wizard-body .wizard-nav .nav li.completed .step-marker:after{font-family:"Glyphicons Halflings";content:"\e013";position:relative;top:1px;left:-1px} .wizard .wizard-body .wizard-nav .nav li.completed:after{width:2px;height:100%;position:absolute;background-color:#1EB475;content:"";top:25px;left:29px} .wizard .wizard-body .wizard-nav .nav li.completed:last-child:after{content:none} .wizard .wizard-body .wizard-nav .nav li.active .step-name{font-weight:700} .wizard .wizard-body .wizard-nav .nav li.disabled .step-marker{color:#666;border-color:#666} .wizard .wizard-body .wizard-nav .nav li.disabled .step-description,.wizard .wizard-body .wizard-nav .nav li.disabled .step-name{color:#666} .wizard .wizard-body .wizard-nav .nav li.disabled.completed .step-marker{background-color:#1EB475;border:2px solid #1EB475;color:#fff} .wizard .wizard-body .wi
zard-nav .nav-pills>li.active>a,.wizard .wizard-body .wizard-nav .nav-pills>li.active>a:focus,.wizard .wizard-body .wizard-nav .nav-pills>li.active>a:hover,.wizard .wizard-body .wizard-nav .nav>li>a:focus,.wizard .wizard-body .wizard-nav .nav>li>a:hover{background-color:inherit} .wizard .wizard-body .wizard-footer{background:#fff;padding:15px 20px} .wizard .wizard-body .wizard-footer button{margin:0 10px} .checkbox-disabled-style{background-color:#b2b8c1;border-color:#b2b8c1} input[type=radio]:checked,input[type=radio]:not(:checked),input[type=checkbox]:checked,input[type=checkbox]:not(:checked){display:none} input[type=radio]:checked+label,input[type=radio]:not(:checked)+label,input[type=checkbox]:checked+label,input[type=checkbox]:not(:checked)+label{position:relative;padding-left:20px} input[type=radio]:checked+label:hover:before,input[type=radio]:not(:checked)+label:hover:before,input[type=checkbox]:checked+label:hover:before,input[type=checkbox]:not(:checked)+label:hover:
before{border-color:#1491C1;background-color:#1491C1} input[type=radio]:checked+label:before,input[type=checkbox]:checked+label:before{background-color:#1491C1;border-color:#1491C1} input[type=radio].disabled+label:before,input[type=radio].disabled+label:hover:before,input[type=radio][disabled]+label:before,input[type=radio][disabled]+label:hover:before,input[type=checkbox].disabled+label:before,input[type=checkbox].disabled+label:hover:before,input[type=checkbox][disabled]+label:before,input[type=checkbox][disabled]+label:hover:before{background-color:#b2b8c1;border-color:#b2b8c1} input[type=checkbox]+label:before{content:'';position:absolute;left:0;top:4px;width:10px;height:10px;-moz-box-sizing:border-box;box-sizing:border-box;border-radius:2px;border-width:1px;border-style:solid;border-color:#ddd} input[type=checkbox]:checked+label:after{content:'\2714';color:#FFF;position:absolute;top:0;left:2px;font-size:9px} input.radio+label:before,input[type=radio]+label:before{content:
'';position:absolute;left:0;top:0;width:12px;height:12px;-moz-box-sizing:border-box;box-sizing:border-box;border-radius:12px;border-width:1px;border-style:solid;border-color:#ddd} input.radio:checked+label:after,input[type=radio]:checked+label:after{content:'';background-color:#FFF;position:absolute;top:3px;left:3px;width:6px;height:6px;border-radius:6px} .navigation-bar-container,.navigation-bar-container ul.nav.side-nav-header{width:230px;transition:width .5s ease-out} .navigation-bar-container{height:auto;background-color:#323544;padding:0;-ms-overflow-style:none;-webkit-font-smoothing:antialiased} .navigation-bar-container ul.nav.side-nav-header li.navigation-header{background:#313d54;padding:15px 5px 15px 25px;height:55px} .navigation-bar-container ul.nav.side-nav-header li.navigation-header>a.ambari-logo{padding:0} .navigation-bar-container ul.nav.side-nav-header li.navigation-header>a.ambari-logo>img{height:25px;float:left;margin-left:-3px} .navigation-bar-container ul
.nav.side-nav-header li.navigation-header .btn-group{cursor:pointer;margin-top:3px} .navigation-bar-container ul.nav.side-nav-header li.navigation-header .btn-group:hover span.ambari-header,.navigation-bar-container ul.nav.side-nav-header li.navigation-header .btn-group:hover span.toggle-icon{color:#fff} .navigation-bar-container ul.nav.side-nav-header li.navigation-header .btn-group span.ambari-header{font-family:Roboto,sans-serif;font-weight:400;font-style:normal;line-height:1;font-size:20px;width:55px;display:inline;color:#b8bec4;padding:0 8px 0 10px} .navigation-bar-container ul.nav.side-nav-header li.navigation-header .btn-group span.toggle-icon{margin-bottom:5px;font-size:13px;display:inline-block;vertical-align:middle;color:#b8bec4} .navigation-bar-container ul.nav.side-nav-header li.navigation-header .btn-group.open .dropdown-toggle{box-shadow:none} .navigation-bar-container ul.nav.side-nav-header li.navigation-header ul.dropdown-menu{top:30px} .navigation-bar-containe
r ul.nav.side-nav-header li.navigation-header ul.dropdown-menu li>a{font-family:Roboto,sans-serif;font-weight:400;font-style:normal;font-size:14px;color:#666;line-height:1.42;white-space:nowrap;overflow:hidden;text-overflow:ellipsis} .navigation-bar-container ul.nav.side-nav-header li.navigation-header ul.dropdown-menu li>a:hover{background:#f5f5f5} .navigation-bar-container ul.nav.side-nav-footer,.navigation-bar-container ul.nav.side-nav-menu{background-color:#323544;width:230px;transition:width .5s ease-out} .navigation-bar-container ul.nav.side-nav-footer li,.navigation-bar-container ul.nav.side-nav-menu li{padding:0;margin:0} .navigation-bar-container ul.nav.side-nav-footer li.mainmenu-li>a,.navigation-bar-container ul.nav.side-nav-footer li.navigation-footer>a,.navigation-bar-container ul.nav.side-nav-footer li.submenu-li>a,.navigation-bar-container ul.nav.side-nav-menu li.mainmenu-li>a,.navigation-bar-container ul.nav.side-nav-menu li.navigation-footer>a,.navigation-bar-co
ntainer ul.nav.side-nav-menu li.submenu-li>a{display:table-cell;vertical-align:middle;width:230px;border-radius:0;-moz-border-radius:0;-webkit-border-radius:0;white-space:nowrap} .navigation-bar-container ul.nav.side-nav-footer li.mainmenu-li>a .navigation-menu-item,.navigation-bar-container ul.nav.side-nav-footer li.navigation-footer>a .navigation-menu-item,.navigation-bar-container ul.nav.side-nav-footer li.submenu-li>a .navigation-menu-item,.navigation-bar-container ul.nav.side-nav-menu li.mainmenu-li>a .navigation-menu-item,.navigation-bar-container ul.nav.side-nav-menu li.navigation-footer>a .navigation-menu-item,.navigation-bar-container ul.nav.side-nav-menu li.submenu-li>a .navigation-menu-item{font-family:Roboto,sans-serif;font-weight:400;font-style:normal;line-height:1;font-size:14px;color:#b8bec4;padding-left:8px} .navigation-bar-container ul.nav.side-nav-footer li.mainmenu-li>a .navigation-icon,.navigation-bar-container ul.nav.side-nav-footer li.navigation-footer>a .nav
igation-icon,.navigation-bar-container ul.nav.side-nav-footer li.submenu-li>a .navigation-icon,.navigation-bar-container ul.nav.side-nav-menu li.mainmenu-li>a .navigation-icon,.navigation-bar-container ul.nav.side-nav-menu li.navigation-footer>a .navigation-icon,.navigation-bar-container ul.nav.side-nav-menu li.submenu-li>a .navigation-icon{line-height:18px;font-size:18px;color:#b8bec4} .navigation-bar-container ul.nav.side-nav-footer li.mainmenu-li>a .toggle-icon,.navigation-bar-container ul.nav.side-nav-footer li.navigation-footer>a .toggle-icon,.navigation-bar-container ul.nav.side-nav-footer li.submenu-li>a .toggle-icon,.navigation-bar-container ul.nav.side-nav-menu li.mainmenu-li>a .toggle-icon,.navigation-bar-container ul.nav.side-nav-menu li.navigation-footer>a .toggle-icon,.navigation-bar-container ul.nav.side-nav-menu li.submenu-li>a .toggle-icon{line-height:14px;font-size:14px;color:#b8bec4;padding:3px 5px 3px 10px} .navigation-bar-container ul.nav.side-nav-footer li.mai
nmenu-li>a,.navigation-bar-container ul.nav.side-nav-footer li.navigation-footer>a,.navigation-bar-container ul.nav.side-nav-menu li.mainmenu-li>a,.navigation-bar-container ul.nav.side-nav-menu li.navigation-footer>a{padding:10px 5px 10px 20px} .navigation-bar-container ul.nav.side-nav-footer li.submenu-li>a,.navigation-bar-container ul.nav.side-nav-menu li.submenu-li>a{padding:10px 5px 10px 25px} .navigation-bar-container ul.nav.side-nav-footer li.navigation-footer,.navigation-bar-container ul.nav.side-nav-menu li.navigation-footer{background:#313d54;height:50px} .navigation-bar-container ul.nav.side-nav-footer li.navigation-footer a .navigation-icon,.navigation-bar-container ul.nav.side-nav-menu li.navigation-footer a .navigation-icon{color:#31823a;font-size:20px;position:relative;padding:0 15px;left:calc(30%)} .navigation-bar-container ul.nav.side-nav-footer li.navigation-footer a .navigation-icon:hover,.navigation-bar-container ul.nav.side-nav-menu li.navigation-footer a .na
vigation-icon:hover{color:#fff} .navigation-bar-container ul.nav.side-nav-footer li>ul>li,.navigation-bar-container ul.nav.side-nav-menu li>ul>li{background-color:#323544} .navigation-bar-container ul.nav.side-nav-footer li>ul>li a,.navigation-bar-container ul.nav.side-nav-menu li>ul>li a{font-family:Roboto,sans-serif;font-weight:400;font-style:normal;line-height:1;font-size:14px;color:#999} .navigation-bar-container ul.nav.side-nav-footer li>ul>li a .submenu-icon,.navigation-bar-container ul.nav.side-nav-menu li>ul>li a .submenu-icon{line-height:14px;font-size:14px} .navigation-bar-container ul.nav.side-nav-footer li>a:hover,.navigation-bar-container ul.nav.side-nav-footer li>ul>li>a:hover,.navigation-bar-container ul.nav.side-nav-menu li>a:hover,.navigation-bar-container ul.nav.side-nav-menu li>ul>li>a:hover{background:#404351;cursor:pointer;color:#fff} .navigation-bar-container ul.nav.side-nav-footer li>a:hover .navigation-icon,.navigation-bar-container ul.nav.side-nav-foote
r li>a:hover .navigation-menu-item,.navigation-bar-container ul.nav.side-nav-footer li>a:hover .submenu-item,.navigation-bar-container ul.nav.side-nav-footer li>a:hover .toggle-icon,.navigation-bar-container ul.nav.side-nav-footer li>ul>li>a:hover .navigation-icon,.navigation-bar-container ul.nav.side-nav-footer li>ul>li>a:hover .navigation-menu-item,.navigation-bar-container ul.nav.side-nav-footer li>ul>li>a:hover .submenu-item,.navigation-bar-container ul.nav.side-nav-footer li>ul>li>a:hover .toggle-icon,.navigation-bar-container ul.nav.side-nav-menu li>a:hover .navigation-icon,.navigation-bar-container ul.nav.side-nav-menu li>a:hover .navigation-menu-item,.navigation-bar-container ul.nav.side-nav-menu li>a:hover .submenu-item,.navigation-bar-container ul.nav.side-nav-menu li>a:hover .toggle-icon,.navigation-bar-container ul.nav.side-nav-menu li>ul>li>a:hover .navigation-icon,.navigation-bar-container ul.nav.side-nav-menu li>ul>li>a:hover .navigation-menu-item,.navigation-bar-cont
ainer ul.nav.side-nav-menu li>ul>li>a:hover .submenu-item,.navigation-bar-container ul.nav.side-nav-menu li>ul>li>a:hover .toggle-icon{color:#fff} .navigation-bar-container ul.nav.side-nav-footer li.active.collapsed,.navigation-bar-container ul.nav.side-nav-footer li.active:not(.has-sub-menu),.navigation-bar-container ul.nav.side-nav-menu li.active.collapsed,.navigation-bar-container ul.nav.side-nav-menu li.active:not(.has-sub-menu){background:#404351;cursor:pointer} .navigation-bar-container ul.nav.side-nav-footer li.active.collapsed>a,.navigation-bar-container ul.nav.side-nav-footer li.active:not(.has-sub-menu)>a,.navigation-bar-container ul.nav.side-nav-menu li.active.collapsed>a,.navigation-bar-container ul.nav.side-nav-menu li.active:not(.has-sub-menu)>a{color:#fff} .navigation-bar-container ul.nav.side-nav-footer li.active.collapsed>a .navigation-icon,.navigation-bar-container ul.nav.side-nav-footer li.active.collapsed>a .navigation-menu-item,.navigation-bar-container ul.na
v.side-nav-footer li.active.collapsed>a .submenu-item,.navigation-bar-container ul.nav.side-nav-footer li.active.collapsed>a .toggle-icon,.navigation-bar-container ul.nav.side-nav-footer li.active:not(.has-sub-menu)>a .navigation-icon,.navigation-bar-container ul.nav.side-nav-footer li.active:not(.has-sub-menu)>a .navigation-menu-item,.navigation-bar-container ul.nav.side-nav-footer li.active:not(.has-sub-menu)>a .submenu-item,.navigation-bar-container ul.nav.side-nav-footer li.active:not(.has-sub-menu)>a .toggle-icon,.navigation-bar-container ul.nav.side-nav-menu li.active.collapsed>a .navigation-icon,.navigation-bar-container ul.nav.side-nav-menu li.active.collapsed>a .navigation-menu-item,.navigation-bar-container ul.nav.side-nav-menu li.active.collapsed>a .submenu-item,.navigation-bar-container ul.nav.side-nav-menu li.active.collapsed>a .toggle-icon,.navigation-bar-container ul.nav.side-nav-menu li.active:not(.has-sub-menu)>a .navigation-icon,.navigation-bar-container ul.nav.sid
e-nav-menu li.active:not(.has-sub-menu)>a .navigation-menu-item,.navigation-bar-container ul.nav.side-nav-menu li.active:not(.has-sub-menu)>a .submenu-item,.navigation-bar-container ul.nav.side-nav-menu li.active:not(.has-sub-menu)>a .toggle-icon{color:#fff} .navigation-bar-container ul.nav.side-nav-footer li.active.collapsed>a:after,.navigation-bar-container ul.nav.side-nav-footer li.active:not(.has-sub-menu)>a:after,.navigation-bar-container ul.nav.side-nav-menu li.active.collapsed>a:after,.navigation-bar-container ul.nav.side-nav-menu li.active:not(.has-sub-menu)>a:after{left:0;top:50%;border:solid transparent;border-width:10px 7px;content:" ";height:0;width:0;position:absolute;pointer-events:none;border-color:transparent transparent transparent #31823a;margin-top:-12px} .navigation-bar-container ul.nav.side-nav-footer .more-actions,.navigation-bar-container ul.nav.side-nav-menu .more-actions{display:none;position:absolute;top:14px;right:33px;line-height:25px;width:20px;text-al
ign:center;font-size:14px;cursor:pointer;vertical-align:middle;color:#fff} .navigation-bar-container.collapsed,.navigation-bar-container.collapsed ul.nav.side-nav-footer,.navigation-bar-container.collapsed ul.nav.side-nav-header,.navigation-bar-container.collapsed ul.nav.side-nav-menu{width:50px} .navigation-bar-container ul.nav.side-nav-footer .more-actions .dropdown-menu>li>a,.navigation-bar-container ul.nav.side-nav-footer .more-actions .dropdown-menu>li>a i,.navigation-bar-container ul.nav.side-nav-menu .more-actions .dropdown-menu>li>a,.navigation-bar-container ul.nav.side-nav-menu .more-actions .dropdown-menu>li>a i{color:#666} .navigation-bar-container ul.nav.side-nav-footer .more-actions .dropdown-menu>li>a:hover,.navigation-bar-container ul.nav.side-nav-menu .more-actions .dropdown-menu>li>a:hover{background:#f5f5f5} .navigation-bar-container ul.nav.side-nav-footer .menu-item-name,.navigation-bar-container ul.nav.side-nav-menu .menu-item-name{display:inline-block;vertic
al-align:bottom;max-width:100px;overflow:hidden;text-overflow:ellipsis;-o-text-overflow:ellipsis;-ms-text-overflow:ellipsis;white-space:nowrap} .navigation-bar-container.collapsed ul.nav.side-nav-footer .more-actions,.navigation-bar-container.collapsed ul.nav.side-nav-footer li a .navigation-menu-item,.navigation-bar-container.collapsed ul.nav.side-nav-footer li a .toggle-icon,.navigation-bar-container.collapsed ul.nav.side-nav-header li.navigation-header .dropdown-menu,.navigation-bar-container.collapsed ul.nav.side-nav-header li.navigation-header span.ambari-header,.navigation-bar-container.collapsed ul.nav.side-nav-header li.navigation-header span.toggle-icon,.navigation-bar-container.collapsed ul.nav.side-nav-menu .more-actions,.navigation-bar-container.collapsed ul.nav.side-nav-menu li a .navigation-menu-item,.navigation-bar-container.collapsed ul.nav.side-nav-menu li a .toggle-icon{display:none} .navigation-bar-container .nav-pills>li.active>a,.navigation-bar-container .nav-
pills>li.active>a:focus,.navigation-bar-container .nav-pills>li.active>a:hover,.navigation-bar-container .nav>li>a:focus,.navigation-bar-container .nav>li>a:hover{background-color:inherit} .navigation-bar-container.collapsed ul.nav.side-nav-header li.navigation-header{padding:15px 0 15px 15px} .navigation-bar-container.collapsed ul.nav.side-nav-footer li a,.navigation-bar-container.collapsed ul.nav.side-nav-menu li a{padding:15px 0 15px 15px;width:50px} .navigation-bar-container.collapsed ul.nav.side-nav-footer li.navigation-footer a .navigation-icon,.navigation-bar-container.collapsed ul.nav.side-nav-menu li.navigation-footer a .navigation-icon{padding:0 5px;left:0} .navigation-bar-container.collapsed ul.nav.side-nav-footer li ul.sub-menu,.navigation-bar-container.collapsed ul.nav.side-nav-menu li ul.sub-menu{display:none;width:230px;position:absolute;z-index:100;top:0;left:50px} .navigation-bar-container.collapsed ul.nav.side-nav-footer li.submenu-li>a,.navigation-bar-contain
er.collapsed ul.nav.side-nav-menu li.submenu-li>a{padding:10px 5px 10px 25px;width:230px} .navigation-bar-container.collapsed ul.nav.side-nav-footer li.active,.navigation-bar-container.collapsed ul.nav.side-nav-menu li.active{background:#404351;cursor:pointer} .navigation-bar-container.collapsed ul.nav.side-nav-footer li.active>a,.navigation-bar-container.collapsed ul.nav.side-nav-footer li.active>a .navigation-icon,.navigation-bar-container.collapsed ul.nav.side-nav-footer li.active>a .navigation-menu-item,.navigation-bar-container.collapsed ul.nav.side-nav-footer li.active>a .submenu-item,.navigation-bar-container.collapsed ul.nav.side-nav-footer li.active>a .toggle-icon,.navigation-bar-container.collapsed ul.nav.side-nav-menu li.active>a,.navigation-bar-container.collapsed ul.nav.side-nav-menu li.active>a .navigation-icon,.navigation-bar-container.collapsed ul.nav.side-nav-menu li.active>a .navigation-menu-item,.navigation-bar-container.collapsed ul.nav.side-nav-menu li.active>
a .submenu-item,.navigation-bar-container.collapsed ul.nav.side-nav-menu li.active>a .toggle-icon{color:#fff} .navigation-bar-container.collapsed ul.nav.side-nav-footer li.active>a:after,.navigation-bar-container.collapsed ul.nav.side-nav-menu li.active>a:after{left:0;top:50%;border:solid transparent;border-width:12px 6px;content:" ";height:0;width:0;position:absolute;pointer-events:none;border-color:transparent transparent transparent #31823a;margin-top:-12px} .navigation-bar-fit-height{position:fixed;top:0;bottom:0;left:0;z-index:2079} .navigation-bar-fit-height .side-nav-header{position:absolute;top:0} .navigation-bar-fit-height .side-nav-menu{position:absolute;top:55px;bottom:50px} .navigation-bar-fit-height .side-nav-footer{position:absolute;bottom:0} .navigation-bar-fit-height .more-actions .dropdown-menu{position:fixed;top:auto;left:auto} .navigation-bar-fit-height .navigation-bar-container{height:100%} .navigation-bar-fit-height .navigation-bar-container .side-nav-me
nu{overflow-y:auto} .notifications-group{position:relative;top:1px} #notifications-dropdown.dropdown-menu{min-width:300px;max-width:300px;min-height:150px;padding:0;z-index:1000;right:-50px;left:auto;top:260%;border:none;box-shadow:0 2px 10px 2px rgba(0,0,0,.29)} #notifications-dropdown.dropdown-menu .popup-arrow-up{position:absolute;right:37px;top:-40px;width:40px;height:40px;overflow:hidden} #notifications-dropdown.dropdown-menu .popup-arrow-up:after{content:"";position:absolute;width:20px;height:20px;background:#fff;-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg);top:30px;left:10px;box-shadow:-1px -1px 10px -2px rgba(0,0,0,.5)} #notifications-dropdown.dropdown-menu .notifications-header{border-bottom:1px solid #eee;padding:15px 20px} #notifications-dropdown.dropdown-menu .notifications-header .notifications-title{font-family:Roboto,sans-serif;font-weight:400;font-style:normal;line-height:1;color:#333;font-size:16px} #notifications-dropdo
wn.dropdown-menu .notifications-body{padding:0 15px;overflow:auto;max-height:500px} #notifications-dropdown.dropdown-menu .notifications-body .no-alert-text{padding:15px 5px} #notifications-dropdown.dropdown-menu .notifications-body .table-controls{padding:10px 0;margin:0;border-bottom:1px solid #eee} #notifications-dropdown.dropdown-menu .notifications-body .table-controls .state-filter{padding:0;font-family:Roboto,sans-serif;font-weight:400;font-style:normal;line-height:1;font-size:12px;color:#666;position:relative} #notifications-dropdown.dropdown-menu .notifications-body .table-controls .state-filter .form-control.filter-select{font-size:12px;color:#666;height:25px} #notifications-dropdown.dropdown-menu .notifications-body .table.alerts-table{margin-top:0} #notifications-dropdown.dropdown-menu .notifications-body .table.alerts-table tbody tr{cursor:pointer} #notifications-dropdown.dropdown-menu .notifications-body .table.alerts-table tbody tr.no-alert-tr:hover{cursor:defa
ult;border-color:transparent transparent #eee} #notifications-dropdown.dropdown-menu .notifications-body .table.alerts-table tbody tr.no-alert-tr:hover>td{border-color:transparent;background-color:#fff} #notifications-dropdown.dropdown-menu .notifications-body .table.alerts-table tbody td.status{width:9%;padding:15px 3px} #notifications-dropdown.dropdown-menu .notifications-body .table.alerts-table tbody td.status .alert-state-CRITICAL{color:#EF6162} #notifications-dropdown.dropdown-menu .notifications-body .table.alerts-table tbody td.status .alert-state-WARNING{color:#E98A40} #notifications-dropdown.dropdown-menu .notifications-body .table.alerts-table tbody td.content{width:90%;padding:15px 3px 10px;font-family:Roboto,sans-serif;font-weight:400;font-style:normal;color:#333;line-height:1.3} #notifications-dropdown.dropdown-menu .notifications-body .table.alerts-table tbody td.content .name{font-weight:700;font-size:14px;color:#333;margin-bottom:5px} #notifications-dropdown.
dropdown-menu .notifications-body .table.alerts-table tbody td.content .description{font-size:12px;color:#666;margin-bottom:4px;display:block;display:-webkit-box;-webkit-line-clamp:3;max-height:47px;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;overflow-wrap:break-word;word-wrap:break-word;-ms-word-break:break-all;word-break:break-all;word-break:break-word;-ms-hyphens:auto;-moz-hyphens:auto;-webkit-hyphens:auto;hyphens:auto} #notifications-dropdown.dropdown-menu .notifications-body .table.alerts-table tbody td.content .timestamp{text-align:right;font-size:11px;color:#999} #notifications-dropdown.dropdown-menu .notifications-footer{border-top:1px solid #eee;padding:15px} .modal-backdrop{background-color:grey} .modal .modal-content{border-radius:2px} .modal .modal-content .modal-body,.modal .modal-content .modal-footer,.modal .modal-content .modal-header{padding-left:20px;padding-right:20px} .modal .modal-content .modal-header{border-bottom:none;padding-top:
20px;color:#666;font-size:20px} .modal .modal-content .modal-header h4{margin:0;color:inherit;font-size:inherit} .modal .modal-content .modal-body{color:#666;font-size:12px} .modal .modal-content .modal-footer{border-top:none;padding-bottom:20px} .modal .modal-content .modal-footer .btn~.btn{margin-left:10px} .accordion .panel-group,.wizard .wizard-body .wizard-content .accordion .panel-group{margin-bottom:0} .accordion .panel-group .panel,.wizard .wizard-body .wizard-content .accordion .panel-group .panel{border-radius:0;border:none;margin-top:0} .accordion .panel-group .panel .panel-heading,.wizard .wizard-body .wizard-content .accordion .panel-group .panel .panel-heading{height:50px;padding:15px 10px;border:1px solid;border-color:#ddd transparent;border-top:none;background:#fff} .accordion .panel-group .panel .panel-heading .panel-title,.wizard .wizard-body .wizard-content .accordion .panel-group .panel .panel-heading .panel-title{font-family:Roboto,sans-serif;font-weight
:400;font-style:normal;line-height:1;color:#333} .accordion .panel-group .panel .panel-heading .panel-title>a,.wizard .wizard-body .wizard-content .accordion .panel-group .panel .panel-heading .panel-title>a{font-size:18px;color:#333} .accordion .panel-group .panel .panel-heading .panel-title>i,.wizard .wizard-body .wizard-content .accordion .panel-group .panel .panel-heading .panel-title>i{font-size:20px;color:#1491c1} .accordion .panel-group .panel .panel-heading:hover,.wizard .wizard-body .wizard-content .accordion .panel-group .panel .panel-heading:hover{background:#f3faff;cursor:pointer} .accordion .panel-group .panel .panel-body,.wizard .wizard-body .wizard-content .accordion .panel-group .panel .panel-body{padding:15px 10px 20px 20px} .h1,.h2,.h3,.h4,.h5,.h6,h1,h2,h3,h4,h5,h6{font-family:Roboto,sans-serif} .h1,h1{font-size:24px} .h2,h2{font-size:18px} .body,body{font-family:Roboto,sans-serif;font-weight:400;font-style:normal;line-height:1;color:#333;font-size:14px} .
description{font-family:Roboto,sans-serif;font-size:12px;color:#000} a,a:focus,a:visited{color:#1491C1} a:focus:hover,a:hover,a:visited:hover{text-decoration:underline} a.disabled:hover,a:active,a:focus.disabled:hover,a:focus:active,a:focus[disabled]:hover,a:visited.disabled:hover,a:visited:active,a:visited[disabled]:hover,a[disabled]:hover{text-decoration:none} a.disabled,a:focus.disabled,a:focus[disabled],a:visited.disabled,a:visited[disabled],a[disabled]{cursor:not-allowed;color:#666;text-decoration:none}
\ No newline at end of file
+.btn-group.open .dropdown-menu,.dropdown.open .dropdown-menu,.font-mixin{font-family:Roboto,sans-serif;font-weight:400;font-style:normal}.pagination-block .pagination-block-item a,.pagination-block .pagination-block-item a:focus,.pagination-block .pagination-block-item a:visited,.table.table-hover .action:hover,a,a:focus,a:visited{text-decoration:none}@font-face{font-family:Roboto;font-weight:400;font-style:normal;src:url(fonts/Roboto-Regular-webfont.eot);src:url(fonts/Roboto-Regular-webfont.eot?#iefix) format('embedded-opentype'),url(fonts/Roboto-Regular-webfont.woff) format('woff'),url(fonts/Roboto-Regular-webfont.ttf) format('truetype'),url(fonts/Roboto-Regular-webfont.svg#robotoregular) format('svg')}.font-mixin{line-height:1;color:#333}.btn,.btn:focus{outline:0;font-family:Roboto,sans-serif;text-transform:uppercase;height:34px;font-size:14px;padding:10px 20px;line-height:14px}.btn .glyphicon,.btn:focus .glyphicon{top:-1px;float:left}.box-shadow{box-shadow:0 0 2px 0 #1391c1}.btn
-default-disabled,.btn-disabled{box-shadow:none;opacity:.6}.btn-default-disabled{color:#FFF;background-color:#808793;border:none}.btn-default,.btn-default:focus{color:#666;background-color:#FFF;border:1px solid #CFD3D7}.btn-default:focus:hover,.btn-default:hover{color:#FFF;background-color:#808793}.btn-default:active,.btn-default:focus:active{color:#666;background-color:#FFF;border:1px solid #CFD3D7;box-shadow:0 0 2px 0 #1391c1}.btn-default.disabled,.btn-default.disabled.active,.btn-default.disabled:active,.btn-default.disabled:hover,.btn-default:focus.disabled,.btn-default:focus.disabled.active,.btn-default:focus.disabled:active,.btn-default:focus.disabled:hover,.btn-default:focus[disabled],.btn-default:focus[disabled].active,.btn-default:focus[disabled]:active,.btn-default:focus[disabled]:hover,.btn-default[disabled],.btn-default[disabled].active,.btn-default[disabled]:active,.btn-default[disabled]:hover{opacity:.6;box-shadow:none;color:#FFF;background-color:#808793;border:none}.b
tn-primary-disabled{opacity:.6;box-shadow:none;color:#D1E8D1;background-color:#3FAE2A;border:1px solid #3FAE2A}.btn-primary,.btn-primary:focus{color:#FFF;background-color:#3FAE2A;border:1px solid #3FAE2A}.btn-primary:focus:hover,.btn-primary:hover{color:#FFF;background-color:#429929;border:1px solid #429929}.btn-primary.active,.btn-primary:active,.btn-primary:focus.active,.btn-primary:focus:active{color:#FFF;background-color:#3FAE2A;border:1px solid #3FAE2A;box-shadow:0 0 2px 0 #1391c1}.btn-primary.disabled,.btn-primary.disabled.active,.btn-primary.disabled:active,.btn-primary.disabled:hover,.btn-primary:focus.disabled,.btn-primary:focus.disabled.active,.btn-primary:focus.disabled:active,.btn-primary:focus.disabled:hover,.btn-primary:focus[disabled],.btn-primary:focus[disabled].active,.btn-primary:focus[disabled]:active,.btn-primary:focus[disabled]:hover,.btn-primary[disabled],.btn-primary[disabled].active,.btn-primary[disabled]:active,.btn-primary[disabled]:hover{opacity:.6;box-sha
dow:none;color:#D1E8D1;background-color:#3FAE2A;border:1px solid #3FAE2A}.btn-secondary-disabled{opacity:.6;box-shadow:none;color:#D1E8D1;background-color:#429929;border:1px solid #3FAE2A}.btn-secondary,.btn-secondary:focus{color:#429929;background-color:#FFF;border:1px solid #3FAE2A}.btn-secondary:focus:hover,.btn-secondary:hover{color:#FFF;background-color:#429929}.btn-secondary:active,.btn-secondary:focus:active{color:#429929;background-color:#FFF;box-shadow:0 0 2px 0 #1391c1}.btn-secondary.disabled,.btn-secondary.disabled.active,.btn-secondary.disabled:active,.btn-secondary.disabled:hover,.btn-secondary:focus.disabled,.btn-secondary:focus.disabled.active,.btn-secondary:focus.disabled:active,.btn-secondary:focus.disabled:hover,.btn-secondary:focus[disabled],.btn-secondary:focus[disabled].active,.btn-secondary:focus[disabled]:active,.btn-secondary:focus[disabled]:hover,.btn-secondary[disabled],.btn-secondary[disabled].active,.btn-secondary[disabled]:active,.btn-secondary[disabled]
:hover{opacity:.6;box-shadow:none;color:#D1E8D1;background-color:#429929;border:1px solid #3FAE2A}.btn-success{border:none}.btn-regular-default-state{background-color:#FFF;color:#666;border:1px solid #cfd3d7}.btn-primary-default-state{background-color:#3FAE2A;border:1px solid #3FAE2A;color:#FFF}.btn-group.open .btn.dropdown-toggle,.dropdown.open .btn.dropdown-toggle{box-shadow:inset 0 0 3px 0 #1391c1}.btn-group.open .btn.dropdown-toggle,.btn-group.open .btn.dropdown-toggle.btn-default,.btn-group.open .btn.dropdown-toggle.btn-default:hover,.btn-group.open .btn.dropdown-toggle:hover,.dropdown.open .btn.dropdown-toggle,.dropdown.open .btn.dropdown-toggle.btn-default,.dropdown.open .btn.dropdown-toggle.btn-default:hover,.dropdown.open .btn.dropdown-toggle:hover{background-color:#FFF;color:#666;border:1px solid #cfd3d7}.btn-group.open .btn.dropdown-toggle+.dropdown-menu>li>a:hover,.btn-group.open .btn.dropdown-toggle.btn-default+.dropdown-menu>li>a:hover,.dropdown.open .btn.dropdown-togg
le+.dropdown-menu>li>a:hover,.dropdown.open .btn.dropdown-toggle.btn-default+.dropdown-menu>li>a:hover{background-color:#808793;color:#FFF}.btn-group.open .btn.dropdown-toggle.btn-primary,.btn-group.open .btn.dropdown-toggle.btn-primary:hover,.dropdown.open .btn.dropdown-toggle.btn-primary,.dropdown.open .btn.dropdown-toggle.btn-primary:hover{background-color:#3FAE2A;border:1px solid #3FAE2A;color:#FFF}.btn-group.open .btn.dropdown-toggle.btn-primary+.dropdown-menu>li>a:hover,.dropdown.open .btn.dropdown-toggle.btn-primary+.dropdown-menu>li>a:hover{background-color:#429929;color:#FFF}.btn-group.open .dropdown-menu,.dropdown.open .dropdown-menu{line-height:1;border-radius:2px;font-size:14px;min-width:200px;background:#FFF;color:#666;border:1px solid #cfd3d7}.btn-group.open .dropdown-menu>li,.dropdown.open .dropdown-menu>li{margin-bottom:1px}.btn-group.open .dropdown-menu>li>a,.dropdown.open .dropdown-menu>li>a{height:24px}.btn-group .btn.dropdown-toggle:first-child,.dropdown .btn.dro
pdown-toggle:first-child{min-width:80px}.btn-group .btn.dropdown-toggle.disabled,.btn-group .btn.dropdown-toggle[disabled],.dropdown .btn.dropdown-toggle.disabled,.dropdown .btn.dropdown-toggle[disabled]{opacity:.6}input.form-control{font-size:14px;border-radius:2px;color:#666;border:1px solid #CFD3D7;height:34px;padding:10px}input.form-control:focus{border-color:#1291c1;box-shadow:none}.help-block{color:#999;font-size:14px}.help-block.validation-block{color:#999;margin-top:10px}.help-block.validation-block::before{position:relative;top:2px;margin-right:5px;font-family:'Glyphicons Halflings'}.wizard .wizard-body .wizard-content .step-description,.wizard .wizard-body .wizard-content .step-header,.wizard .wizard-body .wizard-content .step-title,.wizard .wizard-header h3,h2.table-title{font-family:Roboto,sans-serif;font-weight:400;font-style:normal}.has-success input.form-control{color:#666;border:1px solid #1EB475}.has-success input.form-control:focus{border-color:#1EB475;box-shadow:n
one}.has-success .help-block.validation-block::before{content:'\e084';color:#1EB475}.has-error input.form-control{color:#666;border:1px solid #EF6162}.has-error input.form-control:focus{border-color:#EF6162;box-shadow:none}.has-error .help-block.validation-block::before{content:'\e083';color:#EF6162}.has-warning input.form-control{color:#666;border:1px solid #E98A40}.has-warning input.form-control:focus{border-color:#E98A40;box-shadow:none}.has-warning .help-block.validation-block::before{content:'\e101';color:#E98A40}.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{color:#999;border-color:#ccc;background-color:#ddd}h2.table-title{line-height:1;color:#333;margin-top:10px;font-size:20px}.table{color:#666;font-size:13px}.table tfoot,.table thead{color:#999}.table input[type=checkbox]+label{position:relative;line-height:1.3em;font-size:initial;top:4px;margin-bottom:0}.table thead>tr>th{border-bottom-color:#EEE}.table tfoot>tr:first-of-type>td{border-top-
width:2px;border-top-color:#EEE}.table>tbody>tr>td{border-top-color:#EEE}.table>tbody>tr.active,.table>tbody>tr.active>td{background-color:#EEE}.table.table-hover .action{visibility:hidden;padding:0;line-height:1}.table.table-hover>tbody>tr{border-width:0 1px 1px;border-style:solid;border-color:#EEE transparent}.table.table-hover>tbody>tr>td{border-width:0}.table.table-hover>tbody>tr:hover{border-color:#A7DFF2;background-color:#E7F6FC}.table.table-hover>tbody>tr:hover>td{border-top:1px solid #A7DFF2;background-color:#E7F6FC}.table.table-hover>tbody>tr:hover>td .action{visibility:visible}.table.table-hover>tbody>tr:first-of-type>td{border-top:1px solid transparent}.table.table-hover>tbody>tr:first-of-type:hover>td{border-color:#A7DFF2}.pagination-block .pagination-block-item{float:left;padding:0 5px}.pagination-block .pagination-block-item select{border:none;background-color:transparent;color:#1491C1}.nav.nav-tabs{border:none;margin-bottom:20px}.nav.nav-tabs li a{border-width:0;borde
r-radius:0;border-bottom:3px solid transparent;color:#6B6C6C;text-transform:uppercase}.nav.nav-tabs li a:active,.nav.nav-tabs li a:focus,.nav.nav-tabs li a:hover{color:#333;border-top-width:0;border-left-width:0;border-right-width:0;background:0 0}.nav.nav-tabs li a .badge.badge-important{display:inline;vertical-align:baseline}.nav.nav-tabs li.active a{color:#333;border-bottom:3px solid #3FAE2A;padding-bottom:2px}.nav-tabs-left li,.nav-tabs-right li{float:none;margin-bottom:3px}.nav-tabs-left li a,.nav-tabs-right li a{margin-right:0}.nav-tabs-left li{margin-right:-1px}.nav-tabs-left li a{border:3px solid transparent!important}.nav-tabs-left li.active a,.nav-tabs-left li.active a:active,.nav-tabs-left li.active a:focus,.nav-tabs-left li.active a:hover{border-right:3px solid #3FAE2A!important}.nav-tabs-right li{margin-left:-1px}.nav-tabs-right li a{border:3px solid transparent!important}.nav-tabs-right li.active a,.nav-tabs-right li.active a:active,.nav-tabs-right li.active a:focus,.n
av-tabs-right li.active a:hover{border-left:3px solid #3FAE2A!important}.wizard{border:2px solid #ebecf1}.wizard .wizard-header h3{line-height:1;font-size:20px;color:#333;margin:15px 20px}.wizard .wizard-body{overflow:hidden;margin:0}.wizard .wizard-body .wizard-content{background:#ebecf1;padding-top:15px;float:left;margin-bottom:-99999px;padding-bottom:99999px}.wizard .wizard-body .wizard-content .step-header{color:#666;font-size:14px;line-height:1;margin-bottom:5px}.wizard .wizard-body .wizard-content .step-title{line-height:1;color:#333;font-size:16px}.wizard .wizard-body .wizard-content .step-description{font-size:12px;line-height:1.4;color:#999}.wizard .wizard-body .wizard-content .panel.panel-default{border:none;box-shadow:none;margin-top:20px}.wizard .wizard-body .wizard-content .panel.panel-default .panel-body{padding:10px 20px}.wizard .wizard-body .wizard-nav{min-height:550px;padding-top:25px;background-color:#323544;float:left;margin-bottom:-99999px;padding-bottom:99999px}
.wizard .wizard-body .wizard-nav .nav li{padding:0 15px}.wizard .wizard-body .wizard-nav .nav li a{height:48px;padding:0 5px;display:table-cell;vertical-align:middle}.wizard .wizard-body .wizard-nav .nav li .step-marker{position:absolute;top:9px;line-height:16px;text-align:center;width:20px;height:20px;border:2px solid #1EB475;border-radius:50%;font-size:12px;font-style:inherit;color:#1EB475;background-color:#323544}.wizard .wizard-body .wizard-nav .nav li .step-description,.wizard .wizard-body .wizard-nav .nav li .step-name{font-family:Roboto,sans-serif;font-weight:400;color:#999;margin-left:30px;font-style:normal}.wizard .wizard-body .wizard-nav .nav li .step-name{line-height:1;font-size:14px}.wizard .wizard-body .wizard-nav .nav li .step-index{line-height:18px}.wizard .wizard-body .wizard-nav .nav li .step-description{line-height:1;font-size:12px}.wizard .wizard-body .wizard-nav .nav li.completed .step-marker{background-color:#1EB475;color:#fff;font-size:10px;padding-left:2px}.wi
zard .wizard-body .wizard-nav .nav li.completed .step-marker .step-index{display:none}.wizard .wizard-body .wizard-nav .nav li.completed .step-marker:after{font-family:"Glyphicons Halflings";content:"\e013";position:relative;top:1px;left:-1px}.wizard .wizard-body .wizard-nav .nav li.completed:after{width:2px;height:100%;position:absolute;background-color:#1EB475;content:"";top:25px;left:29px}.wizard .wizard-body .wizard-nav .nav li.completed:last-child:after{content:none}.wizard .wizard-body .wizard-nav .nav li.active .step-name{font-weight:700}.wizard .wizard-body .wizard-nav .nav li.disabled .step-marker{color:#666;border-color:#666}.wizard .wizard-body .wizard-nav .nav li.disabled .step-description,.wizard .wizard-body .wizard-nav .nav li.disabled .step-name{color:#666}.wizard .wizard-body .wizard-nav .nav li.disabled.completed .step-marker{background-color:#1EB475;border:2px solid #1EB475;color:#fff}.wizard .wizard-body .wizard-nav .nav-pills>li.active>a,.wizard .wizard-body .wi
zard-nav .nav-pills>li.active>a:focus,.wizard .wizard-body .wizard-nav .nav-pills>li.active>a:hover,.wizard .wizard-body .wizard-nav .nav>li>a:focus,.wizard .wizard-body .wizard-nav .nav>li>a:hover{background-color:inherit}.wizard .wizard-body .wizard-footer{background:#fff;padding:15px 20px}.wizard .wizard-body .wizard-footer button{margin:0 10px}.checkbox-disabled-style{background-color:#b2b8c1;border-color:#b2b8c1}input[type=radio]:checked,input[type=radio]:not(:checked),input[type=checkbox]:checked,input[type=checkbox]:not(:checked){display:none}input[type=radio]:checked+label,input[type=radio]:not(:checked)+label,input[type=checkbox]:checked+label,input[type=checkbox]:not(:checked)+label{position:relative;padding-left:20px}input[type=radio]:checked+label:hover:before,input[type=radio]:not(:checked)+label:hover:before,input[type=checkbox]:checked+label:hover:before,input[type=checkbox]:not(:checked)+label:hover:before{border-color:#1491C1;background-color:#1491C1}input[type=radi
o]:checked+label:before,input[type=checkbox]:checked+label:before{background-color:#1491C1;border-color:#1491C1}input[type=radio].disabled+label:before,input[type=radio].disabled+label:hover:before,input[type=radio][disabled]+label:before,input[type=radio][disabled]+label:hover:before,input[type=checkbox].disabled+label:before,input[type=checkbox].disabled+label:hover:before,input[type=checkbox][disabled]+label:before,input[type=checkbox][disabled]+label:hover:before{background-color:#b2b8c1;border-color:#b2b8c1}input[type=checkbox]+label:before{content:'';position:absolute;left:0;top:4px;width:10px;height:10px;-moz-box-sizing:border-box;box-sizing:border-box;border-radius:2px;border-width:1px;border-style:solid;border-color:#ddd}input[type=checkbox]:checked+label:after{content:'\2714';color:#FFF;position:absolute;top:0;left:2px;font-size:9px}input.radio+label:before,input[type=radio]+label:before{content:'';position:absolute;left:0;top:0;width:12px;height:12px;-moz-box-sizing:borde
r-box;box-sizing:border-box;border-radius:12px;border-width:1px;border-style:solid;border-color:#ddd}input.radio:checked+label:after,input[type=radio]:checked+label:after{content:'';background-color:#FFF;position:absolute;top:3px;left:3px;width:6px;height:6px;border-radius:6px}.navigation-bar-container,.navigation-bar-container ul.nav.side-nav-header{width:230px;transition:width .5s ease-out}.navigation-bar-container{height:auto;background-color:#323544;padding:0;-ms-overflow-style:none;-webkit-font-smoothing:antialiased}.navigation-bar-container ul.nav.side-nav-header li.navigation-header{background:#313d54;padding:15px 5px 15px 25px;height:55px}.navigation-bar-container ul.nav.side-nav-header li.navigation-header>a.ambari-logo{padding:0}.navigation-bar-container ul.nav.side-nav-header li.navigation-header>a.ambari-logo>img{height:25px;float:left;margin-left:-3px}.navigation-bar-container ul.nav.side-nav-header li.navigation-header .btn-group{cursor:pointer;margin-top:3px}.navigati
on-bar-container ul.nav.side-nav-header li.navigation-header .btn-group:hover span.ambari-header{color:#fff}.navigation-bar-container ul.nav.side-nav-header li.navigation-header .btn-group span.ambari-header{font-family:Roboto,sans-serif;font-weight:400;font-style:normal;line-height:1;font-size:20px;width:55px;display:inline;color:#b8bec4;padding:0 8px 0 10px}.navigation-bar-container ul.nav.side-nav-header li.navigation-header .btn-group span.toggle-icon{margin-bottom:5px;font-size:13px;display:inline-block;vertical-align:middle;color:#43AD49}.navigation-bar-container ul.nav.side-nav-header li.navigation-header .btn-group.open .dropdown-toggle{box-shadow:none}.navigation-bar-container ul.nav.side-nav-header li.navigation-header ul.dropdown-menu{top:30px}.navigation-bar-container ul.nav.side-nav-header li.navigation-header ul.dropdown-menu li>a{font-family:Roboto,sans-serif;font-weight:400;font-style:normal;font-size:14px;color:#666;line-height:1.42;white-space:nowrap;overflow:hidde
n;text-overflow:ellipsis}.navigation-bar-container ul.nav.side-nav-header li.navigation-header ul.dropdown-menu li>a:hover{background:#f5f5f5}.navigation-bar-container ul.nav.side-nav-footer,.navigation-bar-container ul.nav.side-nav-menu{background-color:#323544;width:230px;transition:width .5s ease-out}.navigation-bar-container ul.nav.side-nav-footer li,.navigation-bar-container ul.nav.side-nav-menu li{padding:0;margin:0}.navigation-bar-container ul.nav.side-nav-footer li.mainmenu-li>a,.navigation-bar-container ul.nav.side-nav-footer li.navigation-footer>a,.navigation-bar-container ul.nav.side-nav-footer li.submenu-li>a,.navigation-bar-container ul.nav.side-nav-menu li.mainmenu-li>a,.navigation-bar-container ul.nav.side-nav-menu li.navigation-footer>a,.navigation-bar-container ul.nav.side-nav-menu li.submenu-li>a{display:table-cell;vertical-align:middle;width:230px;border-radius:0;-moz-border-radius:0;-webkit-border-radius:0;white-space:nowrap}.navigation-bar-container ul.nav.side-
nav-footer li.mainmenu-li>a .navigation-menu-item,.navigation-bar-container ul.nav.side-nav-footer li.navigation-footer>a .navigation-menu-item,.navigation-bar-container ul.nav.side-nav-footer li.submenu-li>a .navigation-menu-item,.navigation-bar-container ul.nav.side-nav-menu li.mainmenu-li>a .navigation-menu-item,.navigation-bar-container ul.nav.side-nav-menu li.navigation-footer>a .navigation-menu-item,.navigation-bar-container ul.nav.side-nav-menu li.submenu-li>a .navigation-menu-item{font-family:Roboto,sans-serif;font-weight:400;font-style:normal;line-height:1;font-size:14px;color:#b8bec4;padding-left:8px}.navigation-bar-container ul.nav.side-nav-footer li.mainmenu-li>a .navigation-icon,.navigation-bar-container ul.nav.side-nav-footer li.navigation-footer>a .navigation-icon,.navigation-bar-container ul.nav.side-nav-footer li.submenu-li>a .navigation-icon,.navigation-bar-container ul.nav.side-nav-menu li.mainmenu-li>a .navigation-icon,.navigation-bar-container ul.nav.side-nav-me
nu li.navigation-footer>a .navigation-icon,.navigation-bar-container ul.nav.side-nav-menu li.submenu-li>a .navigation-icon{line-height:18px;font-size:16px;color:#b8bec4}.navigation-bar-container ul.nav.side-nav-footer li.mainmenu-li>a .toggle-icon,.navigation-bar-container ul.nav.side-nav-footer li.navigation-footer>a .toggle-icon,.navigation-bar-container ul.nav.side-nav-footer li.submenu-li>a .toggle-icon,.navigation-bar-container ul.nav.side-nav-menu li.mainmenu-li>a .toggle-icon,.navigation-bar-container ul.nav.side-nav-menu li.navigation-footer>a .toggle-icon,.navigation-bar-container ul.nav.side-nav-menu li.submenu-li>a .toggle-icon{line-height:14px;font-size:14px;color:#b8bec4;padding:3px 5px 3px 10px}.navigation-bar-container ul.nav.side-nav-footer li.mainmenu-li>a,.navigation-bar-container ul.nav.side-nav-menu li.mainmenu-li>a{padding:10px 5px 10px 20px}.navigation-bar-container ul.nav.side-nav-footer li.navigation-footer>a,.navigation-bar-container ul.nav.side-nav-menu li.
navigation-footer>a{padding:14px 5px 14px 20px}.navigation-bar-container ul.nav.side-nav-footer li.submenu-li>a,.navigation-bar-container ul.nav.side-nav-menu li.submenu-li>a{padding:10px 5px 10px 25px}.navigation-bar-container ul.nav.side-nav-footer li.navigation-footer,.navigation-bar-container ul.nav.side-nav-menu li.navigation-footer{background:#313d54;height:48px}.navigation-bar-container ul.nav.side-nav-footer li.navigation-footer a .navigation-icon,.navigation-bar-container ul.nav.side-nav-menu li.navigation-footer a .navigation-icon{color:#3fae2a;font-size:19px;position:relative;padding:0 15px;left:calc(30%)}.navigation-bar-container ul.nav.side-nav-footer li.navigation-footer a .navigation-icon:hover,.navigation-bar-container ul.nav.side-nav-menu li.navigation-footer a .navigation-icon:hover{color:#fff}.navigation-bar-container ul.nav.side-nav-footer li>ul>li,.navigation-bar-container ul.nav.side-nav-menu li>ul>li{background-color:#323544}.navigation-bar-container ul.nav.si
de-nav-footer li>ul>li a,.navigation-bar-container ul.nav.side-nav-menu li>ul>li a{font-family:Roboto,sans-serif;font-weight:400;font-style:normal;line-height:1;font-size:14px;color:#999}.navigation-bar-container ul.nav.side-nav-footer li>ul>li a .submenu-icon,.navigation-bar-container ul.nav.side-nav-menu li>ul>li a .submenu-icon{line-height:14px;font-size:14px}.navigation-bar-container ul.nav.side-nav-footer li>a:hover,.navigation-bar-container ul.nav.side-nav-footer li>ul>li>a:hover,.navigation-bar-container ul.nav.side-nav-menu li>a:hover,.navigation-bar-container ul.nav.side-nav-menu li>ul>li>a:hover{background:#404351;cursor:pointer;color:#fff}.navigation-bar-container ul.nav.side-nav-footer li>a:hover .navigation-icon,.navigation-bar-container ul.nav.side-nav-footer li>a:hover .navigation-menu-item,.navigation-bar-container ul.nav.side-nav-footer li>a:hover .submenu-item,.navigation-bar-container ul.nav.side-nav-footer li>a:hover .toggle-icon,.navigation-bar-container ul.nav.
side-nav-footer li>ul>li>a:hover .navigation-icon,.navigation-bar-container ul.nav.side-nav-footer li>ul>li>a:hover .navigation-menu-item,.navigation-bar-container ul.nav.side-nav-footer li>ul>li>a:hover .submenu-item,.navigation-bar-container ul.nav.side-nav-footer li>ul>li>a:hover .toggle-icon,.navigation-bar-container ul.nav.side-nav-menu li>a:hover .navigation-icon,.navigation-bar-container ul.nav.side-nav-menu li>a:hover .navigation-menu-item,.navigation-bar-container ul.nav.side-nav-menu li>a:hover .submenu-item,.navigation-bar-container ul.nav.side-nav-menu li>a:hover .toggle-icon,.navigation-bar-container ul.nav.side-nav-menu li>ul>li>a:hover .navigation-icon,.navigation-bar-container ul.nav.side-nav-menu li>ul>li>a:hover .navigation-menu-item,.navigation-bar-container ul.nav.side-nav-menu li>ul>li>a:hover .submenu-item,.navigation-bar-container ul.nav.side-nav-menu li>ul>li>a:hover .toggle-icon{color:#fff}.navigation-bar-container ul.nav.side-nav-footer li.active.collapsed,
.navigation-bar-container ul.nav.side-nav-footer li.active:not(.has-sub-menu),.navigation-bar-container ul.nav.side-nav-menu li.active.collapsed,.navigation-bar-container ul.nav.side-nav-menu li.active:not(.has-sub-menu){background:#404351;cursor:pointer}.navigation-bar-container ul.nav.side-nav-footer .more-actions .dropdown-menu>li>a.disabled:hover,.navigation-bar-container ul.nav.side-nav-footer .more-actions .dropdown-menu>li>a:hover,.navigation-bar-container ul.nav.side-nav-menu .more-actions .dropdown-menu>li>a.disabled:hover,.navigation-bar-container ul.nav.side-nav-menu .more-actions .dropdown-menu>li>a:hover{background:#f5f5f5}.navigation-bar-container ul.nav.side-nav-footer li.active.collapsed>a,.navigation-bar-container ul.nav.side-nav-footer li.active:not(.has-sub-menu)>a,.navigation-bar-container ul.nav.side-nav-menu li.active.collapsed>a,.navigation-bar-container ul.nav.side-nav-menu li.active:not(.has-sub-menu)>a{color:#fff}.navigation-bar-container ul.nav.side-nav-fo
oter li.active.collapsed>a .navigation-icon,.navigation-bar-container ul.nav.side-nav-footer li.active.collapsed>a .navigation-menu-item,.navigation-bar-container ul.nav.side-nav-footer li.active.collapsed>a .submenu-item,.navigation-bar-container ul.nav.side-nav-footer li.active.collapsed>a .toggle-icon,.navigation-bar-container ul.nav.side-nav-footer li.active:not(.has-sub-menu)>a .navigation-icon,.navigation-bar-container ul.nav.side-nav-footer li.active:not(.has-sub-menu)>a .navigation-menu-item,.navigation-bar-container ul.nav.side-nav-footer li.active:not(.has-sub-menu)>a .submenu-item,.navigation-bar-container ul.nav.side-nav-footer li.active:not(.has-sub-menu)>a .toggle-icon,.navigation-bar-container ul.nav.side-nav-menu li.active.collapsed>a .navigation-icon,.navigation-bar-container ul.nav.side-nav-menu li.active.collapsed>a .navigation-menu-item,.navigation-bar-container ul.nav.side-nav-menu li.active.collapsed>a .submenu-item,.navigation-bar-container ul.nav.side-nav-men
u li.active.collapsed>a .toggle-icon,.navigation-bar-container ul.nav.side-nav-menu li.active:not(.has-sub-menu)>a .navigation-icon,.navigation-bar-container ul.nav.side-nav-menu li.active:not(.has-sub-menu)>a .navigation-menu-item,.navigation-bar-container ul.nav.side-nav-menu li.active:not(.has-sub-menu)>a .submenu-item,.navigation-bar-container ul.nav.side-nav-menu li.active:not(.has-sub-menu)>a .toggle-icon{color:#fff}.navigation-bar-container ul.nav.side-nav-footer li.active.collapsed>a:after,.navigation-bar-container ul.nav.side-nav-footer li.active:not(.has-sub-menu)>a:after,.navigation-bar-container ul.nav.side-nav-menu li.active.collapsed>a:after,.navigation-bar-container ul.nav.side-nav-menu li.active:not(.has-sub-menu)>a:after{left:0;top:50%;border:solid transparent;border-width:10px 7px;content:" ";height:0;width:0;position:absolute;pointer-events:none;border-color:transparent transparent transparent #3fae2a;margin-top:-12px}.navigation-bar-container ul.nav.side-nav-foot
er .more-actions,.navigation-bar-container ul.nav.side-nav-menu .more-actions{display:block;position:absolute;top:14px;right:33px;line-height:25px;width:20px;text-align:center;font-size:14px;cursor:pointer;vertical-align:middle;color:#fff}.navigation-bar-container.collapsed,.navigation-bar-container.collapsed ul.nav.side-nav-footer,.navigation-bar-container.collapsed ul.nav.side-nav-header,.navigation-bar-container.collapsed ul.nav.side-nav-menu{width:50px}.navigation-bar-container ul.nav.side-nav-footer .more-actions .dropdown-menu>li>a,.navigation-bar-container ul.nav.side-nav-footer .more-actions .dropdown-menu>li>a i,.navigation-bar-container ul.nav.side-nav-menu .more-actions .dropdown-menu>li>a,.navigation-bar-container ul.nav.side-nav-menu .more-actions .dropdown-menu>li>a i{color:#333}.navigation-bar-container ul.nav.side-nav-footer .more-actions .dropdown-menu>li>a.disabled,.navigation-bar-container ul.nav.side-nav-footer .more-actions .dropdown-menu>li>a.disabled i,.naviga
tion-bar-container ul.nav.side-nav-menu .more-actions .dropdown-menu>li>a.disabled,.navigation-bar-container ul.nav.side-nav-menu .more-actions .dropdown-menu>li>a.disabled i{color:#666}.navigation-bar-container ul.nav.side-nav-footer .menu-item-name,.navigation-bar-container ul.nav.side-nav-menu .menu-item-name{display:inline-block;vertical-align:bottom;max-width:100px;overflow:hidden;text-overflow:ellipsis;-o-text-overflow:ellipsis;-ms-text-overflow:ellipsis;white-space:nowrap}.navigation-bar-container.collapsed ul.nav.side-nav-footer .more-actions,.navigation-bar-container.collapsed ul.nav.side-nav-footer li a .navigation-menu-item,.navigation-bar-container.collapsed ul.nav.side-nav-footer li a .toggle-icon,.navigation-bar-container.collapsed ul.nav.side-nav-header li.navigation-header .dropdown-menu,.navigation-bar-container.collapsed ul.nav.side-nav-header li.navigation-header span.ambari-header,.navigation-bar-container.collapsed ul.nav.side-nav-header li.navigation-header spa
n.toggle-icon,.navigation-bar-container.collapsed ul.nav.side-nav-menu .more-actions,.navigation-bar-container.collapsed ul.nav.side-nav-menu li a .navigation-menu-item,.navigation-bar-container.collapsed ul.nav.side-nav-menu li a .toggle-icon{display:none}.navigation-bar-container .nav-pills>li.active>a,.navigation-bar-container .nav-pills>li.active>a:focus,.navigation-bar-container .nav-pills>li.active>a:hover,.navigation-bar-container .nav>li>a:focus,.navigation-bar-container .nav>li>a:hover{background-color:inherit}.navigation-bar-container.collapsed ul.nav.side-nav-header li.navigation-header{padding:15px 0 15px 15px}.navigation-bar-container.collapsed ul.nav.side-nav-footer li a,.navigation-bar-container.collapsed ul.nav.side-nav-menu li a{padding:15px 0 15px 15px;width:50px}.navigation-bar-container.collapsed ul.nav.side-nav-footer li a .navigation-icon,.navigation-bar-container.collapsed ul.nav.side-nav-menu li a .navigation-icon{font-size:19px}.navigation-bar-container.coll
apsed ul.nav.side-nav-footer li.navigation-footer a .navigation-icon,.navigation-bar-container.collapsed ul.nav.side-nav-menu li.navigation-footer a .navigation-icon{padding:0 5px;left:0}.navigation-bar-container.collapsed ul.nav.side-nav-footer li ul.sub-menu,.navigation-bar-container.collapsed ul.nav.side-nav-menu li ul.sub-menu{display:none;width:230px;position:absolute;z-index:100;top:0;left:50px}.navigation-bar-container.collapsed ul.nav.side-nav-footer li.submenu-li>a,.navigation-bar-container.collapsed ul.nav.side-nav-menu li.submenu-li>a{padding:10px 5px 10px 25px;width:230px}.navigation-bar-container.collapsed ul.nav.side-nav-footer li.active,.navigation-bar-container.collapsed ul.nav.side-nav-menu li.active{background:#404351;cursor:pointer}.navigation-bar-container.collapsed ul.nav.side-nav-footer li.active>a,.navigation-bar-container.collapsed ul.nav.side-nav-footer li.active>a .navigation-icon,.navigation-bar-container.collapsed ul.nav.side-nav-footer li.active>a .navig
ation-menu-item,.navigation-bar-container.collapsed ul.nav.side-nav-footer li.active>a .submenu-item,.navigation-bar-container.collapsed ul.nav.side-nav-footer li.active>a .toggle-icon,.navigation-bar-container.collapsed ul.nav.side-nav-menu li.active>a,.navigation-bar-container.collapsed ul.nav.side-nav-menu li.active>a .navigation-icon,.navigation-bar-container.collapsed ul.nav.side-nav-menu li.active>a .navigation-menu-item,.navigation-bar-container.collapsed ul.nav.side-nav-menu li.active>a .submenu-item,.navigation-bar-container.collapsed ul.nav.side-nav-menu li.active>a .toggle-icon{color:#fff}.navigation-bar-container.collapsed ul.nav.side-nav-footer li.active>a:after,.navigation-bar-container.collapsed ul.nav.side-nav-menu li.active>a:after{left:0;top:50%;border:solid transparent;border-width:12px 6px;content:" ";height:0;width:0;position:absolute;pointer-events:none;border-color:transparent transparent transparent #3fae2a;margin-top:-12px}.navigation-bar-fit-height{position
:fixed;top:0;bottom:0;left:0;z-index:2079}.navigation-bar-fit-height .side-nav-header{position:absolute;top:0}.navigation-bar-fit-height .side-nav-menu{position:absolute;top:55px;bottom:50px}.navigation-bar-fit-height .side-nav-footer{position:absolute;bottom:0}.navigation-bar-fit-height .more-actions .dropdown-menu{position:fixed;top:auto;left:auto}.navigation-bar-fit-height .navigation-bar-container{height:100%}.navigation-bar-fit-height .navigation-bar-container .side-nav-menu{overflow-y:auto}.notifications-group{position:relative;top:1px}#notifications-dropdown.dropdown-menu,.notifications-dropdown{min-width:400px;max-width:400px;min-height:150px;padding:0;z-index:1000;right:-50px;left:auto;top:260%;border:none;box-shadow:0 2px 10px 2px rgba(0,0,0,.29)}#notifications-dropdown.dropdown-menu .popup-arrow-up,.notifications-dropdown .popup-arrow-up{position:absolute;right:37px;top:-40px;width:40px;height:40px;overflow:hidden}#notifications-dropdown.dropdown-menu .popup-arrow-up:afte
r,.notifications-dropdown .popup-arrow-up:after{content:"";position:absolute;width:20px;height:20px;background:#fff;-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg);top:30px;left:10px;box-shadow:-1px -1px 10px -2px rgba(0,0,0,.5)}#notifications-dropdown.dropdown-menu .notifications-header,.notifications-dropdown .notifications-header{border-bottom:1px solid #eee;padding:15px 20px}#notifications-dropdown.dropdown-menu .notifications-header .notifications-title,.notifications-dropdown .notifications-header .notifications-title{font-family:Roboto,sans-serif;font-weight:400;font-style:normal;line-height:1;color:#333;font-size:16px}#notifications-dropdown.dropdown-menu .notifications-body,.notifications-dropdown .notifications-body{padding:0 15px;overflow:auto;max-height:500px}#notifications-dropdown.dropdown-menu .notifications-body .no-alert-text,.notifications-dropdown .notifications-body .no-alert-text{padding:15px 5px}#notifications-dropdown.dropdo
wn-menu .notifications-body .table-controls,.notifications-dropdown .notifications-body .table-controls{padding:10px 0;margin:0;border-bottom:1px solid #eee}#notifications-dropdown.dropdown-menu .notifications-body .table-controls .state-filter,.notifications-dropdown .notifications-body .table-controls .state-filter{padding:0;font-family:Roboto,sans-serif;font-weight:400;font-style:normal;line-height:1;font-size:12px;color:#666;position:relative}#notifications-dropdown.dropdown-menu .notifications-body .table-controls .state-filter .form-control.filter-select,.notifications-dropdown .notifications-body .table-controls .state-filter .form-control.filter-select{font-size:12px;color:#666;height:25px}#notifications-dropdown.dropdown-menu .notifications-body .table.alerts-table,.notifications-dropdown .notifications-body .table.alerts-table{margin-top:0}#notifications-dropdown.dropdown-menu .notifications-body .table.alerts-table tbody tr,.notifications-dropdown .notifications-body .tab
le.alerts-table tbody tr{cursor:pointer}#notifications-dropdown.dropdown-menu .notifications-body .table.alerts-table tbody tr.no-alert-tr:hover,.notifications-dropdown .notifications-body .table.alerts-table tbody tr.no-alert-tr:hover{cursor:default;border-color:transparent transparent #eee}#notifications-dropdown.dropdown-menu .notifications-body .table.alerts-table tbody tr.no-alert-tr:hover>td,.notifications-dropdown .notifications-body .table.alerts-table tbody tr.no-alert-tr:hover>td{border-color:transparent;background-color:#fff}#notifications-dropdown.dropdown-menu .notifications-body .table.alerts-table tbody td.status,.notifications-dropdown .notifications-body .table.alerts-table tbody td.status{width:9%;padding:15px 3px}#notifications-dropdown.dropdown-menu .notifications-body .table.alerts-table tbody td.status .alert-state-CRITICAL,.notifications-dropdown .notifications-body .table.alerts-table tbody td.status .alert-state-CRITICAL{color:#EF6162}#notifications-dropdown
.dropdown-menu .notifications-body .table.alerts-table tbody td.status .alert-state-WARNING,.notifications-dropdown .notifications-body .table.alerts-table tbody td.status .alert-state-WARNING{color:#E98A40}#notifications-dropdown.dropdown-menu .notifications-body .table.alerts-table tbody td.content,.notifications-dropdown .notifications-body .table.alerts-table tbody td.content{width:90%;padding:15px 3px 10px;font-family:Roboto,sans-serif;font-weight:400;font-style:normal;color:#333;line-height:1.3}#notifications-dropdown.dropdown-menu .notifications-body .table.alerts-table tbody td.content .name,.notifications-dropdown .notifications-body .table.alerts-table tbody td.content .name{font-weight:700;font-size:14px;color:#333;margin-bottom:5px}#notifications-dropdown.dropdown-menu .notifications-body .table.alerts-table tbody td.content .description,.notifications-dropdown .notifications-body .table.alerts-table tbody td.content .description{font-size:12px;color:#666;margin-bottom:4
px;display:block;display:-webkit-box;-webkit-line-clamp:3;max-height:47px;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;overflow-wrap:break-word;word-wrap:break-word;-ms-word-break:break-all;word-break:break-all;word-break:break-word;-ms-hyphens:auto;-moz-hyphens:auto;-webkit-hyphens:auto;hyphens:auto}#notifications-dropdown.dropdown-menu .notifications-body .table.alerts-table tbody td.content .timestamp,.notifications-dropdown .notifications-body .table.alerts-table tbody td.content .timestamp{text-align:right;font-size:11px;color:#999}#notifications-dropdown.dropdown-menu .notifications-footer,.notifications-dropdown .notifications-footer{border-top:1px solid #eee;padding:15px}.modal-backdrop{background-color:grey}.modal .modal-content{border-radius:2px}.modal .modal-content .modal-body,.modal .modal-content .modal-footer,.modal .modal-content .modal-header{padding-left:20px;padding-right:20px}.modal .modal-content .modal-header{border-bottom:none;padding-top
:20px;color:#666;font-size:20px}.modal .modal-content .modal-header h4{margin:0;color:inherit;font-size:inherit}.modal .modal-content .modal-body{color:#666;font-size:12px}.modal .modal-content .modal-footer{border-top:none;padding-bottom:20px}.modal .modal-content .modal-footer .btn~.btn{margin-left:10px}.accordion .panel-group,.wizard .wizard-body .wizard-content .accordion .panel-group{margin-bottom:0}.accordion .panel-group .panel,.wizard .wizard-body .wizard-content .accordion .panel-group .panel{border-radius:0;border:none;margin-top:0;padding:0 10px}.accordion .panel-group .panel .panel-heading,.wizard .wizard-body .wizard-content .accordion .panel-group .panel .panel-heading{height:50px;padding:15px 10px;border:1px solid;border-color:#ddd transparent;border-top:none;background:#fff}.accordion .panel-group .panel .panel-heading .panel-title,.wizard .wizard-body .wizard-content .accordion .panel-group .panel .panel-heading .panel-title{font-family:Roboto,sans-serif;font-weight
:400;font-style:normal;line-height:1;color:#333}.accordion .panel-group .panel .panel-heading .panel-title>a,.wizard .wizard-body .wizard-content .accordion .panel-group .panel .panel-heading .panel-title>a{font-size:18px;color:#333}.accordion .panel-group .panel .panel-heading .panel-title>i,.wizard .wizard-body .wizard-content .accordion .panel-group .panel .panel-heading .panel-title>i{font-size:20px;color:#1491c1}.accordion .panel-group .panel .panel-heading:hover,.wizard .wizard-body .wizard-content .accordion .panel-group .panel .panel-heading:hover{background:#f3faff;cursor:pointer}.accordion .panel-group .panel .panel-body,.wizard .wizard-body .wizard-content .accordion .panel-group .panel .panel-body{padding:15px 10px 20px 20px}.h1,.h2,.h3,.h4,.h5,.h6,h1,h2,h3,h4,h5,h6{font-family:Roboto,sans-serif}.h1,h1{font-size:24px}.h2,h2{font-size:18px}.body,body{font-family:Roboto,sans-serif;font-weight:400;font-style:normal;line-height:1;color:#333;font-size:14px}.description{font-f
amily:Roboto,sans-serif;font-size:12px;color:#000}a,a:focus,a:visited{color:#1491C1}a:focus:hover,a:hover,a:visited:hover{text-decoration:underline}a.disabled:hover,a:active,a:focus.disabled:hover,a:focus:active,a:focus[disabled]:hover,a:visited.disabled:hover,a:visited:active,a:visited[disabled]:hover,a[disabled]:hover{text-decoration:none}a.disabled,a:focus.disabled,a:focus[disabled],a:visited.disabled,a:visited[disabled],a[disabled]{cursor:not-allowed;color:#666;text-decoration:none}
\ No newline at end of file
[06/50] [abbrv] ambari git commit: AMBARI-22714 Log Search UI:
implement Summary tab for Access Logs page. (ababiichuk)
Posted by rl...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/vendor/js/bootstrap-logsearch.min.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/vendor/js/bootstrap-logsearch.min.js b/ambari-logsearch/ambari-logsearch-web/src/vendor/js/bootstrap-logsearch.min.js
index a1b68d2..333e65d 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/vendor/js/bootstrap-logsearch.min.js
+++ b/ambari-logsearch/ambari-logsearch-web/src/vendor/js/bootstrap-logsearch.min.js
@@ -16,4 +16,4 @@
* limitations under the License.
*/
"use strict";$(document).ready(function(){var n=$(this).find('[data-toggle="collapseAccordion"]');n.off("click").on("click",function(n){var l=$(this);return l.siblings(".panel-body").slideToggle(500),l.children().children(".panel-toggle").toggleClass("fa-angle-down fa-angle-up"),n.stopPropagation(),!1})});
-"use strict";!function(e){e.fn.navigationBar=function(n){var t=e.extend({},e.fn.navigationBar.defaults,n);return this.each(function(){function n(){var n=window.location.pathname+window.location.hash;o.find("li a").each(function(t,a){var i=e(a),s=i.attr("data-href")||i.attr("href");n.indexOf(s)!==-1&&["","#"].indexOf(s)===-1?i.parent().addClass("active"):i.parent().removeClass("active")})}function a(n){var a=e(n).parent(),i=t.activeClass,s=f+"."+i,l=c+"."+i;o.find(s).removeClass(i),o.find(l).removeClass(i),a.addClass(i)}var i=this,s=".navigation-bar-container",o=e(this).find(s),l=e(this).find("[data-toggle="+t.navBarToggleDataAttr+"]"),r=e(this).find("[data-toggle="+t.subMenuNavToggleDataAttr+"]"),f=".side-nav-menu>li",c=".side-nav-menu>li>ul>li",d=e(this).find(".more-actions"),u=d.children(".dropdown-menu");r.each(function(n,t){return e(t).parent().addClass("has-sub-menu")}),t.fitHeight&&(e(this).addClass("navigation-bar-fit-height"),e(this).find(".side-nav-menu").on("DOMMouseScroll
mousewheel",function(n){var t=e(this),a=this.scrollTop,i=this.scrollHeight,s=t.innerHeight(),o=n.originalEvent.wheelDelta,l=o>0,r=function(){return n.stopPropagation(),n.preventDefault(),n.returnValue=!1,!1};return!l&&-o>i-s-a?(t.scrollTop(i),r()):l&&o>a?(t.scrollTop(0),r()):void 0}));var h=o.width();t.moveLeftContent&&e(t.content).css("margin-left",h),t.moveLeftFooter&&e(t.footer).css("margin-left",h),t.handlePopState&&(n(),e(window).bind("popstate",n)),e(f+">a").on("click",function(){a(this)}),e(c+">a").on("click",function(){a(this),e(this).parent().parent().parent().addClass(t.activeClass)}),r.off("click").on("click",function(n){if(o.hasClass("collapsed"))return!1;var a=e(this);return a.siblings(".sub-menu").slideToggle(600,function(){var e=a.parent(),n=e.find("ul");return n.is(":visible")?e.removeClass("collapsed"):e.addClass("collapsed")}),a.children(".toggle-icon").toggleClass(t.menuLeftClass+" "+t.menuDownClass),n.stopPropagation(),!1}),e(this).find(".mainmenu-li>a").hover(f
unction(){var n=e(this).siblings(".more-actions");n.length&&!o.hasClass("collapsed")&&n.css("display","inline-block")},function(){var n=e(this).siblings(".more-actions");n.length&&!o.hasClass("collapsed")&&n.hide()}),d.hover(function(){e(this).css("display","inline-block")}),t.fitHeight&&d.on("click",function(){var n=e(this),t=e(".side-nav-header");u.css({top:n.offset().top-t.offset().top+20+"px",left:n.offset().left+"px"})}),u.on("click",function(){var n=e(this).parent();setTimeout(function(){n.hide()},1e3)}),o.children(".side-nav-menu").scroll(function(){d.removeClass("open")}),l.click(function(){return o.toggleClass("collapsed").promise().done(function(){var n="ul.sub-menu",a=o.find(n),s=o.find(".side-nav-menu>li");o.hasClass("collapsed")?(a.hide(),d.hide(),s.hover(function(){e(this).find(n).show();var a=e(this),i=e(".side-nav-header");t.fitHeight&&e(this).find(n).css({position:"fixed",top:a.offset().top-i.offset().top+"px",left:"50px"})},function(){e(this).find(n).hide()})):(a.s
how().each(function(n,t){return e(t).parent().removeClass("collapsed")}),s.unbind("mouseenter mouseleave"),o.find(".toggle-icon").removeClass(t.menuLeftClass).addClass(t.menuDownClass),t.fitHeight&&e(i).find(n).css({position:"relative",top:0,left:0})),o.on("transitionend",function(){var n=o.width();t.moveLeftContent&&e(t.content).css("margin-left",n),t.moveLeftFooter&&e(t.footer).css("margin-left",n)}),l.find("span").toggleClass(t.collapseNavBarClass+" "+t.expandNavBarClass)}),!1})})},e.fn.navigationBar.defaults={handlePopState:!0,fitHeight:!1,content:"#main",footer:"footer",moveLeftContent:!0,moveLeftFooter:!0,menuLeftClass:"glyphicon-menu-right",menuDownClass:"glyphicon-menu-down",collapseNavBarClass:"fa-angle-double-left",expandNavBarClass:"fa-angle-double-right",activeClass:"active",navBarToggleDataAttr:"collapse-side-nav",subMenuNavToggleDataAttr:"collapse-sub-menu"}}(jQuery);
\ No newline at end of file
+"use strict";!function(e){e.fn.navigationBar=function(n){var t=e.extend({},e.fn.navigationBar.defaults,n);return this.each(function(){function n(){var n=window.location.pathname+window.location.hash;o.find("li a").each(function(t,a){var s=e(a),i=s.attr("data-href")||s.attr("href");n.indexOf(i)!==-1&&["","#"].indexOf(i)===-1?s.parent().addClass("active"):s.parent().removeClass("active")})}function a(n){var a=e(n).parent(),s=t.activeClass,i=f+"."+s,l=d+"."+s;o.find(i).removeClass(s),o.find(l).removeClass(s),a.addClass(s)}var s=this,i=".navigation-bar-container",o=e(this).find(i),l=e(this).find("[data-toggle="+t.navBarToggleDataAttr+"]"),r=e(this).find("[data-toggle="+t.subMenuNavToggleDataAttr+"]"),f=".side-nav-menu>li",d=".side-nav-menu>li>ul>li",c=e(this).find(".more-actions"),u=c.children(".dropdown-menu");r.each(function(n,t){return e(t).parent().addClass("has-sub-menu")}),t.fitHeight&&(e(this).addClass("navigation-bar-fit-height"),e(this).find(".side-nav-menu").on("DOMMouseScroll
mousewheel",function(n){var t=e(this),a=this.scrollTop,s=this.scrollHeight,i=t.innerHeight(),o=n.originalEvent.wheelDelta,l=o>0,r=function(){return n.stopPropagation(),n.preventDefault(),n.returnValue=!1,!1};return!l&&-o>s-i-a?(t.scrollTop(s),r()):l&&o>a?(t.scrollTop(0),r()):void 0}));var h=o.width();t.moveLeftContent&&e(t.content).css("margin-left",h),t.moveLeftFooter&&e(t.footer).css("margin-left",h),t.handlePopState&&(n(),e(window).bind("popstate",n)),e(f+">a").on("click",function(){a(this)}),e(d+">a").on("click",function(){a(this),e(this).parent().parent().parent().addClass(t.activeClass)}),r.off("click").on("click",function(n){if(o.hasClass("collapsed"))return!1;var a=e(this);return a.siblings(".sub-menu").slideToggle(600,function(){var e=a.parent(),n=e.find("ul");return n.is(":visible")?e.removeClass("collapsed"):e.addClass("collapsed")}),a.children(".toggle-icon").toggleClass(t.menuLeftClass+" "+t.menuDownClass),n.stopPropagation(),!1}),t.fitHeight&&c.on("click",function(){v
ar n=e(this),t=e(".side-nav-header");u.css({top:n.offset().top-t.offset().top+20+"px",left:n.offset().left+"px"})}),o.children(".side-nav-menu").scroll(function(){c.removeClass("open")}),l.click(function(){return o.toggleClass("collapsed").promise().done(function(){var n="ul.sub-menu",a=o.find(n),i=o.find(".side-nav-menu>li");o.hasClass("collapsed")?(a.hide(),c.hide(),i.hover(function(){e(this).find(n).show();var a=e(this),s=e(".side-nav-header");t.fitHeight&&e(this).find(n).css({position:"fixed",top:a.offset().top-s.offset().top+"px",left:"50px"})},function(){e(this).find(n).hide()})):(a.show().each(function(n,t){return e(t).parent().removeClass("collapsed")}),i.unbind("mouseenter mouseleave"),o.find(".toggle-icon").removeClass(t.menuLeftClass).addClass(t.menuDownClass),c.show(),t.fitHeight&&e(s).find(n).css({position:"relative",top:0,left:0})),o.on("transitionend",function(){var n=o.width();t.moveLeftContent&&e(t.content).css("margin-left",n),t.moveLeftFooter&&e(t.footer).css("mar
gin-left",n)}),l.find("span").toggleClass(t.collapseNavBarClass+" "+t.expandNavBarClass)}),!1})})},e.fn.navigationBar.defaults={handlePopState:!0,fitHeight:!1,content:"#main",footer:"footer",moveLeftContent:!0,moveLeftFooter:!0,menuLeftClass:"glyphicon-menu-right",menuDownClass:"glyphicon-menu-down",collapseNavBarClass:"fa-angle-double-left",expandNavBarClass:"fa-angle-double-right",activeClass:"active",navBarToggleDataAttr:"collapse-side-nav",subMenuNavToggleDataAttr:"collapse-sub-menu"}}(jQuery);
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/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 8eb2bbd..aed2c50 100644
--- a/ambari-logsearch/ambari-logsearch-web/yarn.lock
+++ b/ambari-logsearch/ambari-logsearch-web/yarn.lock
@@ -277,6 +277,10 @@
dependencies:
"@types/d3-dsv" "*"
+"@types/d3-scale-chromatic@^1.1.0":
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/@types/d3-scale-chromatic/-/d3-scale-chromatic-1.1.0.tgz#6a5033ed1b89b7bad38f5f085a4f16695f07fdf0"
+
"@types/d3-scale@*":
version "1.0.10"
resolved "https://registry.yarnpkg.com/@types/d3-scale/-/d3-scale-1.0.10.tgz#8c5c1dca54a159eed042b46719dbb3bdb7e8c842"
@@ -1769,6 +1773,12 @@ d3-request@1.0.6:
d3-dsv "1"
xmlhttprequest "1"
+d3-scale-chromatic@^1.1.1:
+ version "1.1.1"
+ resolved "https://registry.yarnpkg.com/d3-scale-chromatic/-/d3-scale-chromatic-1.1.1.tgz#811406e8e09dab78a49dac4a32047d5d3edd0c44"
+ dependencies:
+ d3-interpolate "1"
+
d3-scale@1.0.6:
version "1.0.6"
resolved "https://registry.yarnpkg.com/d3-scale/-/d3-scale-1.0.6.tgz#bce19da80d3a0cf422c9543ae3322086220b34ed"
[48/50] [abbrv] ambari git commit: AMBARI-22571. Handle
passwords/sensitive data in Ambari configuration properties (Sandor Molnar
via rlevas)
Posted by rl...@apache.org.
AMBARI-22571. Handle passwords/sensitive data in Ambari configuration properties (Sandor Molnar via rlevas)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/297e5b9f
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/297e5b9f
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/297e5b9f
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 297e5b9f81e64dcd46f736f3f10609ecbc1cd7d6
Parents: 85ef611
Author: Sandor Molnar <sm...@hortonworks.com>
Authored: Mon Dec 18 23:38:29 2017 -0500
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Fri Jan 5 17:54:17 2018 -0500
----------------------------------------------------------------------
ambari-server/pom.xml | 2 +-
.../RootServiceComponentConfiguration.java | 73 +++++++
.../server/configuration/Configuration.java | 11 +-
.../ConfigurationPropertyType.java | 22 +++
.../AmbariServerConfigurationHandler.java | 102 ++++++++--
.../AmbariServerConfigurationUtils.java | 78 ++++++++
.../AmbariServerLDAPConfigurationHandler.java | 9 +-
...ootServiceComponentConfigurationHandler.java | 7 +-
...eComponentConfigurationResourceProvider.java | 18 +-
.../domain/AmbariLdapConfigurationKeys.java | 77 ++++----
...ponentConfigurationResourceProviderTest.java | 192 +++++++++++++------
11 files changed, 473 insertions(+), 118 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/297e5b9f/ambari-server/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-server/pom.xml b/ambari-server/pom.xml
index 2ecf435..5a0afb7 100644
--- a/ambari-server/pom.xml
+++ b/ambari-server/pom.xml
@@ -1169,7 +1169,7 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>2.4</version>
+ <version>2.5</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
http://git-wip-us.apache.org/repos/asf/ambari/blob/297e5b9f/ambari-server/src/main/java/org/apache/ambari/server/api/services/RootServiceComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/RootServiceComponentConfiguration.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/RootServiceComponentConfiguration.java
new file mode 100644
index 0000000..cd31c75
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/RootServiceComponentConfiguration.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.server.api.services;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+public class RootServiceComponentConfiguration {
+
+ private final Map<String, String> properties;
+ private final Map<String, String> propertyTypes;
+
+ public RootServiceComponentConfiguration() {
+ this(new TreeMap<>(), new TreeMap<>());
+ }
+
+ public RootServiceComponentConfiguration(Map<String, String> properties, Map<String, String> propertyTypes) {
+ this.properties = properties == null ? new TreeMap<>() : properties;
+ this.propertyTypes = propertyTypes == null ? new TreeMap<>() : propertyTypes;
+ }
+
+ public void addProperty(String propertyName, String propertyValue) {
+ properties.put(propertyName, propertyValue);
+ }
+
+ public void addPropertyType(String propertyName, String propertyType) {
+ propertyTypes.put(propertyName, propertyType);
+ }
+
+ public Map<String, String> getProperties() {
+ return properties;
+ }
+
+ public Map<String, String> getPropertyTypes() {
+ return propertyTypes;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return EqualsBuilder.reflectionEquals(this, obj);
+ }
+
+ @Override
+ public int hashCode() {
+ return HashCodeBuilder.reflectionHashCode(3, 19, this);
+ }
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/297e5b9f/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
index 2c203c9..9cc7ad0 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
@@ -2774,6 +2774,9 @@ public class Configuration {
public static final ConfigurationProperty<String> DISPATCH_PROPERTY_SCRIPT_DIRECTORY = new ConfigurationProperty<>(
"notification.dispatch.alert.script.directory",AmbariPath.getPath("/var/lib/ambari-server/resources/scripts"));
+ @Markdown(description = "Whether security password encryption is enabled or not. In case it is we store passwords in their own file(s); otherwise we store passwords in the Ambari credential store.")
+ public static final ConfigurationProperty<Boolean> SECURITY_PASSWORD_ENCRYPTON_ENABLED = new ConfigurationProperty<Boolean>("security.passwords.encryption.enabled", false);
+
/**
* The maximum number of authentication attempts permitted to a local user. Once the number of failures reaches this limit the user will be locked out. 0 indicates unlimited failures
@@ -5723,6 +5726,13 @@ public class Configuration {
}
/**
+ * @return whether security password encryption is enabled or not (defaults to {@code false})
+ */
+ public boolean isSecurityPasswordEncryptionEnabled() {
+ return Boolean.parseBoolean(getProperty(SECURITY_PASSWORD_ENCRYPTON_ENABLED));
+ }
+
+ /**
* Generates a markdown table which includes:
* <ul>
* <li>Property key name</li>
@@ -5899,7 +5909,6 @@ public class Configuration {
private ConfigurationProperty(String key, T defaultValue) {
m_key = key;
m_defaultValue = defaultValue;
-
}
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/297e5b9f/ambari-server/src/main/java/org/apache/ambari/server/configuration/ConfigurationPropertyType.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/configuration/ConfigurationPropertyType.java b/ambari-server/src/main/java/org/apache/ambari/server/configuration/ConfigurationPropertyType.java
new file mode 100644
index 0000000..2e61c19
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/configuration/ConfigurationPropertyType.java
@@ -0,0 +1,22 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.server.configuration;
+
+/**
+ * Constants representing types for AMBARI-level properties that are being stored in the DB
+ */
+public enum ConfigurationPropertyType {
+ PLAINTEXT, PASSWORD;
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/297e5b9f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariServerConfigurationHandler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariServerConfigurationHandler.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariServerConfigurationHandler.java
index 34285d6..f3ff2dd 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariServerConfigurationHandler.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariServerConfigurationHandler.java
@@ -18,23 +18,33 @@
package org.apache.ambari.server.controller.internal;
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.Charset;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.TreeMap;
+import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.StaticallyInject;
+import org.apache.ambari.server.api.services.RootServiceComponentConfiguration;
+import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.spi.NoSuchResourceException;
import org.apache.ambari.server.controller.spi.SystemException;
import org.apache.ambari.server.events.AmbariConfigurationChangedEvent;
import org.apache.ambari.server.events.publishers.AmbariEventPublisher;
import org.apache.ambari.server.orm.dao.AmbariConfigurationDAO;
import org.apache.ambari.server.orm.entities.AmbariConfigurationEntity;
+import org.apache.ambari.server.security.encryption.CredentialProvider;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.inject.Inject;
+
/**
* AmbariServerConfigurationHandler handles Ambari server specific configuration properties.
*/
@@ -48,11 +58,15 @@ class AmbariServerConfigurationHandler extends RootServiceComponentConfiguration
@Inject
private static AmbariEventPublisher publisher;
+ @Inject
+ private static Configuration ambariConfiguration;
+
+ private CredentialProvider credentialProvider;
@Override
- public Map<String, Map<String, String>> getConfigurations(String categoryName)
+ public Map<String, RootServiceComponentConfiguration> getConfigurations(String categoryName)
throws NoSuchResourceException {
- Map<String, Map<String, String>> configurations = null;
+ Map<String, RootServiceComponentConfiguration> configurations = null;
List<AmbariConfigurationEntity> entities = (categoryName == null)
? ambariConfigurationDAO.findAll()
@@ -60,17 +74,18 @@ class AmbariServerConfigurationHandler extends RootServiceComponentConfiguration
if (entities != null) {
configurations = new HashMap<>();
-
for (AmbariConfigurationEntity entity : entities) {
String category = entity.getCategoryName();
- Map<String, String> properties = configurations.get(category);
-
- if (properties == null) {
- properties = new TreeMap<>();
- configurations.put(category, properties);
+ RootServiceComponentConfiguration configuration = configurations.get(category);
+ if (configuration == null) {
+ configuration = new RootServiceComponentConfiguration();
+ configurations.put(category, configuration);
}
- properties.put(entity.getPropertyName(), entity.getPropertyValue());
+ configuration.addProperty(entity.getPropertyName(), entity.getPropertyValue());
+ if (categoryName != null) {
+ configuration.addPropertyType(entity.getPropertyName(), AmbariServerConfigurationUtils.getConfigurationPropertyTypeName(categoryName, entity.getPropertyName()));
+ }
}
}
@@ -94,13 +109,76 @@ class AmbariServerConfigurationHandler extends RootServiceComponentConfiguration
}
@Override
- public void updateCategory(String categoryName, Map<String, String> properties, boolean removePropertiesIfNotSpecified) {
- if (ambariConfigurationDAO.reconcileCategory(categoryName, properties, removePropertiesIfNotSpecified)) {
+ public void updateCategory(String categoryName, Map<String, String> properties, boolean removePropertiesIfNotSpecified) throws AmbariException {
+ boolean toBePublished = false;
+ final Iterator<Map.Entry<String, String>> propertiesIterator = properties.entrySet().iterator();
+ while (propertiesIterator.hasNext()) {
+ Map.Entry<String, String> property = propertiesIterator.next();
+ if (AmbariServerConfigurationUtils.isPassword(categoryName, property.getKey())) {
+ if (updatePasswordIfNeeded(categoryName, property.getKey(), property.getValue())) {
+ toBePublished = true;
+ }
+ propertiesIterator.remove(); //we do not need to change the any PASSWORD type configuration going forward
+ }
+ }
+
+ if (!properties.isEmpty()) {
+ toBePublished = ambariConfigurationDAO.reconcileCategory(categoryName, properties, removePropertiesIfNotSpecified) || toBePublished;
+ }
+
+ if (toBePublished) {
// notify subscribers about the configuration changes
publisher.publish(new AmbariConfigurationChangedEvent(categoryName));
}
}
+ private boolean updatePasswordIfNeeded(String categoryName, String propertyName, String newPassword) throws AmbariException {
+ if (newPassword != null) {
+ final String passwordFileOrCredentailStoreAlias = fetchPasswordFileNameOrCredentialStoreAlias(categoryName, propertyName);
+ if (!newPassword.equals(passwordFileOrCredentailStoreAlias)) { //we only need to do anything if the user-supplied password is a 'real' password
+ if (ambariConfiguration.isSecurityPasswordEncryptionEnabled()) {
+ getCredentialProvider().addAliasToCredentialStore(passwordFileOrCredentailStoreAlias, newPassword);
+ } else {
+ savePasswordInFile(passwordFileOrCredentailStoreAlias, newPassword);
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /*
+ * If the configuration element is actually a PASSWORD type element then we either have a password file name stored in the DB
+ * or - in case security password encryption is enabled - a Credential Store alias.
+ */
+ private String fetchPasswordFileNameOrCredentialStoreAlias(String categoryName, String propertyName) {
+ for (AmbariConfigurationEntity entity : ambariConfigurationDAO.findByCategory(categoryName)) {
+ if (entity.getPropertyName().equals(propertyName)) {
+ return entity.getPropertyValue();
+ }
+ }
+
+ return null;
+ }
+
+ private CredentialProvider getCredentialProvider() throws AmbariException {
+ if (credentialProvider == null) {
+ credentialProvider = new CredentialProvider(null, ambariConfiguration.getMasterKeyLocation(),
+ ambariConfiguration.isMasterKeyPersisted(), ambariConfiguration.getMasterKeyStoreLocation());
+ }
+ return credentialProvider;
+ }
+
+ private void savePasswordInFile(String passwordFileName, String newPassword) throws AmbariException {
+ try {
+ if (StringUtils.isNotBlank(passwordFileName)) {
+ FileUtils.writeStringToFile(new File(passwordFileName), newPassword, Charset.defaultCharset());
+ }
+ } catch (IOException e) {
+ throw new AmbariException("Error while updating password file [" + passwordFileName + "]", e);
+ }
+ }
+
@Override
public OperationResult performOperation(String categoryName, Map<String, String> properties,
boolean mergeExistingProperties, String operation,
http://git-wip-us.apache.org/repos/asf/ambari/blob/297e5b9f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariServerConfigurationUtils.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariServerConfigurationUtils.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariServerConfigurationUtils.java
new file mode 100644
index 0000000..ac05f93
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariServerConfigurationUtils.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.server.controller.internal;
+
+import org.apache.ambari.server.configuration.ConfigurationPropertyType;
+import org.apache.ambari.server.ldap.domain.AmbariLdapConfigurationKeys;
+
+/**
+ * Provides useful utility methods for AMBARI-level configuration related tasks.
+ */
+public class AmbariServerConfigurationUtils {
+
+ /**
+ * @param category
+ * the name of the category
+ * @param propertyName
+ * the name of the property
+ * @return the type of the given category/property if such category/property
+ * exists; {@code null} otherwise
+ * @throws IllegalStateException
+ * if there is no property found with the given name
+ */
+ public static ConfigurationPropertyType getConfigurationPropertyType(String category, String propertyName) {
+ if (AmbariServerConfigurationCategory.LDAP_CONFIGURATION.getCategoryName().equals(category)) {
+ return AmbariLdapConfigurationKeys.fromKeyStr(propertyName).getConfigurationPropertyType();
+ }
+ return null;
+ }
+
+ /**
+ * @param category
+ * the name of the category
+ * @param propertyName
+ * the name of the property
+ * @return the String representation of the type if such category/property
+ * exists; {@code null} otherwise * @throws IllegalStateException if
+ * there is no property found with the given name
+ */
+ public static String getConfigurationPropertyTypeName(String category, String propertyName) {
+ final ConfigurationPropertyType configurationPropertyType = getConfigurationPropertyType(category, propertyName);
+ return configurationPropertyType == null ? null : configurationPropertyType.name();
+ }
+
+ /**
+ * Indicates whether the given property's type is
+ *
+ * {@link ConfigurationPropertyType.PASSWORD}
+ *
+ * @param category
+ * the name of the category
+ * @param propertyName
+ * the name of the property
+ * @return {@code true} in case the given property's type is
+ * {@link ConfigurationPropertyType.PASSWORD}; {@code false} otherwise
+ * @throws IllegalStateException
+ * if there is no property found with the given name
+ */
+ public static boolean isPassword(String category, String propertyName) {
+ return ConfigurationPropertyType.PASSWORD.equals(getConfigurationPropertyType(category, propertyName));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/297e5b9f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariServerLDAPConfigurationHandler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariServerLDAPConfigurationHandler.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariServerLDAPConfigurationHandler.java
index 6f16c49..c4dca80 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariServerLDAPConfigurationHandler.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariServerLDAPConfigurationHandler.java
@@ -24,6 +24,7 @@ import java.util.Map;
import java.util.Set;
import org.apache.ambari.server.StaticallyInject;
+import org.apache.ambari.server.api.services.RootServiceComponentConfiguration;
import org.apache.ambari.server.controller.spi.NoSuchResourceException;
import org.apache.ambari.server.controller.spi.SystemException;
import org.apache.ambari.server.ldap.domain.AmbariLdapConfiguration;
@@ -44,7 +45,7 @@ class AmbariServerLDAPConfigurationHandler extends AmbariServerConfigurationHand
@Inject
private static LdapFacade ldapFacade;
-
+
@Override
public OperationResult performOperation(String categoryName, Map<String, String> properties,
boolean mergeExistingProperties, String operation, Map<String, Object> operationParameters) throws SystemException {
@@ -64,12 +65,12 @@ class AmbariServerLDAPConfigurationHandler extends AmbariServerConfigurationHand
// to retrieve if. If one does not exist, that is ok.
if (mergeExistingProperties) {
try {
- Map<String, Map<String, String>> _configurations = getConfigurations(categoryName);
+ Map<String, RootServiceComponentConfiguration> _configurations = getConfigurations(categoryName);
if (_configurations != null) {
- Map<String, String> _ldapProperties = _configurations.get(categoryName);
+ RootServiceComponentConfiguration _ldapProperties = _configurations.get(categoryName);
if (_ldapProperties != null) {
- ldapConfigurationProperties.putAll(_ldapProperties);
+ ldapConfigurationProperties.putAll(_ldapProperties.getProperties());
}
}
} catch (NoSuchResourceException e) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/297e5b9f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceComponentConfigurationHandler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceComponentConfigurationHandler.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceComponentConfigurationHandler.java
index 3b58ce1..e9e4c9e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceComponentConfigurationHandler.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceComponentConfigurationHandler.java
@@ -20,6 +20,8 @@ package org.apache.ambari.server.controller.internal;
import java.util.Map;
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.api.services.RootServiceComponentConfiguration;
import org.apache.ambari.server.controller.spi.NoSuchResourceException;
import org.apache.ambari.server.controller.spi.SystemException;
@@ -35,7 +37,7 @@ abstract class RootServiceComponentConfigurationHandler {
* @return a map of category names to properties (name/value pairs).
* @throws NoSuchResourceException if the requested data is not found
*/
- public abstract Map<String, Map<String, String>> getConfigurations(String categoryName) throws NoSuchResourceException;
+ public abstract Map<String, RootServiceComponentConfiguration> getConfigurations(String categoryName) throws NoSuchResourceException;
/**
* Delete the requested configuration.
@@ -58,8 +60,9 @@ abstract class RootServiceComponentConfigurationHandler {
* @param properties a map of properties to set
* @param removePropertiesIfNotSpecified <code>true</code> to ensure the set of properties are only those that have be explicitly specified;
* <code>false</code> to update the set of existing properties with the specified set of properties, adding missing properties but not removing any properties
+ * @throws AmbariException in case an error occurred while updating category's properties
*/
- public abstract void updateCategory(String categoryName, Map<String, String> properties, boolean removePropertiesIfNotSpecified);
+ public abstract void updateCategory(String categoryName, Map<String, String> properties, boolean removePropertiesIfNotSpecified) throws AmbariException;
/**
* Preform some operation on the set of data for a category.
http://git-wip-us.apache.org/repos/asf/ambari/blob/297e5b9f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceComponentConfigurationResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceComponentConfigurationResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceComponentConfigurationResourceProvider.java
index 74f8a4d..543cf94 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceComponentConfigurationResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RootServiceComponentConfigurationResourceProvider.java
@@ -26,6 +26,7 @@ import java.util.Map;
import java.util.Set;
import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.api.services.RootServiceComponentConfiguration;
import org.apache.ambari.server.api.services.RootServiceComponentConfigurationService;
import org.apache.ambari.server.controller.spi.NoSuchParentResourceException;
import org.apache.ambari.server.controller.spi.NoSuchResourceException;
@@ -50,6 +51,7 @@ public class RootServiceComponentConfigurationResourceProvider extends AbstractA
public static final String CONFIGURATION_CATEGORY_PROPERTY_ID = PropertyHelper.getPropertyId(RESOURCE_KEY, "category");
public static final String CONFIGURATION_PROPERTIES_PROPERTY_ID = PropertyHelper.getPropertyId(RESOURCE_KEY, "properties");
+ public static final String CONFIGURATION_PROPERTY_TYPES_PROPERTY_ID = PropertyHelper.getPropertyId(RESOURCE_KEY, "property_types");
public static final String CONFIGURATION_COMPONENT_NAME_PROPERTY_ID = PropertyHelper.getPropertyId(RESOURCE_KEY, "component_name");
public static final String CONFIGURATION_SERVICE_NAME_PROPERTY_ID = PropertyHelper.getPropertyId(RESOURCE_KEY, "service_name");
@@ -65,6 +67,7 @@ public class RootServiceComponentConfigurationResourceProvider extends AbstractA
set.add(CONFIGURATION_COMPONENT_NAME_PROPERTY_ID);
set.add(CONFIGURATION_CATEGORY_PROPERTY_ID);
set.add(CONFIGURATION_PROPERTIES_PROPERTY_ID);
+ set.add(CONFIGURATION_PROPERTY_TYPES_PROPERTY_ID);
PROPERTIES = Collections.unmodifiableSet(set);
@@ -202,12 +205,13 @@ public class RootServiceComponentConfigurationResourceProvider extends AbstractA
return getRequestStatus(null, null, operationStatusMetadata);
}
- private Resource toResource(String serviceName, String componentName, String categoryName, Map<String, String> properties, Set<String> requestedIds) {
+ private Resource toResource(String serviceName, String componentName, String categoryName, Map<String, String> properties, Map<String, String> propertyTypes, Set<String> requestedIds) {
Resource resource = new ResourceImpl(Resource.Type.RootServiceComponentConfiguration);
setResourceProperty(resource, CONFIGURATION_SERVICE_NAME_PROPERTY_ID, serviceName, requestedIds);
setResourceProperty(resource, CONFIGURATION_COMPONENT_NAME_PROPERTY_ID, componentName, requestedIds);
setResourceProperty(resource, CONFIGURATION_CATEGORY_PROPERTY_ID, categoryName, requestedIds);
setResourceProperty(resource, CONFIGURATION_PROPERTIES_PROPERTY_ID, properties, requestedIds);
+ setResourceProperty(resource, CONFIGURATION_PROPERTY_TYPES_PROPERTY_ID, propertyTypes, requestedIds);
return resource;
}
@@ -238,7 +242,11 @@ public class RootServiceComponentConfigurationResourceProvider extends AbstractA
RootServiceComponentConfigurationHandler handler = rootServiceComponentConfigurationHandlerFactory.getInstance(requestDetails.serviceName, requestDetails.componentName, requestDetails.categoryName);
if (handler != null) {
- handler.updateCategory(requestDetails.categoryName, requestDetails.properties, removePropertiesIfNotSpecified);
+ try {
+ handler.updateCategory(requestDetails.categoryName, requestDetails.properties, removePropertiesIfNotSpecified);
+ } catch (AmbariException e) {
+ throw new SystemException(e.getMessage(), e.getCause());
+ }
} else {
throw new SystemException(String.format("Configurations may not be updated for the %s component of the root service, %s", requestDetails.serviceName, requestDetails.componentName));
}
@@ -390,11 +398,11 @@ public class RootServiceComponentConfigurationResourceProvider extends AbstractA
RootServiceComponentConfigurationHandler handler = rootServiceComponentConfigurationHandlerFactory.getInstance(serviceName, componentName, categoryName);
if (handler != null) {
- Map<String, Map<String, String>> configurations = handler.getConfigurations(categoryName);
+ Map<String, RootServiceComponentConfiguration> configurations = handler.getConfigurations(categoryName);
if (configurations != null) {
- for (Map.Entry<String, Map<String, String>> entry : configurations.entrySet()) {
- resources.add(toResource(serviceName, componentName, entry.getKey(), entry.getValue(), requestedIds));
+ for (Map.Entry<String, RootServiceComponentConfiguration> entry : configurations.entrySet()) {
+ resources.add(toResource(serviceName, componentName, entry.getKey(), entry.getValue().getProperties(), entry.getValue().getPropertyTypes(), requestedIds));
}
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/297e5b9f/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfigurationKeys.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfigurationKeys.java b/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfigurationKeys.java
index 2e1c36b..b7a713b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfigurationKeys.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfigurationKeys.java
@@ -14,62 +14,73 @@
package org.apache.ambari.server.ldap.domain;
+import static org.apache.ambari.server.configuration.ConfigurationPropertyType.PASSWORD;
+import static org.apache.ambari.server.configuration.ConfigurationPropertyType.PLAINTEXT;
+
+import org.apache.ambari.server.configuration.ConfigurationPropertyType;
+
/**
* Constants representing supported LDAP related property names
- * // todo extend this with validation information, description, defaults maybe
+ * // TODO: extend this with validation information, description, defaults maybe
*/
public enum AmbariLdapConfigurationKeys {
- LDAP_ENABLED("ambari.ldap.authentication.enabled"),
- SERVER_HOST("ambari.ldap.connectivity.server.host"),
- SERVER_PORT("ambari.ldap.connectivity.server.port"),
- USE_SSL("ambari.ldap.connectivity.use_ssl"),
+ LDAP_ENABLED("ambari.ldap.authentication.enabled", PLAINTEXT),
+ SERVER_HOST("ambari.ldap.connectivity.server.host", PLAINTEXT),
+ SERVER_PORT("ambari.ldap.connectivity.server.port", PLAINTEXT),
+ USE_SSL("ambari.ldap.connectivity.use_ssl", PLAINTEXT),
- TRUST_STORE("ambari.ldap.connectivity.trust_store"),
- TRUST_STORE_TYPE("ambari.ldap.connectivity.trust_store.type"),
- TRUST_STORE_PATH("ambari.ldap.connectivity.trust_store.path"),
- TRUST_STORE_PASSWORD("ambari.ldap.connectivity.trust_store.password"),
- ANONYMOUS_BIND("ambari.ldap.connectivity.anonymous_bind"),
+ TRUST_STORE("ambari.ldap.connectivity.trust_store", PLAINTEXT),
+ TRUST_STORE_TYPE("ambari.ldap.connectivity.trust_store.type", PLAINTEXT),
+ TRUST_STORE_PATH("ambari.ldap.connectivity.trust_store.path", PLAINTEXT),
+ TRUST_STORE_PASSWORD("ambari.ldap.connectivity.trust_store.password", PASSWORD),
+ ANONYMOUS_BIND("ambari.ldap.connectivity.anonymous_bind", PLAINTEXT),
- BIND_DN("ambari.ldap.connectivity.bind_dn"),
- BIND_PASSWORD("ambari.ldap.connectivity.bind_password"),
+ BIND_DN("ambari.ldap.connectivity.bind_dn", PLAINTEXT),
+ BIND_PASSWORD("ambari.ldap.connectivity.bind_password", PASSWORD),
- ATTR_DETECTION("ambari.ldap.attributes.detection"), // manual | auto
+ ATTR_DETECTION("ambari.ldap.attributes.detection", PLAINTEXT), // manual | auto
- DN_ATTRIBUTE("ambari.ldap.attributes.dn_attr"),
+ DN_ATTRIBUTE("ambari.ldap.attributes.dn_attr", PLAINTEXT),
- USER_OBJECT_CLASS("ambari.ldap.attributes.user.object_class"),
- USER_NAME_ATTRIBUTE("ambari.ldap.attributes.user.name_attr"),
- USER_GROUP_MEMBER_ATTRIBUTE("ambari.ldap.attributes.user.group_member_attr"),
- USER_SEARCH_BASE("ambari.ldap.attributes.user.search_base"),
+ USER_OBJECT_CLASS("ambari.ldap.attributes.user.object_class", PLAINTEXT),
+ USER_NAME_ATTRIBUTE("ambari.ldap.attributes.user.name_attr", PLAINTEXT),
+ USER_GROUP_MEMBER_ATTRIBUTE("ambari.ldap.attributes.user.group_member_attr", PLAINTEXT),
+ USER_SEARCH_BASE("ambari.ldap.attributes.user.search_base", PLAINTEXT),
- GROUP_OBJECT_CLASS("ambari.ldap.attributes.group.object_class"),
- GROUP_NAME_ATTRIBUTE("ambari.ldap.attributes.group.name_attr"),
- GROUP_MEMBER_ATTRIBUTE("ambari.ldap.attributes.group.member_attr"),
- GROUP_SEARCH_BASE("ambari.ldap.attributes.group.search_base"),
+ GROUP_OBJECT_CLASS("ambari.ldap.attributes.group.object_class", PLAINTEXT),
+ GROUP_NAME_ATTRIBUTE("ambari.ldap.attributes.group.name_attr", PLAINTEXT),
+ GROUP_MEMBER_ATTRIBUTE("ambari.ldap.attributes.group.member_attr", PLAINTEXT),
+ GROUP_SEARCH_BASE("ambari.ldap.attributes.group.search_base", PLAINTEXT),
- USER_SEARCH_FILTER("ambari.ldap.advanced.user_search_filter"),
- USER_MEMBER_REPLACE_PATTERN("ambari.ldap.advanced.user_member_replace_pattern"),
- USER_MEMBER_FILTER("ambari.ldap.advanced.user_member_filter"),
+ USER_SEARCH_FILTER("ambari.ldap.advanced.user_search_filter", PLAINTEXT),
+ USER_MEMBER_REPLACE_PATTERN("ambari.ldap.advanced.user_member_replace_pattern", PLAINTEXT),
+ USER_MEMBER_FILTER("ambari.ldap.advanced.user_member_filter", PLAINTEXT),
- GROUP_SEARCH_FILTER("ambari.ldap.advanced.group_search_filter"),
- GROUP_MEMBER_REPLACE_PATTERN("ambari.ldap.advanced.group_member_replace_pattern"),
- GROUP_MEMBER_FILTER("ambari.ldap.advanced.group_member_filter"),
+ GROUP_SEARCH_FILTER("ambari.ldap.advanced.group_search_filter", PLAINTEXT),
+ GROUP_MEMBER_REPLACE_PATTERN("ambari.ldap.advanced.group_member_replace_pattern", PLAINTEXT),
+ GROUP_MEMBER_FILTER("ambari.ldap.advanced.group_member_filter", PLAINTEXT),
- FORCE_LOWERCASE_USERNAMES("ambari.ldap.advanced.force_lowercase_usernames"),
- REFERRAL_HANDLING("ambari.ldap.advanced.referrals"), // folow
- PAGINATION_ENABLED("ambari.ldap.advanced.pagination_enabled"); // true | false
+ FORCE_LOWERCASE_USERNAMES("ambari.ldap.advanced.force_lowercase_usernames", PLAINTEXT),
+ REFERRAL_HANDLING("ambari.ldap.advanced.referrals", PLAINTEXT), // folow
+ PAGINATION_ENABLED("ambari.ldap.advanced.pagination_enabled", PLAINTEXT); // true | false
private String propertyName;
+ private ConfigurationPropertyType configurationPropertyType;
- AmbariLdapConfigurationKeys(String propName) {
+ AmbariLdapConfigurationKeys(String propName, ConfigurationPropertyType configurationPropertyType) {
this.propertyName = propName;
+ this.configurationPropertyType = configurationPropertyType;
}
public String key() {
return this.propertyName;
}
+ public ConfigurationPropertyType getConfigurationPropertyType() {
+ return configurationPropertyType;
+ }
+
public static AmbariLdapConfigurationKeys fromKeyStr(String keyStr) {
for (AmbariLdapConfigurationKeys key : values()) {
if (key.key().equals(keyStr)) {
@@ -77,7 +88,7 @@ public enum AmbariLdapConfigurationKeys {
}
}
- throw new IllegalStateException("invalid konfiguration key found!");
+ throw new IllegalStateException("invalid configuration key found!");
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/297e5b9f/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceComponentConfigurationResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceComponentConfigurationResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceComponentConfigurationResourceProviderTest.java
index 13c644a..bd0ff1d 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceComponentConfigurationResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceComponentConfigurationResourceProviderTest.java
@@ -25,6 +25,8 @@ import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.expectLastCall;
import static org.easymock.EasyMock.newCapture;
+import java.io.File;
+import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -36,6 +38,7 @@ import java.util.TreeMap;
import javax.persistence.EntityManager;
import org.apache.ambari.server.api.services.RootServiceComponentConfigurationService;
+import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.RootComponent;
import org.apache.ambari.server.controller.RootService;
import org.apache.ambari.server.controller.predicate.AndPredicate;
@@ -47,14 +50,23 @@ import org.apache.ambari.server.controller.spi.SystemException;
import org.apache.ambari.server.controller.utilities.PredicateBuilder;
import org.apache.ambari.server.events.AmbariConfigurationChangedEvent;
import org.apache.ambari.server.events.publishers.AmbariEventPublisher;
+import org.apache.ambari.server.ldap.domain.AmbariLdapConfigurationKeys;
import org.apache.ambari.server.orm.dao.AmbariConfigurationDAO;
import org.apache.ambari.server.orm.entities.AmbariConfigurationEntity;
import org.apache.ambari.server.security.TestAuthenticationFactory;
import org.apache.ambari.server.security.authorization.AuthorizationException;
+import org.apache.ambari.server.security.encryption.CredentialProvider;
+import org.apache.ambari.server.state.stack.OsFamily;
+import org.apache.commons.io.FileUtils;
import org.easymock.Capture;
import org.easymock.EasyMockSupport;
import org.junit.After;
+import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.powermock.api.easymock.PowerMock;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
@@ -64,11 +76,40 @@ import com.google.inject.Injector;
import edu.emory.mathcs.backport.java.util.Collections;
import junit.framework.Assert;
+import junit.framework.AssertionFailedError;
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({FileUtils.class, AmbariServerConfigurationHandler.class})
public class RootServiceComponentConfigurationResourceProviderTest extends EasyMockSupport {
private static final String CATEGORY_NAME_1 = "test-category-1";
private static final String CATEGORY_NAME_2 = "test-category-2";
+ private static final String LDAP_CONFIG_CATEGORY = AmbariServerConfigurationCategory.LDAP_CONFIGURATION.getCategoryName();
+
+ private Injector injector;
+ private Predicate predicate;
+ private ResourceProvider resourceProvider;
+ private RootServiceComponentConfigurationHandlerFactory factory;
+ private Request request;
+ private AmbariConfigurationDAO dao;
+ private Configuration configuration;
+ private AmbariEventPublisher publisher;
+ private Map<String, String> properties = new HashMap<>();
+ private Set<Map<String, Object>> propertySets = new HashSet<>();
+
+ @Before
+ public void init() throws Exception {
+ injector = createInjector();
+ resourceProvider = injector.getInstance(RootServiceComponentConfigurationResourceProvider.class);
+ predicate = createPredicate(RootService.AMBARI.name(), RootComponent.AMBARI_SERVER.name(), CATEGORY_NAME_1);
+ request = createMock(Request.class);
+ dao = injector.getInstance(AmbariConfigurationDAO.class);
+ configuration = injector.getInstance(Configuration.class);
+ factory = injector.getInstance(RootServiceComponentConfigurationHandlerFactory.class);
+ publisher = injector.getInstance(AmbariEventPublisher.class);
+ properties = new HashMap<>();
+ propertySets = new HashSet<>();
+ }
@After
public void clearAuthentication() {
@@ -126,21 +167,14 @@ public class RootServiceComponentConfigurationResourceProviderTest extends EasyM
}
private void testCreateResources(Authentication authentication, String opDirective) throws Exception {
- Injector injector = createInjector();
-
- ResourceProvider resourceProvider = injector.getInstance(RootServiceComponentConfigurationResourceProvider.class);
-
- Set<Map<String, Object>> propertySets = new HashSet<>();
-
- Map<String, String> properties1 = new HashMap<>();
- properties1.put("property1a", "value1");
- properties1.put("property2a", "value2");
- propertySets.add(toRequestProperties(CATEGORY_NAME_1, properties1));
+ properties.put(Configuration.AMBARI_PYTHON_WRAP.getKey(), "value1");
+ properties.put(Configuration.AMBARI_DISPLAY_URL.getKey(), "value2");
+ propertySets.add(toRequestProperties(CATEGORY_NAME_1, properties));
Map<String, String> properties2 = new HashMap<>();
if (opDirective == null) {
- properties2.put("property1b", "value1");
- properties2.put("property2b", "value2");
+ properties2.put(Configuration.SSL_TRUSTSTORE_TYPE.getKey(), "value1");
+ properties2.put(Configuration.SSL_TRUSTSTORE_PATH.getKey(), "value2");
propertySets.add(toRequestProperties(CATEGORY_NAME_2, properties2));
}
@@ -151,7 +185,6 @@ public class RootServiceComponentConfigurationResourceProviderTest extends EasyM
requestInfoProperties = Collections.singletonMap(RootServiceComponentConfigurationService.DIRECTIVE_OPERATION, opDirective);
}
- Request request = createMock(Request.class);
expect(request.getProperties()).andReturn(propertySets).once();
expect(request.getRequestInfoProperties()).andReturn(requestInfoProperties).once();
@@ -159,7 +192,6 @@ public class RootServiceComponentConfigurationResourceProviderTest extends EasyM
Capture<Map<String, String>> capturedProperties2 = newCapture();
if (opDirective == null) {
- AmbariConfigurationDAO dao = injector.getInstance(AmbariConfigurationDAO.class);
expect(dao.reconcileCategory(eq(CATEGORY_NAME_1), capture(capturedProperties1), eq(true)))
.andReturn(true)
.once();
@@ -168,12 +200,10 @@ public class RootServiceComponentConfigurationResourceProviderTest extends EasyM
.once();
- AmbariEventPublisher publisher = injector.getInstance(AmbariEventPublisher.class);
publisher.publish(anyObject(AmbariConfigurationChangedEvent.class));
expectLastCall().times(2);
}
- RootServiceComponentConfigurationHandlerFactory factory = injector.getInstance(RootServiceComponentConfigurationHandlerFactory.class);
expect(factory.getInstance(RootService.AMBARI.name(), RootComponent.AMBARI_SERVER.name(), CATEGORY_NAME_1))
.andReturn(new AmbariServerConfigurationHandler())
.once();
@@ -205,7 +235,7 @@ public class RootServiceComponentConfigurationResourceProviderTest extends EasyM
verifyAll();
if (opDirective == null) {
- validateCapturedProperties(properties1, capturedProperties1);
+ validateCapturedProperties(properties, capturedProperties1);
validateCapturedProperties(properties2, capturedProperties2);
} else {
Assert.assertFalse(capturedProperties1.hasCaptured());
@@ -239,22 +269,11 @@ public class RootServiceComponentConfigurationResourceProviderTest extends EasyM
}
private void testDeleteResources(Authentication authentication) throws Exception {
- Injector injector = createInjector();
-
- ResourceProvider resourceProvider = injector.getInstance(RootServiceComponentConfigurationResourceProvider.class);
-
- Predicate predicate = createPredicate(RootService.AMBARI.name(), RootComponent.AMBARI_SERVER.name(), CATEGORY_NAME_1);
-
- Request request = createMock(Request.class);
-
- AmbariConfigurationDAO dao = injector.getInstance(AmbariConfigurationDAO.class);
expect(dao.removeByCategory(CATEGORY_NAME_1)).andReturn(1).once();
- AmbariEventPublisher publisher = injector.getInstance(AmbariEventPublisher.class);
publisher.publish(anyObject(AmbariConfigurationChangedEvent.class));
expectLastCall().once();
- RootServiceComponentConfigurationHandlerFactory factory = injector.getInstance(RootServiceComponentConfigurationHandlerFactory.class);
expect(factory.getInstance(RootService.AMBARI.name(), RootComponent.AMBARI_SERVER.name(), CATEGORY_NAME_1))
.andReturn(new AmbariServerConfigurationHandler())
.once();
@@ -294,25 +313,15 @@ public class RootServiceComponentConfigurationResourceProviderTest extends EasyM
}
private void testGetResources(Authentication authentication) throws Exception {
- Injector injector = createInjector();
-
- ResourceProvider resourceProvider = injector.getInstance(RootServiceComponentConfigurationResourceProvider.class);
-
- Predicate predicate = createPredicate(RootService.AMBARI.name(), RootComponent.AMBARI_SERVER.name(), CATEGORY_NAME_1);
-
- Request request = createMock(Request.class);
expect(request.getPropertyIds()).andReturn(null).anyTimes();
- Map<String, String> properties = new HashMap<>();
- properties.put("property1a", "value1");
- properties.put("property2a", "value2");
+ properties.put(AmbariLdapConfigurationKeys.ANONYMOUS_BIND.key(), "value1");
+ properties.put(AmbariLdapConfigurationKeys.GROUP_MEMBER_ATTRIBUTE.key(), "value2");
- AmbariConfigurationDAO dao = injector.getInstance(AmbariConfigurationDAO.class);
expect(dao.findByCategory(CATEGORY_NAME_1)).andReturn(createEntities(CATEGORY_NAME_1, properties)).once();
- RootServiceComponentConfigurationHandlerFactory factory = injector.getInstance(RootServiceComponentConfigurationHandlerFactory.class);
expect(factory.getInstance(RootService.AMBARI.name(), RootComponent.AMBARI_SERVER.name(), CATEGORY_NAME_1))
- .andReturn(new AmbariServerConfigurationHandler())
+ .andReturn(new AmbariServerLDAPConfigurationHandler())
.once();
replayAll();
@@ -330,16 +339,19 @@ public class RootServiceComponentConfigurationResourceProviderTest extends EasyM
Assert.assertEquals(Resource.Type.RootServiceComponentConfiguration, resource.getType());
Map<String, Map<String, Object>> propertiesMap = resource.getPropertiesMap();
- Assert.assertEquals(2, propertiesMap.size());
+ Assert.assertEquals(3, propertiesMap.size());
Assert.assertEquals(CATEGORY_NAME_1, propertiesMap.get(RootServiceComponentConfigurationResourceProvider.RESOURCE_KEY).get("category"));
- Map<String, Object> retrievedProperties = propertiesMap.get(RootServiceComponentConfigurationResourceProvider.RESOURCE_KEY + "/properties");
+ Map<String, Object> retrievedProperties = propertiesMap.get(RootServiceComponentConfigurationResourceProvider.CONFIGURATION_PROPERTIES_PROPERTY_ID);
Assert.assertEquals(2, retrievedProperties.size());
for (Map.Entry<String, String> entry : properties.entrySet()) {
Assert.assertEquals(entry.getValue(), retrievedProperties.get(entry.getKey()));
}
+
+ Map<String, Object> retrievedPropertyTypes = propertiesMap.get(RootServiceComponentConfigurationResourceProvider.CONFIGURATION_PROPERTY_TYPES_PROPERTY_ID);
+ Assert.assertEquals(2, retrievedPropertyTypes.size());
}
@Test
@@ -393,18 +405,9 @@ public class RootServiceComponentConfigurationResourceProviderTest extends EasyM
}
private void testUpdateResources(Authentication authentication, String opDirective) throws Exception {
- Injector injector = createInjector();
-
- ResourceProvider resourceProvider = injector.getInstance(RootServiceComponentConfigurationResourceProvider.class);
-
- Predicate predicate = createPredicate(RootService.AMBARI.name(), RootComponent.AMBARI_SERVER.name(), CATEGORY_NAME_1);
-
- Set<Map<String, Object>> propertySets = new HashSet<>();
-
- Map<String, String> properties1 = new HashMap<>();
- properties1.put("property1a", "value1");
- properties1.put("property2a", "value2");
- propertySets.add(toRequestProperties(CATEGORY_NAME_1, properties1));
+ properties.put(Configuration.AMBARI_DISPLAY_URL.getKey(), "value1");
+ properties.put(Configuration.BOOTSTRAP_MASTER_HOSTNAME.getKey(), "value2");
+ propertySets.add(toRequestProperties(CATEGORY_NAME_1, properties));
Map<String, String> requestInfoProperties;
if (opDirective == null) {
@@ -413,24 +416,20 @@ public class RootServiceComponentConfigurationResourceProviderTest extends EasyM
requestInfoProperties = Collections.singletonMap(RootServiceComponentConfigurationService.DIRECTIVE_OPERATION, opDirective);
}
- Request request = createMock(Request.class);
expect(request.getProperties()).andReturn(propertySets).once();
expect(request.getRequestInfoProperties()).andReturn(requestInfoProperties).once();
Capture<Map<String, String>> capturedProperties1 = newCapture();
if (opDirective == null) {
- AmbariConfigurationDAO dao = injector.getInstance(AmbariConfigurationDAO.class);
expect(dao.reconcileCategory(eq(CATEGORY_NAME_1), capture(capturedProperties1), eq(false)))
.andReturn(true)
.once();
- AmbariEventPublisher publisher = injector.getInstance(AmbariEventPublisher.class);
publisher.publish(anyObject(AmbariConfigurationChangedEvent.class));
expectLastCall().times(1);
}
- RootServiceComponentConfigurationHandlerFactory factory = injector.getInstance(RootServiceComponentConfigurationHandlerFactory.class);
expect(factory.getInstance(RootService.AMBARI.name(), RootComponent.AMBARI_SERVER.name(), CATEGORY_NAME_1))
.andReturn(new AmbariServerConfigurationHandler())
.once();
@@ -458,12 +457,83 @@ public class RootServiceComponentConfigurationResourceProviderTest extends EasyM
verifyAll();
if (opDirective == null) {
- validateCapturedProperties(properties1, capturedProperties1);
+ validateCapturedProperties(properties, capturedProperties1);
} else {
Assert.assertFalse(capturedProperties1.hasCaptured());
}
}
+ @Test
+ public void shouldNotUpdatePasswordIfItHasNotBeenChanged() throws Exception {
+ SecurityContextHolder.getContext().setAuthentication(TestAuthenticationFactory.createAdministrator());
+ properties.put(AmbariLdapConfigurationKeys.BIND_PASSWORD.key(), "passwd");
+ propertySets.add(toRequestProperties(LDAP_CONFIG_CATEGORY, properties));
+ setupBasicExpectations(properties);
+ expect(configuration.isSecurityPasswordEncryptionEnabled()).andThrow(new AssertionFailedError()).anyTimes(); //this call should never have never been hit
+
+ replayAll();
+ resourceProvider.updateResources(request, predicate);
+ verifyAll();
+ }
+
+ @Test
+ public void shouldUpdatePasswordFileIfSecurityPasswordEncryptionIsDisabled() throws Exception {
+ SecurityContextHolder.getContext().setAuthentication(TestAuthenticationFactory.createAdministrator());
+ properties.put(AmbariLdapConfigurationKeys.BIND_PASSWORD.key(), "newPasswd");
+ propertySets.add(toRequestProperties(LDAP_CONFIG_CATEGORY, properties));
+ Map<String, String> expectedProperties = new HashMap<>();
+ expectedProperties.put(AmbariLdapConfigurationKeys.BIND_PASSWORD.key(), "currentPasswd");
+ setupBasicExpectations(expectedProperties);
+ expect(configuration.isSecurityPasswordEncryptionEnabled()).andReturn(false).once();
+ PowerMock.mockStatic(FileUtils.class);
+ FileUtils.writeStringToFile(new File("currentPasswd"), "newPasswd", Charset.defaultCharset());
+ PowerMock.expectLastCall().once();
+ PowerMock.replay(FileUtils.class);
+ publisher.publish(anyObject(AmbariConfigurationChangedEvent.class));
+ expectLastCall().once();
+
+ replayAll();
+ resourceProvider.updateResources(request, predicate);
+ verifyAll();
+ }
+
+ @Test
+ public void shouldUpdatePasswordInCredentialStoreIfSecurityPasswordEncryptionIsEnabled() throws Exception {
+ SecurityContextHolder.getContext().setAuthentication(TestAuthenticationFactory.createAdministrator());
+ properties.put(AmbariLdapConfigurationKeys.BIND_PASSWORD.key(), "newPasswd");
+ propertySets.add(toRequestProperties(LDAP_CONFIG_CATEGORY, properties));
+ Map<String, String> expectedProperties = new HashMap<>();
+ expectedProperties.put(AmbariLdapConfigurationKeys.BIND_PASSWORD.key(), "currentPasswd");
+ setupBasicExpectations(expectedProperties);
+ expect(configuration.isSecurityPasswordEncryptionEnabled()).andReturn(true).once();
+
+ File masterKeyLocation = createNiceMock(File.class);
+ File masterKeyStoreLocation = createNiceMock(File.class);
+ expect(configuration.getMasterKeyLocation()).andReturn(masterKeyLocation).once();
+ expect(configuration.isMasterKeyPersisted()).andReturn(false).once();
+ expect(configuration.getMasterKeyStoreLocation()).andReturn(masterKeyStoreLocation).once();
+ CredentialProvider credentialProvider = PowerMock.createMock(CredentialProvider.class);
+ PowerMock.expectNew(CredentialProvider.class, null, (String) null, masterKeyLocation, false, masterKeyStoreLocation).andReturn(credentialProvider);
+ credentialProvider.addAliasToCredentialStore("currentPasswd", "newPasswd");
+ PowerMock.expectLastCall().once();
+ PowerMock.replay(credentialProvider, CredentialProvider.class);
+
+ publisher.publish(anyObject(AmbariConfigurationChangedEvent.class));
+ expectLastCall().once();
+
+ replayAll();
+ resourceProvider.updateResources(request, predicate);
+ verifyAll();
+ PowerMock.verify(credentialProvider, CredentialProvider.class);
+ }
+
+ private void setupBasicExpectations(Map<String, String> expectedProperties) {
+ expect(request.getProperties()).andReturn(propertySets).once();
+ expect(request.getRequestInfoProperties()).andReturn(new HashMap<>());
+ expect(dao.findByCategory(LDAP_CONFIG_CATEGORY)).andReturn(createEntities(AmbariServerConfigurationCategory.LDAP_CONFIGURATION.getCategoryName(), expectedProperties)).once();
+ expect(factory.getInstance(RootService.AMBARI.name(), RootComponent.AMBARI_SERVER.name(), LDAP_CONFIG_CATEGORY)).andReturn(new AmbariServerLDAPConfigurationHandler()).once();
+ }
+
private Predicate createPredicate(String serviceName, String componentName, String categoryName) {
Predicate predicateService = new PredicateBuilder()
.property(CONFIGURATION_SERVICE_NAME_PROPERTY_ID)
@@ -521,6 +591,8 @@ public class RootServiceComponentConfigurationResourceProviderTest extends EasyM
return Guice.createInjector(new AbstractModule() {
@Override
protected void configure() {
+ bind(OsFamily.class).toInstance(createNiceMock(OsFamily.class));
+ bind(Configuration.class).toInstance(createNiceMock(Configuration.class));
bind(EntityManager.class).toInstance(createNiceMock(EntityManager.class));
bind(AmbariConfigurationDAO.class).toInstance(createMock(AmbariConfigurationDAO.class));
bind(AmbariEventPublisher.class).toInstance(createMock(AmbariEventPublisher.class));
[35/50] [abbrv] ambari git commit: AMBARI-22522 - Livy server fails
to start during downgrade due to absence of 'conf' directory (Dmitro
Lisnichenko via jonathanhurley)
Posted by rl...@apache.org.
AMBARI-22522 - Livy server fails to start during downgrade due to absence of 'conf' directory (Dmitro Lisnichenko via jonathanhurley)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9e9f68f2
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9e9f68f2
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9e9f68f2
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 9e9f68f2835d702b0c297b8a9c700f49b05f8475
Parents: f4e1a2b
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Sun Dec 17 20:48:31 2017 -0500
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Fri Jan 5 17:54:16 2018 -0500
----------------------------------------------------------------------
.../custom_actions/scripts/install_packages.py | 37 +++++++++++++++++++-
1 file changed, 36 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/9e9f68f2/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py b/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
index 862f205..c3fbc48 100644
--- a/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
+++ b/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
@@ -31,7 +31,6 @@ from resource_management.core.resources import Package
from resource_management.libraries.functions import conf_select
from resource_management.libraries.functions import stack_tools
from resource_management.libraries.functions.stack_select import get_stack_versions
-from resource_management.libraries.functions.version import format_stack_version
from resource_management.libraries.functions.repo_version_history \
import read_actual_version_from_history_file, write_actual_version_to_history_file, REPO_VERSION_HISTORY_FILE
from resource_management.core.providers import get_provider
@@ -155,11 +154,47 @@ class InstallPackages(Script):
if num_errors > 0:
raise Fail("Failed to distribute repositories/install packages")
+ self._fix_default_links("livy", "livy-server")
+ self._fix_default_links("livy2", "livy2-server")
+
# if installing a version of HDP that needs some symlink love, then create them
if is_package_install_successful and 'actual_version' in self.structured_output:
self._relink_configurations_with_conf_select(stack_id, self.structured_output['actual_version'])
+ def _fix_default_links(self, package_name, component_name):
+ """
+ If a prior version of Ambari did not correctly reverse the conf symlinks, then they would
+ be put into a bad state when distributing a new stack. For example:
+
+ /etc/component/conf (directory)
+ <stack-root>/v1/component/conf -> /etc/component/conf
+
+ When distributing v2, we'd detect the /etc/component/conf problems and would try to adjust it:
+ /etc/component/conf -> <stack-root>/current/component/conf
+ <stack-root>/v2/component/conf -> /etc/component/v2/0
+
+ The problem is that v1 never gets changed (since the stack being distributed is v2), and
+ we end up with a circular link:
+ /etc/component/conf -> <stack-root>/current/component/conf
+ <stack-root>/v1/component/conf -> /etc/component/conf
+
+ :return: None
+ """
+ from resource_management.libraries.functions import stack_select
+ package_dirs = conf_select.get_package_dirs()
+ if package_name in package_dirs:
+ Logger.info("Attempting to fix the default conf links for {0}".format(package_name))
+
+ directories = package_dirs[package_name]
+ Logger.info("The following directories will be fixed for {0}: {1}".format(package_name,
+ str(directories)))
+
+ stack_version = stack_select.get_stack_version_before_install(component_name)
+ if stack_version:
+ conf_select.convert_conf_directories_to_symlinks(package_name, stack_version, directories)
+
+
def _relink_configurations_with_conf_select(self, stack_id, stack_version):
"""
Sets up the required structure for /etc/<component>/conf symlinks and <stack-root>/current
[44/50] [abbrv] ambari git commit: AMBARI-22657 Oozie service check
failed during 4th digit PU (dgrinenko)
Posted by rl...@apache.org.
AMBARI-22657 Oozie service check failed during 4th digit PU (dgrinenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/bb218447
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/bb218447
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/bb218447
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: bb218447638066e2329be8ef437d603cede63ca5
Parents: 35247b1
Author: Dmytro Grinenko <ha...@apache.org>
Authored: Fri Dec 15 17:50:01 2017 +0200
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Fri Jan 5 17:54:16 2018 -0500
----------------------------------------------------------------------
.../resources/stacks/HDP/2.0.6/properties/stack_packages.json | 3 ++-
.../main/resources/stacks/HDP/3.0/properties/stack_packages.json | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/bb218447/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json b/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
index 62a46b9..01a30f3 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
@@ -536,7 +536,8 @@
"oozie-server"
],
"PATCH": [
- "oozie-server"
+ "oozie-server",
+ "oozie-client"
],
"STANDARD": [
"oozie-client",
http://git-wip-us.apache.org/repos/asf/ambari/blob/bb218447/ambari-server/src/main/resources/stacks/HDP/3.0/properties/stack_packages.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/3.0/properties/stack_packages.json b/ambari-server/src/main/resources/stacks/HDP/3.0/properties/stack_packages.json
index 4f05377..28efbfa 100644
--- a/ambari-server/src/main/resources/stacks/HDP/3.0/properties/stack_packages.json
+++ b/ambari-server/src/main/resources/stacks/HDP/3.0/properties/stack_packages.json
@@ -532,7 +532,8 @@
"oozie-server"
],
"PATCH": [
- "oozie-server"
+ "oozie-server",
+ "oozie-client"
],
"STANDARD": [
"oozie-client",
[24/50] [abbrv] ambari git commit: AMBARI-22661 Storm service check
fails with StormAtlasHook CNF after cluster deploy (dgrinenko)
Posted by rl...@apache.org.
AMBARI-22661 Storm service check fails with StormAtlasHook CNF after cluster deploy (dgrinenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d5120aab
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d5120aab
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d5120aab
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: d5120aab0f3a13769b8f8e366b689169872a2ec4
Parents: 72035ef
Author: Dmytro Grinenko <ha...@apache.org>
Authored: Sat Dec 16 19:26:43 2017 +0200
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Fri Jan 5 17:54:16 2018 -0500
----------------------------------------------------------------------
.../libraries/functions/setup_atlas_hook.py | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d5120aab/ambari-common/src/main/python/resource_management/libraries/functions/setup_atlas_hook.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/setup_atlas_hook.py b/ambari-common/src/main/python/resource_management/libraries/functions/setup_atlas_hook.py
index 367afc8..985eb37 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/setup_atlas_hook.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/setup_atlas_hook.py
@@ -162,14 +162,9 @@ def setup_atlas_jar_symlinks(hook_name, jar_source_dir):
import params
stack_root = Script.get_stack_root()
- atlas_home_dir = os.path.join(stack_root, "current", "atlas-server")
-
- # if this is an upgrade/downagrade, then we must link in the correct version
- # which may not be "current", so change the home directory location
- upgrade_type = Script.get_upgrade_type(default("/commandParams/upgrade_type", ""))
- if upgrade_type is not None:
- version_dir_segment = stack_features.get_stack_feature_version(Script.get_config())
- atlas_home_dir = os.path.join(stack_root, version_dir_segment, "atlas")
+ atlas_component_name = "atlas"
+ stack_version = stack_features.get_stack_feature_version(Script.get_config())
+ atlas_home_dir = os.path.join(stack_root, stack_version, atlas_component_name)
# Will only exist if this host contains Atlas Server
atlas_hook_dir = os.path.join(atlas_home_dir, "hook", hook_name)
[30/50] [abbrv] ambari git commit: AMBARI-22628 - YARN Shuffle
Service Can't Be Found On Client-Only Nodes After New Cluster Install
(jonathanhurley)
Posted by rl...@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/15d8d1a1
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/15d8d1a1
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/15d8d1a1
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 15d8d1a1485ec5e5441c31566ef8a16632d6046f
Parents: 068b2fe
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Mon Dec 11 09:03:09 2017 -0500
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Fri Jan 5 17:54:16 2018 -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/15d8d1a1/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/15d8d1a1/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/15d8d1a1/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/15d8d1a1/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/15d8d1a1/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/15d8d1a1/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/15d8d1a1/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/15d8d1a1/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/15d8d1a1/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 678581e..a0c4e07 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
@@ -671,6 +671,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);
[37/50] [abbrv] ambari git commit: AMBARI-22644 - Node Managers fail
to start after Spark2 is patched due to CNF YarnShuffleService
(jonathanhurley)
Posted by rl...@apache.org.
AMBARI-22644 - Node Managers fail to start after Spark2 is patched due to CNF YarnShuffleService (jonathanhurley)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7749e655
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7749e655
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7749e655
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 7749e655e74c7bb4e3ada6b92943730c5e1b6e76
Parents: 1071136
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Wed Dec 13 12:33:26 2017 -0500
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Fri Jan 5 17:54:16 2018 -0500
----------------------------------------------------------------------
.../2.1.0.2.0/package/scripts/params_linux.py | 19 ++++++++++++-------
.../3.0.0.3.0/package/scripts/params_linux.py | 20 ++++++++++++--------
.../services/YARN/configuration/yarn-site.xml | 4 ++--
.../stacks/HDP/2.6/upgrades/config-upgrade.xml | 2 --
.../services/YARN/configuration/yarn-site.xml | 4 ++--
5 files changed, 28 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/7749e655/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 9997779..4a49822 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
@@ -89,16 +89,20 @@ 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.
+ that of YARN so it can still find the correct spark 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.
+
+ ATS needs this since it relies on packages installed by Spark. Some classes, like the shuffle
+ classes, are not provided by spark, but by a dependent RPM to YARN, so they do not use this
+ 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
+ :return: a value for the version placeholder in spark classpath properties
"""
# start off seeing if we need to populate a default value for YARN
if yarn_version is None:
@@ -106,18 +110,19 @@ def get_spark_version(service_name, component_name, yarn_version):
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,
+ spark_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:
+ if spark_classpath_version is None:
try:
- shuffle_classpath_version = stack_select.get_role_component_current_stack_version()
+ spark_classpath_version = stack_select.get_role_component_current_stack_version()
except:
- Logger.exception("Unable to query for the correct shuffle classpath")
+ Logger.exception("Unable to query for the correct spark version to use when building classpaths")
+
+ return spark_classpath_version
- 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
http://git-wip-us.apache.org/repos/asf/ambari/blob/7749e655/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 8e9632c..9afd112 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
@@ -89,16 +89,20 @@ 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.
+ that of YARN so it can still find the correct spark 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.
+
+ ATS needs this since it relies on packages installed by Spark. Some classes, like the shuffle
+ classes, are not provided by spark, but by a dependent RPM to YARN, so they do not use this
+ 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
+ :return: a value for the version placeholder in spark classpath properties
"""
# start off seeing if we need to populate a default value for YARN
if yarn_version is None:
@@ -106,18 +110,19 @@ def get_spark_version(service_name, component_name, yarn_version):
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,
+ spark_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:
+ if spark_classpath_version is None:
try:
- shuffle_classpath_version = stack_select.get_role_component_current_stack_version()
+ spark_classpath_version = stack_select.get_role_component_current_stack_version()
except:
- Logger.exception("Unable to query for the correct shuffle classpath")
+ Logger.exception("Unable to query for the correct spark version to use when building classpaths")
+
+ return spark_classpath_version
- 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
@@ -317,7 +322,6 @@ if include_file_path and manage_include_files:
ats_host = set(default("/clusterHostInfo/app_timeline_server_hosts", []))
has_ats = not len(ats_host) == 0
-
# don't using len(nm_hosts) here, because check can take too much time on large clusters
number_of_nm = 1
http://git-wip-us.apache.org/repos/asf/ambari/blob/7749e655/ambari-server/src/main/resources/stacks/HDP/2.5/services/YARN/configuration/yarn-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/services/YARN/configuration/yarn-site.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/services/YARN/configuration/yarn-site.xml
index 29833fb..b6fadcb 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/services/YARN/configuration/yarn-site.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/services/YARN/configuration/yarn-site.xml
@@ -31,13 +31,13 @@
</property>
<property>
<name>yarn.nodemanager.aux-services.spark_shuffle.classpath</name>
- <value>{{stack_root}}/{{spark_version}}/spark/aux/*</value>
+ <value>{{stack_root}}/${hdp.version}/spark/aux/*</value>
<description>The auxiliary service classpath to use for Spark</description>
<on-ambari-upgrade add="false"/>
</property>
<property>
<name>yarn.nodemanager.aux-services.spark2_shuffle.classpath</name>
- <value>{{stack_root}}/{{spark2_version}}/spark2/aux/*</value>
+ <value>{{stack_root}}/${hdp.version}/spark2/aux/*</value>
<description>The auxiliary service classpath to use for Spark 2</description>
<on-ambari-upgrade add="false"/>
</property>
http://git-wip-us.apache.org/repos/asf/ambari/blob/7749e655/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 9c3d0dd..d8f71cd 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
@@ -183,8 +183,6 @@
<changes>
<definition xsi:type="configure" id="hdp_2_6_yarn_spark_versioned_classpaths">
<type>yarn-site</type>
- <set key="yarn.nodemanager.aux-services.spark_shuffle.classpath" value="{{stack_root}}/{{spark_version}}/spark/aux/*"/>
- <set key="yarn.nodemanager.aux-services.spark2_shuffle.classpath" value="{{stack_root}}/{{spark2_version}}/spark2/aux/*"/>
<replace key="yarn.timeline-service.entity-group-fs-store.group-id-plugin-classpath" find="${hdp.version}/spark/" replace-with="{{spark_version}}/spark/"/>
</definition>
</changes>
http://git-wip-us.apache.org/repos/asf/ambari/blob/7749e655/ambari-server/src/main/resources/stacks/HDP/3.0/services/YARN/configuration/yarn-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/3.0/services/YARN/configuration/yarn-site.xml b/ambari-server/src/main/resources/stacks/HDP/3.0/services/YARN/configuration/yarn-site.xml
index d32e2de..01551c4 100644
--- a/ambari-server/src/main/resources/stacks/HDP/3.0/services/YARN/configuration/yarn-site.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/3.0/services/YARN/configuration/yarn-site.xml
@@ -20,7 +20,7 @@
<property>
<name>yarn.nodemanager.aux-services.spark_shuffle.classpath</name>
- <value>{{stack_root}}/{{spark_version}}/spark/aux/*</value>
+ <value>{{stack_root}}/${hdp.version}/spark/aux/*</value>
<description>The auxiliary service classpath to use for Spark</description>
<on-ambari-upgrade add="false"/>
</property>
@@ -41,7 +41,7 @@
<!-- These configs were inherited from HDP 2.5 -->
<property>
<name>yarn.nodemanager.aux-services.spark2_shuffle.classpath</name>
- <value>{{stack_root}}/{{spark2_version}}/spark2/aux/*</value>
+ <value>{{stack_root}}/${hdp.version}/spark2/aux/*</value>
<description>The auxiliary service classpath to use for Spark 2</description>
<on-ambari-upgrade add="false"/>
</property>
[12/50] [abbrv] ambari git commit: AMBARI-22702. Infra Manager:
scheduled deleting of Infra Solr documents (Krisztian Kasa via oleewere )
Posted by rl...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/SolrQueryBuilder.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/SolrQueryBuilder.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/SolrQueryBuilder.java
index b3ea14e..0e41169 100644
--- a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/SolrQueryBuilder.java
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/SolrQueryBuilder.java
@@ -20,27 +20,27 @@ package org.apache.ambari.infra.job.archive;
import org.apache.solr.client.solrj.SolrQuery;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
+import java.util.HashMap;
+import java.util.Map;
import static org.apache.commons.lang.StringUtils.isBlank;
import static org.apache.solr.client.solrj.SolrQuery.ORDER.asc;
public class SolrQueryBuilder {
- public static final Pattern PARAMETER_PATTERN = Pattern.compile("\\$\\{[a-z]+\\}");
-
+ private static final String INTERVAL_START = "start";
+ private static final String INTERVAL_END = "end";
private String queryText;
- private String startValue;
- private String endValue;
+ private final Map<String, String> interval;
private String filterQueryText;
private Document document;
private String[] sortFields;
public SolrQueryBuilder() {
this.queryText = "*:*";
+ interval = new HashMap<>();
+ interval.put(INTERVAL_START, "*");
+ interval.put(INTERVAL_END, "*");
}
public SolrQueryBuilder setQueryText(String queryText) {
@@ -48,14 +48,13 @@ public class SolrQueryBuilder {
return this;
}
- public SolrQueryBuilder setEndValue(String endValue) {
- this.endValue = endValue;
- return this;
- }
-
public SolrQueryBuilder setInterval(String startValue, String endValue) {
- this.startValue = startValue;
- this.endValue = endValue;
+ if (isBlank(startValue))
+ startValue = "*";
+ if (isBlank(endValue))
+ endValue = "*";
+ this.interval.put(INTERVAL_START, startValue);
+ this.interval.put(INTERVAL_END, endValue);
return this;
}
@@ -78,27 +77,17 @@ public class SolrQueryBuilder {
public SolrQuery build() {
SolrQuery solrQuery = new SolrQuery();
- String query = queryText;
- query = setValueOn(query, "${start}", startValue);
- query = setValueOn(query, "${end}", endValue);
-
- solrQuery.setQuery(query);
+ SolrParametrizedString queryText = new SolrParametrizedString(this.queryText).set(interval);
+ solrQuery.setQuery(queryText.toString());
if (filterQueryText != null) {
- String filterQuery = filterQueryText;
- filterQuery = setValueOn(filterQuery, "${start}", startValue);
- filterQuery = setValueOn(filterQuery, "${end}", endValue);
+ SolrParametrizedString filterQuery = new SolrParametrizedString(filterQueryText)
+ .set(interval);
- Set<String> paramNames = collectParamNames(filterQuery);
if (document != null) {
- for (String parameter : paramNames) {
- if (document.get(parameter) != null)
- filterQuery = filterQuery.replace(String.format("${%s}", parameter), String.format("\"%s\"", document.get(parameter)));
- }
+ filterQuery = filterQuery.set(document.getFieldMap());
+ solrQuery.setFilterQueries(filterQuery.toString());
}
-
- if (document == null && paramNames.isEmpty() || document != null && !paramNames.isEmpty())
- solrQuery.setFilterQueries(filterQuery);
}
if (sortFields != null) {
@@ -108,22 +97,4 @@ public class SolrQueryBuilder {
return solrQuery;
}
-
- private String setValueOn(String query, String placeHolder, String value) {
- if (isBlank(value)) {
- value = "*";
- }
- else {
- value = '"' + value + '"';
- }
- return query.replace(placeHolder, value);
- }
-
- private Set<String> collectParamNames(String filterQuery) {
- Matcher matcher = PARAMETER_PATTERN.matcher(filterQuery);
- Set<String> parameters = new HashSet<>();
- while (matcher.find())
- parameters.add(matcher.group().replace("${", "").replace("}", ""));
- return parameters;
- }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/TarGzCompressor.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/TarGzCompressor.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/TarGzCompressor.java
index 55ba58a..8f9d673 100644
--- a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/TarGzCompressor.java
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/TarGzCompressor.java
@@ -27,7 +27,7 @@ import java.io.*;
public class TarGzCompressor extends AbstractFileAction {
@Override
- public File perform(File inputFile) {
+ public File onPerform(File inputFile) {
File tarGzFile = new File(inputFile.getParent(), inputFile.getName() + ".tar.gz");
try (TarArchiveOutputStream tarArchiveOutputStream = new TarArchiveOutputStream(
new GzipCompressorOutputStream(new FileOutputStream(tarGzFile)))) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/WriteCompletedEvent.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/WriteCompletedEvent.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/WriteCompletedEvent.java
new file mode 100644
index 0000000..49abe22
--- /dev/null
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/WriteCompletedEvent.java
@@ -0,0 +1,45 @@
+/*
+ * 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.infra.job.archive;
+
+import java.io.File;
+
+public class WriteCompletedEvent {
+ private final File outFile;
+ private final Document firstDocument;
+ private final Document lastDocument;
+
+ public WriteCompletedEvent(File outFile, Document firstDocument, Document lastDocument) {
+ this.outFile = outFile;
+ this.firstDocument = firstDocument;
+ this.lastDocument = lastDocument;
+ }
+
+ public File getOutFile() {
+ return outFile;
+ }
+
+ public Document getFirstDocument() {
+ return firstDocument;
+ }
+
+ public Document getLastDocument() {
+ return lastDocument;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/deleting/DocumentDeletingConfiguration.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/deleting/DocumentDeletingConfiguration.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/deleting/DocumentDeletingConfiguration.java
new file mode 100644
index 0000000..4fce4b6
--- /dev/null
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/deleting/DocumentDeletingConfiguration.java
@@ -0,0 +1,90 @@
+/*
+ * 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.infra.job.deleting;
+
+import org.apache.ambari.infra.job.JobPropertyMap;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.batch.core.Job;
+import org.springframework.batch.core.Step;
+import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
+import org.springframework.batch.core.configuration.annotation.JobScope;
+import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
+import org.springframework.batch.core.configuration.annotation.StepScope;
+import org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+
+@Configuration
+public class DocumentDeletingConfiguration {
+ private static final Logger LOG = LoggerFactory.getLogger(DocumentDeletingConfiguration.class);
+
+ @Inject
+ private DocumentDeletingPropertyMap propertyMap;
+
+ @Inject
+ private StepBuilderFactory steps;
+
+ @Inject
+ private JobBuilderFactory jobs;
+
+ @Inject
+ private JobRegistryBeanPostProcessor jobRegistryBeanPostProcessor;
+
+ @Inject
+ @Qualifier("deleteStep")
+ private Step deleteStep;
+
+ @PostConstruct
+ public void createJobs() {
+ propertyMap.getSolrDataDeleting().values().forEach(DocumentDeletingProperties::validate);
+
+ propertyMap.getSolrDataDeleting().keySet().forEach(jobName -> {
+ LOG.info("Registering data deleting job {}", jobName);
+ Job job = logDeleteJob(jobName, deleteStep);
+ jobRegistryBeanPostProcessor.postProcessAfterInitialization(job, jobName);
+ });
+ }
+
+ private Job logDeleteJob(String jobName, Step logExportStep) {
+ return jobs.get(jobName).listener(new JobPropertyMap<>(propertyMap)).start(logExportStep).build();
+ }
+
+ @Bean
+ @JobScope
+ public Step deleteStep(DocumentWiperTasklet tasklet) {
+ return steps.get("delete")
+ .tasklet(tasklet)
+ .build();
+ }
+
+ @Bean
+ @StepScope
+ public DocumentWiperTasklet documentWiperTasklet(
+ @Value("#{stepExecution.jobExecution.executionContext.get('jobProperties')}") DocumentDeletingProperties properties,
+ @Value("#{jobParameters[start]}") String start,
+ @Value("#{jobParameters[end]}") String end) {
+ return new DocumentWiperTasklet(properties, start, end);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/deleting/DocumentDeletingProperties.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/deleting/DocumentDeletingProperties.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/deleting/DocumentDeletingProperties.java
new file mode 100644
index 0000000..63b7dd2
--- /dev/null
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/deleting/DocumentDeletingProperties.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ambari.infra.job.deleting;
+
+import org.apache.ambari.infra.job.JobProperties;
+import org.springframework.batch.core.JobParameters;
+
+import static org.apache.commons.lang.StringUtils.isBlank;
+
+public class DocumentDeletingProperties extends JobProperties<DocumentDeletingProperties> {
+ private String zooKeeperConnectionString;
+ private String collection;
+ private String filterField;
+
+ public DocumentDeletingProperties() {
+ super(DocumentDeletingProperties.class);
+ }
+
+ public String getZooKeeperConnectionString() {
+ return zooKeeperConnectionString;
+ }
+
+ public void setZooKeeperConnectionString(String zooKeeperConnectionString) {
+ this.zooKeeperConnectionString = zooKeeperConnectionString;
+ }
+
+ public String getCollection() {
+ return collection;
+ }
+
+ public void setCollection(String collection) {
+ this.collection = collection;
+ }
+
+ public String getFilterField() {
+ return filterField;
+ }
+
+ public void setFilterField(String filterField) {
+ this.filterField = filterField;
+ }
+
+ @Override
+ public void apply(JobParameters jobParameters) {
+ zooKeeperConnectionString = jobParameters.getString("zooKeeperConnectionString", zooKeeperConnectionString);
+ collection = jobParameters.getString("collection", collection);
+ filterField = jobParameters.getString("filterField", filterField);
+ }
+
+ @Override
+ public void validate() {
+ if (isBlank(zooKeeperConnectionString))
+ throw new IllegalArgumentException("The property zooKeeperConnectionString can not be null or empty string!");
+
+ if (isBlank(collection))
+ throw new IllegalArgumentException("The property collection can not be null or empty string!");
+
+ if (isBlank(filterField))
+ throw new IllegalArgumentException("The property filterField can not be null or empty string!");
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/deleting/DocumentDeletingPropertyMap.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/deleting/DocumentDeletingPropertyMap.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/deleting/DocumentDeletingPropertyMap.java
new file mode 100644
index 0000000..fccfd59
--- /dev/null
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/deleting/DocumentDeletingPropertyMap.java
@@ -0,0 +1,44 @@
+/*
+ * 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.infra.job.deleting;
+
+import org.apache.ambari.infra.job.PropertyMap;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.Map;
+
+@Configuration
+@ConfigurationProperties(prefix = "infra-manager.jobs")
+public class DocumentDeletingPropertyMap implements PropertyMap<DocumentDeletingProperties> {
+ private Map<String, DocumentDeletingProperties> solrDataDeleting;
+
+ public Map<String, DocumentDeletingProperties> getSolrDataDeleting() {
+ return solrDataDeleting;
+ }
+
+ public void setSolrDataDeleting(Map<String, DocumentDeletingProperties> solrDataDeleting) {
+ this.solrDataDeleting = solrDataDeleting;
+ }
+
+ @Override
+ public Map<String, DocumentDeletingProperties> getPropertyMap() {
+ return getSolrDataDeleting();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/deleting/DocumentWiperTasklet.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/deleting/DocumentWiperTasklet.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/deleting/DocumentWiperTasklet.java
new file mode 100644
index 0000000..463e6e0
--- /dev/null
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/deleting/DocumentWiperTasklet.java
@@ -0,0 +1,49 @@
+/*
+ * 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.infra.job.deleting;
+
+import org.apache.ambari.infra.job.SolrDAOBase;
+import org.apache.solr.client.solrj.util.ClientUtils;
+import org.springframework.batch.core.StepContribution;
+import org.springframework.batch.core.scope.context.ChunkContext;
+import org.springframework.batch.core.step.tasklet.Tasklet;
+import org.springframework.batch.repeat.RepeatStatus;
+
+public class DocumentWiperTasklet extends SolrDAOBase implements Tasklet {
+ private final String filterField;
+ private final String start;
+ private final String end;
+
+ public DocumentWiperTasklet(DocumentDeletingProperties properties, String start, String end) {
+ super(properties.getZooKeeperConnectionString(), properties.getCollection());
+ this.filterField = properties.getFilterField();
+ this.start = start;
+ this.end = end;
+ }
+
+ @Override
+ public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) {
+ delete(String.format("%s:[%s TO %s]", filterField, getValue(start), getValue(end)));
+ return RepeatStatus.FINISHED;
+ }
+
+ private String getValue(String value) {
+ return "*".equals(value) ? value : ClientUtils.escapeQueryChars(value);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/main/resources/infra-manager.properties
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/resources/infra-manager.properties b/ambari-infra/ambari-infra-manager/src/main/resources/infra-manager.properties
index 27b36b3..9103d09 100644
--- a/ambari-infra/ambari-infra-manager/src/main/resources/infra-manager.properties
+++ b/ambari-infra/ambari-infra-manager/src/main/resources/infra-manager.properties
@@ -20,33 +20,34 @@ management.security.enabled=false
management.health.solr.enabled=false
infra-manager.server.data.folder=/tmp
-infra-manager.jobs.solr_data_export.export_service_logs.zoo_keeper_connection_string=zookeeper:2181
+infra-manager.jobs.solr_data_export.export_service_logs.solr.zoo_keeper_connection_string=zookeeper:2181
+infra-manager.jobs.solr_data_export.export_service_logs.solr.collection=hadoop_logs
+infra-manager.jobs.solr_data_export.export_service_logs.solr.query_text=logtime:[${start} TO ${end}]
+infra-manager.jobs.solr_data_export.export_service_logs.solr.filter_query_text=(logtime:${logtime} AND id:{${id} TO *]) OR logtime:{${logtime} TO ${end}]
+infra-manager.jobs.solr_data_export.export_service_logs.solr.sort_column[0]=logtime
+infra-manager.jobs.solr_data_export.export_service_logs.solr.sort_column[1]=id
infra-manager.jobs.solr_data_export.export_service_logs.read_block_size=100
infra-manager.jobs.solr_data_export.export_service_logs.write_block_size=150
infra-manager.jobs.solr_data_export.export_service_logs.file_name_suffix_column=logtime
+infra-manager.jobs.solr_data_export.export_service_logs.file_name_suffix_date_format=yyyy-MM-dd'T'HH-mm-ss.SSSX
infra-manager.jobs.solr_data_export.export_service_logs.destination_directory_path=/tmp/ambariInfraManager
-infra-manager.jobs.solr_data_export.export_service_logs.query.collection=hadoop_logs
-infra-manager.jobs.solr_data_export.export_service_logs.query.query_text=logtime:[${start} TO ${end}]
-infra-manager.jobs.solr_data_export.export_service_logs.query.filter_query_text=(logtime:${logtime} AND id:{${id} TO *]) OR logtime:{${logtime} TO ${end}]
-infra-manager.jobs.solr_data_export.export_service_logs.query.sort_column[0]=logtime
-infra-manager.jobs.solr_data_export.export_service_logs.query.sort_column[1]=id
-infra-manager.jobs.solr_data_export.export_audit_logs.zoo_keeper_connection_string=zookeeper:2181
-infra-manager.jobs.solr_data_export.export_audit_logs.read_block_size=100
-infra-manager.jobs.solr_data_export.export_audit_logs.write_block_size=150
+infra-manager.jobs.solr_data_export.archive_audit_logs.solr.zoo_keeper_connection_string=zookeeper:2181
+infra-manager.jobs.solr_data_export.archive_audit_logs.solr.collection=audit_logs
+infra-manager.jobs.solr_data_export.archive_audit_logs.solr.query_text=logtime:[${start} TO ${end}]
+infra-manager.jobs.solr_data_export.archive_audit_logs.solr.filter_query_text=(logtime:${logtime} AND id:{${id} TO *]) OR logtime:{${logtime} TO ${end}]
+infra-manager.jobs.solr_data_export.archive_audit_logs.solr.sort_column[0]=logtime
+infra-manager.jobs.solr_data_export.archive_audit_logs.solr.sort_column[1]=id
+infra-manager.jobs.solr_data_export.archive_audit_logs.solr.delete_query_text=logtime:[${start.logtime} TO ${end.logtime}} OR (logtime:${end.logtime} AND id:[* TO ${end.id}])
+infra-manager.jobs.solr_data_export.archive_audit_logs.read_block_size=100
+infra-manager.jobs.solr_data_export.archive_audit_logs.write_block_size=150
# TODO: logtime may not be enough: The same filename can be generated when more than write_block_size count docs has the same logtime value
-infra-manager.jobs.solr_data_export.export_audit_logs.file_name_suffix_column=logtime
-infra-manager.jobs.solr_data_export.export_audit_logs.destination_directory_path=/tmp/ambariInfraManager
-infra-manager.jobs.solr_data_export.export_audit_logs.query.collection=audit_logs
-infra-manager.jobs.solr_data_export.export_audit_logs.query.query_text=logtime:[${start} TO ${end}]
-infra-manager.jobs.solr_data_export.export_audit_logs.query.filter_query_text=(logtime:${logtime} AND id:{${id} TO *]) OR logtime:{${logtime} TO ${end}]
-infra-manager.jobs.solr_data_export.export_audit_logs.query.sort_column[0]=logtime
-infra-manager.jobs.solr_data_export.export_audit_logs.query.sort_column[1]=id
-# TODO: s3_access_key and s3_secret_key to separate file
-infra-manager.jobs.solr_data_export.export_audit_logs.s3_access_key=remote-identity
-infra-manager.jobs.solr_data_export.export_audit_logs.s3_secret_key=remote-credential
-infra-manager.jobs.solr_data_export.export_audit_logs.s3_key_prefix=solr_archive_
-infra-manager.jobs.solr_data_export.export_audit_logs.s3_bucket_name=testbucket
-infra-manager.jobs.solr_data_export.export_audit_logs.s3_endpoint=http://fakes3:4569
+infra-manager.jobs.solr_data_export.archive_audit_logs.file_name_suffix_column=logtime
+infra-manager.jobs.solr_data_export.archive_audit_logs.file_name_suffix_date_format=yyyy-MM-dd'T'HH-mm-ss.SSSX
+infra-manager.jobs.solr_data_export.archive_audit_logs.destination_directory_path=/tmp/ambariInfraManager
+#infra-manager.jobs.solr_data_export.archive_audit_logs.s3_access_file=<any>.csv
+infra-manager.jobs.solr_data_export.archive_audit_logs.s3_key_prefix=solr_archive_
+infra-manager.jobs.solr_data_export.archive_audit_logs.s3_bucket_name=testbucket
+infra-manager.jobs.solr_data_export.archive_audit_logs.s3_endpoint=http://fakes3:4569
# TODO: configure ranger audit logs
#infra-manager.jobs.solr_data_export.export_ranger_audit_logs.zoo_keeper_connection_string=zookeeper:2181
#infra-manager.jobs.solr_data_export.export_ranger_audit_logs.read_block_size=100
@@ -58,3 +59,6 @@ infra-manager.jobs.solr_data_export.export_audit_logs.s3_endpoint=http://fakes3:
#infra-manager.jobs.solr_data_export.export_ranger_audit_logs.query.filter_query_text=(logtime:"${logtime}" AND id:{"${id}" TO *]) OR logtime:{"${logtime}" TO "${end}"]
#infra-manager.jobs.solr_data_export.export_ranger_audit_logs.query.sort_column[0]=logtime
#infra-manager.jobs.solr_data_export.export_ranger_audit_logs.query.sort_column[1]=id
+infra-manager.jobs.solr_data_deleting.delete_audit_logs.zoo_keeper_connection_string=zookeeper:2181
+infra-manager.jobs.solr_data_deleting.delete_audit_logs.collection=audit_logs
+infra-manager.jobs.solr_data_deleting.delete_audit_logs.filter_field=logtime
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/JobPropertiesTest.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/JobPropertiesTest.java b/ambari-infra/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/JobPropertiesTest.java
new file mode 100644
index 0000000..6a76229
--- /dev/null
+++ b/ambari-infra/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/JobPropertiesTest.java
@@ -0,0 +1,56 @@
+package org.apache.ambari.infra.job;
+
+import org.apache.ambari.infra.job.archive.DocumentExportProperties;
+import org.apache.ambari.infra.job.archive.SolrProperties;
+import org.junit.Test;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+/*
+ * 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.
+ */
+public class JobPropertiesTest {
+ @Test
+ public void testDeepCopy() throws Exception {
+ DocumentExportProperties documentExportProperties = new DocumentExportProperties();
+ documentExportProperties.setDestinationDirectoryPath("/tmp");
+ documentExportProperties.setFileNameSuffixColumn(".json");
+ documentExportProperties.setReadBlockSize(10);
+ documentExportProperties.setWriteBlockSize(20);
+ SolrProperties solr = new SolrProperties();
+ solr.setZooKeeperConnectionString("localhost:2181");
+ solr.setFilterQueryText("id:1167");
+ solr.setQueryText("name:'Joe'");
+ solr.setCollection("Users");
+ solr.setSortColumn(new String[] {"name"});
+ documentExportProperties.setSolr(solr);
+
+ DocumentExportProperties parsed = documentExportProperties.deepCopy();
+
+ assertThat(parsed.getDestinationDirectoryPath(), is(documentExportProperties.getDestinationDirectoryPath()));
+ assertThat(parsed.getFileNameSuffixColumn(), is(documentExportProperties.getFileNameSuffixColumn()));
+ assertThat(parsed.getReadBlockSize(), is(documentExportProperties.getReadBlockSize()));
+ assertThat(parsed.getWriteBlockSize(), is(documentExportProperties.getWriteBlockSize()));
+ assertThat(parsed.getSolr().getZooKeeperConnectionString(), is(documentExportProperties.getSolr().getZooKeeperConnectionString()));
+ assertThat(parsed.getSolr().getQueryText(), is(solr.getQueryText()));
+ assertThat(parsed.getSolr().getFilterQueryText(), is(solr.getFilterQueryText()));
+ assertThat(parsed.getSolr().getCollection(), is(solr.getCollection()));
+ assertThat(parsed.getSolr().getSortColumn(), is(solr.getSortColumn()));
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/archive/DocumentExportPropertiesTest.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/archive/DocumentExportPropertiesTest.java b/ambari-infra/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/archive/DocumentExportPropertiesTest.java
deleted file mode 100644
index ae93710..0000000
--- a/ambari-infra/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/archive/DocumentExportPropertiesTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.apache.ambari.infra.job.archive;
-
-import org.junit.Test;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-
-/*
- * 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.
- */
-public class DocumentExportPropertiesTest {
- @Test
- public void testDeepCopy() throws Exception {
- DocumentExportProperties documentExportProperties = new DocumentExportProperties();
- documentExportProperties.setDestinationDirectoryPath("/tmp");
- documentExportProperties.setFileNameSuffixColumn(".json");
- documentExportProperties.setReadBlockSize(10);
- documentExportProperties.setWriteBlockSize(20);
- documentExportProperties.setZooKeeperConnectionString("localhost:2181");
- SolrQueryProperties query = new SolrQueryProperties();
- query.setFilterQueryText("id:1167");
- query.setQueryText("name:'Joe'");
- query.setCollection("Users");
- query.setSortColumn(new String[] {"name"});
- documentExportProperties.setQuery(query);
-
- DocumentExportProperties parsed = documentExportProperties.deepCopy();
-
- assertThat(parsed.getDestinationDirectoryPath(), is(documentExportProperties.getDestinationDirectoryPath()));
- assertThat(parsed.getFileNameSuffixColumn(), is(documentExportProperties.getFileNameSuffixColumn()));
- assertThat(parsed.getReadBlockSize(), is(documentExportProperties.getReadBlockSize()));
- assertThat(parsed.getWriteBlockSize(), is(documentExportProperties.getWriteBlockSize()));
- assertThat(parsed.getZooKeeperConnectionString(), is(documentExportProperties.getZooKeeperConnectionString()));
- assertThat(parsed.getQuery().getQueryText(), is(query.getQueryText()));
- assertThat(parsed.getQuery().getFilterQueryText(), is(query.getFilterQueryText()));
- assertThat(parsed.getQuery().getCollection(), is(query.getCollection()));
- assertThat(parsed.getQuery().getSortColumn(), is(query.getSortColumn()));
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/archive/FileNameSuffixFormatterTest.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/archive/FileNameSuffixFormatterTest.java b/ambari-infra/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/archive/FileNameSuffixFormatterTest.java
new file mode 100644
index 0000000..34e679f
--- /dev/null
+++ b/ambari-infra/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/archive/FileNameSuffixFormatterTest.java
@@ -0,0 +1,58 @@
+package org.apache.ambari.infra.job.archive;
+
+import org.junit.Test;
+
+import java.util.HashMap;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+/*
+ * 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.
+ */
+
+public class FileNameSuffixFormatterTest {
+
+ private FileNameSuffixFormatter formatter = new FileNameSuffixFormatter("logtime", "yyyy-MM-dd'T'hh-mm-ss-SSSX");
+
+ @Test(expected = NullPointerException.class)
+ public void testFormatWhenDocumentIsNullThrowingException() throws Exception {
+ formatter.format(null);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testFormatWhenSpecifiedColumnDoesNotExistsInTheDocumentThrowingException() throws Exception {
+ formatter.format(new Document(new HashMap<>()));
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testFormatWhenSpecifiedColumnContainsBlankValueThrowingException() throws Exception {
+ formatter.format(new Document(new HashMap<String, String>() {{ put("logtime", " "); }}));
+ }
+
+ @Test
+ public void testFormatWhenNoDateFormatSpecifiedRawColumnValueReturned() throws Exception {
+ FileNameSuffixFormatter formatter = new FileNameSuffixFormatter("logtime", null);
+ assertThat(formatter.format(new Document(new HashMap<String, String>() {{ put("logtime", "Monday"); }})), is("Monday"));
+ }
+
+ @Test
+ public void testFormatWhenDateFormatIsSpecifiedAFormattedValueReturned() throws Exception {
+ assertThat(formatter.format(new Document(new HashMap<String, String>() {{ put("logtime", "2017-12-15T10:12:33.453Z"); }})), is("2017-12-15T10-12-33-453Z"));
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/archive/LocalDocumentItemWriterTest.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/archive/LocalDocumentItemWriterTest.java b/ambari-infra/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/archive/LocalDocumentItemWriterTest.java
index 3af93bc..85e79e1 100644
--- a/ambari-infra/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/archive/LocalDocumentItemWriterTest.java
+++ b/ambari-infra/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/archive/LocalDocumentItemWriterTest.java
@@ -32,10 +32,13 @@ import org.junit.runner.RunWith;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
+import static org.easymock.EasyMock.cmp;
import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.LogicalOperator.EQUAL;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
@@ -44,6 +47,7 @@ public class LocalDocumentItemWriterTest extends EasyMockSupport {
private static final Document DOCUMENT = new Document(new HashMap<String, String>() {{ put("id", "1"); }});
private static final Document DOCUMENT2 = new Document(new HashMap<String, String>() {{ put("id", "2"); }});
+ private static final Document DOCUMENT3 = new Document(new HashMap<String, String>() {{ put("id", "3"); }});
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
private LocalDocumentItemWriter localDocumentItemWriter;
@@ -65,17 +69,30 @@ public class LocalDocumentItemWriterTest extends EasyMockSupport {
@Test
public void testWrite() throws Exception {
- itemWriterListener.onCompleted(outFile); expectLastCall();
+ itemWriterListener.onCompleted(
+ cmp(new WriteCompletedEvent(outFile, DOCUMENT, DOCUMENT3), writeCompletedEventEqualityComparator(), EQUAL)); expectLastCall();
replayAll();
localDocumentItemWriter.write(DOCUMENT);
localDocumentItemWriter.write(DOCUMENT2);
+ localDocumentItemWriter.write(DOCUMENT3);
localDocumentItemWriter.close();
List<Document> documentList = readBack(outFile);
- assertThat(documentList.size(), is(2));
+ assertThat(documentList.size(), is(3));
assertThat(documentList.get(0).get("id"), is(DOCUMENT.get("id")));
assertThat(documentList.get(1).get("id"), is(DOCUMENT2.get("id")));
+ assertThat(documentList.get(2).get("id"), is(DOCUMENT3.get("id")));
+ }
+
+ private Comparator<WriteCompletedEvent> writeCompletedEventEqualityComparator() {
+ return (o1, o2) -> {
+ if (o1.getOutFile().equals(o2.getOutFile()) &&
+ o1.getFirstDocument().equals(o2.getFirstDocument()) &&
+ o1.getLastDocument().equals(o2.getLastDocument()))
+ return 0;
+ return 1;
+ };
}
private List<Document> readBack(File file) throws IOException {
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/archive/SolrParametrizedStringTest.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/archive/SolrParametrizedStringTest.java b/ambari-infra/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/archive/SolrParametrizedStringTest.java
new file mode 100644
index 0000000..018c993
--- /dev/null
+++ b/ambari-infra/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/archive/SolrParametrizedStringTest.java
@@ -0,0 +1,57 @@
+package org.apache.ambari.infra.job.archive;
+
+import org.junit.Test;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+
+/*
+ * 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.
+ */
+public class SolrParametrizedStringTest {
+
+ private static final Map<String, String> PARAMETERS_1 = new HashMap<String, String>() {{ put("id", "1"); put("name", "User"); put("product", "Computer"); }};
+ private static final Map<String, String> PARAMETERS_START = new HashMap<String, String>() {{ put("price", "1000"); }};
+ private static final Map<String, String> PARAMETERS_END = new HashMap<String, String>() {{ put("price", "2000"); }};
+
+ @Test
+ public void testToStringEmptyStringResultsEmptyString() {
+ assertThat(new SolrParametrizedString("").set(PARAMETERS_1).toString(), is(""));
+ }
+
+ @Test
+ public void testParameterlessStringResultsItself() {
+ assertThat(new SolrParametrizedString("Hello World!").set(PARAMETERS_1).toString(), is("Hello World!"));
+ }
+
+ @Test
+ public void testParametersAreReplacedIfFoundInString() {
+ assertThat(new SolrParametrizedString("Hello ${name}!").set(PARAMETERS_1).toString(), is("Hello User!"));
+ }
+
+ @Test
+ public void testWhenStringContainsPrefixedParamtersOnlyPrefixedParametersAreSet() {
+ assertThat(new SolrParametrizedString("The ${product} price is between $${start.price} and $${end.price}.")
+ .set(PARAMETERS_1)
+ .set("start", PARAMETERS_START)
+ .set("end", PARAMETERS_END).toString(), is("The Computer price is between $1000 and $2000."));
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/archive/SolrPropertiesTest.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/archive/SolrPropertiesTest.java b/ambari-infra/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/archive/SolrPropertiesTest.java
new file mode 100644
index 0000000..be8a226
--- /dev/null
+++ b/ambari-infra/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/archive/SolrPropertiesTest.java
@@ -0,0 +1,54 @@
+package org.apache.ambari.infra.job.archive;
+
+import org.junit.Test;
+import org.springframework.batch.core.JobParameters;
+import org.springframework.batch.core.JobParametersBuilder;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+/*
+ * 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.
+ */
+public class SolrPropertiesTest {
+ @Test
+ public void testApplySortColumns() throws Exception {
+ JobParameters jobParameters = new JobParametersBuilder()
+ .addString("sortColumn[0]", "logtime")
+ .addString("sortColumn[1]", "id")
+ .toJobParameters();
+
+ SolrProperties solrProperties = new SolrProperties();
+ solrProperties.setSortColumn(new String[] {"testColumn"});
+ solrProperties.apply(jobParameters);
+ assertThat(solrProperties.getSortColumn().length, is(2));
+ assertThat(solrProperties.getSortColumn()[0], is("logtime"));
+ assertThat(solrProperties.getSortColumn()[1], is("id"));
+ }
+
+ @Test
+ public void testApplyWhenNoSortIsDefined() throws Exception {
+ JobParameters jobParameters = new JobParametersBuilder()
+ .toJobParameters();
+
+ SolrProperties solrProperties = new SolrProperties();
+ solrProperties.setSortColumn(new String[] {"testColumn"});
+ solrProperties.apply(jobParameters);
+ assertThat(solrProperties.getSortColumn().length, is(1));
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/archive/SolrQueryBuilderTest.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/archive/SolrQueryBuilderTest.java b/ambari-infra/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/archive/SolrQueryBuilderTest.java
index e9513dc..ee08279 100644
--- a/ambari-infra/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/archive/SolrQueryBuilderTest.java
+++ b/ambari-infra/ambari-infra-manager/src/test/java/org/apache/ambari/infra/job/archive/SolrQueryBuilderTest.java
@@ -21,15 +21,10 @@ package org.apache.ambari.infra.job.archive;
import org.apache.solr.client.solrj.SolrQuery;
import org.junit.Test;
-import java.util.ArrayList;
import java.util.HashMap;
-import java.util.List;
-import java.util.regex.Matcher;
-import static org.apache.ambari.infra.job.archive.SolrQueryBuilder.PARAMETER_PATTERN;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
-import static org.hamcrest.Matchers.hasSize;
import static org.junit.Assert.assertThat;
public class SolrQueryBuilderTest {
@@ -46,40 +41,40 @@ public class SolrQueryBuilderTest {
}
@Test
- public void testSetQuery() throws Exception {
+ public void testSetQueryReplacesTheDefaultQueryTextAndParameterPlaceholdersAreReplacedToValues() throws Exception {
SolrQuery solrQuery = new SolrQueryBuilder()
.setQueryText("logtime:[* TO ${end}]")
- .setEndValue("2017-11-27'T'10:12:11.372Z")
+ .setInterval(null, "2017-11-27'T'10:12:11.372Z")
.build();
- assertThat(solrQuery.getQuery(), is("logtime:[* TO \"2017-11-27'T'10:12:11.372Z\"]"));
+ assertThat(solrQuery.getQuery(), is("logtime:[* TO 2017\\-11\\-27'T'10\\:12\\:11.372Z]"));
}
@Test
- public void testSetFilterQuery() throws Exception {
+ public void testSetFilterQueryAddsAFilterQueryAndParameterPlaceholdersAreReplacedToValues() throws Exception {
SolrQuery solrQuery = new SolrQueryBuilder()
.setFilterQueryText("(logtime:${logtime} AND id:{${id} TO *]) OR logtime:{${logtime} TO ${end}]")
.setDocument(DOCUMENT)
- .setEndValue("2017-11-27'T'10:12:11.372Z")
+ .setInterval(null, "2017-11-27'T'10:12:11.372Z")
.build();
- assertThat(solrQuery.getFilterQueries()[0], is("(logtime:\"2017-10-02'T'10:00:11.634Z\" AND id:{\"1\" TO *]) OR logtime:{\"2017-10-02'T'10:00:11.634Z\" TO \"2017-11-27'T'10:12:11.372Z\"]"));
+ assertThat(solrQuery.getFilterQueries()[0], is( "(logtime:2017\\-10\\-02'T'10\\:00\\:11.634Z AND id:{1 TO *]) OR logtime:{2017\\-10\\-02'T'10\\:00\\:11.634Z TO 2017\\-11\\-27'T'10\\:12\\:11.372Z]"));
}
@Test
public void testSetFilterQueryWhenDocumentIsNull() throws Exception {
SolrQuery solrQuery = new SolrQueryBuilder()
.setFilterQueryText("(logtime:\"${logtime}\" AND id:{\"${id}\" TO *]) OR logtime:{\"${logtime}\" TO \"${end}\"]")
- .setEndValue("2017-11-27'T'10:12:11.372Z")
+ .setInterval(null, "2017-11-27'T'10:12:11.372Z")
.build();
assertThat(solrQuery.getFilterQueries(), is(nullValue()));
}
@Test
- public void testSetFilterQueryWhenEndValueIsNull() throws Exception {
+ public void testNullEndValueDoesNotAffectFilterQuery() throws Exception {
SolrQuery solrQuery = new SolrQueryBuilder()
.setFilterQueryText("logtime:${logtime} AND id:{${id} TO *]")
.setDocument(DOCUMENT)
.build();
- assertThat(solrQuery.getFilterQueries()[0], is("logtime:\"2017-10-02'T'10:00:11.634Z\" AND id:{\"1\" TO *]"));
+ assertThat(solrQuery.getFilterQueries()[0], is("logtime:2017\\-10\\-02'T'10\\:00\\:11.634Z AND id:{1 TO *]"));
}
@Test
@@ -91,20 +86,6 @@ public class SolrQueryBuilderTest {
}
@Test
- public void testRegex() throws Exception {
- Matcher matcher = PARAMETER_PATTERN.matcher("(logtime:\"${logtime}\" AND id:{\"${id}\" TO *]) OR logtime:{\"${logtime}\" TO \"${end}\"]");
- List<String> parameters = new ArrayList<>();
- while (matcher.find())
- parameters.add(matcher.group());
-
- assertThat(parameters, hasSize(4));
- assertThat(parameters.get(0), is("${logtime}"));
- assertThat(parameters.get(1), is("${id}"));
- assertThat(parameters.get(2), is("${logtime}"));
- assertThat(parameters.get(3), is("${end}"));
- }
-
- @Test
public void testSort() throws Exception {
SolrQuery solrQuery = new SolrQueryBuilder().addSort("logtime", "id").build();
assertThat(solrQuery.getSorts().get(0).getItem(), is("logtime"));
@@ -113,7 +94,7 @@ public class SolrQueryBuilderTest {
@Test
public void test_start_and_end_values_are_given() throws Exception {
- SolrQuery solrQuery = new SolrQueryBuilder().setQueryText("id:[${start} TO ${end}]").setInterval("10", "13").build();
+ SolrQuery solrQuery = new SolrQueryBuilder().setQueryText("id:[\"${start}\" TO \"${end}\"]").setInterval("10", "13").build();
assertThat(solrQuery.getQuery(), is("id:[\"10\" TO \"13\"]"));
}
[49/50] [abbrv] ambari git commit: AMBARI-22670 Ambari 3.0: Implement
new design for Admin View: Integrate visual-search box. (atkach)
Posted by rl...@apache.org.
AMBARI-22670 Ambari 3.0: Implement new design for Admin View: Integrate visual-search box. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/72657b6f
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/72657b6f
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/72657b6f
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 72657b6f3888654266a4359089bf9ea8b6c97b6b
Parents: b171ae3
Author: Andrii Tkach <at...@apache.org>
Authored: Tue Dec 19 14:53:08 2017 +0200
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Fri Jan 5 17:54:17 2018 -0500
----------------------------------------------------------------------
.../main/resources/ui/admin-web/app/index.html | 1 +
.../controllers/ambariViews/ViewsListCtrl.js | 104 +++--
.../remoteClusters/RemoteClustersListCtrl.js | 3 +-
.../stackVersions/StackVersionsListCtrl.js | 1 +
.../app/scripts/directives/comboSearch.js | 455 +++++++++++++++++++
.../ui/admin-web/app/styles/combo-search.css | 164 +++++++
.../resources/ui/admin-web/app/styles/main.css | 36 ++
.../app/views/ambariViews/viewsList.html | 45 +-
.../app/views/directives/comboSearch.html | 63 +++
.../app/views/remoteClusters/list.html | 2 +-
.../admin-web/app/views/stackVersions/list.html | 2 +-
.../ambariViews/ViewsListCtrl_test.js | 167 +++++++
.../test/unit/directives/comboSearch_test.js | 242 ++++++++++
13 files changed, 1201 insertions(+), 84 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/72657b6f/ambari-admin/src/main/resources/ui/admin-web/app/index.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/index.html b/ambari-admin/src/main/resources/ui/admin-web/app/index.html
index bf033e6..a1346ed 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/index.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/index.html
@@ -150,6 +150,7 @@
<script src="scripts/directives/PasswordVerify.js"></script>
<script src="scripts/directives/disabledTooltip.js"></script>
<script src="scripts/directives/editableList.js"></script>
+<script src="scripts/directives/comboSearch.js"></script>
<script src="scripts/services/Utility.js"></script>
<script src="scripts/services/UserConstants.js"></script>
<script src="scripts/services/User.js"></script>
http://git-wip-us.apache.org/repos/asf/ambari/blob/72657b6f/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsListCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsListCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsListCtrl.js
index 8b37dca..8c61a25 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsListCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsListCtrl.js
@@ -24,6 +24,29 @@ angular.module('ambariAdminConsole')
$scope.isLoading = false;
$scope.minInstanceForPagination = Settings.minRowsToShowPagination;
+ $scope.filters = [
+ {
+ key: 'short_url_name',
+ label: $t('common.name'),
+ options: []
+ },
+ {
+ key: 'url',
+ label: $t('urls.url'),
+ options: []
+ },
+ {
+ key: 'view_name',
+ label: $t('views.table.viewType'),
+ options: []
+ },
+ {
+ key: 'instance_name',
+ label: $t('urls.viewInstance'),
+ options: []
+ }
+ ];
+
function checkViewVersionStatus(view, versionObj, versionNumber) {
var deferred = View.checkViewVersionStatus(view.view_name, versionNumber);
@@ -66,27 +89,13 @@ angular.module('ambariAdminConsole')
$scope.instances.push(instance.ViewInstanceInfo);
});
});
- initTypeFilter();
+ $scope.initFilterOptions();
$scope.filterInstances();
}).catch(function (data) {
Alert.error($t('views.alerts.cannotLoadViews'), data.data.message);
});
}
- function initTypeFilter() {
- var uniqTypes = $.unique($scope.instances.map(function(instance) {
- return instance.view_name;
- }));
- $scope.typeFilterOptions = [ { label: $t('common.all'), value: '*'} ]
- .concat(uniqTypes.map(function(type) {
- return {
- label: type,
- value: type
- };
- }));
- $scope.instanceTypeFilter = $scope.typeFilterOptions[0];
- }
-
function showInstancesOnPage() {
var startIndex = ($scope.currentPage - 1) * $scope.instancesPerPage + 1;
var endIndex = $scope.currentPage * $scope.instancesPerPage;
@@ -110,11 +119,7 @@ angular.module('ambariAdminConsole')
$scope.instances = [];
$scope.instancesPerPage = 10;
$scope.currentPage = 1;
- $scope.instanceNameFilter = '';
- $scope.instanceUrlFilter = '';
$scope.maxVisiblePages = 10;
- $scope.isNotEmptyFilter = true;
- $scope.instanceTypeFilter = '';
$scope.tableInfo = {
filtered: 0,
showed: 0
@@ -122,25 +127,46 @@ angular.module('ambariAdminConsole')
loadViews();
- $scope.filterInstances = function() {
+ $scope.initFilterOptions = function() {
+ $scope.filters.forEach(function(filter) {
+ filter.options = $.unique($scope.instances.map(function(instance) {
+ if (filter.key === 'url') {
+ return '/main/view/' + instance.view_name + '/' + instance.short_url;
+ }
+ return instance[filter.key];
+ })).map(function(item) {
+ return {
+ key: item,
+ label: item
+ }
+ });
+ });
+ };
+
+ $scope.filterInstances = function(appliedFilters) {
var filteredCount = 0;
angular.forEach($scope.instances, function(instance) {
- if ($scope.instanceNameFilter && instance.short_url_name.indexOf($scope.instanceNameFilter) === -1) {
- return instance.isFiltered = false;
- }
- if ($scope.instanceUrlFilter && ('/main/view/'+ instance.view_name + '/' + instance.short_url).indexOf($scope.instanceUrlFilter) === -1) {
- return instance.isFiltered = false;
- }
- if ($scope.instanceTypeFilter.value !== '*' && instance.view_name.indexOf($scope.instanceTypeFilter.value) === -1) {
- return instance.isFiltered = false;
- }
- filteredCount++;
- instance.isFiltered = true;
+ instance.isFiltered = !(appliedFilters && appliedFilters.length > 0 && appliedFilters.some(function(filter) {
+ if (filter.key === 'url') {
+ return filter.values.every(function(value) {
+ return ('/main/view/' + instance.view_name + '/' + instance.short_url).indexOf(value) === -1;
+ });
+ }
+ return filter.values.every(function(value) {
+ return instance[filter.key].indexOf(value) === -1;
+ });
+ }));
+
+ filteredCount += ~~instance.isFiltered;
});
$scope.tableInfo.filtered = filteredCount;
$scope.resetPagination();
};
+ $scope.toggleSearchBox = function() {
+ $('.search-box-button .popup-arrow-up, .search-box-row').toggleClass('hide');
+ };
+
$scope.pageChanged = function() {
showInstancesOnPage();
};
@@ -150,22 +176,6 @@ angular.module('ambariAdminConsole')
showInstancesOnPage();
};
- $scope.clearFilters = function () {
- $scope.instanceNameFilter = '';
- $scope.instanceUrlFilter = '';
- $scope.instanceTypeFilter = $scope.typeFilterOptions[0];
- $scope.resetPagination();
- };
-
- $scope.$watch(
- function (scope) {
- return Boolean(scope.instanceNameFilter || scope.instanceUrlFilter || (scope.instanceTypeFilter && scope.instanceTypeFilter.value !== '*'));
- },
- function (newValue, oldValue, scope) {
- scope.isNotEmptyFilter = newValue;
- }
- );
-
$scope.cloneInstance = function(instanceClone) {
$scope.createInstance(instanceClone);
};
http://git-wip-us.apache.org/repos/asf/ambari/blob/72657b6f/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/remoteClusters/RemoteClustersListCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/remoteClusters/RemoteClustersListCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/remoteClusters/RemoteClustersListCtrl.js
index 9d47307..4726357 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/remoteClusters/RemoteClustersListCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/remoteClusters/RemoteClustersListCtrl.js
@@ -18,9 +18,10 @@
'use strict';
angular.module('ambariAdminConsole')
-.controller('RemoteClustersListCtrl', ['$scope', '$routeParams', '$translate', 'RemoteCluster', function ($scope, $routeParams, $translate, RemoteCluster) {
+.controller('RemoteClustersListCtrl', ['$scope', '$routeParams', '$translate', 'RemoteCluster', 'Settings', function ($scope, $routeParams, $translate, RemoteCluster, Settings) {
var $t = $translate.instant;
+ $scope.minInstanceForPagination = Settings.minRowsToShowPagination;
$scope.clusterName = $routeParams.clusterName;
$scope.isLoading = false;
http://git-wip-us.apache.org/repos/asf/ambari/blob/72657b6f/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsListCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsListCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsListCtrl.js
index 003d472..ae00978 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsListCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsListCtrl.js
@@ -23,6 +23,7 @@ angular.module('ambariAdminConsole')
$scope.getConstant = function (key) {
return $t(key).toLowerCase();
};
+ $scope.minInstanceForPagination = Settings.minRowsToShowPagination;
$scope.isLoading = false;
$scope.clusterName = $routeParams.clusterName;
$scope.filter = {
http://git-wip-us.apache.org/repos/asf/ambari/blob/72657b6f/ambari-admin/src/main/resources/ui/admin-web/app/scripts/directives/comboSearch.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/directives/comboSearch.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/directives/comboSearch.js
new file mode 100644
index 0000000..af25167
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/directives/comboSearch.js
@@ -0,0 +1,455 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+'use strict';
+
+angular.module('ambariAdminConsole')
+.directive('comboSearch', function() {
+ return {
+ restrict: 'E',
+ templateUrl: 'views/directives/comboSearch.html',
+ scope: {
+ suggestions: '=',
+ filterChange: '=',
+ placeholder: '@',
+ supportCategories: '@'
+ },
+ controller: ['$scope', function($scope) {
+ return {
+ suggestions: $scope.suggestions,
+ placeholder: $scope.placeholder,
+ filterChange: $scope.filterChange,
+ supportCategories: $scope.supportCategories === "true"
+ }
+ }],
+ link: function($scope, $elem, $attr, $ctrl) {
+ var idCounter = 1;
+ var suggestions = $ctrl.suggestions;
+ var supportCategories = $ctrl.supportCategories;
+ var mainInputElement = $elem.find('.main-input.combo-search-input');
+ $scope.paceholder = $ctrl.placeholder;
+ $scope.searchFilterInput = '';
+ $scope.filterSuggestions = [];
+ $scope.showAutoComplete = false;
+ $scope.appliedFilters = [];
+
+ attachInputWidthSetter(mainInputElement);
+ initKeyHandlers();
+ initBlurHandler();
+
+ $scope.$watch(function () {
+ return $scope.appliedFilters.length;
+ }, function () {
+ attachInputWidthSetter($elem.find('.combo-search-input'));
+ });
+
+ $scope.removeFilter = function(filter) {
+ $scope.appliedFilters = $scope.appliedFilters.filter(function(item) {
+ return filter.id !== item.id;
+ });
+ $scope.observeSearchFilterInput(event);
+ mainInputElement.focus();
+ $scope.updateFilters($scope.appliedFilters);
+ };
+
+ $scope.clearFilters = function() {
+ $scope.appliedFilters = [];
+ $scope.updateFilters($scope.appliedFilters);
+ };
+
+ $scope.selectFilter = function(filter, event) {
+ var newAppliedFilter = {
+ id: 'filter_' + idCounter++,
+ currentOption: null,
+ filteredOptions: [],
+ searchOptionInput: '',
+ key: filter.key,
+ label: filter.label,
+ options: filter.options || [],
+ showAutoComplete: false
+ };
+ $scope.appliedFilters.push(newAppliedFilter);
+ if (event) {
+ event.stopPropagation();
+ event.preventDefault();
+ }
+ $scope.isEditing = false;
+ $scope.showAutoComplete = false;
+ $scope.searchFilterInput = '';
+ _.debounce(function() {
+ $('input[name=' + newAppliedFilter.id + ']').focus().width(4);
+ }, 100)();
+ };
+
+ $scope.selectOption = function(event, option, filter) {
+ $('input[name=' + filter.id + ']').val(option.label).trigger('input');
+ filter.showAutoComplete = false;
+ mainInputElement.focus();
+ $scope.observeSearchFilterInput(event);
+ filter.currentOption = option;
+ $scope.updateFilters($scope.appliedFilters);
+ };
+
+ $scope.hideAutocomplete = function(filter) {
+ _.debounce(function() {
+ if (filter) {
+ filter.showAutoComplete = false;
+ } else {
+ if (!$scope.isEditing) {
+ $scope.showAutoComplete = false;
+ }
+ }
+ $scope.$apply();
+ }, 100)();
+ };
+
+ $scope.forceFocus = function(event, filter) {
+ $(event.currentTarget).find('.combo-search-input').focus();
+ $scope.showAutoComplete = false;
+ $scope.observeSearchOptionInput(filter);
+ event.stopPropagation();
+ event.preventDefault();
+ };
+
+ $scope.makeActive = function(active, all) {
+ if (active.isCategory) {
+ return false;
+ }
+ all.forEach(function(item) {
+ item.active = active.key === item.key;
+ });
+ };
+
+ $scope.observeSearchFilterInput = function(event) {
+ if (event) {
+ mainInputElement.focus();
+ $scope.isEditing = true;
+ event.stopPropagation();
+ event.preventDefault();
+ }
+
+ var filteredSuggestions = suggestions.filter(function(item) {
+ return (!$scope.searchFilterInput || item.label.toLowerCase().indexOf($scope.searchFilterInput.toLowerCase()) !== -1);
+ });
+ if (filteredSuggestions.length > 0) {
+ $scope.makeActive(filteredSuggestions[0], filteredSuggestions);
+ $scope.showAutoComplete = true;
+ } else {
+ $scope.showAutoComplete = false;
+ }
+ $scope.filterSuggestions = supportCategories ? formatCategorySuggestions(filteredSuggestions) : filteredSuggestions;
+ };
+
+ $scope.observeSearchOptionInput = function(filter) {
+ var appliedOptions = {};
+ $scope.appliedFilters.forEach(function(item) {
+ if (item.key === filter.key && item.currentOption) {
+ appliedOptions[item.currentOption.key] = true;
+ }
+ });
+
+ if (filter.currentOption && filter.currentOption.key !== filter.searchOptionInput) {
+ filter.currentOption = null;
+ }
+ filter.filteredOptions = filter.options.filter(function(option) {
+ return !(option.key === '' || option.key === undefined || appliedOptions[option.key])
+ && (!filter.searchOptionInput || option.label.toLowerCase().indexOf(filter.searchOptionInput.toLowerCase()) !== -1);
+ });
+ filter.showAutoComplete = filter.filteredOptions.length > 0;
+ if (filter.filteredOptions.length > 0) {
+ $scope.makeActive(filter.filteredOptions[0], filter.filteredOptions);
+ }
+ };
+
+ $scope.extractFilters = function(filters) {
+ var map = {};
+ var result = [];
+
+ filters.forEach(function(filter) {
+ if (filter.currentOption) {
+ if (!map[filter.key]) {
+ map[filter.key] = [];
+ }
+ map[filter.key].push(filter.currentOption.key);
+ }
+ });
+ for(var key in map) {
+ result.push({
+ key: key,
+ values: map[key]
+ });
+ }
+ return result;
+ };
+
+ $scope.updateFilters = function(appliedFilters) {
+ $ctrl.filterChange($scope.extractFilters(appliedFilters));
+ };
+
+ function formatCategorySuggestions(suggestions) {
+ var categories = {};
+ var result = [];
+ suggestions.forEach(function(item) {
+ if (!item.category) {
+ item.category = 'default';
+ }
+ if (!categories[item.category]) {
+ categories[item.category] = [];
+ }
+ categories[item.category].push(item);
+ });
+
+ for(var cat in categories) {
+ result.push({
+ key: cat,
+ label: cat,
+ isCategory: true,
+ isDefault: cat === 'default'
+ });
+ result = result.concat(categories[cat]);
+ }
+ return result;
+ }
+
+ function initBlurHandler() {
+ $(document).click(function() {
+ $scope.isEditing = false;
+ $scope.hideAutocomplete();
+ });
+ }
+
+ function findActiveByName(array, name) {
+ for (var i = 0; i < array.length; i++) {
+ if (array[i].id === name) {
+ return i;
+ }
+ }
+ return null;
+ }
+
+ function findActiveByProperty(array) {
+ for (var i = 0; i < array.length; i++) {
+ if (array[i].active) {
+ return i;
+ }
+ }
+ return 0;
+ }
+
+ function focusInput(filter) {
+ $('input[name=' + filter.id + ']').focus();
+ $scope.showAutoComplete = false;
+ $scope.observeSearchOptionInput(filter);
+ }
+
+ function initKeyHandlers() {
+ $(document).keydown(function(event) {
+ if (event.which === 13) { // "Enter" key
+ enterKeyHandler();
+ $scope.$apply();
+ }
+ if (event.which === 8) { // "Backspace" key
+ backspaceKeyHandler(event);
+ $scope.$apply();
+ }
+ if (event.which === 38) { // "Up" key
+ upKeyHandler();
+ $scope.$apply();
+ }
+ if (event.which === 40) { // "Down" key
+ downKeyHandler();
+ $scope.$apply();
+ }
+ if (event.which === 39) { // "Right Arrow" key
+ rightArrowKeyHandler();
+ $scope.$apply();
+ }
+ if (event.which === 37) { // "Left Arrow" key
+ leftArrowKeyHandler();
+ $scope.$apply();
+ }
+ });
+ }
+
+ function leftArrowKeyHandler() {
+ var activeElement = $(document.activeElement);
+ if (activeElement.is('input') && activeElement[0].selectionStart === 0) {
+ if (activeElement.hasClass('main-input')) {
+ focusInput($scope.appliedFilters[$scope.appliedFilters.length - 1]);
+ } else {
+ var activeIndex = findActiveByName($scope.appliedFilters, activeElement.attr('name'));
+ if (activeIndex !== null && activeIndex > 0) {
+ focusInput($scope.appliedFilters[activeIndex - 1]);
+ }
+ }
+ }
+ }
+
+ function rightArrowKeyHandler() {
+ var activeElement = $(document.activeElement);
+ if (activeElement.is('input') && activeElement[0].selectionStart === activeElement.val().length) {
+ if (!activeElement.hasClass('main-input')) {
+ var activeIndex = findActiveByName($scope.appliedFilters, activeElement.attr('name'));
+ if (activeIndex !== null) {
+ if (activeIndex === $scope.appliedFilters.length - 1) {
+ mainInputElement.focus();
+ $scope.observeSearchFilterInput();
+ } else {
+ focusInput($scope.appliedFilters[activeIndex + 1]);
+ }
+ }
+ }
+ }
+ }
+
+ function downKeyHandler() {
+ var activeIndex = 0;
+ var nextIndex = null;
+
+ if ($scope.showAutoComplete) {
+ activeIndex = findActiveByProperty($scope.filterSuggestions);
+ if (activeIndex < $scope.filterSuggestions.length - 1) {
+ if ($scope.filterSuggestions[activeIndex + 1].isCategory && activeIndex + 2 < $scope.filterSuggestions.length) {
+ nextIndex = activeIndex + 2;
+ } else {
+ nextIndex = activeIndex + 1;
+ }
+ } else {
+ nextIndex = ($scope.filterSuggestions[0].isCategory) ? 1 : 0;
+ }
+ if (nextIndex !== null) {
+ $scope.makeActive($scope.filterSuggestions[nextIndex], $scope.filterSuggestions);
+ }
+ } else {
+ var activeAppliedFilters = $scope.appliedFilters.filter(function(item) {
+ return item.showAutoComplete;
+ });
+ if (activeAppliedFilters.length > 0) {
+ var filteredOptions = activeAppliedFilters[0].filteredOptions;
+ activeIndex = findActiveByProperty(filteredOptions);
+ nextIndex = (activeIndex < filteredOptions.length - 1) ? activeIndex + 1 : 0;
+ }
+ if (nextIndex !== null) {
+ $scope.makeActive(filteredOptions[nextIndex], filteredOptions);
+ }
+ }
+ }
+
+ function upKeyHandler() {
+ var activeIndex = 0;
+ var nextIndex = null;
+
+ if ($scope.showAutoComplete) {
+ activeIndex = findActiveByProperty($scope.filterSuggestions);
+ if (activeIndex > 0) {
+ if ($scope.filterSuggestions[activeIndex - 1].isCategory) {
+ nextIndex = (activeIndex - 2 > 0) ? activeIndex - 2 : $scope.filterSuggestions.length - 1;
+ } else {
+ nextIndex = activeIndex - 1;
+ }
+ } else {
+ nextIndex = $scope.filterSuggestions.length - 1;
+ }
+ if (nextIndex !== null) {
+ $scope.makeActive($scope.filterSuggestions[nextIndex], $scope.filterSuggestions);
+ }
+ } else {
+ var activeAppliedFilters = $scope.appliedFilters.filter(function(item) {
+ return item.showAutoComplete;
+ });
+ if (activeAppliedFilters.length > 0) {
+ var filteredOptions = activeAppliedFilters[0].filteredOptions;
+ activeIndex = findActiveByProperty(filteredOptions);
+ nextIndex = (activeIndex > 0) ? activeIndex - 1 : filteredOptions.length - 1;
+ }
+ if (nextIndex !== null) {
+ $scope.makeActive(filteredOptions[nextIndex], filteredOptions);
+ }
+ }
+ }
+
+ function enterKeyHandler() {
+ if ($scope.showAutoComplete) {
+ var activeFilters = $scope.filterSuggestions.filter(function(item) {
+ return item.active;
+ });
+ if (activeFilters.length > 0) {
+ $scope.selectFilter(activeFilters[0]);
+ }
+ } else {
+ var activeAppliedFilters = $scope.appliedFilters.filter(function(item) {
+ return item.showAutoComplete;
+ });
+ if (activeAppliedFilters.length > 0) {
+ var activeOptions = activeAppliedFilters[0].filteredOptions.filter(function(item) {
+ return item.active;
+ });
+ if (activeOptions.length > 0) {
+ $scope.selectOption(null, activeOptions[0], activeAppliedFilters[0]);
+ }
+ } else {
+ $scope.appliedFilters.filter(function(item) {
+ return !item.currentOption;
+ }).forEach(function(item) {
+ if (item.searchOptionInput !== '') {
+ $scope.selectOption(null, {
+ key: item.searchOptionInput,
+ label: item.searchOptionInput
+ }, item);
+ }
+ });
+ }
+ }
+ }
+
+ function backspaceKeyHandler (event) {
+ if ($(document.activeElement).is('input') && $(document.activeElement)[0].selectionStart === 0) {
+ if ($(document.activeElement).hasClass('main-input') && $scope.appliedFilters.length > 0) {
+ var lastFilter = $scope.appliedFilters[$scope.appliedFilters.length - 1];
+ focusInput(lastFilter);
+ event.stopPropagation();
+ event.preventDefault();
+ } else {
+ var name = $(document.activeElement).attr('name');
+ var activeFilter = $scope.appliedFilters.filter(function(item) {
+ return name === item.id;
+ })[0];
+ if (activeFilter) {
+ $scope.removeFilter(activeFilter);
+ }
+ }
+ }
+ }
+
+ function attachInputWidthSetter(element) {
+ var textPadding = 4;
+ element.on('input', function() {
+ var inputWidth = $(this).textWidth();
+ $(this).css({
+ width: inputWidth + textPadding
+ })
+ }).trigger('input');
+ }
+ }
+ };
+});
+
+$.fn.textWidth = function(text, font) {
+ if (!$.fn.textWidth.fakeEl) $.fn.textWidth.fakeEl = $('<span>').hide().appendTo(document.body);
+ $.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
+ return $.fn.textWidth.fakeEl.width();
+};
http://git-wip-us.apache.org/repos/asf/ambari/blob/72657b6f/ambari-admin/src/main/resources/ui/admin-web/app/styles/combo-search.css
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/styles/combo-search.css b/ambari-admin/src/main/resources/ui/admin-web/app/styles/combo-search.css
new file mode 100644
index 0000000..ee9909c
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/styles/combo-search.css
@@ -0,0 +1,164 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+.combo-search .combo-search-inner {
+ position: relative;
+ border: 1px solid #ccc;
+ border-radius: 4px;
+ box-shadow: 0 0 1px #fff inset;
+ min-height: 34px;
+ line-height: 1em;
+ cursor: text;
+ padding-right: 30px;
+}
+
+.combo-search .combo-search-close {
+ font-size: 13px;
+ color: #999;
+ position: absolute;
+ right: 10px;
+ top: 30%;
+ cursor: pointer;
+}
+.combo-search .combo-search-close:hover {
+ color: #333;
+}
+.combo-search .combo-search-input {
+ background: transparent;
+ display: inline-block;
+ min-width: 4px;
+ width: 4px;
+ line-height: 10px;
+ height: 100%;
+ border: none;
+ outline: none;
+ margin-left: 1px;
+}
+
+.combo-search .combo-search-input-wrapper {
+ display: inline-block;
+ position: relative;
+ height: 32px;
+ margin-left: 5px;
+}
+
+.combo-search .combo-search-content {
+ display: inline-block;
+}
+
+.combo-search .combo-search-dropdown {
+ position: absolute;
+ border: 1px solid #ccc;
+ border-radius: 4px;
+ background-color: #fff;
+ cursor: pointer;
+ z-index: 10;
+ padding: 0;
+ margin: 0;
+ width: auto;
+ min-width: 80px;
+ max-width: 220px;
+ max-height: 240px;
+ overflow-y: auto;
+ overflow-x: hidden;
+ font-size: 13px;
+ top: 30px;
+ left: 5px;
+ box-shadow: 3px 4px 5px -2px rgba(0, 0, 0, 0.5);
+}
+
+.combo-search .combo-search-dropdown ul {
+ max-height: 250px;
+ list-style: none;
+ padding: 0;
+ margin: 0;
+}
+
+.combo-search .filter a {
+ display: block;
+ width: auto;
+ text-decoration: none;
+ color: initial;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ background: none;
+ border: none;
+ padding: 3px 10px 5px 5px;
+}
+
+.combo-search .category a {
+ display: block;
+ width: auto;
+ text-decoration: none;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ padding: 3px 10px 5px 5px;
+ text-transform: capitalize;
+ font-size: 11px;
+ font-weight: bold;
+ color: white;
+ cursor: default;
+ border-bottom: 1px solid #A2A2A2;
+ background-color: #B7B7B7;
+ text-shadow: 0 -1px 0 #999;
+}
+
+.combo-search .filter a.active {
+ background-color: #ddd;
+}
+
+.combo-search .combo-search-applied-filter {
+ position: relative;
+ display: inline-block;
+ padding: 0 3px 0 18px;
+ background-color: #dddddd;
+ border-radius: 4px;
+ margin: 4px 0 0 4px;
+ vertical-align: top;
+ border: 1px solid #d2d2d2;
+}
+
+.combo-search .combo-search-applied-filter i {
+ position: absolute;
+ left: 5px;
+ font-size: 12px;
+ top: 5px;
+ color: #999;
+ cursor: pointer;
+}
+
+.combo-search .combo-search-applied-filter i:hover {
+ color: #333;
+}
+
+.combo-search .combo-search-applied-filter span,
+.combo-search .combo-search-applied-filter input {
+ color: #666;
+ font-size: 11px;
+}
+
+.combo-search .combo-search-applied-filter span {
+ font-weight: bold;
+}
+
+.combo-search .combo-search-applied-filter .combo-search-input-wrapper {
+ height: 22px;
+ margin-left: 0;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/72657b6f/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css b/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
index b4aa558..8f693a8 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/styles/main.css
@@ -1331,3 +1331,39 @@ th.entity-actions {
.entity-actions a:focus:hover {
text-decoration: none;
}
+
+.search-box-button {
+ position: relative;
+ margin-right: 5px;
+}
+
+.search-box-button .btn {
+ padding: 10px;
+}
+
+.search-box-row {
+ padding-top: 15px;
+ padding-bottom: 5px;
+}
+
+.popup-arrow-up {
+ background: inherit;
+ z-index: 1;
+ left: 6px;
+ position: absolute;
+ width: 24px;
+ height: 16px;
+ overflow: hidden;
+}
+
+.popup-arrow-up:after {
+ content: "";
+ position: absolute;
+ width: 20px;
+ height: 20px;
+ background: #fff;
+ transform: rotate(45deg);
+ top: 10px;
+ left: 2px;
+ box-shadow: -2px -2px 10px -3px rgba(0, 0, 0, 0.5);
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/72657b6f/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/viewsList.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/viewsList.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/viewsList.html
index ae57b86..9e9cb55 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/viewsList.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/viewsList.html
@@ -24,11 +24,21 @@
{{'views.create' | translate}}
</button>
</div>
+ <div class="search-box-button pull-right">
+ <button class="btn btn-default" ng-click="toggleSearchBox()">
+ <i class="fa fa-filter" aria-hidden="true"></i>
+ </button>
+ <div class="popup-arrow-up hide"></div>
+ </div>
+ </div>
+
+ <div class="search-box-row hide">
+ <combo-search suggestions="filters" filter-change="filterInstances" placeholder="Search"></combo-search>
</div>
<table class="table table-striped table-hover">
<thead>
- <tr class="fix-bottom">
+ <tr>
<th class="col-md-2">
<span>{{'common.name' | translate}}</span>
</th>
@@ -45,39 +55,6 @@
<span>{{'common.actions' | translate}}</span>
</th>
</tr>
- <tr class="fix-top">
- <th>
- <div class="search-container">
- <input type="text" class="form-control" placeholder="{{'common.any' | translate}}"
- ng-model="instanceNameFilter" ng-change="filterInstances()">
- <button type="button" class="close clearfilter" ng-show="instanceNameFilter"
- ng-click="instanceNameFilter=''; filterInstances()">
- <span aria-hidden="true">×</span>
- <span class="sr-only">{{'common.controls.close' | translate}}</span>
- </button>
- </div>
- </th>
- <th>
- <div class="search-container">
- <input type="text" class="form-control" placeholder="{{'common.any' | translate}}"
- ng-model="instanceUrlFilter" ng-change="filterInstances()">
- <button type="button" class="close clearfilter" ng-show="instanceUrlFilter"
- ng-click="instanceUrlFilter=''; filterInstances()">
- <span aria-hidden="true">×</span>
- <span class="sr-only">{{'common.controls.close' | translate}}</span>
- </button>
- </div>
- </th>
- <th>
- <select class="form-control typefilter v-small-input"
- ng-model="instanceTypeFilter"
- ng-options="item.label for item in typeFilterOptions"
- ng-change="filterInstances()">
- </select>
- </th>
- <th></th>
- <th></th>
- </tr>
</thead>
<tbody>
http://git-wip-us.apache.org/repos/asf/ambari/blob/72657b6f/ambari-admin/src/main/resources/ui/admin-web/app/views/directives/comboSearch.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/directives/comboSearch.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/directives/comboSearch.html
new file mode 100644
index 0000000..a4fdfc2
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/directives/comboSearch.html
@@ -0,0 +1,63 @@
+<!--
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+-->
+
+<div class="combo-search">
+ <div class="combo-search-inner" ng-click="observeSearchFilterInput($event)">
+ <div class="combo-search-applied-filter" ng-repeat="filter in appliedFilters" ng-click="forceFocus($event, filter)">
+ <i class="fa fa-times-circle" ng-click="removeFilter(filter)"></i>
+ <span>{{filter.label}}:</span>
+ <div class="combo-search-input-wrapper">
+ <input type="text"
+ autocomplete="off"
+ ng-attr-name="{{filter.id}}"
+ class="combo-search-input"
+ ng-model="filter.searchOptionInput"
+ ng-change="observeSearchOptionInput(filter)"
+ ng-blur="hideAutocomplete(filter)"/>
+ <div class="combo-search-dropdown" ng-show="filter.showAutoComplete">
+ <ul>
+ <li ng-repeat="item in filter.filteredOptions" class="filter">
+ <a ng-click="selectOption($event, item, filter)"
+ ng-class="{active: item.active}"
+ ng-mouseover="makeActive(item, filter.filteredOptions)">{{item.label}}</a>
+ </li>
+ </ul>
+ </div>
+ </div>
+ </div>
+ <div class="combo-search-input-wrapper">
+ <input type="text"
+ autocomplete="off"
+ placeholder="{{appliedFilters.length === 0 ? placeholder : ''}}"
+ class="combo-search-input main-input"
+ ng-model="searchFilterInput"
+ ng-change="observeSearchFilterInput()"/>
+ <div class="combo-search-dropdown" ng-show="showAutoComplete">
+ <ul>
+ <li ng-repeat="item in filterSuggestions"
+ ng-class="{category: item.isCategory, filter: !item.isCategory, hide: (item.isCategory && item.isDefault)}">
+ <a ng-click="selectFilter(item, $event)"
+ ng-class="{active: item.active}"
+ ng-mouseover="makeActive(item, filterSuggestions)">{{item.label}}</a>
+ </li>
+ </ul>
+ </div>
+ </div>
+ <i class="combo-search-close fa fa-times-circle" ng-show="appliedFilters.length" ng-click="clearFilters()"></i>
+ </div>
+</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/72657b6f/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/list.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/list.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/list.html
index 67d650e..7a8e6f4 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/list.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/list.html
@@ -61,7 +61,7 @@
<div class="alert empty-table-alert col-sm-12" ng-show="!remoteClusters.length && !isLoading">
{{'common.alerts.noRemoteClusterDisplay' | translate}}
</div>
- <div class="col-sm-12 table-bar">
+ <div class="col-sm-12 table-bar" ng-show="tableInfo.total >= minInstanceForPagination">
<div class="pull-left filtered-info">
<span>{{'common.filterInfo' | translate:{showed: tableInfo.showed, total: tableInfo.total, term: constants.groups} }}</span>
<span ng-show="isNotEmptyFilter">- <a href ng-click="clearFilters()">{{'common.controls.clearFilters' | translate}}</a></span>
http://git-wip-us.apache.org/repos/asf/ambari/blob/72657b6f/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html
index 279343b..9d81543 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html
@@ -123,7 +123,7 @@
<div class="alert empty-table-alert col-sm-12" ng-show="!repos.length && !isLoading">
{{'common.alerts.nothingToDisplay' | translate:{term: getConstant("common.version")} }}
</div>
- <div class="col-sm-12 table-bar">
+ <div class="col-sm-12 table-bar" ng-show="tableInfo.total >= minInstanceForPagination">
<div class="pull-left filtered-info">
<span>{{'common.filterInfo' | translate:{showed: tableInfo.showed, total: tableInfo.total, term: getConstant("common.versions")} }}</span>
<span ng-show="isNotEmptyFilter">- <a href ng-click="clearFilters()">{{'common.controls.clearFilters' | translate}}</a></span>
http://git-wip-us.apache.org/repos/asf/ambari/blob/72657b6f/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/ambariViews/ViewsListCtrl_test.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/ambariViews/ViewsListCtrl_test.js b/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/ambariViews/ViewsListCtrl_test.js
new file mode 100644
index 0000000..362b94a
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/ambariViews/ViewsListCtrl_test.js
@@ -0,0 +1,167 @@
+/**
+ * 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.
+ */
+
+describe('#Cluster', function () {
+ describe('ViewsListCtrl', function() {
+ var scope, ctrl;
+
+ beforeEach(function () {
+ module('ambariAdminConsole');
+ inject(function($rootScope, $controller) {
+ scope = $rootScope.$new();
+ ctrl = $controller('ViewsListCtrl', {$scope: scope});
+ });
+ scope.instances = [
+ {
+ short_url_name: 'sun1',
+ url: 'url1',
+ view_name: 'vn1',
+ instance_name: 'in1',
+ short_url: 'su1'
+ },
+ {
+ short_url_name: 'sun2',
+ url: 'url2',
+ view_name: 'vn2',
+ instance_name: 'in2',
+ short_url: 'su2'
+ }
+ ];
+ });
+
+ describe('#initFilterOptions()', function () {
+ beforeEach(function() {
+ scope.initFilterOptions();
+ });
+
+ it('should fill short_url_name options', function() {
+ expect(scope.filters[0].options).toEqual([
+ {
+ key: 'sun1',
+ label: 'sun1'
+ },
+ {
+ key: 'sun2',
+ label: 'sun2'
+ }
+ ]);
+ });
+
+ it('should fill url options', function() {
+ expect(scope.filters[1].options).toEqual([
+ {
+ key: '/main/view/vn1/su1',
+ label: '/main/view/vn1/su1'
+ },
+ {
+ key: '/main/view/vn2/su2',
+ label: '/main/view/vn2/su2'
+ }
+ ]);
+ });
+
+ it('should fill view_name options', function() {
+ expect(scope.filters[2].options).toEqual([
+ {
+ key: 'vn1',
+ label: 'vn1'
+ },
+ {
+ key: 'vn2',
+ label: 'vn2'
+ }
+ ]);
+ });
+
+ it('should fill instance_name options', function() {
+ expect(scope.filters[3].options).toEqual([
+ {
+ key: 'in1',
+ label: 'in1'
+ },
+ {
+ key: 'in2',
+ label: 'in2'
+ }
+ ]);
+ });
+ });
+
+
+ describe('#filterInstances', function() {
+ beforeEach(function() {
+ spyOn(scope, 'resetPagination');
+ });
+
+ it('all should be filtered when filters not applied', function() {
+ scope.filterInstances();
+ expect(scope.tableInfo.filtered).toEqual(2);
+ scope.filterInstances([]);
+ expect(scope.tableInfo.filtered).toEqual(2);
+ });
+
+ it('resetPagination should be called', function() {
+ scope.filterInstances();
+ expect(scope.resetPagination).toHaveBeenCalled();
+ });
+
+ it('one view should be filtered', function() {
+ var appliedFilters = [
+ {
+ key: 'view_name',
+ values: ['vn1']
+ }
+ ];
+ scope.filterInstances(appliedFilters);
+ expect(scope.tableInfo.filtered).toEqual(1);
+ expect(scope.instances[0].isFiltered).toBeTruthy();
+ expect(scope.instances[1].isFiltered).toBeFalsy();
+ });
+
+ it('two views should be filtered', function() {
+ var appliedFilters = [
+ {
+ key: 'view_name',
+ values: ['vn1', 'vn2']
+ }
+ ];
+ scope.filterInstances(appliedFilters);
+ expect(scope.tableInfo.filtered).toEqual(2);
+ expect(scope.instances[0].isFiltered).toBeTruthy();
+ expect(scope.instances[1].isFiltered).toBeTruthy();
+ });
+
+ it('one views should be filtered with combo filter', function() {
+ var appliedFilters = [
+ {
+ key: 'view_name',
+ values: ['vn1', 'vn2']
+ },
+ {
+ key: 'instance_name',
+ values: ['in2']
+ }
+ ];
+ scope.filterInstances(appliedFilters);
+ expect(scope.tableInfo.filtered).toEqual(1);
+ expect(scope.instances[0].isFiltered).toBeFalsy();
+ expect(scope.instances[1].isFiltered).toBeTruthy();
+ });
+ });
+ });
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/72657b6f/ambari-admin/src/main/resources/ui/admin-web/test/unit/directives/comboSearch_test.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/test/unit/directives/comboSearch_test.js b/ambari-admin/src/main/resources/ui/admin-web/test/unit/directives/comboSearch_test.js
new file mode 100644
index 0000000..9bc7083
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/test/unit/directives/comboSearch_test.js
@@ -0,0 +1,242 @@
+/**
+ * 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.
+ */
+
+describe('#comboSearch', function () {
+ var scope, element;
+
+ beforeEach(module('ambariAdminConsole'));
+ beforeEach(module('views/directives/comboSearch.html'));
+
+ beforeEach(inject(function($rootScope, $compile) {
+ scope = $rootScope.$new();
+
+ var preCompiledElement = '<combo-search suggestions="filters" filter-change="filterItems" placeholder="Search"></combo-search>';
+
+ scope.filters = [
+ {
+ key: 'f1',
+ label: 'filter1',
+ options: []
+ },
+ {
+ key: 'f2',
+ label: 'filter2',
+ options: []
+ }
+ ];
+ scope.filterItems = angular.noop;
+ spyOn(scope, 'filterItems');
+
+
+ element = $compile(preCompiledElement)(scope);
+ scope.$digest();
+ }));
+
+ afterEach(function() {
+ element.remove();
+ });
+
+
+ describe('#removeFilter', function() {
+ it('should remove filter by id', function () {
+ var isoScope = element.isolateScope();
+ isoScope.appliedFilters.push({
+ id: 1
+ });
+ spyOn(isoScope, 'observeSearchFilterInput');
+ spyOn(isoScope, 'updateFilters');
+
+ isoScope.removeFilter({id: 1});
+
+ expect(isoScope.appliedFilters).toEqual([]);
+ expect(isoScope.observeSearchFilterInput).toHaveBeenCalled();
+ expect(isoScope.updateFilters).toHaveBeenCalledWith([]);
+ });
+ });
+
+ describe('#clearFilters', function() {
+ it('should empty appliedFilters', function () {
+ var isoScope = element.isolateScope();
+ isoScope.appliedFilters.push({
+ id: 1
+ });
+ spyOn(isoScope, 'updateFilters');
+
+ isoScope.clearFilters();
+
+ expect(isoScope.appliedFilters).toEqual([]);
+ expect(isoScope.updateFilters).toHaveBeenCalledWith([]);
+ });
+ });
+
+ describe('#selectFilter', function() {
+ it('should add new filter to appliedFilters', function () {
+ var isoScope = element.isolateScope();
+
+ isoScope.selectFilter({
+ key: 'f1',
+ label: 'filter1',
+ options: []
+ });
+
+ expect(isoScope.appliedFilters[0]).toEqual({
+ id: 'filter_1',
+ currentOption: null,
+ filteredOptions: [],
+ searchOptionInput: '',
+ key: 'f1',
+ label: 'filter1',
+ options: [],
+ showAutoComplete: false
+ });
+ expect(isoScope.isEditing).toBeFalsy();
+ expect(isoScope.showAutoComplete).toBeFalsy();
+ expect(isoScope.searchFilterInput).toEqual('');
+ });
+ });
+
+ describe('#selectOption', function() {
+ it('should set value to appliedFilter', function () {
+ var isoScope = element.isolateScope();
+ var filter = {};
+
+ spyOn(isoScope, 'observeSearchFilterInput');
+ spyOn(isoScope, 'updateFilters');
+
+ isoScope.selectOption(null, {
+ key: 'o1',
+ label: 'option1'
+ }, filter);
+
+ expect(filter.currentOption).toEqual({
+ key: 'o1',
+ label: 'option1'
+ });
+ expect(filter.showAutoComplete).toBeFalsy();
+ expect(isoScope.observeSearchFilterInput).toHaveBeenCalled();
+ expect(isoScope.updateFilters).toHaveBeenCalled();
+ });
+ });
+
+ describe('#hideAutocomplete', function() {
+
+ it('showAutoComplete should be false when filter passed', function () {
+ var isoScope = element.isolateScope();
+ var filter = {
+ showAutoComplete: true
+ };
+ jasmine.Clock.useMock();
+
+ isoScope.hideAutocomplete(filter);
+
+ jasmine.Clock.tick(101);
+ expect(filter.showAutoComplete).toBeFalsy();
+ });
+
+ it('showAutoComplete should be false when isEditing = false', function () {
+ var isoScope = element.isolateScope();
+ jasmine.Clock.useMock();
+
+ isoScope.isEditing = false;
+ isoScope.showAutoComplete = true;
+ isoScope.hideAutocomplete();
+
+ jasmine.Clock.tick(101);
+ expect(isoScope.showAutoComplete).toBeFalsy();
+ });
+
+ it('showAutoComplete should be false when isEditing = true', function () {
+ var isoScope = element.isolateScope();
+ jasmine.Clock.useMock();
+
+ isoScope.isEditing = true;
+ isoScope.showAutoComplete = true;
+ isoScope.hideAutocomplete();
+
+ jasmine.Clock.tick(101);
+ expect(isoScope.showAutoComplete).toBeTruthy();
+ });
+ });
+
+ describe('#makeActive', function() {
+ it('category option can not be active', function () {
+ var isoScope = element.isolateScope();
+ var active = {
+ key: 'o1',
+ isCategory: true,
+ active: false
+ };
+
+ isoScope.makeActive(active, [active]);
+
+ expect(active.active).toBeFalsy();
+ });
+
+ it('value option can be active', function () {
+ var isoScope = element.isolateScope();
+ var active = {
+ key: 'o1',
+ isCategory: false,
+ active: false
+ };
+
+ isoScope.makeActive(active, [active]);
+
+ expect(active.active).toBeTruthy();
+ });
+ });
+
+ describe('#updateFilters', function() {
+ it('filter function from parent scope should be called', function () {
+ var isoScope = element.isolateScope();
+ spyOn(isoScope, 'extractFilters').andReturn([{}]);
+
+ isoScope.updateFilters([{}]);
+
+ expect(scope.filterItems).toHaveBeenCalledWith([{}]);
+ });
+ });
+
+ describe('#extractFilters', function() {
+ it('should extract filters', function () {
+ var isoScope = element.isolateScope();
+ var filters = [
+ {
+ currentOption: { key: 'o1'},
+ key: 'f1'
+ },
+ {
+ currentOption: { key: 'o2'},
+ key: 'f1'
+ },
+ {
+ currentOption: null,
+ key: 'f2'
+ }
+ ];
+
+ expect(isoScope.extractFilters(filters)).toEqual([
+ {
+ key: 'f1',
+ values: ['o1', 'o2']
+ }
+ ]);
+ });
+ });
+
+});
[05/50] [abbrv] ambari git commit: revert "AMBARI-22712. Update
install Wizard layout" (akovalenko)
Posted by rl...@apache.org.
revert "AMBARI-22712. Update install Wizard layout" (akovalenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1c602b01
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1c602b01
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1c602b01
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 1c602b011b6230efc5240fac904f1f3eb54a296f
Parents: 69bc10d
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Tue Jan 2 15:15:37 2018 +0200
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Tue Jan 2 15:15:37 2018 +0200
----------------------------------------------------------------------
.../HIVE/0.12.0.2.0/configuration/hive-env.xml | 1 -
.../HIVE/2.1.0.3.0/configuration/hive-env.xml | 1 -
.../OOZIE/4.0.0.2.0/configuration/oozie-env.xml | 1 -
.../OOZIE/4.2.0.3.0/configuration/oozie-env.xml | 1 -
.../services/HIVE/configuration/hive-env.xml | 1 -
.../services/OOZIE/configuration/oozie-env.xml | 1 -
ambari-web/app/controllers/installer.js | 2 +-
.../hawq/addStandby/step3_controller.js | 3 +-
.../main/admin/kerberos/wizard_controller.js | 2 +-
.../main/admin/stack_and_upgrade_controller.js | 2 +-
ambari-web/app/controllers/main/host/details.js | 2 +-
ambari-web/app/controllers/main/service/item.js | 4 +-
.../app/controllers/wizard/step3_controller.js | 2 +-
.../app/controllers/wizard/step6_controller.js | 12 ++++++
ambari-web/app/messages.js | 5 ++-
.../configs/component_actions_by_configs.js | 4 +-
ambari-web/app/styles/application.less | 2 +
ambari-web/app/styles/hosts.less | 5 ---
.../app/styles/theme/bootstrap-ambari.css | 7 ++--
ambari-web/app/styles/wizard.less | 20 ---------
.../common/assign_master_components.hbs | 24 ++++++-----
ambari-web/app/templates/wizard/step3.hbs | 12 +++---
ambari-web/app/templates/wizard/step6.hbs | 30 +++-----------
.../wizard/step6/step6_issues_popup.hbs | 43 ++++++++++++++++++++
.../common/assign_master_components_view.js | 4 +-
.../configs/widgets/combo_config_widget_view.js | 8 ----
ambari-web/app/views/common/controls_view.js | 2 +-
.../common/form/manage_credentials_form_view.js | 3 +-
.../common/modal_popups/confirmation_popup.js | 11 ++---
.../kerberos/kerberos_wizard_controler_test.js | 8 ++--
30 files changed, 112 insertions(+), 111 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/1c602b01/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-env.xml b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-env.xml
index 75b0196..730b0e8 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-env.xml
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-env.xml
@@ -93,7 +93,6 @@
<overridable>false</overridable>
<type>value-list</type>
<entries>
- <entries_editable>false</entries_editable>
<entry>
<value>New MySQL Database</value>
<label>New MySQL</label>
http://git-wip-us.apache.org/repos/asf/ambari/blob/1c602b01/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/configuration/hive-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/configuration/hive-env.xml b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/configuration/hive-env.xml
index 4703b6b..759a7bb 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/configuration/hive-env.xml
+++ b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/configuration/hive-env.xml
@@ -321,7 +321,6 @@
<value-attributes>
<overridable>false</overridable>
<type>value-list</type>
- <entries_editable>false</entries_editable>
<entries>
<entry>
<value>New MySQL Database</value>
http://git-wip-us.apache.org/repos/asf/ambari/blob/1c602b01/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/configuration/oozie-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/configuration/oozie-env.xml b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/configuration/oozie-env.xml
index f0c1e57..4eafe1c 100644
--- a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/configuration/oozie-env.xml
+++ b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/configuration/oozie-env.xml
@@ -56,7 +56,6 @@
<value-attributes>
<overridable>false</overridable>
<type>value-list</type>
- <entries_editable>false</entries_editable>
<entries>
<entry>
<value>New Derby Database</value>
http://git-wip-us.apache.org/repos/asf/ambari/blob/1c602b01/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/configuration/oozie-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/configuration/oozie-env.xml b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/configuration/oozie-env.xml
index d05bdb4..225764e 100644
--- a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/configuration/oozie-env.xml
+++ b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/configuration/oozie-env.xml
@@ -237,7 +237,6 @@ export HADOOP_OPTS="-Dhdp.version=${HDP_VERSION} ${HADOOP_OPTS}"
<value-attributes>
<overridable>false</overridable>
<type>value-list</type>
- <entries_editable>false</entries_editable>
<entries>
<entry>
<value>New Derby Database</value>
http://git-wip-us.apache.org/repos/asf/ambari/blob/1c602b01/ambari-server/src/main/resources/stacks/HDP/2.3/services/HIVE/configuration/hive-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/HIVE/configuration/hive-env.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/services/HIVE/configuration/hive-env.xml
index 9391d0f..01fd6ab 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/HIVE/configuration/hive-env.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/HIVE/configuration/hive-env.xml
@@ -90,7 +90,6 @@ export JAVA_LIBRARY_PATH="$JAVA_LIBRARY_PATH:{{jdbc_libs_dir}}"
<value-attributes>
<overridable>false</overridable>
<type>value-list</type>
- <entries_editable>false</entries_editable>
<entries>
<entry>
<value>New MySQL Database</value>
http://git-wip-us.apache.org/repos/asf/ambari/blob/1c602b01/ambari-server/src/main/resources/stacks/HDP/2.3/services/OOZIE/configuration/oozie-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/OOZIE/configuration/oozie-env.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/services/OOZIE/configuration/oozie-env.xml
index e742234..c4bc4c1 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/OOZIE/configuration/oozie-env.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/OOZIE/configuration/oozie-env.xml
@@ -115,7 +115,6 @@ export HADOOP_OPTS="-Dhdp.version=${HDP_VERSION} ${HADOOP_OPTS}"
<value-attributes>
<overridable>false</overridable>
<type>value-list</type>
- <entries_editable>false</entries_editable>
<entries>
<entry>
<value>New Derby Database</value>
http://git-wip-us.apache.org/repos/asf/ambari/blob/1c602b01/ambari-web/app/controllers/installer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/installer.js b/ambari-web/app/controllers/installer.js
index 4aa57c3..4ecdc9b 100644
--- a/ambari-web/app/controllers/installer.js
+++ b/ambari-web/app/controllers/installer.js
@@ -1120,7 +1120,7 @@ App.InstallerController = App.WizardController.extend(App.Persist, {
}
var versionsString = stringUtils.getFormattedStringFromArray(versionsList, t('or'));
var popupBody = t('popup.jdkValidation.body').format(selectedStack.get('stackName') + ' ' + selectedStack.get('stackVersion'), versionsString, currentJDKVersion);
- App.showConfirmationPopup(sCallback, popupBody, fCallback, t('popup.jdkValidation.header'), t('common.proceedAnyway'), 'danger');
+ App.showConfirmationPopup(sCallback, popupBody, fCallback, t('popup.jdkValidation.header'), t('common.proceedAnyway'), true);
return;
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/1c602b01/ambari-web/app/controllers/main/admin/highAvailability/hawq/addStandby/step3_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/hawq/addStandby/step3_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/hawq/addStandby/step3_controller.js
index bc454c2..81ece37 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/hawq/addStandby/step3_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/hawq/addStandby/step3_controller.js
@@ -150,7 +150,8 @@ App.AddHawqStandbyWizardStep3Controller = Em.Controller.extend({
Em.I18n.t('admin.addHawqStandby.wizard.step3.confirm.dataDir.body').format(dataDir, hawqStandby),
null,
Em.I18n.t('admin.addHawqStandby.wizard.step3.confirm.dataDir.title'),
- "Confirm"
+ "Confirm",
+ false
);
}
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/1c602b01/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js b/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js
index 41a8006..64b2065 100644
--- a/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js
+++ b/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js
@@ -345,7 +345,7 @@ App.KerberosWizardController = App.WizardController.extend(App.InstallComponent,
var primaryText = Em.I18n.t('common.exitAnyway');
var msg = isCritical ? Em.I18n.t('admin.kerberos.wizard.exit.critical.msg')
: Em.I18n.t('admin.kerberos.wizard.exit.warning.msg');
- return App.showConfirmationPopup(primary, msg, null, null, primaryText, isCritical ? 'danger' : 'success');
+ return App.showConfirmationPopup(primary, msg, null, null, primaryText, isCritical);
},
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/1c602b01/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
index 051af05..35041bf 100644
--- a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
+++ b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
@@ -1488,7 +1488,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
},
Em.I18n.t('admin.stackUpgrade.upgrade.retry.confirm.body').format(version.get('displayName')),
null,
- this.getUpgradeDowngradeHeader(version.get('upgradeTypeDislayName'), version.get('displayName'))
+ this.getUpgradeDowngradeHeader(version.get('upgradeTypeDislayName'), version.get('displayName'), false)
);
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/1c602b01/ambari-web/app/controllers/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js
index 20a72bf..25a27b1 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -407,7 +407,7 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
// not available
return App.showConfirmationPopup(
callback, Em.I18n.t('services.service.stop.HDFS.warningMsg.checkPointNA'), null,
- Em.I18n.t('common.warning'), Em.I18n.t('common.proceedAnyway'), 'danger'
+ Em.I18n.t('common.warning'), Em.I18n.t('common.proceedAnyway'), true
);
} else {
// still young
http://git-wip-us.apache.org/repos/asf/ambari/blob/1c602b01/ambari-web/app/controllers/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/item.js b/ambari-web/app/controllers/main/service/item.js
index f8a6e62..4f53391 100644
--- a/ambari-web/app/controllers/main/service/item.js
+++ b/ambari-web/app/controllers/main/service/item.js
@@ -342,7 +342,7 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
// not available
return App.showConfirmationPopup(
callback, Em.I18n.t('services.service.stop.HDFS.warningMsg.checkPointNA'), null,
- Em.I18n.t('common.warning'), Em.I18n.t('common.proceedAnyway'), 'danger'
+ Em.I18n.t('common.warning'), Em.I18n.t('common.proceedAnyway'), true
);
} else {
// still young
@@ -1249,7 +1249,7 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
null,
popupHeader,
Em.I18n.t('common.delete'),
- 'danger'
+ true
);
} else {
this.showLastWarning(serviceName, interDependentServices, dependentServicesToDeleteFmt);
http://git-wip-us.apache.org/repos/asf/ambari/blob/1c602b01/ambari-web/app/controllers/wizard/step3_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step3_controller.js b/ambari-web/app/controllers/wizard/step3_controller.js
index 55f4323..29393e3 100644
--- a/ambari-web/app/controllers/wizard/step3_controller.js
+++ b/ambari-web/app/controllers/wizard/step3_controller.js
@@ -843,7 +843,7 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, App.Check
function () {
self._submitProceed();
},
- Em.I18n.t('installer.step3.hostWarningsPopup.hostHasWarnings'), null, null, null, 'warning');
+ Em.I18n.t('installer.step3.hostWarningsPopup.hostHasWarnings'));
}
this._submitProceed();
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/1c602b01/ambari-web/app/controllers/wizard/step6_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step6_controller.js b/ambari-web/app/controllers/wizard/step6_controller.js
index 5e7358d..68ec3ed 100644
--- a/ambari-web/app/controllers/wizard/step6_controller.js
+++ b/ambari-web/app/controllers/wizard/step6_controller.js
@@ -161,6 +161,18 @@ App.WizardStep6Controller = Em.Controller.extend(App.HostComponentValidationMixi
*/
anyWarnings: Em.computed.or('anyGeneralWarnings', 'anyHostWarnings'),
+ openSlavesAndClientsIssues: function () {
+ App.ModalPopup.show({
+ 'data-qa': 'slave-clients-issues-modal',
+ header: Em.I18n.t('installer.step6.validationSlavesAndClients.popup.header'),
+ bodyClass: Em.View.extend({
+ controller: this,
+ templateName: require('templates/wizard/step6/step6_issues_popup')
+ }),
+ secondary: null
+ });
+ },
+
/**
* Verify condition that at least one checkbox of each component was checked
* @method clearError
http://git-wip-us.apache.org/repos/asf/ambari/blob/1c602b01/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 6da0368..f570608 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -844,7 +844,7 @@ Em.I18n.translations = {
'installer.step3.hostWarningsPopup.moreHosts':'{0} more hosts...<br>Click on link to view all hosts.',
'installer.step3.hostWarningsPopup.allHosts':'List of hosts',
'installer.step3.hostWarningsPopup.rerunChecks':'Rerun Checks',
- 'installer.step3.hostWarningsPopup.hostHasWarnings':'Host checks failed on some of your hosts. It is highly recommended that you fix these problems first before proceeding to prevent potentially major problems with cluster installation. Are you sure you want to ignore these warnings and proceed?',
+ 'installer.step3.hostWarningsPopup.hostHasWarnings':'Warning: Host checks failed on some of your hosts. It is highly recommended that you fix these problems first before proceeding to prevent potentially major problems with cluster installation. Are you sure you want to ignore these warnings and proceed?',
'installer.step3.warningsWindow.allHosts':'Warnings across all hosts',
'installer.step3.warningsWindow.warningsOn':'Warnings on ',
'installer.step3.warningsWindow.directoriesAndFiles':'DIRECTORIES AND FILES',
@@ -920,7 +920,10 @@ Em.I18n.translations = {
'installer.step6.wizardStep6Host.title':'master components hosted on {0}',
'installer.step6.addHostWizard.body':'Assign HBase master and ZooKeeper server.',
'installer.step6.error.mustSelectOneForSlaveHost': 'You must assign at least one slave/client component to each host with no master component',
+ 'installer.step6.validationSlavesAndClients.hasIssues': 'Your slave and client assignment has issues. ',
'installer.step6.validationSlavesAndClients.click': 'Click',
+ 'installer.step6.validationSlavesAndClients.forDetails': ' for details.',
+ 'installer.step6.validationSlavesAndClients.popup.header': 'Assign Slaves and Clients Issues',
'installer.step6.validationSlavesAndClients.popup.body': 'Assignment of slave and client components has the following issues',
'installer.step6.validationIssuesAttention.header': 'Validation Issues',
'installer.step6.validationIssuesAttention': 'Slave and Client component assignments have issues that need attention.',
http://git-wip-us.apache.org/repos/asf/ambari/blob/1c602b01/ambari-web/app/mixins/main/service/configs/component_actions_by_configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/main/service/configs/component_actions_by_configs.js b/ambari-web/app/mixins/main/service/configs/component_actions_by_configs.js
index 4656c2e..b687752 100644
--- a/ambari-web/app/mixins/main/service/configs/component_actions_by_configs.js
+++ b/ambari-web/app/mixins/main/service/configs/component_actions_by_configs.js
@@ -86,7 +86,7 @@ App.ComponentActionsByConfigs = Em.Mixin.create({
}
App.showConfirmationPopup(function () {
self.popupPrimaryButtonCallback(config_action);
- }, body, null, Em.I18n.t('popup.confirmation.commonHeader'), config_action.get('popupProperties').primaryButton.label, 'success', 'refresh_yarn_queues')
+ }, body, null, Em.I18n.t('popup.confirmation.commonHeader'), config_action.get('popupProperties').primaryButton.label, false, 'refresh_yarn_queues')
}
}
}
@@ -99,7 +99,7 @@ App.ComponentActionsByConfigs = Em.Mixin.create({
var self = this;
App.showConfirmationPopup(function () {
self.hsiRestartPopupPrimaryButtonCallback(components);
- }, Em.I18n.t('popup.confirmation.hsiRestart.body'), null, Em.I18n.t('popup.confirmation.commonHeader'), Em.I18n.t('popup.confirmation.hsiRestart.buttonText'), 'success', 'restart_hsi')
+ }, Em.I18n.t('popup.confirmation.hsiRestart.body'), null, Em.I18n.t('popup.confirmation.commonHeader'), Em.I18n.t('popup.confirmation.hsiRestart.buttonText'), false, 'restart_hsi')
},
hsiRestartPopupPrimaryButtonCallback: function (components) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/1c602b01/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index 8bbd4cc..670ae7d 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -2474,6 +2474,8 @@ a.abort-icon:hover {
.step-marker {
.step-index {
display: block;
+ margin-top: -1px;
+ margin-left: 0.3px;
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/1c602b01/ambari-web/app/styles/hosts.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/hosts.less b/ambari-web/app/styles/hosts.less
index e3677f8..9f0da8b 100644
--- a/ambari-web/app/styles/hosts.less
+++ b/ambari-web/app/styles/hosts.less
@@ -298,11 +298,6 @@
}
}
margin-top: 10px;
- .panel-heading {
- i {
- line-height: 19px;
- }
- }
}
}
.glyphicon-warning-sign {
http://git-wip-us.apache.org/repos/asf/ambari/blob/1c602b01/ambari-web/app/styles/theme/bootstrap-ambari.css
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/theme/bootstrap-ambari.css b/ambari-web/app/styles/theme/bootstrap-ambari.css
index 2bd3292..e85bb32 100644
--- a/ambari-web/app/styles/theme/bootstrap-ambari.css
+++ b/ambari-web/app/styles/theme/bootstrap-ambari.css
@@ -599,8 +599,8 @@ h2.table-title {
top: 9px;
line-height: 16px;
text-align: center;
- width: 23px;
- height: 23px;
+ width: 20px;
+ height: 20px;
border: 2px solid #1EB475;
border-radius: 50%;
font-size: 12px;
@@ -617,7 +617,6 @@ h2.table-title {
font-size: 14px;
color: #999;
margin-left: 30px;
- margin-bottom: 5px;
}
.wizard .wizard-body .wizard-nav .nav li .step-index {
line-height: 18px;
@@ -655,7 +654,7 @@ h2.table-title {
background-color: #1EB475;
content: "";
top: 25px;
- left: 31px;
+ left: 29px;
}
.wizard .wizard-body .wizard-nav .nav li.completed:last-child:after {
content: none;
http://git-wip-us.apache.org/repos/asf/ambari/blob/1c602b01/ambari-web/app/styles/wizard.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/wizard.less b/ambari-web/app/styles/wizard.less
index 4e680ca..7d425d9 100644
--- a/ambari-web/app/styles/wizard.less
+++ b/ambari-web/app/styles/wizard.less
@@ -60,9 +60,6 @@
#get-started {
.cluster-name-input {
padding: 4px 0px;
- input[placeholder] {
- text-transform: uppercase;
- }
}
}
@@ -442,14 +439,9 @@
height: 100px;
color: #ccc;
}
- .hosts-dropdown {
- padding-left: 10px;
- }
.dropdown {
button {
width: 100%;
- text-align: left;
- padding: 10px;
.selected-item {
width: 95%;
margin-right: 5px;
@@ -459,18 +451,6 @@
}
}
}
- .assign-masters-controls {
- padding-left: 30px;
- div {
- display: inline-block;
- width: 22px;
- div {
- display: inline-block;
- width: 100%;
- }
- }
-
- }
}
label.host-name {
http://git-wip-us.apache.org/repos/asf/ambari/blob/1c602b01/ambari-web/app/templates/common/assign_master_components.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/assign_master_components.hbs b/ambari-web/app/templates/common/assign_master_components.hbs
index 7095742..d5dec3a 100644
--- a/ambari-web/app/templates/common/assign_master_components.hbs
+++ b/ambari-web/app/templates/common/assign_master_components.hbs
@@ -74,7 +74,7 @@
</label>
</div>
</div>
- <div class="col-md-6 hosts-dropdown">
+ <div class="col-md-6">
{{#if isServiceCoHost}}
<div class="hostName" {{QAAttr "service-co-host"}}>
{{selectedHost}}<i class="glyphicon glyphicon-asterisks">✵</i>
@@ -106,14 +106,16 @@
</div>
{{/if}}
</div>
- <div class="col-md-2 pts assign-masters-controls">
+ <div class="col-md-1 pts">
{{#if showAddControl}}
- <div>
+ <div class="pull-right">
{{view App.AddControlView componentNameBinding="component_name"}}
</div>
{{/if}}
+ </div>
+ <div class="col-md-1 pts">
{{#if showRemoveControl}}
- <div>
+ <div class="pull-left">
{{view App.RemoveControlView componentNameBinding="component_name" serviceComponentIdBinding="serviceComponentId"}}
</div>
{{/if}}
@@ -127,12 +129,14 @@
<div class="host-assignments col-md-4">
{{#each masterHostMapping}}
- <div class="well">
- <div>
- <div class="hostString"><span>{{hostInfo}}</span></div>
- {{#each masterServicesToDisplay}}
- <span {{QAAttr "component-on-host"}} {{bindAttr class="isInstalled:assigned-service:new-service :service-component :label"}}>{{display_name}}</span>
- {{/each}}
+ <div class="well side-menu-well">
+ <div class="row">
+ <div class="col-md-10 col-md-offset-1">
+ <div class="hostString"><span>{{hostInfo}}</span></div>
+ {{#each masterServicesToDisplay}}
+ <span {{QAAttr "component-on-host"}} {{bindAttr class="isInstalled:assigned-service:new-service :service-component :label"}}>{{display_name}}</span>
+ {{/each}}
+ </div>
</div>
</div>
{{/each}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/1c602b01/ambari-web/app/templates/wizard/step3.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/wizard/step3.hbs b/ambari-web/app/templates/wizard/step3.hbs
index ff436a8..e00012c 100644
--- a/ambari-web/app/templates/wizard/step3.hbs
+++ b/ambari-web/app/templates/wizard/step3.hbs
@@ -62,9 +62,6 @@
<table id="confirm-hosts-table" class="table table-hover" {{QAAttr "confirm-hosts-table"}}>
<thead>
<tr>
- <th {{QAAttr "confirm-hosts-table-heading-cell"}}>
- {{view App.CheckboxView checkedBinding="view.pageChecked"}}
- </th>
<th class="col-md-5" {{QAAttr "confirm-hosts-table-heading-cell"}}>{{t common.host}}</th>
<!-- retrieved from local storage initially -->
<th class="col-md-2" {{QAAttr "confirm-hosts-table-heading-cell"}}>{{t common.progress}}</th>
@@ -73,15 +70,15 @@
<th class="col-md-2" {{QAAttr "confirm-hosts-table-heading-cell"}}>{{t common.action}}</th>
<!-- trash icon -->
<!-- retry icon -->
+ <th {{QAAttr "confirm-hosts-table-heading-cell"}}>
+ {{view App.CheckboxView checkedBinding="view.pageChecked"}}
+ </th>
</tr>
</thead>
<tbody {{QAAttr "confirm-hosts-table-body"}}>
{{#if view.pageContent}}
{{#each host in view.pageContent}}
{{#view App.WizardHostView categoryBinding="controller.category" hostInfoBinding="host" data-qa="confirm-hosts-table-body-row"}}
- <td class="step3-table-checkbox" {{QAAttr "confirm-hosts-table-body-cell"}}>
- {{view App.CheckboxView checkedBinding="host.isChecked" labelIdentifier="select-host-checkbox"}}
- </td>
<td class="host" {{QAAttr "confirm-hosts-table-body-cell"}}>
<span title="{{unbound host.name}}" class="trim_hostname" {{QAAttr "confirm-hosts-table-host-name"}}>{{host.name}}</span>
</td>
@@ -103,6 +100,9 @@
<i class="glyphicon glyphicon-trash" {{translateAttr title="common.remove"}}></i>
</a>
</td>
+ <td class="step3-table-checkbox" {{QAAttr "confirm-hosts-table-body-cell"}}>
+ {{view App.CheckboxView checkedBinding="host.isChecked" labelIdentifier="select-host-checkbox"}}
+ </td>
{{/view}}
{{/each}}
{{else}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/1c602b01/ambari-web/app/templates/wizard/step6.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/wizard/step6.hbs b/ambari-web/app/templates/wizard/step6.hbs
index ac538b6..6128b88 100644
--- a/ambari-web/app/templates/wizard/step6.hbs
+++ b/ambari-web/app/templates/wizard/step6.hbs
@@ -22,31 +22,11 @@
<div class="panel panel-default">
<div class="panel-body">
- {{#if anyErrors}}
- <p>{{t installer.step6.validationSlavesAndClients.popup.body}}</p>
- <div class="limited-height-2">
- {{#if anyGeneralErrors}}
- <div class="alert alert-danger">
- <ul>
- {{#if errorMessage}}
- <li>{{errorMessage}}</li>
- {{/if}}
- {{#each msg in controller.generalErrorMessages}}
- <li>{{msg}}</li>
- {{/each}}
- </ul>
- </div>
- {{/if}}
-
- {{#if anyGeneralWarnings}}
- <div class="alert alert-warning">
- <ul>
- {{#each msg in controller.generalWarningMessages}}
- <li>{{msg}}</li>
- {{/each}}
- </ul>
- </div>
- {{/if}}
+ {{#if anyGeneralIssues}}
+ <div class="alert alert-danger" {{QAAttr "error-message"}}>
+ {{t installer.step6.validationSlavesAndClients.hasIssues}}
+ <a href="javascript:void(null);" {{action openSlavesAndClientsIssues target="controller"}}>{{t installer.step6.validationSlavesAndClients.click}}</a>
+ {{t installer.step6.validationSlavesAndClients.forDetails}}
</div>
{{/if}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/1c602b01/ambari-web/app/templates/wizard/step6/step6_issues_popup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/wizard/step6/step6_issues_popup.hbs b/ambari-web/app/templates/wizard/step6/step6_issues_popup.hbs
new file mode 100644
index 0000000..c2201d3
--- /dev/null
+++ b/ambari-web/app/templates/wizard/step6/step6_issues_popup.hbs
@@ -0,0 +1,43 @@
+{{!
+* 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.
+}}
+
+<p>{{t installer.step6.validationSlavesAndClients.popup.body}}</p>
+<div class="limited-height-2">
+ {{#if anyGeneralErrors}}
+ <div class="alert alert-danger">
+ <ul>
+ {{#if errorMessage}}
+ <li>{{errorMessage}}</li>
+ {{/if}}
+ {{#each msg in controller.generalErrorMessages}}
+ <li>{{msg}}</li>
+ {{/each}}
+ </ul>
+ </div>
+ {{/if}}
+
+ {{#if anyGeneralWarnings}}
+ <div class="alert alert-warning">
+ <ul>
+ {{#each msg in controller.generalWarningMessages}}
+ <li>{{msg}}</li>
+ {{/each}}
+ </ul>
+ </div>
+ {{/if}}
+</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/1c602b01/ambari-web/app/views/common/assign_master_components_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/assign_master_components_view.js b/ambari-web/app/views/common/assign_master_components_view.js
index 0217aae..001667a 100644
--- a/ambari-web/app/views/common/assign_master_components_view.js
+++ b/ambari-web/app/views/common/assign_master_components_view.js
@@ -172,7 +172,7 @@ App.AddControlView = Em.View.extend({
*/
componentName: null,
- tagName: "div",
+ tagName: "span",
classNames: ["label", 'extra-component'],
@@ -213,7 +213,7 @@ App.RemoveControlView = Em.View.extend({
*/
componentName: null,
- tagName: "div",
+ tagName: "span",
'data-qa': 'remove-master',
http://git-wip-us.apache.org/repos/asf/ambari/blob/1c602b01/ambari-web/app/views/common/configs/widgets/combo_config_widget_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/widgets/combo_config_widget_view.js b/ambari-web/app/views/common/configs/widgets/combo_config_widget_view.js
index b8f957e..5efc4f7 100644
--- a/ambari-web/app/views/common/configs/widgets/combo_config_widget_view.js
+++ b/ambari-web/app/views/common/configs/widgets/combo_config_widget_view.js
@@ -43,19 +43,11 @@ App.ComboConfigWidgetView = App.ConfigWidgetView.extend({
this._super();
this.toggleWidgetState();
this.initPopover();
- this.disableSwitchToTextBox();
this.addObserver('config.stackConfigProperty.valueAttributes.entries.[]', this, this.updateValuesList);
this.addObserver('controller.forceUpdateBoundaries', this, this.updateValuesList);
this.addObserver('config.value', this, this.isValueCompatibleWithWidget);
},
- disableSwitchToTextBox: function () {
- var valueAttributes = this.get('config.valueAttributes');
- if (valueAttributes && valueAttributes.hasOwnProperty('entriesEditable') && !valueAttributes.entriesEditable) {
- this.set('supportSwitchToTextBox', false);
- }
- },
-
/**
* Update options list by recommendations
* @method updateValuesList
http://git-wip-us.apache.org/repos/asf/ambari/blob/1c602b01/ambari-web/app/views/common/controls_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/controls_view.js b/ambari-web/app/views/common/controls_view.js
index 4d3089a..747d96c 100644
--- a/ambari-web/app/views/common/controls_view.js
+++ b/ambari-web/app/views/common/controls_view.js
@@ -41,7 +41,7 @@ App.ServiceConfigPopoverSupport = Ember.Mixin.create({
serviceConfig: null,
attributeBindings:['readOnly'],
isPopoverEnabled: true,
- popoverPlacement: 'auto right',
+ popoverPlacement: 'right',
didInsertElement: function () {
App.tooltip(this.$('[data-toggle=tooltip]'), {placement: 'top'});
http://git-wip-us.apache.org/repos/asf/ambari/blob/1c602b01/ambari-web/app/views/common/form/manage_credentials_form_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/form/manage_credentials_form_view.js b/ambari-web/app/views/common/form/manage_credentials_form_view.js
index b869446..7e46431 100644
--- a/ambari-web/app/views/common/form/manage_credentials_form_view.js
+++ b/ambari-web/app/views/common/form/manage_credentials_form_view.js
@@ -219,7 +219,8 @@ App.ManageCredentialsFormView = Em.View.extend({
}, t('admin.kerberos.credentials.remove.confirmation.body'),
function () {},
null,
- t('yes'));
+ t('yes'),
+ false);
popup.set('secondary', t('no'));
return {
deferred: dfd,
http://git-wip-us.apache.org/repos/asf/ambari/blob/1c602b01/ambari-web/app/views/common/modal_popups/confirmation_popup.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/modal_popups/confirmation_popup.js b/ambari-web/app/views/common/modal_popups/confirmation_popup.js
index 8592300..c7d95f4 100644
--- a/ambari-web/app/views/common/modal_popups/confirmation_popup.js
+++ b/ambari-web/app/views/common/modal_popups/confirmation_popup.js
@@ -26,15 +26,10 @@ var App = require('app');
* @param {Function} secondary
* @param {String} header
* @param {String} primaryText
- * @param {String} primaryStyle
+ * @param {Boolean} isCritical
* @return {*}
*/
-App.showConfirmationPopup = function (primary, body, secondary, header, primaryText, primaryStyle = 'success', staticId) {
- var primaryClass = {
- 'success': 'btn-success',
- 'warning': 'btn-warning',
- 'danger': 'btn-danger'
- }[primaryStyle];
+App.showConfirmationPopup = function (primary, body, secondary, header, primaryText, isCritical, staticId) {
if (!primary) {
return false;
}
@@ -44,7 +39,7 @@ App.showConfirmationPopup = function (primary, body, secondary, header, primaryT
primary: primaryText || Em.I18n.t('ok'),
header: header || Em.I18n.t('popup.confirmation.commonHeader'),
body: body || Em.I18n.t('question.sure'),
- primaryClass: primaryClass,
+ primaryClass: isCritical ? 'btn-danger' : 'btn-success',
primaryId: staticId ? staticId + '_primary' : '',
secondaryId: staticId ? staticId + '_secondary' : '',
thirdId: staticId ? staticId + '_third' : '',
http://git-wip-us.apache.org/repos/asf/ambari/blob/1c602b01/ambari-web/test/controllers/main/admin/kerberos/kerberos_wizard_controler_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/kerberos/kerberos_wizard_controler_test.js b/ambari-web/test/controllers/main/admin/kerberos/kerberos_wizard_controler_test.js
index c158a89..f6754d5 100644
--- a/ambari-web/test/controllers/main/admin/kerberos/kerberos_wizard_controler_test.js
+++ b/ambari-web/test/controllers/main/admin/kerberos/kerberos_wizard_controler_test.js
@@ -36,13 +36,13 @@ describe('App.KerberosWizardController', function() {
it('should open warning confirmation popup', function () {
var f = Em.K;
controller.warnBeforeExitPopup(f, false);
- expect(App.showConfirmationPopup.calledWith(f, Em.I18n.t('admin.kerberos.wizard.exit.warning.msg'), null, null, Em.I18n.t('common.exitAnyway'), 'success')).to.be.true;
+ expect(App.showConfirmationPopup.calledWith(f, Em.I18n.t('admin.kerberos.wizard.exit.warning.msg'), null, null, Em.I18n.t('common.exitAnyway'), false)).to.be.true;
});
it('should open critical confirmation popup', function () {
var f = Em.K;
controller.warnBeforeExitPopup(f, true);
- expect(App.showConfirmationPopup.calledWith(f, Em.I18n.t('admin.kerberos.wizard.exit.critical.msg'), null, null, Em.I18n.t('common.exitAnyway'), 'danger')).to.be.true;
+ expect(App.showConfirmationPopup.calledWith(f, Em.I18n.t('admin.kerberos.wizard.exit.critical.msg'), null, null, Em.I18n.t('common.exitAnyway'), true)).to.be.true;
});
});
@@ -467,12 +467,12 @@ describe('App.KerberosWizardController', function() {
it("isCritical is true", function() {
controller.warnBeforeExitPopup(Em.K, true);
- expect(App.showConfirmationPopup.calledWith(Em.K, Em.I18n.t('admin.kerberos.wizard.exit.critical.msg'), null, null, Em.I18n.t('common.exitAnyway'), 'danger')).to.be.true;
+ expect(App.showConfirmationPopup.calledWith(Em.K, Em.I18n.t('admin.kerberos.wizard.exit.critical.msg'), null, null, Em.I18n.t('common.exitAnyway'), true)).to.be.true;
});
it("isCritical is false", function() {
controller.warnBeforeExitPopup(Em.K, false);
- expect(App.showConfirmationPopup.calledWith(Em.K, Em.I18n.t('admin.kerberos.wizard.exit.warning.msg'), null, null, Em.I18n.t('common.exitAnyway'), 'success')).to.be.true;
+ expect(App.showConfirmationPopup.calledWith(Em.K, Em.I18n.t('admin.kerberos.wizard.exit.warning.msg'), null, null, Em.I18n.t('common.exitAnyway'), false)).to.be.true;
});
});
[31/50] [abbrv] ambari git commit: AMBARI-22651 Unable to add/change
role for user. (atkach)
Posted by rl...@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/ada1ea54
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ada1ea54
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ada1ea54
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: ada1ea543059521b1e93abd208583ae85affd162
Parents: 4a668f0
Author: Andrii Tkach <at...@apache.org>
Authored: Thu Dec 14 12:45:09 2017 +0200
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Fri Jan 5 17:54:16 2018 -0500
----------------------------------------------------------------------
.../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/ada1ea54/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/ada1ea54/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/ada1ea54/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/ada1ea54/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/50] [abbrv] ambari git commit: AMBARI-22690 Registering existing
hdp version failed with sql exception (dgrinenko)
Posted by rl...@apache.org.
AMBARI-22690 Registering existing hdp version failed with sql exception (dgrinenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a95759d2
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a95759d2
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a95759d2
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: a95759d2fe16ec1bc9ea38c3c06e56a354d92e82
Parents: aa5b0fe
Author: Dmytro Grinenko <ha...@apache.org>
Authored: Tue Jan 2 17:25:08 2018 +0200
Committer: Dmytro Grinenko <ha...@apache.org>
Committed: Tue Jan 2 17:25:08 2018 +0200
----------------------------------------------------------------------
.../ambari/server/orm/entities/RepositoryVersionEntity.java | 5 +++++
.../internal/VersionDefinitionResourceProviderTest.java | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/a95759d2/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RepositoryVersionEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RepositoryVersionEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RepositoryVersionEntity.java
index ceb35e5..ea43e42 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RepositoryVersionEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RepositoryVersionEntity.java
@@ -237,6 +237,11 @@ public class RepositoryVersionEntity {
*/
public void setVersion(String version) {
this.version = version;
+
+ // need to be called to avoid work with wrong value until entity would be persisted
+ if (null != version && null != stack && null != stack.getStackName()){
+ removePrefixFromVersion();
+ }
}
public String getDisplayName() {
http://git-wip-us.apache.org/repos/asf/ambari/blob/a95759d2/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProviderTest.java
index 402a8f8..5a657fd 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProviderTest.java
@@ -536,7 +536,7 @@ public class VersionDefinitionResourceProviderTest {
res = status.getAssociatedResources().iterator().next();
Assert.assertTrue(res.getPropertiesMap().containsKey("VersionDefinition"));
- Assert.assertEquals("HDP-2.2.0.4-a", res.getPropertyValue("VersionDefinition/repository_version"));
+ Assert.assertEquals("2.2.0.4-a", res.getPropertyValue("VersionDefinition/repository_version"));
Assert.assertEquals("HDP-2.2.0.4-a", res.getPropertyValue("VersionDefinition/display_name"));
Assert.assertNotNull(res.getPropertyValue("VersionDefinition/show_available"));
Assert.assertNotNull(res.getPropertyValue("VersionDefinition/validation"));
[02/50] [abbrv] ambari git commit: AMBARI-22506.Incorrect pie chart
distribution(Venkata Sairam)
Posted by rl...@apache.org.
AMBARI-22506.Incorrect pie chart distribution(Venkata Sairam)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c1b8cda9
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c1b8cda9
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c1b8cda9
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: c1b8cda9608180cd00384a8453e3e5f78a865cb2
Parents: 0288728
Author: Venkata Sairam <ve...@gmail.com>
Authored: Thu Dec 28 12:07:19 2017 +0530
Committer: Venkata Sairam <ve...@gmail.com>
Committed: Thu Dec 28 12:07:19 2017 +0530
----------------------------------------------------------------------
.../ZEPPELIN/0.7.0/package/scripts/master.py | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/c1b8cda9/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 df892f8..efa3ffe 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
@@ -539,9 +539,14 @@ class Master(Script):
if params.zookeeper_znode_parent \
and params.hbase_zookeeper_quorum:
interpreter['properties']['phoenix.driver'] = 'org.apache.phoenix.jdbc.PhoenixDriver'
- interpreter['properties']['phoenix.hbase.client.retries.number'] = '1'
- interpreter['properties']['phoenix.user'] = 'phoenixuser'
- interpreter['properties']['phoenix.password'] = ''
+ if 'phoenix.hbase.client.retries.number' not in interpreter['properties']:
+ interpreter['properties']['phoenix.hbase.client.retries.number'] = '1'
+ if 'phoenix.phoenix.query.numberFormat' not in interpreter['properties']:
+ interpreter['properties']['phoenix.phoenix.query.numberFormat'] = '#.#'
+ if 'phoenix.user' not in interpreter['properties']:
+ interpreter['properties']['phoenix.user'] = 'phoenixuser'
+ if 'phoenix.password' not in interpreter['properties']:
+ interpreter['properties']['phoenix.password'] = ''
interpreter['properties']['phoenix.url'] = "jdbc:phoenix:" + \
params.hbase_zookeeper_quorum + ':' + \
params.zookeeper_znode_parent
[13/50] [abbrv] ambari git commit: AMBARI-22702. Infra Manager:
scheduled deleting of Infra Solr documents (Krisztian Kasa via oleewere )
Posted by rl...@apache.org.
AMBARI-22702. Infra Manager: scheduled deleting of Infra Solr documents (Krisztian Kasa via oleewere
)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a85ff23b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a85ff23b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a85ff23b
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: a85ff23bd8737a17544983c44752a9fd602d864a
Parents: c813e05
Author: Krisztian Kasa <ka...@gmail.com>
Authored: Wed Jan 3 11:38:43 2018 +0100
Committer: Oliver Szabo <ol...@gmail.com>
Committed: Wed Jan 3 11:38:43 2018 +0100
----------------------------------------------------------------------
.../ambari/infra/OffsetDateTimeConverter.java | 2 +-
.../ambari/infra/steps/AbstractInfraSteps.java | 4 +-
.../ambari/infra/steps/ExportJobsSteps.java | 48 ++++++-
.../resources/stories/infra_api_tests.story | 31 ++--
.../docker/infra-manager-docker-compose.sh | 2 +
ambari-infra/ambari-infra-manager/pom.xml | 5 +
.../apache/ambari/infra/job/JobProperties.java | 47 ++++++
.../apache/ambari/infra/job/JobPropertyMap.java | 57 ++++++++
.../apache/ambari/infra/job/PropertyMap.java | 25 ++++
.../apache/ambari/infra/job/SolrDAOBase.java | 65 +++++++++
.../infra/job/archive/AbstractFileAction.java | 15 +-
.../infra/job/archive/CompositeFileAction.java | 4 +-
.../ambari/infra/job/archive/Document.java | 2 +-
.../archive/DocumentArchivingConfiguration.java | 142 +++++++++++++++++++
.../archive/DocumentExportConfiguration.java | 140 ------------------
.../job/archive/DocumentExportJobListener.java | 58 --------
.../job/archive/DocumentExportProperties.java | 117 +++++++++------
.../job/archive/DocumentExportPropertyMap.java | 8 +-
.../ambari/infra/job/archive/DocumentWiper.java | 23 +++
.../ambari/infra/job/archive/FileAction.java | 2 +-
.../job/archive/FileNameSuffixFormatter.java | 56 ++++++++
.../infra/job/archive/ItemWriterListener.java | 4 +-
.../job/archive/LocalDocumentItemWriter.java | 17 ++-
.../job/archive/LocalItemWriterListener.java | 36 +++++
.../ambari/infra/job/archive/S3Properties.java | 23 ++-
.../ambari/infra/job/archive/S3Uploader.java | 4 +-
.../ambari/infra/job/archive/SolrDAO.java | 68 +++++++++
.../infra/job/archive/SolrDocumentIterator.java | 3 +-
.../infra/job/archive/SolrDocumentSource.java | 41 +-----
.../job/archive/SolrParametrizedString.java | 77 ++++++++++
.../infra/job/archive/SolrProperties.java | 117 +++++++++++++++
.../infra/job/archive/SolrQueryBuilder.java | 69 +++------
.../infra/job/archive/TarGzCompressor.java | 2 +-
.../infra/job/archive/WriteCompletedEvent.java | 45 ++++++
.../deleting/DocumentDeletingConfiguration.java | 90 ++++++++++++
.../deleting/DocumentDeletingProperties.java | 77 ++++++++++
.../deleting/DocumentDeletingPropertyMap.java | 44 ++++++
.../job/deleting/DocumentWiperTasklet.java | 49 +++++++
.../src/main/resources/infra-manager.properties | 48 ++++---
.../ambari/infra/job/JobPropertiesTest.java | 56 ++++++++
.../archive/DocumentExportPropertiesTest.java | 54 -------
.../archive/FileNameSuffixFormatterTest.java | 58 ++++++++
.../archive/LocalDocumentItemWriterTest.java | 21 ++-
.../job/archive/SolrParametrizedStringTest.java | 57 ++++++++
.../infra/job/archive/SolrPropertiesTest.java | 54 +++++++
.../infra/job/archive/SolrQueryBuilderTest.java | 39 ++---
46 files changed, 1531 insertions(+), 475 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager-it/src/test/java/org/apache/ambari/infra/OffsetDateTimeConverter.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager-it/src/test/java/org/apache/ambari/infra/OffsetDateTimeConverter.java b/ambari-infra/ambari-infra-manager-it/src/test/java/org/apache/ambari/infra/OffsetDateTimeConverter.java
index 9db562c..ef469a4 100644
--- a/ambari-infra/ambari-infra-manager-it/src/test/java/org/apache/ambari/infra/OffsetDateTimeConverter.java
+++ b/ambari-infra/ambari-infra-manager-it/src/test/java/org/apache/ambari/infra/OffsetDateTimeConverter.java
@@ -25,7 +25,7 @@ import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
public class OffsetDateTimeConverter implements ParameterConverters.ParameterConverter {
- private static final DateTimeFormatter SOLR_DATETIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSX");
+ public static final DateTimeFormatter SOLR_DATETIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSX");
@Override
public boolean accept(Type type) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager-it/src/test/java/org/apache/ambari/infra/steps/AbstractInfraSteps.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager-it/src/test/java/org/apache/ambari/infra/steps/AbstractInfraSteps.java b/ambari-infra/ambari-infra-manager-it/src/test/java/org/apache/ambari/infra/steps/AbstractInfraSteps.java
index 703e1cf..f48d4c2 100644
--- a/ambari-infra/ambari-infra-manager-it/src/test/java/org/apache/ambari/infra/steps/AbstractInfraSteps.java
+++ b/ambari-infra/ambari-infra-manager-it/src/test/java/org/apache/ambari/infra/steps/AbstractInfraSteps.java
@@ -46,7 +46,6 @@ import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.time.OffsetDateTime;
import java.util.Date;
-import java.util.UUID;
import java.util.function.BooleanSupplier;
import static java.lang.System.currentTimeMillis;
@@ -64,6 +63,7 @@ public abstract class AbstractInfraSteps {
private String dockerHost;
private SolrClient solrClient;
private AmazonS3Client s3client;
+ private int documentId = 0;
public InfraClient getInfraClient() {
return new InfraClient(String.format("http://%s:%d/api/v1/jobs", dockerHost, INFRA_MANAGER_PORT));
@@ -189,7 +189,7 @@ public abstract class AbstractInfraSteps {
solrInputDocument.addField("action", "getfileinfo");
solrInputDocument.addField("log_message", "allowed=true\tugi=ambari-qa (auth:SIMPLE)\tip=/192.168.64.102\tcmd=getfileinfo\tsrc=/ats/active\tdst=null\tperm=null\tproto=rpc\tcallerContext=HIVE_QUERY_ID:ambari-qa_20160317200111_223b3079-4a2d-431c-920f-6ba37ed63e9f");
solrInputDocument.addField("logger_name", "FSNamesystem.audit");
- solrInputDocument.addField("id", UUID.randomUUID().toString());
+ solrInputDocument.addField("id", Integer.toString(documentId++));
solrInputDocument.addField("authType", "SIMPLE");
solrInputDocument.addField("logfile_line_number", 1);
solrInputDocument.addField("cliIP", "/192.168.64.102");
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager-it/src/test/java/org/apache/ambari/infra/steps/ExportJobsSteps.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager-it/src/test/java/org/apache/ambari/infra/steps/ExportJobsSteps.java b/ambari-infra/ambari-infra-manager-it/src/test/java/org/apache/ambari/infra/steps/ExportJobsSteps.java
index 4a09d7d..22826a0 100644
--- a/ambari-infra/ambari-infra-manager-it/src/test/java/org/apache/ambari/infra/steps/ExportJobsSteps.java
+++ b/ambari-infra/ambari-infra-manager-it/src/test/java/org/apache/ambari/infra/steps/ExportJobsSteps.java
@@ -23,6 +23,8 @@ import com.amazonaws.services.s3.model.ListObjectsRequest;
import com.amazonaws.services.s3.model.ObjectListing;
import com.amazonaws.services.s3.model.ObjectMetadata;
import org.apache.ambari.infra.InfraClient;
+import org.apache.solr.client.solrj.SolrQuery;
+import org.apache.solr.client.solrj.SolrServerException;
import org.jbehave.core.annotations.Alias;
import org.jbehave.core.annotations.Given;
import org.jbehave.core.annotations.Then;
@@ -31,9 +33,13 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.UncheckedIOException;
import java.time.Duration;
import java.time.OffsetDateTime;
+import static org.apache.ambari.infra.OffsetDateTimeConverter.SOLR_DATETIME_FORMATTER;
+import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.hasProperty;
import static org.hamcrest.core.IsCollectionContaining.hasItem;
@@ -44,8 +50,10 @@ public class ExportJobsSteps extends AbstractInfraSteps {
@Given("$count documents in solr")
public void addDocuments(int count) throws Exception {
- for (int i = 0; i < count; ++i)
- addDocument(OffsetDateTime.now().minusMinutes(i));
+ OffsetDateTime intervalEnd = OffsetDateTime.now();
+ for (int i = 0; i < count; ++i) {
+ addDocument(intervalEnd.minusMinutes(i % (count / 10)));
+ }
getSolrClient().commit();
}
@@ -84,7 +92,7 @@ public class ExportJobsSteps extends AbstractInfraSteps {
}
@Then("Check filenames contains the text $text on s3 server after $waitSec seconds")
- public void checkS3After(String text, int waitSec) throws Exception {
+ public void checkS3After(String text, int waitSec) {
AmazonS3Client s3Client = getS3client();
ListObjectsRequest listObjectsRequest = new ListObjectsRequest().withBucketName(S3_BUCKET_NAME);
doWithin(waitSec, "check uploaded files to s3", () -> s3Client.doesBucketExist(S3_BUCKET_NAME)
@@ -103,4 +111,38 @@ public class ExportJobsSteps extends AbstractInfraSteps {
.filter(s3ObjectSummary -> s3ObjectSummary.getKey().contains(text))
.count() == count);
}
+
+ @Then("No file exists on s3 server with filenames containing the text $text")
+ public void fileNotExistOnS3(String text) {
+ AmazonS3Client s3Client = getS3client();
+ ListObjectsRequest listObjectsRequest = new ListObjectsRequest().withBucketName(S3_BUCKET_NAME);
+ assertThat(s3Client.listObjects(listObjectsRequest).getObjectSummaries().stream()
+ .anyMatch(s3ObjectSummary -> s3ObjectSummary.getKey().contains(text)), is(false));
+ }
+
+ @Then("solr contains $count documents between $startLogtime and $endLogtime")
+ public void documentCount(int count, OffsetDateTime startLogTime, OffsetDateTime endLogTime) throws Exception {
+ SolrQuery query = new SolrQuery();
+ query.setRows(count * 2);
+ query.setQuery(String.format("logtime:[\"%s\" TO \"%s\"]", SOLR_DATETIME_FORMATTER.format(startLogTime), SOLR_DATETIME_FORMATTER.format(endLogTime)));
+ assertThat(getSolrClient().query(query).getResults().size(), is(count));
+ }
+
+ @Then("solr does not contain documents between $startLogtime and $endLogtime after $waitSec seconds")
+ public void isSolrEmpty(OffsetDateTime startLogTime, OffsetDateTime endLogTime, int waitSec) {
+ SolrQuery query = new SolrQuery();
+ query.setRows(1);
+ query.setQuery(String.format("logtime:[\"%s\" TO \"%s\"]", SOLR_DATETIME_FORMATTER.format(startLogTime), SOLR_DATETIME_FORMATTER.format(endLogTime)));
+ doWithin(waitSec, "check solr is empty", () -> isSolrEmpty(query));
+ }
+
+ private boolean isSolrEmpty(SolrQuery query) {
+ try {
+ return getSolrClient().query(query).getResults().isEmpty();
+ } catch (SolrServerException e) {
+ throw new RuntimeException(e);
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager-it/src/test/resources/stories/infra_api_tests.story
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager-it/src/test/resources/stories/infra_api_tests.story b/ambari-infra/ambari-infra-manager-it/src/test/resources/stories/infra_api_tests.story
index cd1f49d..1044258 100644
--- a/ambari-infra/ambari-infra-manager-it/src/test/resources/stories/infra_api_tests.story
+++ b/ambari-infra/ambari-infra-manager-it/src/test/resources/stories/infra_api_tests.story
@@ -1,23 +1,38 @@
-Scenario: Export documents form solr and upload them to s3 using defult configuration
+Scenario: Exporting documents form solr and upload them to s3 using defult configuration
Given 1000 documents in solr
-When start export_audit_logs job
+When start archive_audit_logs job
Then Check filenames contains the text audit_logs on s3 server after 20 seconds
Scenario: Exporting 10 documents using writeBlockSize=3 produces 4 files
Given 10 documents in solr with logtime from 2010-10-09T05:00:00.000Z to 2010-10-09T20:00:00.000Z
-When start export_audit_logs job with parameters writeBlockSize=3,start=2010-10-09T00:00:00.000Z,end=2010-10-11T00:00:00.000Z
+When start archive_audit_logs job with parameters writeBlockSize=3,start=2010-10-09T00:00:00.000Z,end=2010-10-11T00:00:00.000Z
Then Check 4 files exists on s3 server with filenames containing the text solr_archive_audit_logs_-_2010-10-09 after 20 seconds
+And solr does not contain documents between 2010-10-09T05:00:00.000Z and 2010-10-09T20:00:00.000Z after 5 seconds
+Scenario: Running archiving job with a bigger start value than end value exports and deletes 0 documents
-Scenario: Export job fails when part of the data is exported. After resolving the issue and restarting the job exports the rest of the data.
+Given 10 documents in solr with logtime from 2010-01-01T05:00:00.000Z to 2010-01-04T05:00:00.000Z
+When start archive_audit_logs job with parameters writeBlockSize=3,start=2010-01-03T05:00:00.000Z,end=2010-01-02T05:00:00.000Z
+Then No file exists on s3 server with filenames containing the text solr_archive_audit_logs_-_2010-01-0
+And solr contains 10 documents between 2010-01-01T05:00:00.000Z and 2010-01-04T05:00:00.000Z
+
+Scenario: Archiving job fails when part of the data is exported. After resolving the issue and restarting the job exports the rest of the data.
Given 200 documents in solr with logtime from 2011-10-09T05:00:00.000Z to 2011-10-09T20:00:00.000Z
-And a file on s3 with key solr_archive_audit_logs_-_2011-10-09T08:00:00.000Z.json.tar.gz
-When start export_audit_logs job with parameters writeBlockSize=20,start=2010-11-09T00:00:00.000Z,end=2011-10-11T00:00:00.000Z
+And a file on s3 with key solr_archive_audit_logs_-_2011-10-09T08-00-00.000Z.json.tar.gz
+When start archive_audit_logs job with parameters writeBlockSize=20,start=2010-11-09T00:00:00.000Z,end=2011-10-11T00:00:00.000Z
Then Check 3 files exists on s3 server with filenames containing the text solr_archive_audit_logs_-_2011-10-09 after 20 seconds
-When delete file with key solr_archive_audit_logs_-_2011-10-09T08:00:00.000Z.json.tar.gz from s3
-And restart export_audit_logs job with parameters writeBlockSize=20,start=2010-11-09T00:00:00.000Z,end=2011-10-11T00:00:00.000Z
+And solr does not contain documents between 2011-10-09T05:00:00.000Z and 2011-10-09T07:59:59.999Z after 5 seconds
+When delete file with key solr_archive_audit_logs_-_2011-10-09T08-00-00.000Z.json.tar.gz from s3
+And restart archive_audit_logs job with parameters writeBlockSize=20,start=2010-11-09T00:00:00.000Z,end=2011-10-11T00:00:00.000Z
Then Check 10 files exists on s3 server with filenames containing the text solr_archive_audit_logs_-_2011-10-09 after 20 seconds
+And solr does not contain documents between 2011-10-09T05:00:00.000Z and 2011-10-09T20:00:00.000Z after 5 seconds
+
+Scenario: After Deleting job deletes documents from solr no document found in the specified interval
+
+Given 10 documents in solr with logtime from 2012-10-09T05:00:00.000Z to 2012-10-09T20:00:00.000Z
+When start delete_audit_logs job with parameters start=2012-10-09T05:00:00.000Z,end=2012-10-09T20:00:00.000Z
+Then solr does not contain documents between 2012-10-09T05:00:00.000Z and 2012-10-09T20:00:00.000Z after 5 seconds
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/docker/infra-manager-docker-compose.sh
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/docker/infra-manager-docker-compose.sh b/ambari-infra/ambari-infra-manager/docker/infra-manager-docker-compose.sh
old mode 100644
new mode 100755
index ab02659..6ddb7c2
--- a/ambari-infra/ambari-infra-manager/docker/infra-manager-docker-compose.sh
+++ b/ambari-infra/ambari-infra-manager/docker/infra-manager-docker-compose.sh
@@ -81,6 +81,8 @@ function setup_profile() {
local AMBARI_LOCATION=$(pwd)
popd
cat << EOF > $sdir/Profile
+AWS_ACCESS_KEY_ID=test
+AWS_SECRET_ACCESS_KEY=test
EOF
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/pom.xml b/ambari-infra/ambari-infra-manager/pom.xml
index 67bf7d1..de131b0 100644
--- a/ambari-infra/ambari-infra-manager/pom.xml
+++ b/ambari-infra/ambari-infra-manager/pom.xml
@@ -428,6 +428,11 @@
<artifactId>aws-java-sdk-s3</artifactId>
<version>1.11.5</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-csv</artifactId>
+ <version>1.5</version>
+ </dependency>
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/JobProperties.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/JobProperties.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/JobProperties.java
new file mode 100644
index 0000000..0841dd7
--- /dev/null
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/JobProperties.java
@@ -0,0 +1,47 @@
+/*
+ * 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.infra.job;
+
+import org.apache.htrace.fasterxml.jackson.databind.ObjectMapper;
+import org.springframework.batch.core.JobParameters;
+
+import java.io.IOException;
+import java.io.UncheckedIOException;
+
+public abstract class JobProperties<T extends JobProperties<T>> {
+ private final Class<T> clazz;
+
+ protected JobProperties(Class<T> clazz) {
+ this.clazz = clazz;
+ }
+
+ public T deepCopy() {
+ try {
+ ObjectMapper objectMapper = new ObjectMapper();
+ String json = objectMapper.writeValueAsString(this);
+ return objectMapper.readValue(json, clazz);
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ }
+
+ public abstract void apply(JobParameters jobParameters);
+
+ public abstract void validate();
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/JobPropertyMap.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/JobPropertyMap.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/JobPropertyMap.java
new file mode 100644
index 0000000..b5061f8
--- /dev/null
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/JobPropertyMap.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ambari.infra.job;
+
+import org.springframework.batch.core.ExitStatus;
+import org.springframework.batch.core.JobExecution;
+import org.springframework.batch.core.JobExecutionListener;
+
+public class JobPropertyMap<T extends JobProperties<T>> implements JobExecutionListener {
+
+ private final PropertyMap<T> propertyMap;
+
+ public JobPropertyMap(PropertyMap<T> propertyMap) {
+ this.propertyMap = propertyMap;
+ }
+
+ @Override
+ public void beforeJob(JobExecution jobExecution) {
+ try {
+ String jobName = jobExecution.getJobInstance().getJobName();
+ T defaultProperties = propertyMap.getPropertyMap().get(jobName);
+ if (defaultProperties == null)
+ throw new UnsupportedOperationException("Properties not found for job " + jobName);
+
+ T properties = defaultProperties.deepCopy();
+ properties.apply(jobExecution.getJobParameters());
+ properties.validate();
+ jobExecution.getExecutionContext().put("jobProperties", properties);
+ }
+ catch (UnsupportedOperationException | IllegalArgumentException ex) {
+ jobExecution.stop();
+ jobExecution.setExitStatus(new ExitStatus(ExitStatus.FAILED.getExitCode(), ex.getMessage()));
+ throw ex;
+ }
+ }
+
+ @Override
+ public void afterJob(JobExecution jobExecution) {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/PropertyMap.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/PropertyMap.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/PropertyMap.java
new file mode 100644
index 0000000..e7b9e77
--- /dev/null
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/PropertyMap.java
@@ -0,0 +1,25 @@
+/*
+ * 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.infra.job;
+
+import java.util.Map;
+
+public interface PropertyMap<T extends JobProperties<T>> {
+ Map<String, T> getPropertyMap();
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/SolrDAOBase.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/SolrDAOBase.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/SolrDAOBase.java
new file mode 100644
index 0000000..3ac5b05
--- /dev/null
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/SolrDAOBase.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ambari.infra.job;
+
+import org.apache.solr.client.solrj.SolrServerException;
+import org.apache.solr.client.solrj.impl.CloudSolrClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.io.UncheckedIOException;
+
+public abstract class SolrDAOBase {
+ private static final Logger LOG = LoggerFactory.getLogger(SolrDAOBase.class);
+
+ private final String zooKeeperConnectionString;
+ private final String defaultCollection;
+
+ protected SolrDAOBase(String zooKeeperConnectionString, String defaultCollection) {
+ this.zooKeeperConnectionString = zooKeeperConnectionString;
+ this.defaultCollection = defaultCollection;
+ }
+
+ protected void delete(String deleteQueryText) {
+ try (CloudSolrClient client = createClient()) {
+ try {
+ LOG.info("Executing solr delete by query {}", deleteQueryText);
+ client.deleteByQuery(deleteQueryText);
+ client.commit();
+ } catch (Exception e) {
+ try {
+ client.rollback();
+ } catch (SolrServerException e1) {
+ LOG.warn("Unable to rollback after solr delete operation failure.", e1);
+ }
+ throw new RuntimeException(e);
+ }
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ }
+
+ protected CloudSolrClient createClient() {
+ CloudSolrClient client = new CloudSolrClient.Builder().withZkHost(zooKeeperConnectionString).build();
+ client.setDefaultCollection(defaultCollection);
+ return client;
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/AbstractFileAction.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/AbstractFileAction.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/AbstractFileAction.java
index 7a30393..3df18b6 100644
--- a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/AbstractFileAction.java
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/AbstractFileAction.java
@@ -18,16 +18,21 @@
*/
package org.apache.ambari.infra.job.archive;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.io.File;
public abstract class AbstractFileAction implements FileAction {
+ private static final Logger LOG = LoggerFactory.getLogger(AbstractFileAction.class);
+
@Override
- public File perform(File inputFile, boolean deleteInput) {
- File outputFile = perform(inputFile);
- if (deleteInput)
- inputFile.delete();
+ public File perform(File inputFile) {
+ File outputFile = onPerform(inputFile);
+ if (!inputFile.delete())
+ LOG.warn("File {} was not deleted. Exists: {}", inputFile.getAbsolutePath(), inputFile.exists());
return outputFile;
}
- protected abstract File perform(File inputFile);
+ protected abstract File onPerform(File inputFile);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/CompositeFileAction.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/CompositeFileAction.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/CompositeFileAction.java
index 8421802..99bc6d9 100644
--- a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/CompositeFileAction.java
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/CompositeFileAction.java
@@ -37,10 +37,10 @@ public class CompositeFileAction implements FileAction {
}
@Override
- public File perform(File inputFile, boolean deleteInput) {
+ public File perform(File inputFile) {
File file = inputFile;
for (FileAction action : actions) {
- file = action.perform(file, deleteInput);
+ file = action.perform(file);
}
return file;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/Document.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/Document.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/Document.java
index 1f3957a..5ff9587 100644
--- a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/Document.java
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/Document.java
@@ -42,7 +42,7 @@ public class Document {
}
@JsonAnyGetter
- private Map<String, String> getFieldMap() {
+ public Map<String, String> getFieldMap() {
return fieldMap;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/DocumentArchivingConfiguration.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/DocumentArchivingConfiguration.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/DocumentArchivingConfiguration.java
new file mode 100644
index 0000000..7588b99
--- /dev/null
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/DocumentArchivingConfiguration.java
@@ -0,0 +1,142 @@
+/*
+ * 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.infra.job.archive;
+
+import org.apache.ambari.infra.job.JobPropertyMap;
+import org.apache.ambari.infra.job.ObjectSource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.batch.core.Job;
+import org.springframework.batch.core.Step;
+import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
+import org.springframework.batch.core.configuration.annotation.JobScope;
+import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
+import org.springframework.batch.core.configuration.annotation.StepScope;
+import org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+import java.io.File;
+import java.nio.file.Paths;
+
+@Configuration
+public class DocumentArchivingConfiguration {
+ private static final Logger LOG = LoggerFactory.getLogger(DocumentArchivingConfiguration.class);
+
+ @Inject
+ private DocumentExportPropertyMap propertyMap;
+
+ @Inject
+ private StepBuilderFactory steps;
+
+ @Inject
+ private JobBuilderFactory jobs;
+
+ @Inject
+ @Qualifier("exportStep")
+ private Step exportStep;
+
+ @Inject
+ private JobRegistryBeanPostProcessor jobRegistryBeanPostProcessor;
+
+
+ @PostConstruct
+ public void createJobs() {
+ propertyMap.getSolrDataExport().values().forEach(DocumentExportProperties::validate);
+
+ propertyMap.getSolrDataExport().keySet().forEach(jobName -> {
+ LOG.info("Registering data archiving job {}", jobName);
+ Job job = logExportJob(jobName, exportStep);
+ jobRegistryBeanPostProcessor.postProcessAfterInitialization(job, jobName);
+ });
+ }
+
+ private Job logExportJob(String jobName, Step logExportStep) {
+ return jobs.get(jobName).listener(new JobPropertyMap<>(propertyMap)).start(logExportStep).build();
+ }
+
+ @Bean
+ @JobScope
+ public Step exportStep(DocumentExporter documentExporter) {
+ return steps.get("export")
+ .tasklet(documentExporter)
+ .build();
+ }
+
+ @Bean
+ @StepScope
+ public DocumentExporter documentExporter(DocumentItemReader documentItemReader,
+ @Value("#{stepExecution.jobExecution.id}") String jobId,
+ @Value("#{stepExecution.jobExecution.executionContext.get('jobProperties')}") DocumentExportProperties properties,
+ SolrDAO solrDAO) {
+ File path = Paths.get(
+ properties.getDestinationDirectoryPath(),
+ // TODO: jobId should remain the same after continuing job
+ String.format("%s_%s", properties.getSolr().getCollection(), jobId)).toFile(); // TODO: add end date
+ LOG.info("Destination directory path={}", path);
+ if (!path.exists()) {
+ if (!path.mkdirs()) {
+ LOG.warn("Unable to create directory {}", path);
+ }
+ }
+
+ CompositeFileAction fileAction = new CompositeFileAction(new TarGzCompressor());
+ properties.s3Properties().ifPresent(s3Properties -> fileAction.add(new S3Uploader(s3Properties)));
+ FileNameSuffixFormatter fileNameSuffixFormatter = FileNameSuffixFormatter.from(properties);
+ LocalItemWriterListener itemWriterListener = new LocalItemWriterListener(fileAction, solrDAO);
+
+ return new DocumentExporter(
+ documentItemReader,
+ firstDocument -> new LocalDocumentItemWriter(
+ outFile(properties.getSolr().getCollection(), path, fileNameSuffixFormatter.format(firstDocument)), itemWriterListener),
+ properties.getWriteBlockSize());
+ }
+
+ @Bean
+ @StepScope
+ public SolrDAO solrDAO(@Value("#{stepExecution.jobExecution.executionContext.get('jobProperties')}") DocumentExportProperties properties) {
+ return new SolrDAO(properties.getSolr());
+ }
+
+ private File outFile(String collection, File directoryPath, String suffix) {
+ File file = new File(directoryPath, String.format("%s_-_%s.json", collection, suffix));
+ LOG.info("Exporting to temp file {}", file.getAbsolutePath());
+ return file;
+ }
+
+ @Bean
+ @StepScope
+ public DocumentItemReader reader(ObjectSource<Document> documentSource,
+ @Value("#{stepExecution.jobExecution.executionContext.get('jobProperties')}") DocumentExportProperties properties) {
+ return new DocumentItemReader(documentSource, properties.getReadBlockSize());
+ }
+
+ @Bean
+ @StepScope
+ public ObjectSource<Document> logSource(@Value("#{jobParameters[start]}") String start,
+ @Value("#{jobParameters[end]}") String end,
+ SolrDAO solrDAO) {
+
+ return new SolrDocumentSource(solrDAO, start, end);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/DocumentExportConfiguration.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/DocumentExportConfiguration.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/DocumentExportConfiguration.java
deleted file mode 100644
index 1895911..0000000
--- a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/DocumentExportConfiguration.java
+++ /dev/null
@@ -1,140 +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.infra.job.archive;
-
-import org.apache.ambari.infra.job.ObjectSource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.batch.core.Job;
-import org.springframework.batch.core.Step;
-import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
-import org.springframework.batch.core.configuration.annotation.JobScope;
-import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
-import org.springframework.batch.core.configuration.annotation.StepScope;
-import org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-import javax.annotation.PostConstruct;
-import javax.inject.Inject;
-import java.io.File;
-import java.nio.file.Paths;
-
-@Configuration
-public class DocumentExportConfiguration {
- private static final Logger LOG = LoggerFactory.getLogger(DocumentExportConfiguration.class);
-
- @Inject
- private DocumentExportPropertyMap propertyMap;
-
- @Inject
- private StepBuilderFactory steps;
-
- @Inject
- private JobBuilderFactory jobs;
-
- @Inject
- @Qualifier("exportStep")
- private Step exportStep;
-
- @Inject
- private JobRegistryBeanPostProcessor jobRegistryBeanPostProcessor;
-
-
- @PostConstruct
- public void createJobs() {
- propertyMap.getSolrDataExport().values().forEach(DocumentExportProperties::validate);
-
- propertyMap.getSolrDataExport().keySet().forEach(jobName -> {
- Job job = logExportJob(jobName, exportStep);
- jobRegistryBeanPostProcessor.postProcessAfterInitialization(job, jobName);
- });
- }
-
- private Job logExportJob(String jobName, Step logExportStep) {
- return jobs.get(jobName).listener(new DocumentExportJobListener(propertyMap)).start(logExportStep).build();
- }
-
- @Bean
- @JobScope
- public Step exportStep(DocumentExporter documentExporter) {
- return steps.get("export")
- .tasklet(documentExporter)
- .build();
- }
-
- @Bean
- @StepScope
- public DocumentExporter documentExporter(DocumentItemReader documentItemReader,
- @Value("#{stepExecution.jobExecution.id}") String jobId,
- @Value("#{stepExecution.jobExecution.executionContext.get('exportProperties')}") DocumentExportProperties properties) {
- File path = Paths.get(
- properties.getDestinationDirectoryPath(),
- // TODO: jobId should remain the same after continuing job
- String.format("%s_%s", properties.getQuery().getCollection(), jobId)).toFile(); // TODO: add end date
- LOG.info("Destination directory path={}", path);
- if (!path.exists()) {
- if (!path.mkdirs()) {
- LOG.warn("Unable to create directory {}", path);
- }
- }
-
- CompositeFileAction fileAction = new CompositeFileAction(new TarGzCompressor());
- properties.s3Properties().ifPresent(s3Properties -> fileAction.add(new S3Uploader(s3Properties)));
-
- return new DocumentExporter(
- documentItemReader,
- firstDocument -> localDocumentItemWriter(properties, path, fileAction, firstDocument),
- properties.getWriteBlockSize());
- }
-
- private LocalDocumentItemWriter localDocumentItemWriter(DocumentExportProperties properties, File path, FileAction fileAction, Document firstDocument) {
- return new LocalDocumentItemWriter(outFile(properties.getQuery().getCollection(), path, firstDocument.get(properties.getFileNameSuffixColumn())),
- file -> fileAction.perform(file, true));
- }
-
- private File outFile(String collection, File directoryPath, String suffix) {
- // TODO: format date (suffix)
- File file = new File(directoryPath, String.format("%s_-_%s.json", collection, suffix));
- LOG.info("Exporting to temp file {}", file.getAbsolutePath());
- return file;
- }
-
- @Bean
- @StepScope
- public DocumentItemReader reader(ObjectSource<Document> documentSource,
- @Value("#{stepExecution.jobExecution.executionContext.get('exportProperties')}") DocumentExportProperties properties) {
- return new DocumentItemReader(documentSource, properties.getReadBlockSize());
- }
-
- @Bean
- @StepScope
- public ObjectSource logSource(@Value("#{jobParameters[start]}") String start,
- @Value("#{jobParameters[end]}") String end,
- @Value("#{stepExecution.jobExecution.executionContext.get('exportProperties')}") DocumentExportProperties properties) {
-
- return new SolrDocumentSource(
- properties.getZooKeeperConnectionString(),
- properties.getQuery(),
- start,
- end);
- }
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/DocumentExportJobListener.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/DocumentExportJobListener.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/DocumentExportJobListener.java
deleted file mode 100644
index 3b6c402..0000000
--- a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/DocumentExportJobListener.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.ambari.infra.job.archive;
-
-import org.springframework.batch.core.ExitStatus;
-import org.springframework.batch.core.JobExecution;
-import org.springframework.batch.core.JobExecutionListener;
-
-public class DocumentExportJobListener implements JobExecutionListener {
-
- private final DocumentExportPropertyMap propertyMap;
-
- public DocumentExportJobListener(DocumentExportPropertyMap propertyMap) {
- this.propertyMap = propertyMap;
- }
-
-
- @Override
- public void beforeJob(JobExecution jobExecution) {
- try {
- String jobName = jobExecution.getJobInstance().getJobName();
- DocumentExportProperties defaultProperties = propertyMap.getSolrDataExport().get(jobName);
- if (defaultProperties == null)
- throw new UnsupportedOperationException("Properties not found for job " + jobName);
-
- DocumentExportProperties properties = defaultProperties.deepCopy();
- properties.apply(jobExecution.getJobParameters());
- properties.validate();
- jobExecution.getExecutionContext().put("exportProperties", properties);
- }
- catch (UnsupportedOperationException | IllegalArgumentException ex) {
- jobExecution.stop();
- jobExecution.setExitStatus(new ExitStatus(ExitStatus.FAILED.getExitCode(), ex.getMessage()));
- throw ex;
- }
- }
-
- @Override
- public void afterJob(JobExecution jobExecution) {
- jobExecution.setExitStatus(new ExitStatus(ExitStatus.COMPLETED.getExitCode()));
- }
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/DocumentExportProperties.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/DocumentExportProperties.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/DocumentExportProperties.java
index 37f6d1b..1484eed 100644
--- a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/DocumentExportProperties.java
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/DocumentExportProperties.java
@@ -18,34 +18,71 @@
*/
package org.apache.ambari.infra.job.archive;
-import org.apache.htrace.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.ambari.infra.job.JobProperties;
+import org.apache.commons.csv.CSVParser;
+import org.apache.commons.csv.CSVRecord;
import org.springframework.batch.core.JobParameters;
+import java.io.FileReader;
import java.io.IOException;
import java.io.UncheckedIOException;
+import java.util.Iterator;
+import java.util.Map;
import java.util.Optional;
+import java.util.function.Supplier;
+import static org.apache.commons.csv.CSVFormat.DEFAULT;
import static org.apache.commons.lang.StringUtils.isBlank;
-public class DocumentExportProperties {
- private String zooKeeperConnectionString;
+public class DocumentExportProperties extends JobProperties<DocumentExportProperties> {
private int readBlockSize;
private int writeBlockSize;
private String destinationDirectoryPath;
private String fileNameSuffixColumn;
- private SolrQueryProperties query;
- private String s3AccessKey;
- private String s3SecretKey;
+ private String fileNameSuffixDateFormat;
+ private SolrProperties solr;
+ private String s3AccessFile;
private String s3KeyPrefix;
private String s3BucketName;
private String s3Endpoint;
+ private transient Supplier<Optional<S3Properties>> s3Properties;
+
+ public DocumentExportProperties() {
+ super(DocumentExportProperties.class);
+ s3Properties = this::loadS3Properties;
+ }
+
+ private Optional<S3Properties> loadS3Properties() {
+ if (isBlank(s3BucketName))
+ return Optional.empty();
+
+ String accessKey = System.getenv("AWS_ACCESS_KEY_ID");
+ String secretKey = System.getenv("AWS_SECRET_ACCESS_KEY");
+
+ if (isBlank(accessKey) || isBlank(secretKey)) {
+ if (isBlank(s3AccessFile))
+ return Optional.empty();
+ try (CSVParser csvParser = CSVParser.parse(new FileReader(s3AccessFile), DEFAULT.withHeader("Access key ID", "Secret access key"))) {
+ Iterator<CSVRecord> iterator = csvParser.iterator();
+ if (!iterator.hasNext()) {
+ return Optional.empty();
+ }
+
+ CSVRecord record = csvParser.iterator().next();
+ Map<String, Integer> header = csvParser.getHeaderMap();
+ accessKey = record.get(header.get("Access key ID"));
+ secretKey = record.get(header.get("Secret access key"));
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ }
- public String getZooKeeperConnectionString() {
- return zooKeeperConnectionString;
- }
-
- public void setZooKeeperConnectionString(String zooKeeperConnectionString) {
- this.zooKeeperConnectionString = zooKeeperConnectionString;
+ return Optional.of(new S3Properties(
+ accessKey,
+ secretKey,
+ s3KeyPrefix,
+ s3BucketName,
+ s3Endpoint));
}
public int getReadBlockSize() {
@@ -80,28 +117,29 @@ public class DocumentExportProperties {
this.fileNameSuffixColumn = fileNameSuffixColumn;
}
- public SolrQueryProperties getQuery() {
- return query;
+ public String getFileNameSuffixDateFormat() {
+ return fileNameSuffixDateFormat;
}
- public void setQuery(SolrQueryProperties query) {
- this.query = query;
+ public void setFileNameSuffixDateFormat(String fileNameSuffixDateFormat) {
+ this.fileNameSuffixDateFormat = fileNameSuffixDateFormat;
}
- public String getS3AccessKey() {
- return s3AccessKey;
+ public SolrProperties getSolr() {
+ return solr;
}
- public void setS3AccessKey(String s3AccessKey) {
- this.s3AccessKey = s3AccessKey;
+ public void setSolr(SolrProperties query) {
+ this.solr = query;
}
- public String getS3SecretKey() {
- return s3SecretKey;
+ public String getS3AccessFile() {
+ return s3AccessFile;
}
- public void setS3SecretKey(String s3SecretKey) {
- this.s3SecretKey = s3SecretKey;
+ public void setS3AccessFile(String s3AccessFile) {
+ this.s3AccessFile = s3AccessFile;
+ s3Properties = this::loadS3Properties;
}
public String getS3KeyPrefix() {
@@ -128,12 +166,16 @@ public class DocumentExportProperties {
this.s3Endpoint = s3Endpoint;
}
+ public Optional<S3Properties> s3Properties() {
+ return s3Properties.get();
+ }
+
+ @Override
public void apply(JobParameters jobParameters) {
- zooKeeperConnectionString = jobParameters.getString("zooKeeperConnectionString", zooKeeperConnectionString);
readBlockSize = getIntJobParameter(jobParameters, "readBlockSize", readBlockSize);
writeBlockSize = getIntJobParameter(jobParameters, "writeBlockSize", writeBlockSize);
destinationDirectoryPath = jobParameters.getString("destinationDirectoryPath", destinationDirectoryPath);
- query.apply(jobParameters);
+ solr.apply(jobParameters);
}
private int getIntJobParameter(JobParameters jobParameters, String parameterName, int defaultValue) {
@@ -143,26 +185,8 @@ public class DocumentExportProperties {
return Integer.parseInt(valueText);
}
- public DocumentExportProperties deepCopy() {
- try {
- ObjectMapper objectMapper = new ObjectMapper();
- String json = objectMapper.writeValueAsString(this);
- return objectMapper.readValue(json, DocumentExportProperties.class);
- } catch (IOException e) {
- throw new UncheckedIOException(e);
- }
- }
-
- public Optional<S3Properties> s3Properties() {
- if (!isBlank(s3AccessKey) && !isBlank(s3SecretKey) && !isBlank(s3BucketName))
- return Optional.of(new S3Properties(s3AccessKey, s3SecretKey, s3KeyPrefix, s3BucketName, s3Endpoint));
- return Optional.empty();
- }
-
+ @Override
public void validate() {
- if (isBlank(zooKeeperConnectionString))
- throw new IllegalArgumentException("The property zooKeeperConnectionString can not be null or empty string!");
-
if (readBlockSize == 0)
throw new IllegalArgumentException("The property readBlockSize must be greater than 0!");
@@ -175,6 +199,7 @@ public class DocumentExportProperties {
if (isBlank(fileNameSuffixColumn))
throw new IllegalArgumentException("The property fileNameSuffixColumn can not be null or empty string!");
- query.validate();
+ solr.validate();
+ s3Properties().ifPresent(S3Properties::validate);
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/DocumentExportPropertyMap.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/DocumentExportPropertyMap.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/DocumentExportPropertyMap.java
index 9af4afc..16e77d2 100644
--- a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/DocumentExportPropertyMap.java
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/DocumentExportPropertyMap.java
@@ -18,6 +18,7 @@
*/
package org.apache.ambari.infra.job.archive;
+import org.apache.ambari.infra.job.PropertyMap;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@@ -25,7 +26,7 @@ import java.util.Map;
@Configuration
@ConfigurationProperties(prefix = "infra-manager.jobs")
-public class DocumentExportPropertyMap {
+public class DocumentExportPropertyMap implements PropertyMap<DocumentExportProperties> {
private Map<String, DocumentExportProperties> solrDataExport;
public Map<String, DocumentExportProperties> getSolrDataExport() {
@@ -35,4 +36,9 @@ public class DocumentExportPropertyMap {
public void setSolrDataExport(Map<String, DocumentExportProperties> solrDataExport) {
this.solrDataExport = solrDataExport;
}
+
+ @Override
+ public Map<String, DocumentExportProperties> getPropertyMap() {
+ return getSolrDataExport();
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/DocumentWiper.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/DocumentWiper.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/DocumentWiper.java
new file mode 100644
index 0000000..2b2a355
--- /dev/null
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/DocumentWiper.java
@@ -0,0 +1,23 @@
+/*
+ * 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.infra.job.archive;
+
+public interface DocumentWiper {
+ void delete(Document firstDocument, Document lastDocument);
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/FileAction.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/FileAction.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/FileAction.java
index d3f2a65..26a8c63 100644
--- a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/FileAction.java
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/FileAction.java
@@ -21,5 +21,5 @@ package org.apache.ambari.infra.job.archive;
import java.io.File;
public interface FileAction {
- File perform(File inputFile, boolean deleteInput);
+ File perform(File inputFile);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/FileNameSuffixFormatter.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/FileNameSuffixFormatter.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/FileNameSuffixFormatter.java
new file mode 100644
index 0000000..af48ab9
--- /dev/null
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/FileNameSuffixFormatter.java
@@ -0,0 +1,56 @@
+/*
+ * 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.infra.job.archive;
+
+import java.time.OffsetDateTime;
+import java.time.format.DateTimeFormatter;
+
+import static org.apache.ambari.infra.job.archive.SolrDocumentIterator.SOLR_DATE_FORMAT_TEXT;
+import static org.apache.commons.lang.StringUtils.isBlank;
+
+public class FileNameSuffixFormatter {
+ private static final DateTimeFormatter SOLR_DATETIME_FORMATTER = DateTimeFormatter.ofPattern(SOLR_DATE_FORMAT_TEXT);
+
+ public static FileNameSuffixFormatter from(DocumentExportProperties properties) {
+ return new FileNameSuffixFormatter(properties.getFileNameSuffixColumn(), properties.getFileNameSuffixDateFormat());
+ }
+
+
+ private final String columnName;
+
+ private final DateTimeFormatter dateFormat;
+
+ public FileNameSuffixFormatter(String columnName, String dateTimeFormat) {
+ this.columnName = columnName;
+ dateFormat = isBlank(dateTimeFormat) ? null : DateTimeFormatter.ofPattern(dateTimeFormat);
+ }
+
+ public String format(Document document) {
+ if (document == null)
+ throw new NullPointerException("Can not format file name suffix: input document is null!");
+
+ if (isBlank(document.get(columnName)))
+ throw new IllegalArgumentException("The specified document does not have a column " + columnName + " or it's value is blank!");
+
+ if (dateFormat == null)
+ return document.get(columnName);
+ OffsetDateTime date = OffsetDateTime.parse(document.get(columnName), SOLR_DATETIME_FORMATTER);
+ return date.format(dateFormat);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/ItemWriterListener.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/ItemWriterListener.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/ItemWriterListener.java
index 7427771..33a67cb 100644
--- a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/ItemWriterListener.java
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/ItemWriterListener.java
@@ -18,8 +18,6 @@
*/
package org.apache.ambari.infra.job.archive;
-import java.io.File;
-
public interface ItemWriterListener {
- void onCompleted(File file);
+ void onCompleted(WriteCompletedEvent event);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/LocalDocumentItemWriter.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/LocalDocumentItemWriter.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/LocalDocumentItemWriter.java
index baad61b..531d2d5 100644
--- a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/LocalDocumentItemWriter.java
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/LocalDocumentItemWriter.java
@@ -20,16 +20,22 @@ package org.apache.ambari.infra.job.archive;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.io.IOUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.*;
public class LocalDocumentItemWriter implements DocumentItemWriter {
+ private static final Logger LOG = LoggerFactory.getLogger(LocalDocumentItemWriter.class);
+
private static final ObjectMapper json = new ObjectMapper();
private static final String ENCODING = "UTF-8";
private final File outFile;
private final BufferedWriter bufferedWriter;
private final ItemWriterListener itemWriterListener;
+ private Document firstDocument = null;
+ private Document lastDocument = null;
public LocalDocumentItemWriter(File outFile, ItemWriterListener itemWriterListener) {
this.itemWriterListener = itemWriterListener;
@@ -48,6 +54,11 @@ public class LocalDocumentItemWriter implements DocumentItemWriter {
try {
bufferedWriter.write(json.writeValueAsString(document));
bufferedWriter.newLine();
+
+ if (firstDocument == null)
+ firstDocument = document;
+
+ lastDocument = document;
}
catch (IOException e) {
throw new UncheckedIOException(e);
@@ -57,14 +68,16 @@ public class LocalDocumentItemWriter implements DocumentItemWriter {
@Override
public void revert() {
IOUtils.closeQuietly(bufferedWriter);
- outFile.delete();
+ if (!outFile.delete())
+ LOG.warn("File {} was not deleted. Exists: {}", outFile.getAbsolutePath(), outFile.exists());
}
@Override
public void close() {
try {
bufferedWriter.close();
- itemWriterListener.onCompleted(outFile);
+ if (itemWriterListener != null)
+ itemWriterListener.onCompleted(new WriteCompletedEvent(outFile, firstDocument, lastDocument));
} catch (IOException e) {
throw new UncheckedIOException(e);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/LocalItemWriterListener.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/LocalItemWriterListener.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/LocalItemWriterListener.java
new file mode 100644
index 0000000..a24d524
--- /dev/null
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/LocalItemWriterListener.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ambari.infra.job.archive;
+
+public class LocalItemWriterListener implements ItemWriterListener {
+ private final FileAction fileAction;
+ private final DocumentWiper documentWiper;
+
+ public LocalItemWriterListener(FileAction fileAction, DocumentWiper documentWiper) {
+ this.fileAction = fileAction;
+ this.documentWiper = documentWiper;
+ }
+
+
+ @Override
+ public void onCompleted(WriteCompletedEvent event) {
+ fileAction.perform(event.getOutFile());
+ documentWiper.delete(event.getFirstDocument(), event.getLastDocument());
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/S3Properties.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/S3Properties.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/S3Properties.java
index 0979f10..88b71cf 100644
--- a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/S3Properties.java
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/S3Properties.java
@@ -18,12 +18,14 @@
*/
package org.apache.ambari.infra.job.archive;
+import static org.apache.commons.lang.StringUtils.isBlank;
+
public class S3Properties {
- private String s3AccessKey;
- private String s3SecretKey;
- private String s3KeyPrefix;
- private String s3BucketName;
- private String s3EndPoint;
+ private final String s3AccessKey;
+ private final String s3SecretKey;
+ private final String s3KeyPrefix;
+ private final String s3BucketName;
+ private final String s3EndPoint;
public S3Properties(String s3AccessKey, String s3SecretKey, String s3KeyPrefix, String s3BucketName, String s3EndPoint) {
this.s3AccessKey = s3AccessKey;
@@ -62,4 +64,15 @@ public class S3Properties {
", s3EndPoint='" + s3EndPoint + '\'' +
'}';
}
+
+ public void validate() {
+ if (isBlank(s3AccessKey))
+ throw new IllegalArgumentException("The property s3AccessKey can not be null or empty string!");
+
+ if (isBlank(s3SecretKey))
+ throw new IllegalArgumentException("The property s3SecretKey can not be null or empty string!");
+
+ if (isBlank(s3BucketName))
+ throw new IllegalArgumentException("The property s3BucketName can not be null or empty string!");
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/S3Uploader.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/S3Uploader.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/S3Uploader.java
index deeb9c7..0ab68ed 100644
--- a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/S3Uploader.java
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/S3Uploader.java
@@ -29,7 +29,7 @@ import static org.apache.commons.lang.StringUtils.isBlank;
*/
public class S3Uploader extends AbstractFileAction {
- private static final Logger LOG = LoggerFactory.getLogger(DocumentExportConfiguration.class);
+ private static final Logger LOG = LoggerFactory.getLogger(S3Uploader.class);
private final AmazonS3Client client;
private final String keyPrefix;
@@ -49,7 +49,7 @@ public class S3Uploader extends AbstractFileAction {
}
@Override
- public File perform(File inputFile) {
+ public File onPerform(File inputFile) {
String key = keyPrefix + inputFile.getName();
if (client.doesObjectExist(bucketName, key)) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/SolrDAO.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/SolrDAO.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/SolrDAO.java
new file mode 100644
index 0000000..fba08e7
--- /dev/null
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/SolrDAO.java
@@ -0,0 +1,68 @@
+/*
+ * 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.infra.job.archive;
+
+import org.apache.ambari.infra.job.SolrDAOBase;
+import org.apache.solr.client.solrj.SolrQuery;
+import org.apache.solr.client.solrj.SolrServerException;
+import org.apache.solr.client.solrj.impl.CloudSolrClient;
+import org.apache.solr.client.solrj.response.QueryResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.io.UncheckedIOException;
+
+public class SolrDAO extends SolrDAOBase implements DocumentWiper {
+ private static final Logger LOG = LoggerFactory.getLogger(SolrDAO.class);
+
+ private final SolrProperties queryProperties;
+
+ public SolrDAO(SolrProperties queryProperties) {
+ super(queryProperties.getZooKeeperConnectionString(), queryProperties.getCollection());
+ this.queryProperties = queryProperties;
+ }
+
+ @Override
+ public void delete(Document firstDocument, Document lastDocument) {
+ delete(new SolrParametrizedString(queryProperties.getDeleteQueryText())
+ .set("start", firstDocument.getFieldMap())
+ .set("end", lastDocument.getFieldMap()).toString());
+ }
+
+ public SolrDocumentIterator query(String start, String end, Document subIntervalFrom, int rows) {
+ SolrQuery query = queryProperties.toQueryBuilder()
+ .setInterval(start, end)
+ .setDocument(subIntervalFrom)
+ .build();
+ query.setRows(rows);
+
+ LOG.info("Executing solr query {}", query.toLocalParamsString());
+
+ try {
+ CloudSolrClient client = createClient();
+ QueryResponse response = client.query(query);
+ return new SolrDocumentIterator(response, client);
+ } catch (SolrServerException e) {
+ throw new RuntimeException(e);
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/SolrDocumentIterator.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/SolrDocumentIterator.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/SolrDocumentIterator.java
index 2e7341d..f8d8382 100644
--- a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/SolrDocumentIterator.java
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/SolrDocumentIterator.java
@@ -34,7 +34,8 @@ import java.util.TimeZone;
public class SolrDocumentIterator implements CloseableIterator<Document> {
- private static final DateFormat SOLR_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX");
+ public static final String SOLR_DATE_FORMAT_TEXT = "yyyy-MM-dd'T'HH:mm:ss.SSSX";
+ private static final DateFormat SOLR_DATE_FORMAT = new SimpleDateFormat(SOLR_DATE_FORMAT_TEXT);
static {
SOLR_DATE_FORMAT.setTimeZone(TimeZone.getTimeZone("UTC"));
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/SolrDocumentSource.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/SolrDocumentSource.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/SolrDocumentSource.java
index 5ded9ac..39ddd1e 100644
--- a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/SolrDocumentSource.java
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/SolrDocumentSource.java
@@ -20,53 +20,20 @@ package org.apache.ambari.infra.job.archive;
import org.apache.ambari.infra.job.CloseableIterator;
import org.apache.ambari.infra.job.ObjectSource;
-import org.apache.solr.client.solrj.SolrQuery;
-import org.apache.solr.client.solrj.SolrServerException;
-import org.apache.solr.client.solrj.impl.CloudSolrClient;
-import org.apache.solr.client.solrj.response.QueryResponse;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.io.UncheckedIOException;
-import java.time.format.DateTimeFormatter;
public class SolrDocumentSource implements ObjectSource<Document> {
- public static final DateTimeFormatter SOLR_DATETIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSX");
- private static final Logger LOG = LoggerFactory.getLogger(SolrDocumentSource.class);
-
- private final String zkConnectionString;
- private final SolrQueryProperties properties;
+ private final SolrDAO solrDAO;
private final String start;
private final String end;
- public SolrDocumentSource(String zkConnectionString, SolrQueryProperties properties, String start, String end) {
- this.zkConnectionString = zkConnectionString;
- this.properties = properties;
+ public SolrDocumentSource(SolrDAO solrDAO, String start, String end) {
+ this.solrDAO = solrDAO;
this.start = start;
this.end = end;
}
@Override
public CloseableIterator<Document> open(Document current, int rows) {
- CloudSolrClient client = new CloudSolrClient.Builder().withZkHost(zkConnectionString).build();
- client.setDefaultCollection(properties.getCollection());
-
- SolrQuery query = properties.toQueryBuilder()
- .setInterval(start, end)
- .setDocument(current)
- .build();
- query.setRows(rows);
-
- LOG.info("Executing solr query {}", query.toLocalParamsString());
-
- try {
- QueryResponse response = client.query(query);
- return new SolrDocumentIterator(response, client);
- } catch (SolrServerException e) {
- throw new RuntimeException(e);
- } catch (IOException e) {
- throw new UncheckedIOException(e);
- }
+ return solrDAO.query(start, end, current, rows);
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/SolrParametrizedString.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/SolrParametrizedString.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/SolrParametrizedString.java
new file mode 100644
index 0000000..9770982
--- /dev/null
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/SolrParametrizedString.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ambari.infra.job.archive;
+
+import org.apache.solr.client.solrj.util.ClientUtils;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class SolrParametrizedString {
+ private static final String PARAMETER_PATTERN = "\\$\\{%s[a-z0-9A-Z]+}";
+ private static final Pattern NO_PREFIX_PARAMETER_PATTERN = Pattern.compile(String.format(PARAMETER_PATTERN, ""));
+
+ private final String string;
+
+ public SolrParametrizedString(String string) {
+ this.string = string;
+ }
+
+ private Set<String> collectParamNames(Pattern regExPattern) {
+ Matcher matcher = regExPattern.matcher(string);
+ Set<String> parameters = new HashSet<>();
+ while (matcher.find())
+ parameters.add(matcher.group().replace("${", "").replace("}", ""));
+ return parameters;
+ }
+
+ @Override
+ public String toString() {
+ return string;
+ }
+
+ public SolrParametrizedString set(Map<String, String> parameterMap) {
+ return set(NO_PREFIX_PARAMETER_PATTERN, null, parameterMap);
+ }
+
+ public SolrParametrizedString set(String prefix, Map<String, String> parameterMap) {
+ String dottedPrefix = prefix + ".";
+ return set(Pattern.compile(String.format(PARAMETER_PATTERN, dottedPrefix)), dottedPrefix, parameterMap);
+ }
+
+ private SolrParametrizedString set(Pattern regExPattern, String prefix, Map<String, String> parameterMap) {
+ String newString = string;
+ for (String paramName : collectParamNames(regExPattern)) {
+ String paramSuffix = prefix == null ? paramName : paramName.replace(prefix, "");
+ if (parameterMap.get(paramSuffix) != null)
+ newString = newString.replace(String.format("${%s}", paramName), getValue(parameterMap, paramSuffix));
+ }
+ return new SolrParametrizedString(newString);
+ }
+
+ private String getValue(Map<String, String> parameterMap, String paramSuffix) {
+ String value = parameterMap.get(paramSuffix);
+ if ("*".equals(value))
+ return value;
+ return ClientUtils.escapeQueryChars(value);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a85ff23b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/SolrProperties.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/SolrProperties.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/SolrProperties.java
new file mode 100644
index 0000000..a2a78c2
--- /dev/null
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/archive/SolrProperties.java
@@ -0,0 +1,117 @@
+/*
+ * 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.infra.job.archive;
+
+import org.springframework.batch.core.JobParameters;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.apache.commons.lang.StringUtils.isBlank;
+
+public class SolrProperties {
+ private String zooKeeperConnectionString;
+ private String collection;
+ private String queryText;
+ private String filterQueryText;
+ private String[] sortColumn;
+ private String deleteQueryText;
+
+ public String getZooKeeperConnectionString() {
+ return zooKeeperConnectionString;
+ }
+
+ public void setZooKeeperConnectionString(String zooKeeperConnectionString) {
+ this.zooKeeperConnectionString = zooKeeperConnectionString;
+ }
+
+ public String getCollection() {
+ return collection;
+ }
+
+ public void setCollection(String collection) {
+ this.collection = collection;
+ }
+
+ public String getQueryText() {
+ return queryText;
+ }
+
+ public void setQueryText(String queryText) {
+ this.queryText = queryText;
+ }
+
+ public String getFilterQueryText() {
+ return filterQueryText;
+ }
+
+ public void setFilterQueryText(String filterQueryText) {
+ this.filterQueryText = filterQueryText;
+ }
+
+ public String[] getSortColumn() {
+ return sortColumn;
+ }
+
+ public void setSortColumn(String[] sortColumn) {
+ this.sortColumn = sortColumn;
+ }
+
+ public String getDeleteQueryText() {
+ return deleteQueryText;
+ }
+
+ public void setDeleteQueryText(String deleteQueryText) {
+ this.deleteQueryText = deleteQueryText;
+ }
+
+ public SolrQueryBuilder toQueryBuilder() {
+ return new SolrQueryBuilder().
+ setQueryText(queryText)
+ .setFilterQueryText(filterQueryText)
+ .addSort(sortColumn);
+ }
+
+ public void apply(JobParameters jobParameters) {
+ zooKeeperConnectionString = jobParameters.getString("zooKeeperConnectionString", zooKeeperConnectionString);
+ collection = jobParameters.getString("collection", collection);
+ queryText = jobParameters.getString("queryText", queryText);
+ filterQueryText = jobParameters.getString("filterQueryText", filterQueryText);
+ deleteQueryText = jobParameters.getString("deleteQueryText", deleteQueryText);
+
+ String sortValue;
+ List<String> sortColumns = new ArrayList<>();
+ int i = 0;
+ while ((sortValue = jobParameters.getString(String.format("sortColumn[%d]", i))) != null) {
+ sortColumns.add(sortValue);
+ ++i;
+ }
+
+ if (sortColumns.size() > 0)
+ sortColumn = sortColumns.toArray(new String[sortColumns.size()]);
+ }
+
+ public void validate() {
+ if (isBlank(zooKeeperConnectionString))
+ throw new IllegalArgumentException("The property zooKeeperConnectionString can not be null or empty string!");
+
+ if (isBlank(collection))
+ throw new IllegalArgumentException("The property collection can not be null or empty string!");
+ }
+}
[29/50] [abbrv] ambari git commit: AMBARI-22647. Rafactor: Package
Log Search and Log Feeder into jars + cleanup start scripts (oleewere)
Posted by rl...@apache.org.
AMBARI-22647. Rafactor: Package Log Search and Log Feeder into jars + cleanup start scripts (oleewere)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/26a33e54
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/26a33e54
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/26a33e54
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 26a33e545b89243daecef21bdf0e2798412e49e8
Parents: 2244d97
Author: Oliver Szabo <ol...@gmail.com>
Authored: Fri Dec 15 22:17:46 2017 +0100
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Fri Jan 5 17:54:16 2018 -0500
----------------------------------------------------------------------
.../ambari-logsearch-assembly/pom.xml | 117 +++-----
.../src/main/package/deb/logfeeder/postinst | 22 ++
.../src/main/package/deb/logfeeder/postrm | 6 +
.../src/main/package/deb/logfeeder/posttrm | 15 -
.../src/main/package/deb/logfeeder/preinst | 13 +
.../src/main/package/deb/portal/postinst | 19 ++
.../src/main/package/deb/portal/postrm | 6 +
.../src/main/package/deb/portal/preinst | 13 +
.../main/package/rpm/logfeeder/postinstall.sh | 37 +++
.../main/package/rpm/logfeeder/postremove.sh | 21 ++
.../main/package/rpm/logfeeder/preinstall.sh | 28 ++
.../src/main/package/rpm/portal/postinstall.sh | 34 +++
.../src/main/package/rpm/portal/postremove.sh | 21 ++
.../src/main/package/rpm/portal/preinstall.sh | 28 ++
.../ambari-logsearch-logfeeder/README.md | 4 +-
.../ambari-logsearch-logfeeder/build.properties | 18 --
.../ambari-logsearch-logfeeder/build.xml | 28 +-
.../ambari-logsearch-logfeeder/pom.xml | 31 --
.../ambari-logsearch-logfeeder/run.sh | 4 +-
.../org/apache/ambari/logfeeder/LogFeeder.java | 35 +--
.../ambari/logfeeder/LogFeederCommandLine.java | 63 ++--
.../ambari/logfeeder/common/ConfigHandler.java | 7 +-
.../src/main/package/deb/control/control | 22 --
.../src/main/package/deb/control/postinst | 15 -
.../src/main/package/deb/control/postrm | 15 -
.../src/main/package/deb/control/preinst | 15 -
.../src/main/package/deb/control/prerm | 15 -
.../src/main/scripts/logfeeder-env.sh | 40 +++
.../src/main/scripts/logfeeder.sh | 292 +++++++++++++++++++
.../src/main/scripts/run.sh | 103 -------
.../ambari-logsearch-server/README.md | 2 +-
.../ambari-logsearch-server/build.xml | 36 ++-
.../ambari-logsearch-server/pom.xml | 11 -
ambari-logsearch/ambari-logsearch-server/run.sh | 2 +-
.../org/apache/ambari/logsearch/LogSearch.java | 2 +-
.../src/main/scripts/logsearch-env.sh | 40 +++
.../src/main/scripts/logsearch.sh | 274 +++++++++++++++++
.../src/main/scripts/run.sh | 99 -------
.../src/main/scripts/stop.sh | 44 ---
ambari-logsearch/docker/Dockerfile | 6 +-
ambari-logsearch/docker/all.yml | 4 +-
ambari-logsearch/docker/bin/start.sh | 30 +-
ambari-logsearch/docker/docker-compose.yml | 2 -
ambari-logsearch/docker/logsearch-logfeeder.yml | 1 -
ambari-logsearch/docker/logsearch-server.yml | 1 -
.../test-config/logfeeder/logfeeder-env.sh | 5 +-
.../test-config/logfeeder/logfeeder.properties | 2 +-
.../test-config/logsearch/logsearch-env.sh | 5 +-
.../logsearch/logsearch-https.properties | 4 +-
.../test-config/logsearch/logsearch.properties | 4 +-
.../0.5.0/configuration/logfeeder-env.xml | 2 +-
.../configuration/logfeeder-properties.xml | 2 +-
.../0.5.0/configuration/logsearch-env.xml | 6 +-
.../0.5.0/package/scripts/logfeeder.py | 7 +-
.../0.5.0/package/scripts/logsearch.py | 8 +-
.../0.5.0/package/scripts/logsearch_common.py | 54 ----
.../LOGSEARCH/0.5.0/package/scripts/params.py | 8 +-
.../0.5.0/package/scripts/setup_logfeeder.py | 2 +-
.../0.5.0/package/scripts/setup_logsearch.py | 2 +-
.../0.5.0/properties/logfeeder-env.sh.j2 | 5 +-
.../0.5.0/properties/logsearch-env.sh.j2 | 5 +-
.../stack-hooks/after-INSTALL/scripts/params.py | 2 +-
.../hooks/after-INSTALL/test_after_install.py | 8 +-
.../stacks/2.4/LOGSEARCH/test_logfeeder.py | 34 +--
.../stacks/2.4/LOGSEARCH/test_logsearch.py | 31 +-
.../test/python/stacks/2.4/configs/default.json | 2 +-
66 files changed, 1102 insertions(+), 737 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-assembly/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-assembly/pom.xml b/ambari-logsearch/ambari-logsearch-assembly/pom.xml
index cbc62ce..19c3d90 100644
--- a/ambari-logsearch/ambari-logsearch-assembly/pom.xml
+++ b/ambari-logsearch/ambari-logsearch-assembly/pom.xml
@@ -82,6 +82,18 @@
<configuration>
<group>Development</group>
<name>${logsearch.portal.package.name}</name>
+ <postinstallScriptlet>
+ <scriptFile>${project.basedir}/src/main/package/rpm/portal/postinstall.sh</scriptFile>
+ <fileEncoding>utf-8</fileEncoding>
+ </postinstallScriptlet>
+ <postremoveScriptlet>
+ <scriptFile>${project.basedir}/src/main/package/rpm/portal/postremove.sh</scriptFile>
+ <fileEncoding>utf-8</fileEncoding>
+ </postremoveScriptlet>
+ <preinstallScriptlet>
+ <scriptFile>${project.basedir}/src/main/package/rpm/portal/preinstall.sh</scriptFile>
+ <fileEncoding>utf-8</fileEncoding>
+ </preinstallScriptlet>
<mappings>
<mapping>
<directory>${logsearch.portal.mapping.path}</directory>
@@ -89,37 +101,11 @@
<source>
<location>${logsearch.server.dir}/target/package</location>
<excludes>
- <exclude>classes/log4j.xml</exclude>
- <exclude>classes/logsearch.properties</exclude>
- <exclude>classes/user_pass.json</exclude>
- <exclude>classes/HadoopServiceConfig.json</exclude>
- <exclude>solr_configsets/**</exclude>
<exclude>libs/checkstyle*.jar</exclude>
</excludes>
</source>
</sources>
</mapping>
- <mapping>
- <directory>${logsearch.portal.conf.mapping.path}</directory>
- <sources>
- <source>
- <location>${logsearch.server.dir}/target/package/classes</location>
- <includes>
- <include>log4j.xml</include>
- <include>logsearch.properties</include>
- <include>user_pass.json</include>
- </includes>
- </source>
- </sources>
- </mapping>
- <mapping>
- <directory>${logsearch.portal.conf.mapping.path}/solr_configsets</directory>
- <sources>
- <source>
- <location>${logsearch.server.dir}/target/package/solr_configsets</location>
- </source>
- </sources>
- </mapping>
</mappings>
</configuration>
</execution>
@@ -132,6 +118,18 @@
<configuration>
<group>Development</group>
<name>${logsearch.logfeeder.package.name}</name>
+ <postinstallScriptlet>
+ <scriptFile>${project.basedir}/src/main/package/rpm/logfeeder/postinstall.sh</scriptFile>
+ <fileEncoding>utf-8</fileEncoding>
+ </postinstallScriptlet>
+ <postremoveScriptlet>
+ <scriptFile>${project.basedir}/src/main/package/rpm/logfeeder/postremove.sh</scriptFile>
+ <fileEncoding>utf-8</fileEncoding>
+ </postremoveScriptlet>
+ <preinstallScriptlet>
+ <scriptFile>${project.basedir}/src/main/package/rpm/logfeeder/preinstall.sh</scriptFile>
+ <fileEncoding>utf-8</fileEncoding>
+ </preinstallScriptlet>
<mappings>
<mapping>
<directory>${logsearch.logfeeder.mapping.path}</directory>
@@ -139,27 +137,11 @@
<source>
<location>${logsearch.logfeeder.dir}/target/package</location>
<excludes>
- <exclude>classes/log4j.xml</exclude>
- <exclude>classes/logfeeder.properties</exclude>
- <exclude>classes/grok-patterns</exclude>
<exclude>libs/checkstyle*.jar</exclude>
</excludes>
</source>
</sources>
</mapping>
- <mapping>
- <directory>${logsearch.logfeeder.conf.mapping.path}</directory>
- <sources>
- <source>
- <location>${logsearch.logfeeder.dir}/target/package/classes</location>
- <includes>
- <include>log4j.xml</include>
- <include>logfeeder.properties</include>
- <include>grok-patterns</include>
- </includes>
- </source>
- </sources>
- </mapping>
</mappings>
</configuration>
</execution>
@@ -197,7 +179,11 @@
<directory>${project.basedir}/src/main/package/deb</directory>
<excludes>
<exclude>portal/postinst</exclude>
+ <exclude>portal/postrm</exclude>
+ <exclude>portal/preinstall</exclude>
<exclude>logfeeder/postinst</exclude>
+ <exclude>logfeeder/postrm</exclude>
+ <exclude>logfeeder/preinstall</exclude>
</excludes>
<filtering>false</filtering>
</resource>
@@ -205,7 +191,11 @@
<directory>${project.basedir}/src/main/package/deb</directory>
<includes>
<include>portal/postinst</include>
+ <include>portal/postrm</include>
+ <include>portal/preinstall</include>
<include>logfeeder/postinst</include>
+ <include>logfeeder/postrm</include>
+ <include>logfeeder/preinstall</include>
</includes>
<filtering>true</filtering>
</resource>
@@ -242,34 +232,9 @@
<group>root</group>
</mapper>
<excludes>
- classes/log4j.xml,classes/logsearch.properties,classes/user_pass.json,classes/HadoopServiceConfig.json,solr_configsets/**,libs/checkstyle*.jar
+ libs/checkstyle*.jar
</excludes>
</data>
- <data>
- <src>${logsearch.server.dir}/target/package/classes</src>
- <type>directory</type>
- <mapper>
- <prefix>${logsearch.portal.conf.mapping.path}</prefix>
- <type>perm</type>
- <user>root</user>
- <group>root</group>
- <filemode>644</filemode>
- </mapper>
- <includes>
- log4j.xml,logsearch.properties,user_pass.json
- </includes>
- </data>
- <data>
- <src>${logsearch.server.dir}/target/package/solr_configsets</src>
- <type>directory</type>
- <mapper>
- <prefix>${logsearch.portal.conf.mapping.path}/solr_configsets</prefix>
- <type>perm</type>
- <user>root</user>
- <group>root</group>
- </mapper>
- <excludes>libs/checkstyle*.jar</excludes>
- </data>
</dataSet>
</configuration>
</execution>
@@ -297,23 +262,9 @@
<group>root</group>
</mapper>
<excludes>
- classes/log4j.xml,classes/logfeeder.properties,classes/grok-patterns,libs/checkstyle*.jar
+ libs/checkstyle*.jar
</excludes>
</data>
- <data>
- <src>${logsearch.logfeeder.dir}/target/package/classes</src>
- <type>directory</type>
- <mapper>
- <prefix>${logsearch.logfeeder.conf.mapping.path}</prefix>
- <type>perm</type>
- <user>root</user>
- <group>root</group>
- <filemode>644</filemode>
- </mapper>
- <includes>
- log4j.xml,logfeeder.properties,grok-patterns
- </includes>
- </data>
</dataSet>
</configuration>
</execution>
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/postinst
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/postinst b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/postinst
index 21a01fa..a4eec77 100644
--- a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/postinst
+++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/postinst
@@ -13,3 +13,25 @@
# 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
+
+LOGFEEDER_SCRIPT_LINK_NAME="/usr/bin/logfeeder"
+LOGFEEDER_SCRIPT_SOURCE="/usr/lib/ambari-logsearch-logfeeder/bin/logfeeder.sh"
+
+LOGFEEDER_CONF_LINK="/etc/ambari-logsearch-logfeeder/conf"
+LOGFEEDER_CONF_SOURCE="/usr/lib/ambari-logsearch-logfeeder/conf"
+
+ln -s $LOGFEEDER_SCRIPT_SOURCE $LOGFEEDER_SCRIPT_LINK_NAME
+ln -s $LOGFEEDER_CONF_SOURCE $LOGFEEDER_CONF_LINK
+
+# handle old checkpoint & keys folder
+
+LOGFEEDER_CONF_BACKUP="/usr/lib/ambari-logsearch-logfeeder/conf-old"
+
+if [ -d "$LOGFEEDER_CONF_BACKUP" ]; then
+ if [ -d "$LOGFEEDER_CONF_BACKUP/keys" ]; then
+ cp -r $LOGFEEDER_CONF_BACKUP/keys $LOGFEEDER_CONF_SOURCE
+ fi
+ if [ -d "$LOGFEEDER_CONF_BACKUP/checkpoints" ]; then
+ cp -r $LOGFEEDER_CONF_BACKUP/checkpoints $LOGFEEDER_CONF_SOURCE
+ fi
+fi
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/postrm
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/postrm b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/postrm
index 21a01fa..5f1c623 100644
--- a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/postrm
+++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/postrm
@@ -13,3 +13,9 @@
# 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
+
+LOGFEEDER_SCRIPT_LINK_NAME="/usr/bin/logfeeder"
+LOGFEEDER_CONF_DIR_LINK="/etc/ambari-logsearch-logfeeder/conf"
+
+rm -f $LOGFEEDER_SCRIPT_LINK_NAME
+rm -f $LOGFEEDER_CONF_DIR_LINK
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/posttrm
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/posttrm b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/posttrm
deleted file mode 100644
index 21a01fa..0000000
--- a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/posttrm
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/bash
-# 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
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/preinst
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/preinst b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/preinst
index 21a01fa..01d70e0 100644
--- a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/preinst
+++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/logfeeder/preinst
@@ -13,3 +13,16 @@
# 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
+
+LOGFEEDER_CONF="/etc/ambari-logsearch-logfeeder/conf"
+LOGFEEDER_CONF_BACKUP="/usr/lib/ambari-logsearch-logfeeder/conf-old"
+
+if [ -d $LOGFEEDER_CONF_BACKUP ]; then
+ rm -rf $LOGFEEDER_CONF_BACKUP
+fi
+
+if [ -d $LOGFEEDER_CONF ]; then
+ mkdir -p $LOGFEEDER_CONF_BACKUP
+ cp -r $LOGFEEDER_CONF/* $LOGFEEDER_CONF_BACKUP
+ rm -rf $LOGFEEDER_CONF
+fi
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/postinst
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/postinst b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/postinst
index 21a01fa..9107482 100644
--- a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/postinst
+++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/postinst
@@ -13,3 +13,22 @@
# 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
+
+LOGSEARCH_SCRIPT_LINK_NAME="/usr/bin/logsearch"
+LOGSEARCH_SCRIPT_SOURCE="/usr/lib/ambari-logsearch-portal/bin/logsearch.sh"
+
+LOGSEARCH_CONF_LINK="/etc/ambari-logsearch-portal/conf"
+LOGSEARCH_CONF_SOURCE="/usr/lib/ambari-logsearch-portal/conf"
+
+ln -s $LOGSEARCH_SCRIPT_SOURCE $LOGSEARCH_SCRIPT_LINK_NAME
+ln -s $LOGSEARCH_CONF_SOURCE $LOGSEARCH_CONF_LINK
+
+# handle old keys folder
+
+LOGSEARCH_CONF_BACKUP="/usr/lib/ambari-logsearch-portal/conf-old"
+
+if [ -d "$LOGSEARCH_CONF_BACKUP" ]; then
+ if [ -d "$LOGSEARCH_CONF_BACKUP/keys" ]; then
+ cp -r $LOGSEARCH_CONF_BACKUP/keys $LOGSEARCH_CONF_SOURCE
+ fi
+fi
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/postrm
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/postrm b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/postrm
index 21a01fa..8de05c1 100644
--- a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/postrm
+++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/postrm
@@ -13,3 +13,9 @@
# 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
+
+LOGSEARCH_SCRIPT_LINK_NAME="/usr/bin/logsearch"
+LOGSEARCH_CONF_DIR_LINK="/etc/ambari-logsearch-portal/conf"
+
+rm -f $LOGSEARCH_SCRIPT_LINK_NAME
+rm -f $LOGSEARCH_CONF_DIR_LINK
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/preinst
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/preinst b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/preinst
index 21a01fa..dfb8752 100644
--- a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/preinst
+++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/deb/portal/preinst
@@ -13,3 +13,16 @@
# 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
+
+LOGSEARCH_CONF="/etc/ambari-logsearch-portal/conf"
+LOGSEARCH_CONF_BACKUP="/usr/lib/ambari-logsearch-portal/conf-old"
+
+if [ -d $LOGSEARCH_CONF_BACKUP ]; then
+ rm -rf $LOGSEARCH_CONF_BACKUP
+fi
+
+if [ -d $LOGSEARCH_CONF ]; then
+ mkdir -p $LOGSEARCH_CONF_BACKUP
+ cp -r $LOGSEARCH_CONF/* $LOGSEARCH_CONF_BACKUP
+ rm -rf $LOGSEARCH_CONF
+fi
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/logfeeder/postinstall.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/logfeeder/postinstall.sh b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/logfeeder/postinstall.sh
new file mode 100755
index 0000000..a4eec77
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/logfeeder/postinstall.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+# 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
+
+LOGFEEDER_SCRIPT_LINK_NAME="/usr/bin/logfeeder"
+LOGFEEDER_SCRIPT_SOURCE="/usr/lib/ambari-logsearch-logfeeder/bin/logfeeder.sh"
+
+LOGFEEDER_CONF_LINK="/etc/ambari-logsearch-logfeeder/conf"
+LOGFEEDER_CONF_SOURCE="/usr/lib/ambari-logsearch-logfeeder/conf"
+
+ln -s $LOGFEEDER_SCRIPT_SOURCE $LOGFEEDER_SCRIPT_LINK_NAME
+ln -s $LOGFEEDER_CONF_SOURCE $LOGFEEDER_CONF_LINK
+
+# handle old checkpoint & keys folder
+
+LOGFEEDER_CONF_BACKUP="/usr/lib/ambari-logsearch-logfeeder/conf-old"
+
+if [ -d "$LOGFEEDER_CONF_BACKUP" ]; then
+ if [ -d "$LOGFEEDER_CONF_BACKUP/keys" ]; then
+ cp -r $LOGFEEDER_CONF_BACKUP/keys $LOGFEEDER_CONF_SOURCE
+ fi
+ if [ -d "$LOGFEEDER_CONF_BACKUP/checkpoints" ]; then
+ cp -r $LOGFEEDER_CONF_BACKUP/checkpoints $LOGFEEDER_CONF_SOURCE
+ fi
+fi
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/logfeeder/postremove.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/logfeeder/postremove.sh b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/logfeeder/postremove.sh
new file mode 100755
index 0000000..5f1c623
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/logfeeder/postremove.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+# 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
+
+LOGFEEDER_SCRIPT_LINK_NAME="/usr/bin/logfeeder"
+LOGFEEDER_CONF_DIR_LINK="/etc/ambari-logsearch-logfeeder/conf"
+
+rm -f $LOGFEEDER_SCRIPT_LINK_NAME
+rm -f $LOGFEEDER_CONF_DIR_LINK
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/logfeeder/preinstall.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/logfeeder/preinstall.sh b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/logfeeder/preinstall.sh
new file mode 100644
index 0000000..01d70e0
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/logfeeder/preinstall.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+# 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
+
+LOGFEEDER_CONF="/etc/ambari-logsearch-logfeeder/conf"
+LOGFEEDER_CONF_BACKUP="/usr/lib/ambari-logsearch-logfeeder/conf-old"
+
+if [ -d $LOGFEEDER_CONF_BACKUP ]; then
+ rm -rf $LOGFEEDER_CONF_BACKUP
+fi
+
+if [ -d $LOGFEEDER_CONF ]; then
+ mkdir -p $LOGFEEDER_CONF_BACKUP
+ cp -r $LOGFEEDER_CONF/* $LOGFEEDER_CONF_BACKUP
+ rm -rf $LOGFEEDER_CONF
+fi
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/portal/postinstall.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/portal/postinstall.sh b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/portal/postinstall.sh
new file mode 100644
index 0000000..9107482
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/portal/postinstall.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+# 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
+
+LOGSEARCH_SCRIPT_LINK_NAME="/usr/bin/logsearch"
+LOGSEARCH_SCRIPT_SOURCE="/usr/lib/ambari-logsearch-portal/bin/logsearch.sh"
+
+LOGSEARCH_CONF_LINK="/etc/ambari-logsearch-portal/conf"
+LOGSEARCH_CONF_SOURCE="/usr/lib/ambari-logsearch-portal/conf"
+
+ln -s $LOGSEARCH_SCRIPT_SOURCE $LOGSEARCH_SCRIPT_LINK_NAME
+ln -s $LOGSEARCH_CONF_SOURCE $LOGSEARCH_CONF_LINK
+
+# handle old keys folder
+
+LOGSEARCH_CONF_BACKUP="/usr/lib/ambari-logsearch-portal/conf-old"
+
+if [ -d "$LOGSEARCH_CONF_BACKUP" ]; then
+ if [ -d "$LOGSEARCH_CONF_BACKUP/keys" ]; then
+ cp -r $LOGSEARCH_CONF_BACKUP/keys $LOGSEARCH_CONF_SOURCE
+ fi
+fi
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/portal/postremove.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/portal/postremove.sh b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/portal/postremove.sh
new file mode 100644
index 0000000..8de05c1
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/portal/postremove.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+# 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
+
+LOGSEARCH_SCRIPT_LINK_NAME="/usr/bin/logsearch"
+LOGSEARCH_CONF_DIR_LINK="/etc/ambari-logsearch-portal/conf"
+
+rm -f $LOGSEARCH_SCRIPT_LINK_NAME
+rm -f $LOGSEARCH_CONF_DIR_LINK
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/portal/preinstall.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/portal/preinstall.sh b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/portal/preinstall.sh
new file mode 100644
index 0000000..dfb8752
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/portal/preinstall.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+# 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
+
+LOGSEARCH_CONF="/etc/ambari-logsearch-portal/conf"
+LOGSEARCH_CONF_BACKUP="/usr/lib/ambari-logsearch-portal/conf-old"
+
+if [ -d $LOGSEARCH_CONF_BACKUP ]; then
+ rm -rf $LOGSEARCH_CONF_BACKUP
+fi
+
+if [ -d $LOGSEARCH_CONF ]; then
+ mkdir -p $LOGSEARCH_CONF_BACKUP
+ cp -r $LOGSEARCH_CONF/* $LOGSEARCH_CONF_BACKUP
+ rm -rf $LOGSEARCH_CONF
+fi
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-logfeeder/README.md
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/README.md b/ambari-logsearch/ambari-logsearch-logfeeder/README.md
index d2e55f0..48cb81b 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/README.md
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/README.md
@@ -29,11 +29,11 @@ First you need to start every required service (except logfeeder), go to `ambari
docker-compose up -d zookeeper solr logsearch
```
-Secondly, if you are planning to run Log Feeder from an IDE, for running the LogFeeder main methoud, you will need to set the working directory to `ambari/ambari-logsearch/ambari-logsearch-logfeeder` and use `--monitor` as a command line argument.
+Secondly, if you are planning to run Log Feeder from an IDE, for running the LogFeeder main methoud, you will need to set the working directory to `ambari/ambari-logsearch/ambari-logsearch-logfeeder` or set `LOGFEEDER_RELATIVE_LOCATION` env variable.
With Maven, you won't need these steps, just run this command from the ambari-logsearch-logfeeder folder:
```bash
-mvn clean package -DskipTests exec:java
+mvn clean package -DskipTests spring-boot:run
```
# Input Configuration
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-logfeeder/build.properties
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/build.properties b/ambari-logsearch/ambari-logsearch-logfeeder/build.properties
deleted file mode 100644
index 013ba2e..0000000
--- a/ambari-logsearch/ambari-logsearch-logfeeder/build.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-app.pkg.dir=${app.work.dir}/pkg
-
-app.dev.war.dir=${app.work.dir}/webapps/logsearch
-app.war.name=logsearch.war
-
-app.target.dir=${builddir}/target/classes/static
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-logfeeder/build.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/build.xml b/ambari-logsearch/ambari-logsearch-logfeeder/build.xml
index 738b2ef..c150b55 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/build.xml
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/build.xml
@@ -19,10 +19,8 @@
<property environment="env"/>
<property name="debuglevel" value="source,lines,vars"/>
<dirname property="builddir" file="build.xml"/>
- <property name="target" value="1.7"/>
- <property name="source" value="1.7"/>
- <property file="local.properties"/>
- <property file="build.properties"/>
+ <property name="target" value="1.8"/>
+ <property name="source" value="1.8"/>
<target name="init">
</target>
<target name="build"/>
@@ -31,18 +29,20 @@
<delete dir="target/package"/>
<copy todir="target/package/libs" includeEmptyDirs="no">
<fileset dir="target/libs"/>
+ <fileset file="target/ambari-logsearch-logfeeder*.jar"/>
</copy>
- <copy todir="target/package/classes" includeEmptyDirs="no">
- <fileset dir="target/classes"/>
+ <copy todir="target/package/bin" includeEmptyDirs="no">
+ <fileset file="src/main/scripts/logfeeder.sh"/>
</copy>
- <copy todir="target/package" includeEmptyDirs="no">
- <fileset file="config.json"/>
+ <copy todir="target/package/conf" includeEmptyDirs="no">
+ <fileset file="target/classes/grok-patterns"/>
+ <fileset file="target/classes/log4j.xml"/>
+ <fileset file="target/classes/logfeeder.properties"/>
+ <fileset file="target/classes/alias_config.json"/>
+ <fileset file="src/main/scripts/logfeeder-env.sh"/>
</copy>
- <copy todir="target/package" includeEmptyDirs="no">
- <fileset file="grok-patterns"/>
- <fileset file="src/main/scripts/run.sh"/>
- </copy>
- <chmod file="target/package/run.sh" perm="755"/>
+ <chmod file="target/package/bin/logfeeder.sh" perm="755"/>
+ <chmod file="target/package/conf/logfeeder-env.sh" perm="755"/>
<tar compression="gzip" destfile="target/ambari-logsearch-logfeeder.tgz">
<tarfileset mode="755" dir="target/package">
<include name="*.sh"/>
@@ -52,6 +52,4 @@
</tarfileset>
</tar>
</target>
- <target description="Build all projects which reference this project. Useful to propagate changes."
- name="build-refprojects"/>
</project>
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/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 005af15..6a3524d 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/pom.xml
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/pom.xml
@@ -198,7 +198,6 @@
</dependency>
</dependencies>
<build>
- <finalName>LogFeeder</finalName>
<pluginManagement>
<plugins>
<plugin>
@@ -222,40 +221,10 @@
<target>${jdk.version}</target>
</configuration>
</plugin>
-
- <!-- Exec main class plugin -->
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <version>1.2.1</version>
- <executions>
- <execution>
- <goals>
- <goal>java</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <mainClass>org.apache.ambari.logfeeder.LogFeeder</mainClass>
- <arguments>
- <argument>--monitor</argument>
- </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>
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-logfeeder/run.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/run.sh b/ambari-logsearch/ambari-logsearch-logfeeder/run.sh
index 70947ec..47a9e6c 100755
--- a/ambari-logsearch/ambari-logsearch-logfeeder/run.sh
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/run.sh
@@ -14,6 +14,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-echo "LOG FEEDER"
-mvn clean compile
-mvn exec:java
+mvn clean spring-boot:run
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/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 2d31e5a..235109c 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
@@ -18,54 +18,21 @@
*/
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;
-
@SpringBootApplication(
scanBasePackages = {"org.apache.ambari.logfeeder"}
)
public class LogFeeder {
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");
+ String pidFile = System.getenv("LOGFEEDER_PID_FILE") == null ? "logfeeder.pid" : System.getenv("LOGFEEDER_PID_FILE");
new SpringApplicationBuilder(LogFeeder.class)
.bannerMode(Banner.Mode.OFF)
.listeners(new ApplicationPidFileWriter(pidFile))
.run(args);
}
-
- private static void test(LogFeederCommandLine cli) {
- try {
- LogManager.shutdown();
- String testLogEntry = cli.getTestLogEntry();
- String testShipperConfig = FileUtils.readFileToString(new File(cli.getTestShipperConfig()), Charset.defaultCharset());
- List<String> testGlobalConfigs = new ArrayList<>();
- for (String testGlobalConfigFile : cli.getTestGlobalConfigs().split(",")) {
- testGlobalConfigs.add(FileUtils.readFileToString(new File(testGlobalConfigFile), Charset.defaultCharset()));
- }
- String testLogId = cli.getTestLogId();
- Map<String, Object> result = new LogEntryParseTester(testLogEntry, testShipperConfig, testGlobalConfigs, testLogId).parse();
- String parsedLogEntry = new GsonBuilder().setPrettyPrinting().create().toJson(result);
- System.out.println("The result of the parsing is:\n" + parsedLogEntry);
- } catch (Exception e) {
- System.out.println("Exception occurred, could not test if log entry is parseable");
- e.printStackTrace(System.out);
- }
- }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/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 61e7a1e..a6fcb2a 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
@@ -19,22 +19,25 @@
package org.apache.ambari.logfeeder;
+import com.google.gson.GsonBuilder;
+import org.apache.ambari.logfeeder.common.LogEntryParseTester;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
+import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.log4j.LogManager;
+import java.io.File;
+import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
public class LogFeederCommandLine {
-
- private static final Logger LOG = LoggerFactory.getLogger(LogFeederCommandLine.class);
private static final String TEST_COMMAND = "test";
private static final String TEST_LOG_ENTRY_OPTION = "test-log-entry";
@@ -42,11 +45,9 @@ public class LogFeederCommandLine {
private static final String TEST_GLOBAL_CONFIG_OPTION = "test-global-config";
private static final String TEST_LOG_ID_OPTION = "test-log-id";
- private static final String COMMAND_LINE_SYNTAX = "java org.apache.ambari.logfeeder.LogFeeder -(monitor|test) [args]";
-
- private CommandLine cli;
+ private static final String COMMAND_LINE_SYNTAX = "java org.apache.ambari.logfeeder.LogFeederCommandLine --test [args]";
- public LogFeederCommandLine(String[] args) {
+ public static void main(String[] args) {
Options options = new Options();
HelpFormatter helpFormatter = new HelpFormatter();
helpFormatter.setDescPadding(10);
@@ -95,7 +96,7 @@ public class LogFeederCommandLine {
try {
CommandLineParser cmdLineParser = new DefaultParser();
- cli = cmdLineParser.parse(options, args);
+ CommandLine cli = cmdLineParser.parse(options, args);
if (cli.hasOption('h')) {
helpFormatter.printHelp(COMMAND_LINE_SYNTAX, options);
@@ -105,11 +106,12 @@ public class LogFeederCommandLine {
if (cli.hasOption("t")) {
command = TEST_COMMAND;
validateRequiredOptions(cli, command, testLogEntryOption, testShipperConfOption);
- } else {
- LOG.info("Start application in monitor mode ");
}
+ test(cli);
} catch (Exception e) {
- LOG.info("Error parsing command line parameters: {}. LogFeeder will be started in monitoring mode.", e.getMessage());
+ e.printStackTrace();
+ helpFormatter.printHelp(COMMAND_LINE_SYNTAX, options);
+ System.exit(1);
}
}
@@ -125,24 +127,23 @@ public class LogFeederCommandLine {
String.format("The following options required for '%s' : %s", command, StringUtils.join(requiredOptions, ",")));
}
}
-
- public boolean isTest() {
- return cli != null && cli.hasOption('t');
- }
-
- public String getTestLogEntry() {
- return cli.getOptionValue("tle");
- }
-
- public String getTestShipperConfig() {
- return cli.getOptionValue("tsc");
- }
-
- public String getTestGlobalConfigs() {
- return cli.getOptionValue("tgc");
- }
-
- public String getTestLogId() {
- return cli.getOptionValue("tli");
+
+ private static void test(CommandLine cli) {
+ try {
+ LogManager.shutdown();
+ String testLogEntry = cli.getOptionValue("tle");
+ String testShipperConfig = FileUtils.readFileToString(new File(cli.getOptionValue("tsc")), Charset.defaultCharset());
+ List<String> testGlobalConfigs = new ArrayList<>();
+ for (String testGlobalConfigFile : cli.getOptionValue("tgc").split(",")) {
+ testGlobalConfigs.add(FileUtils.readFileToString(new File(testGlobalConfigFile), Charset.defaultCharset()));
+ }
+ String testLogId = cli.getOptionValue("tli");
+ Map<String, Object> result = new LogEntryParseTester(testLogEntry, testShipperConfig, testGlobalConfigs, testLogId).parse();
+ String parsedLogEntry = new GsonBuilder().setPrettyPrinting().create().toJson(result);
+ System.out.println("The result of the parsing is:\n" + parsedLogEntry);
+ } catch (Exception e) {
+ System.out.println("Exception occurred, could not test if log entry is parseable");
+ e.printStackTrace(System.out);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/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 35c0e6a..037f4a1 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
@@ -21,12 +21,12 @@ package org.apache.ambari.logfeeder.common;
import java.io.BufferedInputStream;
import java.io.File;
+import java.io.FileNotFoundException;
import java.lang.reflect.Type;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -62,6 +62,7 @@ import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import com.google.gson.reflect.TypeToken;
+import org.springframework.core.io.ClassPathResource;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
@@ -146,6 +147,10 @@ public class ConfigHandler implements InputConfigMonitor {
private void loadConfigsUsingClassLoader(String configFileName) throws Exception {
try (BufferedInputStream fis = (BufferedInputStream) this.getClass().getClassLoader().getResourceAsStream(configFileName)) {
+ ClassPathResource configFile = new ClassPathResource(configFileName);
+ if (!configFile.exists()) {
+ throw new FileNotFoundException(configFileName);
+ }
String configData = IOUtils.toString(fis, Charset.defaultCharset());
loadConfigs(configData);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-logfeeder/src/main/package/deb/control/control
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/package/deb/control/control b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/package/deb/control/control
deleted file mode 100644
index 40cd855..0000000
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/package/deb/control/control
+++ /dev/null
@@ -1,22 +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: [[artifactId]]
-Version: [[package-version]]-[[package-release]]
-Section: [[deb.section]]
-Priority: [[deb.priority]]
-Depends: [[deb.dependency.list]]
-Architecture: [[deb.architecture]]
-Description: [[description]]
-Maintainer: [[deb.publisher]]
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-logfeeder/src/main/package/deb/control/postinst
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/package/deb/control/postinst b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/package/deb/control/postinst
deleted file mode 100644
index 21a01fa..0000000
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/package/deb/control/postinst
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/bash
-# 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
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-logfeeder/src/main/package/deb/control/postrm
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/package/deb/control/postrm b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/package/deb/control/postrm
deleted file mode 100644
index 21a01fa..0000000
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/package/deb/control/postrm
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/bash
-# 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
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-logfeeder/src/main/package/deb/control/preinst
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/package/deb/control/preinst b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/package/deb/control/preinst
deleted file mode 100644
index 21a01fa..0000000
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/package/deb/control/preinst
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/bash
-# 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
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-logfeeder/src/main/package/deb/control/prerm
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/package/deb/control/prerm b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/package/deb/control/prerm
deleted file mode 100644
index 21a01fa..0000000
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/package/deb/control/prerm
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/bash
-# 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
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-logfeeder/src/main/scripts/logfeeder-env.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/scripts/logfeeder-env.sh b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/scripts/logfeeder-env.sh
new file mode 100755
index 0000000..37e9930
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/scripts/logfeeder-env.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+# 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.
+
+# Log Feeder extra options
+export LOGFEEDER_JAVA_OPTS=${LOGFEEDER_JAVA_OPTS:-""}
+
+# Log Feeder debug options
+# export LOGFEEDER_DEBUG=true
+# exoprt LOGFEEDER_DEBUG_SUSPEND=n
+export LOGFEEDER_DEBUG_PORT=5006
+
+# Log Feeder memory
+# export LOGFEEDER_JAVA_MEM="-Xmx512m"
+
+# export LOG_PATH=/var/log/ambari-logsearch-logfeeder/
+# export LOG_FILE=logfeeder.log
+
+# Pid file of the application
+# export LOGFEEDER_PID_DIR=/var/run/ambari-logsearch-logfeeder
+# export LOGFEEDER_PID_FILE=logfeeder.pid
+
+# SSL settings"
+# export LOGFEEDER_SSL="true"
+# export LOGFEEDER_KEYSTORE_LOCATION="/my/path/keystore.jks"
+# export LOGFEEDER_KEYSTORE_TYPE="jks"
+# export LOGFEEDER_TRUSTSTORE_LOCATION="/my/path/trutstore.jks"
+# export LOGFEEDER_TRUSTSTORE_TYPE="jks"
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-logfeeder/src/main/scripts/logfeeder.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/scripts/logfeeder.sh b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/scripts/logfeeder.sh
new file mode 100755
index 0000000..cfacea5
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/scripts/logfeeder.sh
@@ -0,0 +1,292 @@
+#!/bin/bash
+# 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.
+
+JVM="java"
+
+if [ -x $JAVA_HOME/bin/java ]; then
+ JVM=$JAVA_HOME/bin/java
+fi
+
+if [ "$LOGFEEDER_JAVA_MEM" = "" ]; then
+ LOGFEEDER_JAVA_MEM="-Xmx512m"
+fi
+
+readlinkf(){
+ # get real path on mac OSX
+ perl -MCwd -e 'print Cwd::abs_path shift' "$1";
+}
+
+if [ "$(uname -s)" = 'Linux' ]; then
+ SCRIPT_DIR="`dirname "$(readlink -f "$0")"`"
+else
+ SCRIPT_DIR="`dirname "$(readlinkf "$0")"`"
+fi
+
+LOGFEEDER_ROOT_DIR="`dirname \"$SCRIPT_DIR\"`"
+LOGFEEDER_LIBS_DIR="$LOGFEEDER_ROOT_DIR/libs"
+
+if [ "$LOGFEEDER_CONF_DIR" = "" ]; then
+ LOGFEEDER_CONF_DIR="/etc/ambari-logsearch-logfeeder/conf"
+ if [ ! -d $LOGFEEDER_CONF_DIR ]; then
+ if [ -d "$LOGFEEDER_ROOT_DIR/conf" ]; then
+ LOGFEEDER_CONF_DIR="$LOGFEEDER_ROOT_DIR/conf"
+ fi
+ fi
+fi
+
+if [ -f "$LOGFEEDER_CONF_DIR/logfeeder-env.sh" ]; then
+ source $LOGFEEDER_CONF_DIR/logfeeder-env.sh
+fi
+
+if [ ! -z "$LOGSEARCH_SOLR_CLIENT_SSL_INCLUDE" ]; then
+ source $LOGSEARCH_SOLR_CLIENT_SSL_INCLUDE
+fi
+
+if [ -z "$LOGFEEDER_PID_FILE" ]; then
+ LOGFEEDER_PID_DIR=$HOME
+ export LOGFEEDER_PID_FILE=$LOGFEEDER_PID_DIR/logfeeder.pid
+fi
+
+if [ -z "$LOG_FILE" ]; then
+ export LOG_FILE="logfeeder.log"
+fi
+
+LOGFEEDER_GC_LOGFILE="logfeeder_gc.log"
+
+if [ -z "$LOG_PATH" ]; then
+ LOG_FILE="$HOME/$LOG_FILE"
+ LOGFEEDER_GC_LOGFILE="$HOME/$LOGFEEDER_GC_LOGFILE"
+else
+ LOG_PATH_WITHOUT_SLASH=${LOG_PATH%/}
+ LOG_FILE="$LOG_PATH_WITHOUT_SLASH/$LOG_FILE"
+ LOGFEEDER_GC_LOGFILE="$LOG_PATH_WITHOUT_SLASH/$LOGFEEDER_GC_LOGFILE"
+fi
+
+LOGFEEDER_GC_OPTS="-XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:$LOGFEEDER_GC_LOGFILE"
+
+function print_usage() {
+ cat << EOF
+
+ Usage: [<command>] [<arguments with flags>]
+
+ commands:
+ start Start Log Feeder
+ stop Stop Log Feeder
+ status Check Log Feeder status (pid file)
+ test Test Log Feeder shipper configs
+ help Print usage
+
+
+ start command arguments:
+ -d, --debug Start java process in debug mode
+ -f, --foreground Start java process in foreground
+
+ test command arguments:
+ -h, --help Print usage
+ -tle, --test-log-entry Log entry to test if it's parseable (required)
+ -tsc, --test-shipper-config Shipper configuration file for testing if log entry is parseable (required)
+ -tgc, --test-global-config Global configuration files (comma separated list) for testing if log entry is parseable
+ -tli, --test-log-id The id of the log to test
+
+EOF
+}
+
+function spinner() {
+ local pid=$1
+ local delay=0.5
+ local spinstr='|/-\'
+ while [ "$(ps aux | awk '{print $2}' | grep -w $pid)" ]; do
+ local temp=${spinstr#?}
+ printf " [%c] " "$spinstr"
+ local spinstr=$temp${spinstr%"$temp"}
+ sleep $delay
+ printf "\b\b\b\b\b\b"
+ done
+ printf " \b\b\b\b"
+}
+
+function status() {
+ echo "Checking Log Feeder status ..."
+ if [ -f "$LOGFEEDER_PID_FILE" ]; then
+ LOGFEEDER_PID=`cat "$LOGFEEDER_PID_FILE"`
+ else
+ echo "Log Feeder pid not exists. (probably the process is not running)"
+ exit 1
+ fi
+
+ if ps -p $LOGFEEDER_PID > /dev/null
+ then
+ echo "Log Feeder process is running. (pid: $LOGFEEDER_PID)"
+ exit 0
+ else
+ echo "Log Feeder process is not running."
+ exit 1
+ fi
+}
+
+function start() {
+ (status);
+ exit_status=$(echo $?)
+ if [ "$exit_status" = "0" ]; then
+ echo "Skipping start process."
+ exit 0
+ fi
+
+ FG="false"
+ LOGFEEDER_DEBUG_SUSPEND=${LOGFEEDER_DEBUG_SUSPEND:-n}
+ LOGFEEDER_DEBUG_PORT=${LOGFEEDER_DEBUG_PORT:-"5006"}
+
+ if [ "$LOGFEEDER_DEBUG" = "true" ]; then
+ LOGFEEDER_JAVA_OPTS="$LOGFEEDER_JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=$LOGFEEDER_DEBUG_PORT,server=y,suspend=$LOGFEEDER_DEBUG_SUSPEND "
+ fi
+
+ if [ "$LOGFEEDER_SSL" = "true" ]; then
+ LOGFEEDER_JAVA_OPTS="$LOGFEEDER_JAVA_OPTS -Djavax.net.ssl.keyStore=$LOGFEEDER_KEYSTORE_LOCATION -Djavax.net.ssl.keyStoreType=$LOGFEEDER_KEYSTORE_TYPE -Djavax.net.ssl.trustStore=$LOGFEEDER_TRUSTSTORE_LOCATION -Djavax.net.ssl.trustStoreType=$LOGFEEDER_TRUSTSTORE_TYPE"
+ fi
+
+ if [ "$LOGFEEDER_JMX" = "true" ]; then
+ LOGFEEDER_JAVA_OPTS="$LOGFEEDER_JAVA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=2098"
+ fi
+
+ if [ $# -gt 0 ]; then
+ while true; do
+ case "$1" in
+ -f|--foreground)
+ FG="true"
+ shift
+ ;;
+ -d|--debug)
+ if [ "$LOGFEEDER_DEBUG" != "true" ]; then
+ LOGFEEDER_JAVA_OPTS="$LOGFEEDER_JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=$LOGFEEDER_DEBUG_PORT,server=y,suspend=$LOGFEEDER_DEBUG_SUSPEND "
+ fi
+ shift
+ ;;
+ *)
+ if [ "${1:0:2}" == "-D" ]; then
+ # pass thru any opts that begin with -D (java system props)
+ LOGFEEDER_JAVA_OPTS+=("$1")
+ echo "$LOGFEEDER_JAVA_OPTS"
+ shift
+ else
+ if [ "$1" != "" ]; then
+ print_usage
+ exit 1
+ else
+ break
+ fi
+ fi
+ ;;
+ esac
+ done
+ fi
+
+ if [ $FG == "true" ]; then
+ echo "Starting logfeeder... (foreground) pid_file=$LOGFEEDER_PID_FILE"
+ echo "Run command $JVM -cp '$LOGFEEDER_CONF_DIR:$LOGFEEDER_LIBS_DIR/*' $LOGFEEDER_GC_OPTS $LOGFEEDER_JAVA_OPTS $LOGFEEDER_JAVA_MEM org.apache.ambari.logfeeder.LogFeeder"
+ $JVM -cp "$LOGFEEDER_CONF_DIR:$LOGFEEDER_LIBS_DIR/*" $LOGFEEDER_GC_OPTS $LOGFEEDER_JAVA_OPTS $LOGFEEDER_JAVA_MEM org.apache.ambari.logfeeder.LogFeeder
+ else
+ echo "Starting logfeeder... Output file=$LOG_FILE pid_file=$LOGFEEDER_PID_FILE"
+ echo "Run command nohup $JVM -cp '$LOGFEEDER_CONF_DIR:$LOGFEEDER_LIBS_DIR/*' $LOGFEEDER_GC_OPTS $LOGFEEDER_JAVA_OPTS $LOGFEEDER_JAVA_MEM org.apache.ambari.logfeeder.LogFeeder"
+ nohup $JVM -cp "$LOGFEEDER_CONF_DIR:$LOGFEEDER_LIBS_DIR/*" $LOGFEEDER_GC_OPTS $LOGFEEDER_JAVA_OPTS $LOGFEEDER_JAVA_MEM org.apache.ambari.logfeeder.LogFeeder > $LOG_FILE 2>&1 &
+ fi
+}
+
+function stop() {
+ LOGFEEDER_STOP_WAIT=3
+ if [ -f "$LOGFEEDER_PID_FILE" ]; then
+ LOGFEEDER_PID=`cat "$LOGFEEDER_PID_FILE"`
+ fi
+
+ if [ "$LOGFEEDER_PID" != "" ]; then
+ echo -e "Sending stop command to Log Feeder... Checking PID: $LOGFEEDER_PID."
+ kill $LOGFEEDER_PID
+ (loops=0
+ while true
+ do
+ CHECK_PID=`ps auxww | awk '{print $2}' | grep -w $LOGFEEDER_PID | sort -r | tr -d ' '`
+ if [ "$CHECK_PID" != "" ]; then
+ slept=$((loops * 2))
+ if [ $slept -lt $LOGFEEDER_STOP_WAIT ]; then
+ sleep 2
+ loops=$[$loops+1]
+ else
+ exit # subshell!
+ fi
+ else
+ exit # subshell!
+ fi
+ done) &
+ spinner $!
+ rm -f "$LOGFEEDER_PID_FILE"
+ else
+ echo -e "No LogFeeder process found to stop."
+ exit 0
+ fi
+
+ CHECK_PID=`ps auxww | awk '{print $2}' | grep -w $LOGFEEDER_PID | sort -r | tr -d ' '`
+ if [ "$CHECK_PID" != "" ]; then
+ echo -e "Log Feeder process $LOGFEEDER_PID is still running; forcefully killing it now."
+ kill -9 $LOGFEEDER_PID
+ echo "Killed process $LOGFEEDER_PID"
+ rm -f "$LOGFEEDER_PID_FILE"
+ sleep 1
+ else
+ echo "Log Feeder is stopped."
+ fi
+
+ CHECK_PID=`ps auxww | awk '{print $2}' | grep -w $LOGFEEDER_PID | sort -r | tr -d ' '`
+ if [ "$CHECK_PID" != "" ]; then
+ echo "ERROR: Failed to kill Log Feeder Java process $LOGFEEDER_PID ... script fails."
+ exit 1
+ fi
+}
+
+function test() {
+ echo "Running command: $JVM -cp "$LOGFEEDER_CONF_DIR:$LOGFEEDER_LIBS_DIR/*" org.apache.ambari.logfeeder.LogFeederCommandLine --test ${@}"
+ $JVM -cp "$LOGFEEDER_CONF_DIR:$LOGFEEDER_LIBS_DIR/*" $LOGFEEDER_JAVA_OPTS org.apache.ambari.logfeeder.LogFeederCommandLine --test ${@}
+}
+
+if [ $# -gt 0 ]; then
+ SCRIPT_CMD="$1"
+ shift
+else
+ print_usage
+ exit 1
+fi
+
+case $SCRIPT_CMD in
+ start)
+ start ${1+"$@"}
+ ;;
+ stop)
+ stop
+ ;;
+ status)
+ status
+ ;;
+ test)
+ test ${1+"$@"}
+ ;;
+ help)
+ print_usage
+ exit 0
+ ;;
+ *)
+ print_usage
+ exit 1
+ ;;
+
+esac
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-logfeeder/src/main/scripts/run.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/scripts/run.sh b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/scripts/run.sh
deleted file mode 100644
index 22e1cb2..0000000
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/scripts/run.sh
+++ /dev/null
@@ -1,103 +0,0 @@
-#!/bin/bash
-# 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.
-
-curr_dir=`pwd`
-cd `dirname $0`; script_dir=`pwd`; cd $curr_dir
-
-foreground=0
-if [ "$1" = "-foreground" ]; then
- foreground=1
- shift
-fi
-
-if [ ! -z "$LOGFEEDER_INCLUDE" ]; then
- source $LOGFEEDER_INCLUDE
-fi
-
-if [ ! -z "$LOGSEARCH_SOLR_CLIENT_SSL_INCLUDE" ]; then
- source $LOGSEARCH_SOLR_CLIENT_SSL_INCLUDE
-fi
-
-JAVA=java
-if [ -x $JAVA_HOME/bin/java ]; then
- JAVA=$JAVA_HOME/bin/java
-fi
-
-if [ "$LOGFEEDER_JAVA_MEM" = "" ]; then
- LOGFEEDER_JAVA_MEM="-Xmx512m"
-fi
-
-if [ "$LOGFILE" = "" ]; then
- LOGFILE="/var/log/logfeeder/logfeeder.out"
-fi
-
-if [ "$PID_FILE" = "" ]; then
- LOGFEEDER_PID_DIR=$HOME
- PID_FILE=$LOGFEEDER_PID_DIR/logsearch-logfeeder-$USER.pid
-fi
-
-if [ "$LOGFEEDER_CONF_DIR" = "" ]; then
- LOGFEEDER_CONF_DIR="/etc/logfeeder/conf"
- if [ ! -d $LOGFEEDER_CONF_DIR ]; then
- if [ -d $script_dir/classes ]; then
- LOGFEEDER_CONF_DIR=$script_dir/classes
- fi
- fi
-fi
-
-LOGFEEDER_DEBUG_SUSPEND=${LOGFEEDER_DEBUG_SUSPEND:-n}
-if [ "$LOGFEEDER_DEBUG" = "true" ] && [ ! -z "$LOGFEEDER_DEBUG_PORT" ]; then
- LOGFEEDER_JAVA_OPTS="$LOGFEEDER_JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=$LOGFEEDER_DEBUG_PORT,server=y,suspend=$LOGFEEDER_DEBUG_SUSPEND "
-fi
-
-LOGFEEDER_GC_LOGFILE=`dirname $LOGFILE`/logfeeder_gc.log
-LOGFEEDER_GC_OPTS="-XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:$LOGFEEDER_GC_LOGFILE"
-
-#JMX="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=2098"
-
-if [ "$LOGFEEDER_SSL" = "true" ]; then
- LOGFEEDER_JAVA_OPTS="$LOGFEEDER_JAVA_OPTS -Djavax.net.ssl.keyStore=$LOGFEEDER_KEYSTORE_LOCATION -Djavax.net.ssl.keyStoreType=$LOGFEEDER_KEYSTORE_TYPE -Djavax.net.ssl.trustStore=$LOGFEEDER_TRUSTSTORE_LOCATION -Djavax.net.ssl.trustStoreType=$LOGFEEDER_TRUSTSTORE_TYPE"
-fi
-
-if [ $foreground -eq 0 ]; then
- if [ -f ${PID_FILE} ]; then
- PID=`cat ${PID_FILE}`
- if kill -0 $PID 2>/dev/null; then
- echo "logfeeder already running (${PID}) killing..."
- kill $PID 2>/dev/null
- sleep 5
- if kill -0 $PID 2>/dev/null; then
- echo "logfeeder still running. Will kill process forcefully in another 10 seconds..."
- sleep 10
- kill -9 $PID 2>/dev/null
- sleep 2
- fi
- fi
-
- if kill -0 $PID 2>/dev/null; then
- echo "ERROR: Even after all efforts to stop logfeeder, it is still running. pid=$PID. Please manually kill the service and try again."
- exit 1
- fi
- fi
-
- echo "Starting logfeeder. Output file=$LOGFILE pid_file=$PID_FILE"
- #LOGFEEDER_CLI_CLASSPATH=set -x
-nohup $JAVA -cp "$LOGFEEDER_CLI_CLASSPATH:$LOGFEEDER_CONF_DIR:$script_dir/libs/*:$script_dir/classes" $LOGFEEDER_GC_OPTS $LOGFEEDER_JAVA_MEM $LOGFEEDER_JAVA_OPTS $JMX org.apache.ambari.logfeeder.LogFeeder --monitor $* > $LOGFILE 2>&1 &
- echo $! > $PID_FILE
-else
-$JAVA -cp "$LOGFEEDER_CLI_CLASSPATH:$LOGFEEDER_CONF_DIR:$script_dir/libs/*:$script_dir/classes" $LOGFEEDER_JAVA_MEM $LOGFEEDER_JAVA_OPTS $JMX org.apache.ambari.logfeeder.LogFeeder --monitor $*
-fi
-
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-server/README.md
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/README.md b/ambari-logsearch/ambari-logsearch-server/README.md
index 26b1f73..7432344 100644
--- a/ambari-logsearch/ambari-logsearch-server/README.md
+++ b/ambari-logsearch/ambari-logsearch-server/README.md
@@ -33,7 +33,7 @@ Then you can start Log Search server from maven
cd ambari/ambari-logsearch/ambari-logsearch-server
./run.sh
# or
-mvn clean spring-boot:run
+mvn clean package -DskipTests spring-boot:run
```
You can also start Log Search server from an IDE as well. One thing is important: the config set location that the server tries to upload to ZooKeeper. By default config sets are located at `${LOGSEARCH_SERVER_RELATIVE_LOCATION:}src/main/configsets` in `logsearch.properties`. Based or from where you run `LogSearch.java`, you need to set `LOGSEARCH_SERVER_RELATIVE_LOCATION` env variable properly.
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-server/build.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/build.xml b/ambari-logsearch/ambari-logsearch-server/build.xml
index 5c50485..c711fe1 100644
--- a/ambari-logsearch/ambari-logsearch-server/build.xml
+++ b/ambari-logsearch/ambari-logsearch-server/build.xml
@@ -19,9 +19,8 @@
<property environment="env"/>
<property name="debuglevel" value="source,lines,vars"/>
<dirname property="builddir" file="build.xml"/>
- <property name="target" value="1.7"/>
- <property name="source" value="1.7"/>
- <property file="build.properties"/>
+ <property name="target" value="1.8"/>
+ <property name="source" value="1.8"/>
<target name="init">
</target>
@@ -31,20 +30,34 @@
<delete dir="target/package"/>
<copy todir="target/package/libs" includeEmptyDirs="no">
<fileset dir="target/libs"/>
+ <fileset file="target/ambari-logsearch-server*.jar"/>
</copy>
<copy todir="target/classes/static" includeEmptyDirs="no">
<fileset dir="target/dist"/>
</copy>
- <copy todir="target/package/classes" includeEmptyDirs="no">
- <fileset dir="target/classes"/>
+ <copy todir="target/package/webapp/static" includeEmptyDirs="no">
+ <fileset dir="target/classes/static"/>
</copy>
- <copy todir="target/package/solr_configsets" includeEmptyDirs="yes">
+ <copy todir="target/package/webapp/swagger" includeEmptyDirs="no">
+ <fileset dir="target/classes/swagger"/>
+ </copy>
+ <copy todir="target/package/conf" includeEmptyDirs="no">
+ <fileset file="src/main/scripts/logsearch-env.sh"/>
+ <fileset file="target/classes/log4j.xml"/>
+ <fileset file="target/classes/default.properties"/>
+ <fileset file="target/classes/logsearch.properties"/>
+ <fileset file="target/classes/info.properties"/>
+ <fileset file="target/classes/user_pass.json"/>
+ <fileset file="target/classes/HadoopServiceConfig.json"/>
+ </copy>
+ <copy todir="target/package/conf/solr_configsets" includeEmptyDirs="yes">
<fileset dir="src/main/configsets"/>
</copy>
- <copy todir="target/package" includeEmptyDirs="no">
- <fileset file="src/main/scripts/*"/>
+ <copy todir="target/package/bin" includeEmptyDirs="no">
+ <fileset file="src/main/scripts/logsearch.sh"/>
</copy>
- <chmod file="target/package/*.sh" perm="755"/>
+ <chmod file="target/package/bin/logsearch.sh" perm="755"/>
+ <chmod file="target/package/conf/logsearch-env.sh" perm="755"/>
<tar compression="gzip" destfile="target/ambari-logsearch-portal.tar.gz">
<tarfileset mode="755" dir="target/package">
<include name="*.sh"/>
@@ -53,10 +66,5 @@
<exclude name="*.sh"/>
</tarfileset>
</tar>
-
</target>
-
-
- <target description="Build all projects which reference this project. Useful to propagate changes."
- name="build-refprojects"/>
</project>
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-server/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/pom.xml b/ambari-logsearch/ambari-logsearch-server/pom.xml
index 5444b00..6a7debf 100755
--- a/ambari-logsearch/ambari-logsearch-server/pom.xml
+++ b/ambari-logsearch/ambari-logsearch-server/pom.xml
@@ -44,7 +44,6 @@
<activeByDefault>true</activeByDefault>
</activation>
<build>
- <finalName>LogSearch</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
@@ -77,16 +76,6 @@
<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>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-server/run.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/run.sh b/ambari-logsearch/ambari-logsearch-server/run.sh
index f245930..2de0536 100755
--- a/ambari-logsearch/ambari-logsearch-server/run.sh
+++ b/ambari-logsearch/ambari-logsearch-server/run.sh
@@ -17,4 +17,4 @@ echo "
███████╗╚██████╔╝╚██████╔╝ ███████║███████╗██║ ██║██║ ██║╚██████╗██║ ██║
╚══════╝ ╚═════╝ ╚═════╝ ╚══════╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝
"
-mvn clean spring-boot:run
+mvn clean package -DskipTests spring-boot:run
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/LogSearch.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/LogSearch.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/LogSearch.java
index 39343c7..45cda0a 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/LogSearch.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/LogSearch.java
@@ -36,7 +36,7 @@ public class LogSearch {
public static void main(String[] args) {
- String pidFile = System.getenv("PID_FILE") == null ? "logsearch.pid" : System.getenv("PID_FILE");
+ String pidFile = System.getenv("LOGSEARCH_PID_FILE") == null ? "logsearch.pid" : System.getenv("LOGSEARCH_PID_FILE");
new SpringApplicationBuilder(LogSearch.class)
.bannerMode(Banner.Mode.OFF)
.listeners(new ApplicationPidFileWriter(pidFile))
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-server/src/main/scripts/logsearch-env.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/scripts/logsearch-env.sh b/ambari-logsearch/ambari-logsearch-server/src/main/scripts/logsearch-env.sh
new file mode 100755
index 0000000..d8a837f
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/scripts/logsearch-env.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+# 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.
+
+# Log Search extra options
+export LOGSEARCH_JAVA_OPTS=${LOGSEARCH_JAVA_OPTS:-""}
+
+# Log Search debug options
+# export LOGSEARCH_DEBUG=true
+# exoprt LOGSEARCH_DEBUG_SUSPEND=n
+export LOGSEARCH_DEBUG_PORT=5005
+
+# Log Search memory
+# export LOGSEARCH_JAVA_MEM="--Xmx1024m"
+
+# export LOG_PATH=/var/log/ambari-logsearch-logfeeder/
+# export LOG_FILE=logsearch.log
+
+# Pid file of the application
+# export LOGSEARCH_PID_DIR=/var/run/ambari-logsearch-logfeeder
+# export LOGSEARCH_PID_FILE=logfeeder.pid
+
+# SSL settings"
+# export LOGSEARCH_SSL="true"
+# export LOGSEARCH_KEYSTORE_LOCATION="/my/path/keystore.jks"
+# export LOGSEARCH_KEYSTORE_TYPE="jks"
+# export LOGSEARCH_TRUSTSTORE_LOCATION="/my/path/trutstore.jks"
+# export LOGSEARCH_TRUSTSTORE_TYPE="jks"
\ No newline at end of file
[14/50] [abbrv] ambari git commit: AMBARI-22718. Cannot set
security.inter.broker.protocol: SASL_SSL via Blueprint with Kerberos
Posted by rl...@apache.org.
AMBARI-22718. Cannot set security.inter.broker.protocol: SASL_SSL via Blueprint with Kerberos
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/13056cf2
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/13056cf2
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/13056cf2
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 13056cf2b0bf4ff20192860e2bfee556c1c57b4a
Parents: a85ff23
Author: Doroszlai, Attila <ad...@hortonworks.com>
Authored: Wed Jan 3 09:30:33 2018 +0100
Committer: Doroszlai, Attila <ad...@hortonworks.com>
Committed: Thu Jan 4 12:53:04 2018 +0100
----------------------------------------------------------------------
.../KAFKA/0.8.1/package/scripts/params.py | 6 +-
.../2.6/KAFKA/test_kafka_broker_other_sasl.py | 16 +
.../2.6/configs/secure_kafka_sasl_ssl.json | 632 +++++++++++++++++++
3 files changed, 652 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/13056cf2/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/params.py b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/params.py
index 46fdfba..dc42b93 100644
--- a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1/package/scripts/params.py
@@ -160,8 +160,10 @@ if has_metric_collector:
kerberos_security_enabled = config['configurations']['cluster-env']['security_enabled']
kafka_kerberos_enabled = (('security.inter.broker.protocol' in config['configurations']['kafka-broker']) and
- ((config['configurations']['kafka-broker']['security.inter.broker.protocol'] == "PLAINTEXTSASL") or
- (config['configurations']['kafka-broker']['security.inter.broker.protocol'] == "SASL_PLAINTEXT")))
+ ((config['configurations']['kafka-broker']['security.inter.broker.protocol'] in ("PLAINTEXTSASL", "SASL_PLAINTEXT")) or
+ ((config['configurations']['kafka-broker']['security.inter.broker.protocol'] == "SASL_SSL") and
+ check_stack_feature(StackFeature.KAFKA_EXTENDED_SASL_SUPPORT, stack_version_formatted))))
+
kafka_other_sasl_enabled = not kerberos_security_enabled and check_stack_feature(StackFeature.KAFKA_LISTENERS, stack_version_formatted) and \
check_stack_feature(StackFeature.KAFKA_EXTENDED_SASL_SUPPORT, stack_version_formatted) and \
http://git-wip-us.apache.org/repos/asf/ambari/blob/13056cf2/ambari-server/src/test/python/stacks/2.6/KAFKA/test_kafka_broker_other_sasl.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.6/KAFKA/test_kafka_broker_other_sasl.py b/ambari-server/src/test/python/stacks/2.6/KAFKA/test_kafka_broker_other_sasl.py
index e0bab40..a0eab8e 100644
--- a/ambari-server/src/test/python/stacks/2.6/KAFKA/test_kafka_broker_other_sasl.py
+++ b/ambari-server/src/test/python/stacks/2.6/KAFKA/test_kafka_broker_other_sasl.py
@@ -75,6 +75,22 @@ class TestKafkaBroker(RMFTestCase):
owner = 'kafka')
+ def test_configure_sasl_ssl_kerberos(self):
+ self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/kafka_broker.py",
+ classname = "KafkaBroker",
+ command = "configure",
+ config_file="secure_kafka_sasl_ssl.json",
+ stack_version = self.STACK_VERSION,
+ target = RMFTestCase.TARGET_COMMON_SERVICES
+ )
+
+ self.assertResourceCalledIgnoreEarlier('TemplateConfig', '/usr/hdp/current/kafka-broker/config/kafka_jaas.conf',
+ owner = 'kafka')
+
+ self.assertResourceCalledIgnoreEarlier('TemplateConfig', '/usr/hdp/current/kafka-broker/config/kafka_client_jaas.conf',
+ owner = 'kafka')
+
+
def test_configure_plaintext(self):
self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/kafka_broker.py",
classname = "KafkaBroker",
http://git-wip-us.apache.org/repos/asf/ambari/blob/13056cf2/ambari-server/src/test/python/stacks/2.6/configs/secure_kafka_sasl_ssl.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.6/configs/secure_kafka_sasl_ssl.json b/ambari-server/src/test/python/stacks/2.6/configs/secure_kafka_sasl_ssl.json
new file mode 100644
index 0000000..cb5b257
--- /dev/null
+++ b/ambari-server/src/test/python/stacks/2.6/configs/secure_kafka_sasl_ssl.json
@@ -0,0 +1,632 @@
+{
+ "roleCommand": "SERVICE_CHECK",
+ "clusterName": "c1",
+ "hostname": "c6401.ambari.apache.org",
+ "hostLevelParams": {
+ "not_managed_hdfs_path_list": "[\"/apps/hive/warehouse\",\"/apps/falcon\",\"/mr-history/done\",\"/app-logs\",\"/tmp\"]",
+ "agent_stack_retry_count": "5",
+ "agent_stack_retry_on_unavailability": "false",
+ "jdk_location": "http://c6401.ambari.apache.org:8080/resources/",
+ "ambari_db_rca_password": "mapred",
+ "ambari_db_rca_url": "jdbc:postgresql://c6401.ambari.apache.org/ambarirca",
+ "jce_name": "UnlimitedJCEPolicyJDK7.zip",
+ "stack_version": "2.6.5.0",
+ "stack_name": "HDP",
+ "ambari_db_rca_driver": "org.postgresql.Driver",
+ "jdk_name": "jdk-7u67-linux-x64.tar.gz",
+ "ambari_db_rca_username": "mapred",
+ "java_home": "/usr/jdk64/jdk1.7.0_45",
+ "db_name": "ambari",
+ "custom_mysql_jdbc_name": "mysql-connector-java.jar"
+ },
+ "commandType": "EXECUTION_COMMAND",
+ "roleParams": {},
+ "serviceName": "SLIDER",
+ "role": "SLIDER",
+ "commandParams": {
+ "version": "2.6.5.0-1235",
+ "command_timeout": "300",
+ "service_package_folder": "OOZIE",
+ "script_type": "PYTHON",
+ "script": "scripts/service_check.py",
+ "excluded_hosts": "host1,host2"
+ },
+ "taskId": 152,
+ "public_hostname": "c6401.ambari.apache.org",
+ "configurations": {
+ "slider-client": {
+ "slider.yarn.queue": "default"
+ },
+ "sqoop-site": {
+ "atlas.cluster.name": "c1",
+ "sqoop.job.data.publish.class": "org.apache.atlas.sqoop.hook.SqoopHook"
+ },
+ "mahout-env": {
+ "mahout_user": "mahout"
+ },
+ "hbase-env": {
+ "hbase_user": "hbase"
+ },
+ "yarn-env": {
+ "yarn_user": "yarn"
+ },
+ "mahout-log4j": {
+ "content": "\n #\n #\n # Licensed to the Apache Software Foundation (ASF) under one\n # or more contributor license agreements. See the NOTICE file\n # distributed with this work for additional information\n # regarding copyright ownership. The ASF licenses this file\n # to you under the Apache License, Version 2.0 (the\n # \"License\"); you may not use this file except in compliance\n # with the License. You may obtain a copy of the License at\n #\n # http://www.apache.org/licenses/LICENSE-2.0\n #\n # Unless required by applicable law or agreed to in writing,\n # software distributed under the License is distributed on an\n # \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n # KIND, either express or implied. See the License for the\n # specific language governing permissions a
nd limitations\n # under the License.\n #\n #\n #\n\n # Set everything to be logged to the console\n log4j.rootCategory=WARN, console\n log4j.appender.console=org.apache.log4j.ConsoleAppender\n log4j.appender.console.target=System.err\n log4j.appender.console.layout=org.apache.log4j.PatternLayout\n log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{1}: %m%n\n\n # Settings to quiet third party logs that are too verbose\n log4j.logger.org.eclipse.jetty=WARN\n log4j.logger.org.apache.spark.repl.SparkIMain$exprTyper=WARN\n log4j.logger.org.apache.spark.repl.SparkILoop$SparkILoopInterpreter=WARN"
+ },
+ "hadoop-env": {
+ "hdfs_user": "hdfs",
+ "hdfs_tmp_dir": "/tmp"
+ },
+ "core-site": {
+ "fs.defaultFS": "hdfs://c6401.ambari.apache.org:8020"
+ },
+ "hdfs-site": {
+ "a": "b"
+ },
+ "yarn-site": {
+ "yarn.application.classpath": "/etc/hadoop/conf,/usr/lib/hadoop/*,/usr/lib/hadoop/lib/*,/usr/lib/hadoop-hdfs/*,/usr/lib/hadoop-hdfs/lib/*,/usr/lib/hadoop-yarn/*,/usr/lib/hadoop-yarn/lib/*,/usr/lib/hadoop-mapreduce/*,/usr/lib/hadoop-mapreduce/lib/*",
+ "yarn.resourcemanager.address": "c6401.ambari.apache.org:8050",
+ "yarn.resourcemanager.scheduler.address": "c6401.ambari.apache.org:8030"
+ },
+ "cluster-env": {
+ "managed_hdfs_resource_property_names": "",
+ "security_enabled": "true",
+ "ignore_groupsusers_create": "false",
+ "smokeuser": "ambari-qa",
+ "kerberos_domain": "EXAMPLE.COM",
+ "user_group": "hadoop"
+ },
+ "webhcat-site": {
+ "templeton.jar": "/usr/hdp/current/hive-webhcat/share/webhcat/svr/lib/hive-webhcat-*.jar",
+ "templeton.pig.archive": "hdfs:///hdp/apps/{{ hdp_stack_version }}/pig/pig.tar.gz",
+ "templeton.hive.archive": "hdfs:///hdp/apps/{{ hdp_stack_version }}/hive/hive.tar.gz",
+ "templeton.sqoop.archive": "hdfs:///hdp/apps/{{ hdp_stack_version }}/sqoop/sqoop.tar.gz",
+ "templeton.streaming.jar": "hdfs:///hdp/apps/{{ hdp_stack_version }}/mr/hadoop-streaming.jar"
+ },
+ "slider-log4j": {
+ "content": "log4jproperties\nline2"
+ },
+ "slider-env": {
+ "content": "envproperties\nline2"
+ },
+ "gateway-site": {
+ "java.security.auth.login.config": "/etc/knox/conf/krb5JAASLogin.conf",
+ "gateway.hadoop.kerberos.secured": "false",
+ "gateway.gateway.conf.dir": "deployments",
+ "gateway.path": "gateway",
+ "sun.security.krb5.debug": "true",
+ "java.security.krb5.conf": "/etc/knox/conf/krb5.conf",
+ "gateway.port": "8443"
+ },
+
+ "users-ldif": {
+ "content": "\n # Licensed to the Apache Software Foundation (ASF) under one\n # or more contributor license agreements. See the NOTICE file\n # distributed with this work for additional information\n # regarding copyright ownership. The ASF licenses this file\n # to you under the Apache License, Version 2.0 (the\n # \"License\"); you may not use this file except in compliance\n # with the License. You may obtain a copy of the License at\n #\n # http://www.apache.org/licenses/LICENSE-2.0\n #\n # Unless required by applicable law or agreed to in writing, software\n # distributed under the License is distributed on an \"AS IS\" BASIS,\n # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n # See the License for the specific language governing permissions and\n # limitations under the Lice
nse.\n\n version: 1\n\n # Please replace with site specific values\n dn: dc=hadoop,dc=apache,dc=org\n objectclass: organization\n objectclass: dcObject\n o: Hadoop\n dc: hadoop\n\n # Entry for a sample people container\n # Please replace with site specific values\n dn: ou=people,dc=hadoop,dc=apache,dc=org\n objectclass:top\n objectclass:organizationalUnit\n ou: people\n\n # Entry for a sample end user\n # Please replace with site specific values\n dn: uid=guest,ou=people,dc=hadoop,dc=apache,dc=org\n objectclass:top\n objectclass:person\n objectclass:organizationalPerson\n objectclass:inetOrgPerson\n cn: Guest\n sn: User\n uid: guest\n userPassword:guest-password\n\n # entry for sample user admin\n dn:
uid=admin,ou=people,dc=hadoop,dc=apache,dc=org\n objectclass:top\n objectclass:person\n objectclass:organizationalPerson\n objectclass:inetOrgPerson\n cn: Admin\n sn: Admin\n uid: admin\n userPassword:admin-password\n\n # entry for sample user sam\n dn: uid=sam,ou=people,dc=hadoop,dc=apache,dc=org\n objectclass:top\n objectclass:person\n objectclass:organizationalPerson\n objectclass:inetOrgPerson\n cn: sam\n sn: sam\n uid: sam\n userPassword:sam-password\n\n # entry for sample user tom\n dn: uid=tom,ou=people,dc=hadoop,dc=apache,dc=org\n objectclass:top\n objectclass:person\n objectclass:organizationalPerson\n objectclass:inetOrgPerson\n cn: tom\n sn: tom\n uid: tom\n userPasswor
d:tom-password\n\n # create FIRST Level groups branch\n dn: ou=groups,dc=hadoop,dc=apache,dc=org\n objectclass:top\n objectclass:organizationalUnit\n ou: groups\n description: generic groups branch\n\n # create the analyst group under groups\n dn: cn=analyst,ou=groups,dc=hadoop,dc=apache,dc=org\n objectclass:top\n objectclass: groupofnames\n cn: analyst\n description:analyst group\n member: uid=sam,ou=people,dc=hadoop,dc=apache,dc=org\n member: uid=tom,ou=people,dc=hadoop,dc=apache,dc=org\n\n\n # create the scientist group under groups\n dn: cn=scientist,ou=groups,dc=hadoop,dc=apache,dc=org\n objectclass:top\n objectclass: groupofnames\n cn: scientist\n description: scientist group\n member: uid=sam,ou=people,dc=hadoop,dc=apache,dc=org"
+ },
+
+ "topology": {
+ "content": "\n <topology>\n\n <gateway>\n\n <provider>\n <role>authentication</role>\n <name>ShiroProvider</name>\n <enabled>true</enabled>\n <param>\n <name>sessionTimeout</name>\n <value>30</value>\n </param>\n <param>\n <name>main.ldapRealm</name>\n <value>org.apache.hadoop.gateway.shirorealm.KnoxLdapRealm</value>\n </param>\n <param>\n <name>main.ldapRealm.userDnTemplate</name>\n <value>uid={0},ou=people,dc=hadoop,dc=apache,dc=org</value>\n </param>\n <param>\n <name>main.ldapRealm.contextFactory.url</name>\n <value>ldap://{{knox_host_name}}:33389</value>\n
</param>\n <param>\n <name>main.ldapRealm.contextFactory.authenticationMechanism</name>\n <value>simple</value>\n </param>\n <param>\n <name>urls./**</name>\n <value>authcBasic</value>\n </param>\n </provider>\n\n <provider>\n <role>identity-assertion</role>\n <name>Default</name>\n <enabled>true</enabled>\n </provider>\n\n </gateway>\n\n <service>\n <role>NAMENODE</role>\n <url>hdfs://{{namenode_host}}:{{namenode_rpc_port}}</url>\n </service>\n\n <service>\n <role>JOBTRACKER</role>\n <url>rpc://{{rm_host}}:{{jt_rpc_port}}</url>\n </service>\n\n <service>\n <role>WEBHDFS</role
>\n <url>http://{{namenode_host}}:{{namenode_http_port}}/webhdfs</url>\n </service>\n\n <service>\n <role>WEBHCAT</role>\n <url>http://{{webhcat_server_host}}:{{templeton_port}}/templeton</url>\n </service>\n\n <service>\n <role>OOZIE</role>\n <url>http://{{oozie_server_host}}:{{oozie_server_port}}/oozie</url>\n </service>\n\n <service>\n <role>WEBHBASE</role>\n <url>http://{{hbase_master_host}}:{{hbase_master_port}}</url>\n </service>\n\n <service>\n <role>HIVE</role>\n <url>http://{{hive_server_host}}:{{hive_http_port}}/{{hive_http_path}}</url>\n </service>\n\n <service>\n <role>RESOURCEMANAGER</role>\n <url>http://{{rm_host}}:{{rm_port}}/ws</url>\n </service>\n </topology>"
+ },
+
+ "ldap-log4j": {
+ "content": "\n # Licensed to the Apache Software Foundation (ASF) under one\n # or more contributor license agreements. See the NOTICE file\n # distributed with this work for additional information\n # regarding copyright ownership. The ASF licenses this file\n # to you under the Apache License, Version 2.0 (the\n # \"License\"); you may not use this file except in compliance\n # with the License. You may obtain a copy of the License at\n #\n # http://www.apache.org/licenses/LICENSE-2.0\n #\n # Unless required by applicable law or agreed to in writing, software\n # distributed under the License is distributed on an \"AS IS\" BASIS,\n # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n # See the License for the specific language governing permissions and\n # limitations under the License.\n #testing\n\n app.log.dir=${launcher.dir
}/../logs\n app.log.file=${launcher.name}.log\n\n log4j.rootLogger=ERROR, drfa\n log4j.logger.org.apache.directory.server.ldap.LdapServer=INFO\n log4j.logger.org.apache.directory=WARN\n\n log4j.appender.stdout=org.apache.log4j.ConsoleAppender\n log4j.appender.stdout.layout=org.apache.log4j.PatternLayout\n log4j.appender.stdout.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{2}: %m%n\n\n log4j.appender.drfa=org.apache.log4j.DailyRollingFileAppender\n log4j.appender.drfa.File=${app.log.dir}/${app.log.file}\n log4j.appender.drfa.DatePattern=.yyyy-MM-dd\n log4j.appender.drfa.layout=org.apache.log4j.PatternLayout\n log4j.appender.drfa.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n"
+ },
+
+ "gateway-log4j": {
+ "content": "\n\n # Licensed to the Apache Software Foundation (ASF) under one\n # or more contributor license agreements. See the NOTICE file\n # distributed with this work for additional information\n # regarding copyright ownership. The ASF licenses this file\n # to you under the Apache License, Version 2.0 (the\n # \"License\"); you may not use this file except in compliance\n # with the License. You may obtain a copy of the License at\n #\n # http://www.apache.org/licenses/LICENSE-2.0\n #\n # Unless required by applicable law or agreed to in writing, software\n # distributed under the License is distributed on an \"AS IS\" BASIS,\n # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n # See the License for the specific language governing permissions and\n # limitations under the License.\n\n app.log.dir=${launcher.dir}/../logs\n app.log.file=${launcher.name}.log\n
app.audit.file=${launcher.name}-audit.log\n\n log4j.rootLogger=ERROR, drfa\n\n log4j.logger.org.apache.hadoop.gateway=INFO\n #log4j.logger.org.apache.hadoop.gateway=DEBUG\n\n #log4j.logger.org.eclipse.jetty=DEBUG\n #log4j.logger.org.apache.shiro=DEBUG\n #log4j.logger.org.apache.http=DEBUG\n #log4j.logger.org.apache.http.client=DEBUG\n #log4j.logger.org.apache.http.headers=DEBUG\n #log4j.logger.org.apache.http.wire=DEBUG\n\n log4j.appender.stdout=org.apache.log4j.ConsoleAppender\n log4j.appender.stdout.layout=org.apache.log4j.PatternLayout\n log4j.appender.stdout.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{2}: %m%n\n\n log4j.appender.drfa=org.apache.log4j.DailyRollingFileAppender\n log4j.appender.drfa.File=${app.log.dir}/${app.log.file}\n log4j.appender.drfa.DatePattern=.yyyy-MM-dd\n log4j.appender.drfa.layout=org.apache.log4j.PatternLayout\n log4j.appender.drfa.layout.ConversionPattern=%
d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n\n\n log4j.logger.audit=INFO, auditfile\n log4j.appender.auditfile=org.apache.log4j.DailyRollingFileAppender\n log4j.appender.auditfile.File=${app.log.dir}/${app.audit.file}\n log4j.appender.auditfile.Append = true\n log4j.appender.auditfile.DatePattern = '.'yyyy-MM-dd\n log4j.appender.auditfile.layout = org.apache.hadoop.gateway.audit.log4j.layout.AuditLayout"
+ },
+ "knox-env": {
+ "knox_master_secret": "sa",
+ "knox_group": "knox",
+ "knox_pid_dir": "/var/run/knox",
+ "knox_user": "knox"
+ },
+ "kafka-env": {
+ "kafka_user_nproc_limit": "65536",
+ "content": "\n#!/bin/bash\n\n# Set KAFKA specific environment variables here.\n\n# The java implementation to use.\nexport JAVA_HOME={{java64_home}}\nexport PATH=$PATH:$JAVA_HOME/bin\nexport PID_DIR={{kafka_pid_dir}}\nexport LOG_DIR={{kafka_log_dir}}\n{% if kerberos_security_enabled or kafka_other_sasl_enabled %}\nexport KAFKA_KERBEROS_PARAMS=\"-Djavax.security.auth.useSubjectCredsOnly=false {{kafka_kerberos_params}}\"\n{% else %}\nexport KAFKA_KERBEROS_PARAMS={{kafka_kerberos_params}}\n{% endif %}\n# Add kafka sink to classpath and related depenencies\nif [ -e \"/usr/lib/ambari-metrics-kafka-sink/ambari-metrics-kafka-sink.jar\" ]; then\n export CLASSPATH=$CLASSPATH:/usr/lib/ambari-metrics-kafka-sink/ambari-metrics-kafka-sink.jar\n export CLASSPATH=$CLASSPATH:/usr/lib/ambari-metrics-kafka-sink/lib/*\nfi\nif [ -f /etc/kafka/conf/kafka-ranger-env.sh ]; then\n. /etc/kafka/conf/kafka-ranger-env.sh\nfi",
+ "kafka_log_dir": "/var/log/kafka",
+ "kafka_pid_dir": "/var/run/kafka",
+ "kafka_user_nofile_limit": "128000",
+ "is_supported_kafka_ranger": "true",
+ "kafka_user": "kafka"
+ },
+ "kafka-log4j": {
+ "kafka_log_maxbackupindex": "20",
+ "content": "\n#\n#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied. See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n#\n#\nkafka.logs.dir=logs\n\nlog4j.rootLogger=INFO, stdout\n\nlog4j.appender.stdout=org.apache.log4j.ConsoleAppender\nlog4j.appender.stdout.layout=org.apache.log4j
.PatternLayout\nlog4j.appender.stdout.layout.ConversionPattern=[%d] %p %m (%c)%n\n\nlog4j.appender.kafkaAppender=org.apache.log4j.DailyRollingFileAppender\nlog4j.appender.kafkaAppender.DatePattern='.'yyyy-MM-dd-HH\nlog4j.appender.kafkaAppender.File=${kafka.logs.dir}/server.log\nlog4j.appender.kafkaAppender.layout=org.apache.log4j.PatternLayout\nlog4j.appender.kafkaAppender.layout.ConversionPattern=[%d] %p %m (%c)%n\nlog4j.appender.kafkaAppender.MaxFileSize = {{kafka_log_maxfilesize}}MB\nlog4j.appender.kafkaAppender.MaxBackupIndex = {{kafka_log_maxbackupindex}}\n\nlog4j.appender.stateChangeAppender=org.apache.log4j.DailyRollingFileAppender\nlog4j.appender.stateChangeAppender.DatePattern='.'yyyy-MM-dd-HH\nlog4j.appender.stateChangeAppender.File=${kafka.logs.dir}/state-change.log\nlog4j.appender.stateChangeAppender.layout=org.apache.log4j.PatternLayout\nlog4j.appender.stateChangeAppender.layout.ConversionPattern=[%d] %p %m (%c)%n\n\nlog4j.appender.requestAppender=org.apache.log4j.Daily
RollingFileAppender\nlog4j.appender.requestAppender.DatePattern='.'yyyy-MM-dd-HH\nlog4j.appender.requestAppender.File=${kafka.logs.dir}/kafka-request.log\nlog4j.appender.requestAppender.layout=org.apache.log4j.PatternLayout\nlog4j.appender.requestAppender.layout.ConversionPattern=[%d] %p %m (%c)%n\n\nlog4j.appender.cleanerAppender=org.apache.log4j.DailyRollingFileAppender\nlog4j.appender.cleanerAppender.DatePattern='.'yyyy-MM-dd-HH\nlog4j.appender.cleanerAppender.File=${kafka.logs.dir}/log-cleaner.log\nlog4j.appender.cleanerAppender.layout=org.apache.log4j.PatternLayout\nlog4j.appender.cleanerAppender.layout.ConversionPattern=[%d] %p %m (%c)%n\n\nlog4j.appender.controllerAppender=org.apache.log4j.DailyRollingFileAppender\nlog4j.appender.controllerAppender.DatePattern='.'yyyy-MM-dd-HH\nlog4j.appender.controllerAppender.File=${kafka.logs.dir}/controller.log\nlog4j.appender.controllerAppender.layout=org.apache.log4j.PatternLayout\nlog4j.appender.controllerAppender.layout.ConversionPatt
ern=[%d] %p %m (%c)%n\nlog4j.appender.controllerAppender.MaxFileSize = {{controller_log_maxfilesize}}MB\nlog4j.appender.controllerAppender.MaxBackupIndex = {{controller_log_maxbackupindex}}\n# Turn on all our debugging info\n#log4j.logger.kafka.producer.async.DefaultEventHandler=DEBUG, kafkaAppender\n#log4j.logger.kafka.client.ClientUtils=DEBUG, kafkaAppender\n#log4j.logger.kafka.perf=DEBUG, kafkaAppender\n#log4j.logger.kafka.perf.ProducerPerformance$ProducerThread=DEBUG, kafkaAppender\n#log4j.logger.org.I0Itec.zkclient.ZkClient=DEBUG\nlog4j.logger.kafka=INFO, kafkaAppender\nlog4j.logger.kafka.network.RequestChannel$=WARN, requestAppender\nlog4j.additivity.kafka.network.RequestChannel$=false\n\n#log4j.logger.kafka.network.Processor=TRACE, requestAppender\n#log4j.logger.kafka.server.KafkaApis=TRACE, requestAppender\n#log4j.additivity.kafka.server.KafkaApis=false\nlog4j.logger.kafka.request.logger=WARN, requestAppender\nlog4j.additivity.kafka.request.logger=false\n\nlog4j.logger.kafka
.controller=TRACE, controllerAppender\nlog4j.additivity.kafka.controller=false\n\nlog4j.logger.kafka.log.LogCleaner=INFO, cleanerAppender\nlog4j.additivity.kafka.log.LogCleaner=false\n\nlog4j.logger.state.change.logger=TRACE, stateChangeAppender\nlog4j.additivity.state.change.logger=false",
+ "kafka_log_maxfilesize": "256",
+ "controller_log_maxfilesize": "256",
+ "controller_log_maxbackupindex": "20"
+ },
+ "kafka-broker": {
+ "auto.leader.rebalance.enable": "true",
+ "kafka.ganglia.metrics.port": "8671",
+ "socket.send.buffer.bytes": "102400",
+ "num.network.threads": "3",
+ "log.segment.bytes": "1073741824",
+ "kafka.ganglia.metrics.host": "localhost",
+ "kafka.timeline.metrics.maxRowCacheSize": "10000",
+ "replica.lag.time.max.ms": "10000",
+ "num.io.threads": "8",
+ "offsets.retention.minutes": "86400000",
+ "fetch.purgatory.purge.interval.requests": "10000",
+ "offsets.topic.compression.codec": "0",
+ "default.replication.factor": "1",
+ "port": "6667",
+ "num.recovery.threads.per.data.dir": "1",
+ "kafka.metrics.reporters": "org.apache.hadoop.metrics2.sink.kafka.KafkaTimelineMetricsReporter",
+ "log.retention.bytes": "-1",
+ "producer.purgatory.purge.interval.requests": "10000",
+ "replica.lag.max.messages": "4000",
+ "replica.high.watermark.checkpoint.interval.ms": "5000",
+ "zookeeper.connect": "ydavis-kafka-ambari-upgrade-1.openstacklocal:2181",
+ "controlled.shutdown.retry.backoff.ms": "5000",
+ "sasl.enabled.mechanisms": "GSSAPI",
+ "kafka.timeline.metrics.reporter.sendInterval": "5900",
+ "num.partitions": "1",
+ "offsets.topic.segment.bytes": "104857600",
+ "replica.fetch.min.bytes": "1",
+ "zookeeper.sync.time.ms": "2000",
+ "offset.metadata.max.bytes": "4096",
+ "kafka.timeline.metrics.reporter.enabled": "true",
+ "kafka.timeline.metrics.truststore.type": "{{metric_truststore_type}}",
+ "controlled.shutdown.max.retries": "3",
+ "leader.imbalance.per.broker.percentage": "10",
+ "min.insync.replicas": "1",
+ "offsets.commit.required.acks": "-1",
+ "replica.fetch.wait.max.ms": "500",
+ "controlled.shutdown.enable": "true",
+ "log.roll.hours": "168",
+ "log.cleanup.interval.mins": "10",
+ "replica.socket.receive.buffer.bytes": "65536",
+ "kafka.ganglia.metrics.reporter.enabled": "true",
+ "kafka.timeline.metrics.truststore.path": "{{metric_truststore_path}}",
+ "zookeeper.connection.timeout.ms": "25000",
+ "delete.topic.enable": "false",
+ "offsets.load.buffer.size": "5242880",
+ "num.replica.fetchers": "1",
+ "socket.request.max.bytes": "104857600",
+ "message.max.bytes": "1000000",
+ "controller.message.queue.size": "10",
+ "kafka.ganglia.metrics.group": "kafka",
+ "compression.type": "producer",
+ "queued.max.requests": "500",
+ "log.index.interval.bytes": "4096",
+ "replica.fetch.max.bytes": "1048576",
+ "offsets.topic.num.partitions": "50",
+ "socket.receive.buffer.bytes": "102400",
+ "kafka.timeline.metrics.port": "{{metric_collector_port}}",
+ "offsets.commit.timeout.ms": "5000",
+ "offsets.topic.replication.factor": "3",
+ "external.kafka.metrics.include.prefix": "kafka.network.RequestMetrics.ResponseQueueTimeMs.request.OffsetCommit.98percentile,kafka.network.RequestMetrics.ResponseQueueTimeMs.request.Offsets.95percentile,kafka.network.RequestMetrics.ResponseSendTimeMs.request.Fetch.95percentile,kafka.network.RequestMetrics.RequestsPerSec.request",
+ "offsets.retention.check.interval.ms": "600000",
+ "log.index.size.max.bytes": "10485760",
+ "log.dirs": "/kafka-logs",
+ "listeners": "SASL_PLAINTEXT://localhost:6667,SASL_SSL://localhost:6668",
+ "security.inter.broker.protocol": "SASL_SSL",
+ "kafka.timeline.metrics.hosts": "{{ams_collector_hosts}}",
+ "controller.socket.timeout.ms": "30000",
+ "replica.socket.timeout.ms": "30000",
+ "zookeeper.session.timeout.ms": "30000",
+ "auto.create.topics.enable": "true",
+ "kafka.timeline.metrics.truststore.password": "{{metric_truststore_password}}",
+ "external.kafka.metrics.exclude.prefix": "kafka.network.RequestMetrics,kafka.server.DelayedOperationPurgatory,kafka.server.BrokerTopicMetrics.BytesRejectedPerSec,kafka.server.KafkaServer.ClusterId",
+ "leader.imbalance.check.interval.seconds": "300",
+ "sasl.mechanism.inter.broker.protocol": "GSSAPI",
+ "log.retention.hours": "168",
+ "kafka.timeline.metrics.protocol": "{{metric_collector_protocol}}"
+ },
+ "spark-defaults": {
+ "spark.yarn.applicationMaster.waitTries": "10",
+ "spark.history.kerberos.keytab": "none",
+ "spark.yarn.preserve.staging.files": "false",
+ "spark.yarn.submit.file.replication": "3",
+ "spark.history.kerberos.principal": "none",
+ "spark.yarn.driver.memoryOverhead": "384",
+ "spark.yarn.queue": "default",
+ "spark.yarn.containerLauncherMaxThreads": "25",
+ "spark.yarn.scheduler.heartbeat.interval-ms": "5000",
+ "spark.history.ui.port": "18080",
+ "spark.yarn.max.executor.failures": "3",
+ "spark.driver.extraJavaOptions": "",
+ "spark.history.provider": "org.apache.spark.deploy.yarn.history.YarnHistoryProvider",
+ "spark.yarn.am.extraJavaOptions": "",
+ "spark.yarn.executor.memoryOverhead": "384"
+ },
+ "spark-javaopts-properties": {
+ "content": " "
+ },
+ "spark-log4j-properties": {
+ "content": "\n# Set everything to be logged to the console\nlog4j.rootCategory=INFO, console\nlog4j.appender.console=org.apache.log4j.ConsoleAppender\nlog4j.appender.console.target=System.err\nlog4j.appender.console.layout=org.apache.log4j.PatternLayout\nlog4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{1}: %m%n\n\n# Settings to quiet third party logs that are too verbose\nlog4j.logger.org.eclipse.jetty=WARN\nlog4j.logger.org.eclipse.jetty.util.component.AbstractLifeCycle=ERROR\nlog4j.logger.org.apache.spark.repl.SparkIMain$exprTyper=INFO\nlog4j.logger.org.apache.spark.repl.SparkILoop$SparkILoopInterpreter=INFO"
+ },
+ "spark-env": {
+ "content": "\n#!/usr/bin/env bash\n\n# This file is sourced when running various Spark programs.\n# Copy it as spark-env.sh and edit that to configure Spark for your site.\n\n# Options read in YARN client mode\n#SPARK_EXECUTOR_INSTANCES=\"2\" #Number of workers to start (Default: 2)\n#SPARK_EXECUTOR_CORES=\"1\" #Number of cores for the workers (Default: 1).\n#SPARK_EXECUTOR_MEMORY=\"1G\" #Memory per Worker (e.g. 1000M, 2G) (Default: 1G)\n#SPARK_DRIVER_MEMORY=\"512 Mb\" #Memory for Master (e.g. 1000M, 2G) (Default: 512 Mb)\n#SPARK_YARN_APP_NAME=\"spark\" #The name of your application (Default: Spark)\n#SPARK_YARN_QUEUE=\"~@~Xdefault~@~Y\" #The hadoop queue to use for allocation requests (Default: @~Xdefault~@~Y)\n#SPARK_YARN_DIST_FILES=\"\" #Comma separated list of files to be distributed with the job.\n#SPARK_YARN_DIST_ARCHIVES=\"\" #Comma separated list of archives to be distributed with the job.\n\n# Generic options for the daemons used in the standalone deploy mode\n\n# Alt
ernate conf dir. (Default: ${SPARK_HOME}/conf)\nexport SPARK_CONF_DIR=${SPARK_HOME:-{{spark_home}}}/conf\n\n# Where log files are stored.(Default:${SPARK_HOME}/logs)\n#export SPARK_LOG_DIR=${SPARK_HOME:-{{spark_home}}}/logs\nexport SPARK_LOG_DIR={{spark_log_dir}}\n\n# Where the pid file is stored. (Default: /tmp)\nexport SPARK_PID_DIR={{spark_pid_dir}}\n\n# A string representing this instance of spark.(Default: $USER)\nSPARK_IDENT_STRING=$USER\n\n# The scheduling priority for daemons. (Default: 0)\nSPARK_NICENESS=0\n\nexport HADOOP_HOME=${HADOOP_HOME:-{{hadoop_home}}}\nexport HADOOP_CONF_DIR=${HADOOP_CONF_DIR:-{{hadoop_conf_dir}}}\n\n# The java implementation to use.\nexport JAVA_HOME={{java_home}}\n\nif [ -d \"/etc/tez/conf/\" ]; then\n export TEZ_CONF_DIR=/etc/tez/conf\nelse\n export TEZ_CONF_DIR=\nfi",
+ "spark_pid_dir": "/var/run/spark",
+ "spark_log_dir": "/var/log/spark",
+ "spark_group": "spark",
+ "spark_user": "spark"
+ },
+ "spark2-env": {
+ "content": "\n#!/usr/bin/env bash\n\n# This file is sourced when running various Spark programs.\n# Copy it as spark-env.sh and edit that to configure Spark for your site.\n\n# Options read in YARN client mode\n#SPARK_EXECUTOR_INSTANCES=\"2\" #Number of workers to start (Default: 2)\n#SPARK_EXECUTOR_CORES=\"1\" #Number of cores for the workers (Default: 1).\n#SPARK_EXECUTOR_MEMORY=\"1G\" #Memory per Worker (e.g. 1000M, 2G) (Default: 1G)\n#SPARK_DRIVER_MEMORY=\"512 Mb\" #Memory for Master (e.g. 1000M, 2G) (Default: 512 Mb)\n#SPARK_YARN_APP_NAME=\"spark\" #The name of your application (Default: Spark)\n#SPARK_YARN_QUEUE=\"~@~Xdefault~@~Y\" #The hadoop queue to use for allocation requests (Default: @~Xdefault~@~Y)\n#SPARK_YARN_DIST_FILES=\"\" #Comma separated list of files to be distributed with the job.\n#SPARK_YARN_DIST_ARCHIVES=\"\" #Comma separated list of archives to be distributed with the job.\n\n# Generic options for the daemons used in the standalone deploy mode\n\n# Alt
ernate conf dir. (Default: ${SPARK_HOME}/conf)\nexport SPARK_CONF_DIR=${SPARK_HOME:-{{spark_home}}}/conf\n\n# Where log files are stored.(Default:${SPARK_HOME}/logs)\n#export SPARK_LOG_DIR=${SPARK_HOME:-{{spark_home}}}/logs\nexport SPARK_LOG_DIR={{spark_log_dir}}\n\n# Where the pid file is stored. (Default: /tmp)\nexport SPARK_PID_DIR={{spark_pid_dir}}\n\n# A string representing this instance of spark.(Default: $USER)\nSPARK_IDENT_STRING=$USER\n\n# The scheduling priority for daemons. (Default: 0)\nSPARK_NICENESS=0\n\nexport HADOOP_HOME=${HADOOP_HOME:-{{hadoop_home}}}\nexport HADOOP_CONF_DIR=${HADOOP_CONF_DIR:-{{hadoop_conf_dir}}}\n\n# The java implementation to use.\nexport JAVA_HOME={{java_home}}\n\nif [ -d \"/etc/tez/conf/\" ]; then\n export TEZ_CONF_DIR=/etc/tez/conf\nelse\n export TEZ_CONF_DIR=\nfi",
+ "spark_pid_dir": "/var/run/spark",
+ "spark_log_dir": "/var/log/spark",
+ "spark_group": "spark",
+ "spark_user": "spark"
+ },
+ "spark-metrics-properties": {
+ "content": "\n# syntax: [instance].sink|source.[name].[options]=[value]\n\n# This file configures Spark's internal metrics system. The metrics system is\n# divided into instances which correspond to internal components.\n# Each instance can be configured to report its metrics to one or more sinks.\n# Accepted values for [instance] are \"master\", \"worker\", \"executor\", \"driver\",\n# and \"applications\". A wild card \"*\" can be used as an instance name, in\n# which case all instances will inherit the supplied property.\n#\n# Within an instance, a \"source\" specifies a particular set of grouped metrics.\n# there are two kinds of sources:\n# 1. Spark internal sources, like MasterSource, WorkerSource, etc, which will\n# collect a Spark component's internal state. Each instance is paired with a\n# Spark source that is added automatically.\n# 2. Common sources, like JvmSource, which will collect low level state.\n# These can be added through configuration options and are then
loaded\n# using reflection.\n#\n# A \"sink\" specifies where metrics are delivered to. Each instance can be\n# assigned one or more sinks.\n#\n# The sink|source field specifies whether the property relates to a sink or\n# source.\n#\n# The [name] field specifies the name of source or sink.\n#\n# The [options] field is the specific property of this source or sink. The\n# source or sink is responsible for parsing this property.\n#\n# Notes:\n# 1. To add a new sink, set the \"class\" option to a fully qualified class\n# name (see examples below).\n# 2. Some sinks involve a polling period. The minimum allowed polling period\n# is 1 second.\n# 3. Wild card properties can be overridden by more specific properties.\n# For example, master.sink.console.period takes precedence over\n# *.sink.console.period.\n# 4. A metrics specific configuration\n# \"spark.metrics.conf=${SPARK_HOME}/conf/metrics.properties\" should be\n# added to Java properties using -Dspark.metrics.conf=xxx if you want to\
n# customize metrics system. You can also put the file in ${SPARK_HOME}/conf\n# and it will be loaded automatically.\n# 5. MetricsServlet is added by default as a sink in master, worker and client\n# driver, you can send http request \"/metrics/json\" to get a snapshot of all the\n# registered metrics in json format. For master, requests \"/metrics/master/json\" and\n# \"/metrics/applications/json\" can be sent seperately to get metrics snapshot of\n# instance master and applications. MetricsServlet may not be configured by self.\n#\n\n## List of available sinks and their properties.\n\n# org.apache.spark.metrics.sink.ConsoleSink\n# Name: Default: Description:\n# period 10 Poll period\n# unit seconds Units of poll period\n\n# org.apache.spark.metrics.sink.CSVSink\n# Name: Default: Description:\n# period 10 Poll period\n# unit seconds Units of poll period\n# directory /tmp Where to store CSV files\n\n# org.apache.spark.metrics.sink.GangliaSink\n# Name: Default: Description:\n# host N
ONE Hostname or multicast group of Ganglia server\n# port NONE Port of Ganglia server(s)\n# period 10 Poll period\n# unit seconds Units of poll period\n# ttl 1 TTL of messages sent by Ganglia\n# mode multicast Ganglia network mode ('unicast' or 'multicast')\n\n# org.apache.spark.metrics.sink.JmxSink\n\n# org.apache.spark.metrics.sink.MetricsServlet\n# Name: Default: Description:\n# path VARIES* Path prefix from the web server root\n# sample false Whether to show entire set of samples for histograms ('false' or 'true')\n#\n# * Default path is /metrics/json for all instances except the master. The master has two paths:\n# /metrics/aplications/json # App information\n# /metrics/master/json # Master information\n\n# org.apache.spark.metrics.sink.GraphiteSink\n# Name: Default: Description:\n# host NONE Hostname of Graphite server\n# port NONE Port of Graphite server\n# period 10 Poll period\n# unit seconds Units of poll period\n# prefix EMPTY STRING Prefix to prepend to metric name\n\n##
Examples\n# Enable JmxSink for all instances by class name\n#*.sink.jmx.class=org.apache.spark.metrics.sink.JmxSink\n\n# Enable ConsoleSink for all instances by class name\n#*.sink.console.class=org.apache.spark.metrics.sink.ConsoleSink\n\n# Polling period for ConsoleSink\n#*.sink.console.period=10\n\n#*.sink.console.unit=seconds\n\n# Master instance overlap polling period\n#master.sink.console.period=15\n\n#master.sink.console.unit=seconds\n\n# Enable CsvSink for all instances\n#*.sink.csv.class=org.apache.spark.metrics.sink.CsvSink\n\n# Polling period for CsvSink\n#*.sink.csv.period=1\n\n#*.sink.csv.unit=minutes\n\n# Polling directory for CsvSink\n#*.sink.csv.directory=/tmp/\n\n# Worker instance overlap polling period\n#worker.sink.csv.period=10\n\n#worker.sink.csv.unit=minutes\n\n# Enable jvm source for instance master, worker, driver and executor\n#master.source.jvm.class=org.apache.spark.metrics.source.JvmSource\n\n#worker.source.jvm.class=org.apache.spark.metrics.source.JvmSo
urce\n\n#driver.source.jvm.class=org.apache.spark.metrics.source.JvmSource\n\n#executor.source.jvm.class=org.apache.spark.metrics.source.JvmSource"
+ },
+ "spark-metrics-properties": {
+ "content": "\n# syntax: [instance].sink|source.[name].[options]=[value]\n\n# This file configures Spark's internal metrics system. The metrics system is\n# divided into instances which correspond to internal components.\n# Each instance can be configured to report its metrics to one or more sinks.\n# Accepted values for [instance] are \"master\", \"worker\", \"executor\", \"driver\",\n# and \"applications\". A wild card \"*\" can be used as an instance name, in\n# which case all instances will inherit the supplied property.\n#\n# Within an instance, a \"source\" specifies a particular set of grouped metrics.\n# there are two kinds of sources:\n# 1. Spark internal sources, like MasterSource, WorkerSource, etc, which will\n# collect a Spark component's internal state. Each instance is paired with a\n# Spark source that is added automatically.\n# 2. Common sources, like JvmSource, which will collect low level state.\n# These can be added through configuration options and are then
loaded\n# using reflection.\n#\n# A \"sink\" specifies where metrics are delivered to. Each instance can be\n# assigned one or more sinks.\n#\n# The sink|source field specifies whether the property relates to a sink or\n# source.\n#\n# The [name] field specifies the name of source or sink.\n#\n# The [options] field is the specific property of this source or sink. The\n# source or sink is responsible for parsing this property.\n#\n# Notes:\n# 1. To add a new sink, set the \"class\" option to a fully qualified class\n# name (see examples below).\n# 2. Some sinks involve a polling period. The minimum allowed polling period\n# is 1 second.\n# 3. Wild card properties can be overridden by more specific properties.\n# For example, master.sink.console.period takes precedence over\n# *.sink.console.period.\n# 4. A metrics specific configuration\n# \"spark.metrics.conf=${SPARK_HOME}/conf/metrics.properties\" should be\n# added to Java properties using -Dspark.metrics.conf=xxx if you want to\
n# customize metrics system. You can also put the file in ${SPARK_HOME}/conf\n# and it will be loaded automatically.\n# 5. MetricsServlet is added by default as a sink in master, worker and client\n# driver, you can send http request \"/metrics/json\" to get a snapshot of all the\n# registered metrics in json format. For master, requests \"/metrics/master/json\" and\n# \"/metrics/applications/json\" can be sent seperately to get metrics snapshot of\n# instance master and applications. MetricsServlet may not be configured by self.\n#\n\n## List of available sinks and their properties.\n\n# org.apache.spark.metrics.sink.ConsoleSink\n# Name: Default: Description:\n# period 10 Poll period\n# unit seconds Units of poll period\n\n# org.apache.spark.metrics.sink.CSVSink\n# Name: Default: Description:\n# period 10 Poll period\n# unit seconds Units of poll period\n# directory /tmp Where to store CSV files\n\n# org.apache.spark.metrics.sink.GangliaSink\n# Name: Default: Description:\n# host N
ONE Hostname or multicast group of Ganglia server\n# port NONE Port of Ganglia server(s)\n# period 10 Poll period\n# unit seconds Units of poll period\n# ttl 1 TTL of messages sent by Ganglia\n# mode multicast Ganglia network mode ('unicast' or 'multicast')\n\n# org.apache.spark.metrics.sink.JmxSink\n\n# org.apache.spark.metrics.sink.MetricsServlet\n# Name: Default: Description:\n# path VARIES* Path prefix from the web server root\n# sample false Whether to show entire set of samples for histograms ('false' or 'true')\n#\n# * Default path is /metrics/json for all instances except the master. The master has two paths:\n# /metrics/aplications/json # App information\n# /metrics/master/json # Master information\n\n# org.apache.spark.metrics.sink.GraphiteSink\n# Name: Default: Description:\n# host NONE Hostname of Graphite server\n# port NONE Port of Graphite server\n# period 10 Poll period\n# unit seconds Units of poll period\n# prefix EMPTY STRING Prefix to prepend to metric name\n\n##
Examples\n# Enable JmxSink for all instances by class name\n#*.sink.jmx.class=org.apache.spark.metrics.sink.JmxSink\n\n# Enable ConsoleSink for all instances by class name\n#*.sink.console.class=org.apache.spark.metrics.sink.ConsoleSink\n\n# Polling period for ConsoleSink\n#*.sink.console.period=10\n\n#*.sink.console.unit=seconds\n\n# Master instance overlap polling period\n#master.sink.console.period=15\n\n#master.sink.console.unit=seconds\n\n# Enable CsvSink for all instances\n#*.sink.csv.class=org.apache.spark.metrics.sink.CsvSink\n\n# Polling period for CsvSink\n#*.sink.csv.period=1\n\n#*.sink.csv.unit=minutes\n\n# Polling directory for CsvSink\n#*.sink.csv.directory=/tmp/\n\n# Worker instance overlap polling period\n#worker.sink.csv.period=10\n\n#worker.sink.csv.unit=minutes\n\n# Enable jvm source for instance master, worker, driver and executor\n#master.source.jvm.class=org.apache.spark.metrics.source.JvmSource\n\n#worker.source.jvm.class=org.apache.spark.metrics.source.JvmSo
urce\n\n#driver.source.jvm.class=org.apache.spark.metrics.source.JvmSource\n\n#executor.source.jvm.class=org.apache.spark.metrics.source.JvmSource"
+ },
+ "livy-log4j-properties": {
+ "content": "\n # Set everything to be logged to the console\n log4j.rootCategory=INFO, console\n log4j.appender.console=org.apache.log4j.ConsoleAppender\n log4j.appender.console.target=System.err\n log4j.appender.console.layout=org.apache.log4j.PatternLayout\n log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{1}: %m%n\n\n log4j.logger.org.eclipse.jetty=WARN"
+ },
+ "livy2-log4j-properties": {
+ "content": "\n # Set everything to be logged to the console\n log4j.rootCategory=INFO, console\n log4j.appender.console=org.apache.log4j.ConsoleAppender\n log4j.appender.console.target=System.err\n log4j.appender.console.layout=org.apache.log4j.PatternLayout\n log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{1}: %m%n\n\n log4j.logger.org.eclipse.jetty=WARN"
+ },
+ "livy-conf": {
+ "livy.server.port": "8998",
+ "livy.server.csrf_protection.enabled": "true",
+ "livy.environment": "production",
+ "livy.impersonation.enabled": "true",
+ "livy.server.session.timeout": "3600000"
+ },
+ "livy2-conf": {
+ "livy.server.port": "8999",
+ "livy.server.csrf_protection.enabled": "true",
+ "livy.environment": "production",
+ "livy.impersonation.enabled": "true",
+ "livy.server.session.timeout": "3600000"
+ },
+ "livy-spark-blacklist": {
+ "content": "\n #\n # Configuration override / blacklist. Defines a list of properties that users are not allowed\n # to override when starting Spark sessions.\n #\n # This file takes a list of property names (one per line). Empty lines and lines starting with \"#\"\n # are ignored.\n #"
+ },
+ "livy2-spark-blacklist": {
+ "content": "\n #\n # Configuration override / blacklist. Defines a list of properties that users are not allowed\n # to override when starting Spark sessions.\n #\n # This file takes a list of property names (one per line). Empty lines and lines starting with \"#\"\n # are ignored.\n #"
+ },
+ "livy-env": {
+ "livy_group": "livy",
+ "spark_home": "/usr/hdp/current/spark-client",
+ "content": "\n #!/usr/bin/env bash\n\n # - SPARK_HOME Spark which you would like to use in livy\n # - HADOOP_CONF_DIR Directory containing the Hadoop / YARN configuration to use.\n # - LIVY_LOG_DIR Where log files are stored. (Default: ${LIVY_HOME}/logs)\n # - LIVY_PID_DIR Where the pid file is stored. (Default: /tmp)\n # - LIVY_SERVER_JAVA_OPTS Java Opts for running livy server (You can set jvm related setting here, like jvm memory/gc algorithm and etc.)\n export SPARK_HOME=/usr/hdp/current/spark-client\n export HADOOP_CONF_DIR=/etc/hadoop/conf\n export LIVY_LOG_DIR={{livy_log_dir}}\n export LIVY_PID_DIR={{livy_pid_dir}}\n export LIVY_SERVER_JAVA_OPTS=\"-Xmx2g\"",
+ "livy_pid_dir": "/var/run/livy",
+ "livy_log_dir": "/var/log/livy",
+ "livy_user": "livy"
+ },
+ "livy2-env": {
+ "livy2_group": "livy",
+ "spark_home": "/usr/hdp/current/spark2-client",
+ "content": "\n #!/usr/bin/env bash\n\n # - SPARK_HOME Spark which you would like to use in livy\n # - HADOOP_CONF_DIR Directory containing the Hadoop / YARN configuration to use.\n # - LIVY_LOG_DIR Where log files are stored. (Default: ${LIVY_HOME}/logs)\n # - LIVY_PID_DIR Where the pid file is stored. (Default: /tmp)\n # - LIVY_SERVER_JAVA_OPTS Java Opts for running livy server (You can set jvm related setting here, like jvm memory/gc algorithm and etc.)\n export SPARK_HOME=/usr/hdp/current/spark2-client\n export HADOOP_CONF_DIR=/etc/hadoop/conf\n export LIVY_LOG_DIR={{livy_log_dir}}\n export LIVY_PID_DIR={{livy_pid_dir}}\n export LIVY_SERVER_JAVA_OPTS=\"-Xmx2g\"",
+ "livy2_pid_dir": "/var/run/livy2",
+ "livy2_log_dir": "/var/log/livy2",
+ "livy2_user": "livy"
+ },
+ "infra-solr-env": {
+ "infra_solr_znode": "/infra-solr",
+ "infra_solr_user": "solr",
+ "infra_solr_client_log_dir" :"/var/log/ambari-infra-solr-client"
+ },
+ "infra-solr-client-log4j" : {
+ "infra_solr_client_log_dir" : "/var/log/ambari-infra-solr-client",
+ "content" : "content"
+ },
+ "application-properties": {
+ "atlas.cluster.name" : "c2",
+ "atlas.rest.address": "http://c6401.ambari.apache.org:21000",
+ "atlas.graph.storage.backend": "berkeleyje",
+ "atlas.graph.storage.directory": "data/berkley",
+ "atlas.graph.index.search.backend": "solr5",
+ "atlas.graph.index.search.directory": "data/es",
+ "atlas.graph.index.search.elasticsearch.client-only": false,
+ "atlas.graph.index.search.elasticsearch.local-mode": true,
+ "atlas.lineage.hive.table.type.name": "Table",
+ "atlas.lineage.hive.column.type.name": "Column",
+ "atlas.lineage.hive.table.column.name": "columns",
+ "atlas.lineage.hive.process.type.name": "LoadProcess",
+ "atlas.lineage.hive.process.inputs.name": "inputTables",
+ "atlas.lineage.hive.process.outputs.name": "outputTables",
+ "atlas.enableTLS": false,
+ "atlas.authentication.method": "simple",
+ "atlas.authentication.principal": "atlas",
+ "atlas.authentication.keytab": "/etc/security/keytabs/atlas.service.keytab",
+ "atlas.http.authentication.enabled": false,
+ "atlas.http.authentication.type": "simple",
+ "atlas.http.authentication.kerberos.principal": "HTTP/_HOST@EXAMPLE.COM",
+ "atlas.http.authentication.kerberos.keytab": "/etc/security/keytabs/spnego.service.keytab",
+ "atlas.http.authentication.kerberos.name.rules": "DEFAULT",
+ "atlas.server.http.port" : "21000",
+ "atlas.notification.embedded" : false,
+ "atlas.kafka.bootstrap.servers" : "c6401.ambari.apache.org:6667",
+ "atlas.kafka.data" : "/usr/hdp/current/atlas-server/data/kafka",
+ "atlas.kafka.entities.group.id" : "entities",
+ "atlas.kafka.hook.group.id" : "atlas",
+ "atlas.kafka.zookeeper.connect" : "c6401.ambari.apache.org:2181"
+ },
+ "atlas-env": {
+ "content": "# The java implementation to use. If JAVA_HOME is not found we expect java and jar to be in path\nexport JAVA_HOME={{java64_home}}\n# any additional java opts you want to set. This will apply to both client and server operations\nexport METADATA_OPTS={{metadata_opts}}\n# metadata configuration directory\nexport METADATA_CONF={{conf_dir}}\n# Where log files are stored. Defatult is logs directory under the base install location\nexport METADATA_LOG_DIR={{log_dir}}\n# additional classpath entries\nexport METADATACPPATH={{metadata_classpath}}\n# data dir\nexport METADATA_DATA_DIR={{data_dir}}\n# Where do you want to expand the war file. By Default it is in /server/webapp dir under the base install dir.\nexport METADATA_EXPANDED_WEBAPP_DIR={{expanded_war_dir}}",
+ "metadata_user": "atlas",
+ "metadata_port": 21000,
+ "metadata_pid_dir": "/var/run/atlas",
+ "metadata_log_dir": "/var/log/atlas",
+ "metadata_data_dir": "/var/lib/atlas/data",
+ "metadata_expanded_war_dir": "/var/lib/atlas/server/webapp"
+ },
+ "atlas-log4j": {
+ "content": "<property><name>content</name><description>Custom log4j.properties</description><value></value></property>",
+ "atlas_log_level": "debug",
+ "audit_log_level": "OFF"
+ },
+ "atlas-solrconfig": {
+ "content": "<property><name>content</name><description>Custom solrconfig properties</description><value></value></property>"
+ },
+ "zeppelin-env": {
+ "zeppelin.server.kerberos.keytab": "",
+ "shiro_ini_content": "\n[users]\n# List of users with their password allowed to access Zeppelin.\n# To use a different strategy (LDAP / Database / ...) check the shiro doc at http://shiro.apache.org/configuration.html#Configuration-INISections\n#admin = password1\n#user1 = password2, role1, role2\n#user2 = password3, role3\n#user3 = password4, role2\n\n# Sample LDAP configuration, for user Authentication, currently tested for single Realm\n[main]\n#ldapRealm = org.apache.shiro.realm.ldap.JndiLdapRealm\n#ldapRealm.userDnTemplate = uid={0},cn=users,cn=accounts,dc=hortonworks,dc=com\n#ldapRealm.contextFactory.url = ldap://ldaphost:389\n#ldapRealm.contextFactory.authenticationMechanism = SIMPLE\n#sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager\n#securityManager.sessionManager = $sessionManager\n# 86,400,000 milliseconds = 24 hour\n#securityManager.sessionManager.globalSessionTimeout = 86400000\nshiro.loginUrl = /api/login\n\n[urls]\n# anon means the acce
ss is anonymous.\n# authcBasic means Basic Auth Security\n# To enfore security, comment the line below and uncomment the next one\n/api/version = anon\n/** = anon\n#/** = authc",
+ "zeppelin.spark.jar.dir": "/apps/zeppelin",
+ "zeppelin.executor.mem": "512m",
+ "zeppelin_pid_dir": "/var/run/zeppelin",
+ "zeppelin.executor.instances": "2",
+ "log4j_properties_content": "\nlog4j.rootLogger = INFO, dailyfile\nlog4j.appender.stdout = org.apache.log4j.ConsoleAppender\nlog4j.appender.stdout.layout = org.apache.log4j.PatternLayout\nlog4j.appender.stdout.layout.ConversionPattern=%5p [%d] ({%t} %F[%M]:%L) - %m%n\nlog4j.appender.dailyfile.DatePattern=.yyyy-MM-dd\nlog4j.appender.dailyfile.Threshold = INFO\nlog4j.appender.dailyfile = org.apache.log4j.DailyRollingFileAppender\nlog4j.appender.dailyfile.File = ${zeppelin.log.file}\nlog4j.appender.dailyfile.layout = org.apache.log4j.PatternLayout\nlog4j.appender.dailyfile.layout.ConversionPattern=%5p [%d] ({%t} %F[%M]:%L) - %m%n",
+ "zeppelin.server.kerberos.principal": "",
+ "zeppelin_user": "zeppelin",
+ "zeppelin_env_content": "\n# Spark master url. eg. spark://master_addr:7077. Leave empty if you want to use local mode\nexport MASTER=yarn-client\nexport SPARK_YARN_JAR={{spark_jar}}\n\n\n# Where log files are stored. PWD by default.\nexport ZEPPELIN_LOG_DIR={{zeppelin_log_dir}}\n\n# The pid files are stored. /tmp by default.\nexport ZEPPELIN_PID_DIR={{zeppelin_pid_dir}}\n\n\nexport JAVA_HOME={{java64_home}}\n\n# Additional jvm options. for example, export ZEPPELIN_JAVA_OPTS=\"-Dspark.executor.memory=8g -Dspark.cores.max=16\"\nexport ZEPPELIN_JAVA_OPTS=\"-Dhdp.version={{full_stack_version}} -Dspark.executor.memory={{executor_mem}} -Dspark.executor.instances={{executor_instances}} -Dspark.yarn.queue={{spark_queue}}\"\n\n\n# Zeppelin jvm mem options Default -Xmx1024m -XX:MaxPermSize=512m\n# export ZEPPELIN_MEM\n\n# zeppelin interpreter process jvm mem options. Defualt = ZEPPELIN_MEM\n# export ZEPPELIN_INTP_MEM\n\n# zeppelin interpreter process jvm options. Default = ZEPPELIN_JA
VA_OPTS\n# export ZEPPELIN_INTP_JAVA_OPTS\n\n# Where notebook saved\n# export ZEPPELIN_NOTEBOOK_DIR\n\n# Id of notebook to be displayed in homescreen. ex) 2A94M5J1Z\n# export ZEPPELIN_NOTEBOOK_HOMESCREEN\n\n# hide homescreen notebook from list when this value set to \"true\". default \"false\"\n# export ZEPPELIN_NOTEBOOK_HOMESCREEN_HIDE\n\n# Bucket where notebook saved\n# export ZEPPELIN_NOTEBOOK_S3_BUCKET\n\n# User in bucket where notebook saved. For example bucket/user/notebook/2A94M5J1Z/note.json\n# export ZEPPELIN_NOTEBOOK_S3_USER\n\n# A string representing this instance of zeppelin. $USER by default\n# export ZEPPELIN_IDENT_STRING\n\n# The scheduling priority for daemons. Defaults to 0.\n# export ZEPPELIN_NICENESS\n\n\n#### Spark interpreter configuration ####\n\n## Use provided spark installation ##\n## defining SPARK_HOME makes Zeppelin run spark interpreter process using spark-submit\n##\n# (required) When it is defined, load it instead of Zeppelin embedded Spark libraries\n
export SPARK_HOME={{spark_home}}\n\n# (optional) extra options to pass to spark submit. eg) \"--driver-memory 512M --executor-memory 1G\".\n# export SPARK_SUBMIT_OPTIONS\n\n## Use embedded spark binaries ##\n## without SPARK_HOME defined, Zeppelin still able to run spark interpreter process using embedded spark binaries.\n## however, it is not encouraged when you can define SPARK_HOME\n##\n# Options read in YARN client mode\n# yarn-site.xml is located in configuration directory in HADOOP_CONF_DIR.\nexport HADOOP_CONF_DIR=/etc/hadoop/conf\n\n# Pyspark (supported with Spark 1.2.1 and above)\n# To configure pyspark, you need to set spark distribution's path to 'spark.home' property in Interpreter setting screen in Zeppelin GUI\n# path to the python command. must be the same path on the driver(Zeppelin) and all workers.\n# export PYSPARK_PYTHON\n\nexport PYTHONPATH=\"${SPARK_HOME}/python:${SPARK_HOME}/python/lib/py4j-0.8.2.1-src.zip\"\nexport SPARK_YARN_USER_ENV=\"PYTHONPATH=${PYTHONPAT
H}\"\n\n## Spark interpreter options ##\n##\n# Use HiveContext instead of SQLContext if set true. true by default.\n# export ZEPPELIN_SPARK_USEHIVECONTEXT\n\n# Execute multiple SQL concurrently if set true. false by default.\n# export ZEPPELIN_SPARK_CONCURRENTSQL\n\n# Max number of SparkSQL result to display. 1000 by default.\n# export ZEPPELIN_SPARK_MAXRESULT",
+ "zeppelin_log_dir": "/var/log/zeppelin",
+ "zeppelin_group": "zeppelin"
+ },
+"zeppelin-config": {
+ "zeppelin.server.port": "9995",
+ "zeppelin.server.ssl.port": "9995",
+ "zeppelin.ssl.truststore.password": "change me",
+ "zeppelin.interpreters": "org.apache.zeppelin.spark.SparkInterpreter,org.apache.zeppelin.spark.PySparkInterpreter,org.apache.zeppelin.spark.SparkSqlInterpreter,org.apache.zeppelin.spark.DepInterpreter,org.apache.zeppelin.markdown.Markdown,org.apache.zeppelin.angular.AngularInterpreter,org.apache.zeppelin.shell.ShellInterpreter,org.apache.zeppelin.jdbc.JDBCInterpreter,org.apache.zeppelin.phoenix.PhoenixInterpreter,org.apache.zeppelin.livy.LivySparkInterpreter,org.apache.zeppelin.livy.LivyPySparkInterpreter,org.apache.zeppelin.livy.LivySparkRInterpreter,org.apache.zeppelin.livy.LivySparkSQLInterpreter",
+ "zeppelin.interpreter.group.order": "spark,angular,jdbc,livy,md,sh",
+ "zeppelin.ssl.truststore.path": "conf/truststore",
+ "zeppelin.notebook.dir": "notebook",
+ "zeppelin.ssl.keystore.password": "change me",
+ "zeppelin.ssl.keystore.path": "conf/keystore",
+ "zeppelin.server.addr": "0.0.0.0",
+ "zeppelin.ssl.client.auth": "false",
+ "zeppelin.notebook.homescreen": " ",
+ "zeppelin.interpreter.dir": "interpreter",
+ "zeppelin.ssl.keystore.type": "JKS",
+ "zeppelin.notebook.s3.user": "user",
+ "zeppelin.ssl.key.manager.password": "change me",
+ "zeppelin.anonymous.allowed": "true",
+ "zeppelin.ssl.truststore.type": "JKS",
+ "zeppelin.ssl": "false",
+ "zeppelin.notebook.storage": "org.apache.zeppelin.notebook.repo.VFSNotebookRepo",
+ "zeppelin.websocket.max.text.message.size": "1024000",
+ "zeppelin.interpreter.connect.timeout": "30000",
+ "zeppelin.notebook.s3.bucket": "zeppelin",
+ "zeppelin.notebook.homescreen.hide": "false",
+ "zeppelin.server.allowed.origins": "*"
+ },
+ "zoo.cfg": {
+ "clientPort": "2181"
+ },
+ "ranger-hbase-plugin-properties": {
+ "ranger-hbase-plugin-enabled":"yes"
+ },
+ "ranger-hive-plugin-properties": {
+ "ranger-hive-plugin-enabled":"yes"
+ },
+ "ranger-env": {
+ "xml_configurations_supported" : "true"
+ },
+ "tagsync-application-properties": {
+ "atlas.kafka.hook.group.id": "atlas",
+ "atlas.kafka.zookeeper.connect": "os-mv-31-dev-4.novalocal:2181",
+ "atlas.kafka.acks": "1",
+ "atlas.kafka.entities.group.id": "ranger_entities_consumer",
+ "atlas.kafka.data": "/usr/hdp/current/atlas-server/data/kafka",
+ "atlas.kafka.bootstrap.servers": "localhost:2181",
+ "atlas.notification.embedded": "false"
+ },
+ "ranger-tagsync-site": {
+ "ranger.tagsync.sink.impl.class": "org.apache.ranger.tagsync.sink.tagadmin.TagAdminRESTSink",
+ "ranger.tagsync.atlasrestsource.endpoint": "",
+ "ranger.tagsync.tagadmin.rest.ssl.config.file": "/usr/hdp/current/ranger-tagsync/conf/mytruststore.jks",
+ "ranger.tagsync.logdir": "/var/log/ranger/tagsync",
+ "ranger.tagsync.filesource.filename": "/usr/hdp/current/ranger-tagsync/conf/etc/ranger/data/tags.json",
+ "ranger.tagsync.enabled": "true",
+ "ranger.tagsync.tagadmin.rest.url": "{{ranger_external_url}}",
+ "ranger.tagsync.atlasrestsource.download.interval": "",
+ "ranger.tagsync.filesource.modtime.check.interval": "60000",
+ "ranger.tagsync.tagadmin.password": "rangertagsync",
+ "ranger.tagsync.source.impl.class": "file",
+ "ranger.tagsync.source.atlas.custom.resource.mappers": "",
+ "ranger.tagsync.tagadmin.alias": "tagsync.tagadmin",
+ "ranger.tagsync.tagadmin.keystore": "/usr/hdp/current/ranger-tagsync/conf/rangertagsync.jceks",
+ "ranger.tagsync.atlas.to.service.mapping": ""
+ },
+ "druid-env": {
+ "druid_log_dir" : "/var/log/druid",
+ "druid_pid_dir" : "/var/run/druid",
+ "content" : "#!/bin/bash\n # Set DRUID specific environment variables here.\n# The java implementation to use\nexport JAVA_HOME={{java8_home}}\nexport PATH=$PATH:$JAVA_HOME/bin\nexport DRUID_PID_DIR={{druid_pid_dir}}\nexport DRUID_LOG_DIR={{druid_log_dir}}\nexport DRUID_CONF_DIR={{druid_conf_dir}}\nexport DRUID_LIB_DIR={{druid_home}}/lib",
+ "druid.coordinator.jvm.heap.memory" : 1024,
+ "druid.coordinator.jvm.direct.memory": 2048,
+ "druid.coordinator.jvm.opts": "-Duser.timezone=UTC -Dfile.encoding=UTF-8",
+ "druid.broker.jvm.heap.memory" : 1024,
+ "druid.broker.jvm.direct.memory": 2048,
+ "druid.broker.jvm.opts": "-Duser.timezone=UTC -Dfile.encoding=UTF-8",
+ "druid.middlemanager.jvm.heap.memory" : 1024,
+ "druid.middlemanager.jvm.direct.memory": 2048,
+ "druid.middlemanager.jvm.opts": "-Duser.timezone=UTC -Dfile.encoding=UTF-8",
+ "druid.historical.jvm.heap.memory" : 1024,
+ "druid.historical.jvm.direct.memory": 2048,
+ "druid.historical.jvm.opts": "-Duser.timezone=UTC -Dfile.encoding=UTF-8",
+ "druid.overlord.jvm.heap.memory" : 1024,
+ "druid.overlord.jvm.direct.memory": 2048,
+ "druid.overlord.jvm.opts": "-Duser.timezone=UTC -Dfile.encoding=UTF-8",
+ "druid.router.jvm.heap.memory" : 1024,
+ "druid.router.jvm.direct.memory": 2048,
+ "druid.router.jvm.opts": "-Duser.timezone=UTC -Dfile.encoding=UTF-8",
+ "druid_user": "druid"
+ },
+ "druid-common" : {
+ "druid.metadata.storage.type" : "mysql",
+ "druid.metadata.storage.connector.connectURI" : "jdbc:mysql://my-db-host:3306/druid?createDatabaseIfNotExist=true",
+ "druid.metadata.storage.connector.user" : "druid",
+ "druid.metadata.storage.connector.password" : "diurd",
+ "druid.storage.type" : "hdfs",
+ "druid.storage.storageDirectory" : "/user/druid/data",
+ "druid.indexer.logs.type": "hdfs",
+ "druid.indexer.logs.directory": "/user/druid/logs",
+ "druid.extensions.pullList": "[\"custom-druid-extension\"]",
+ "druid.extensions.repositoryList": "[\"http://custom-mvn-repo/public/release\"]",
+ "druid.extensions.loadList": "[\"mysql-metadata-storage\", \"druid-datasketches\"]",
+ "druid.security.extensions.loadList": "[\"druid-kerberos\"]"
+ },
+ "druid-historical" : {
+ "druid.segmentCache.infoDir" : "/apps/druid/segmentCache/info_dir",
+ "druid.segmentCache.locations" :"[{\"path\":\"/apps/druid/segmentCache\",\"maxSize\":300000000000}]"
+ },
+ "druid-coordinator" : {
+ "druid.service" : "druid/coordinator"
+ },
+ "druid-overlord" : {
+ "druid.service" : "druid/overlord"
+ },
+ "druid-broker" : {
+ "druid.service" : "druid/broker"
+ },
+ "druid-middlemanager" : {
+ "druid.service" : "druid/middlemanager",
+ "druid.indexer.task.hadoopWorkingPath" : "/tmp/druid-indexing",
+ "druid.indexer.task.baseTaskDir" : "/apps/druid/tasks"
+ },
+ "druid-router" : {
+ "druid.service" : "druid/router"
+ },
+ "druid-log4j" : {
+ "content" : "<![CDATA[<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!--\n ~ Licensed to the Apache Software Foundation (ASF) under one\n ~ or more contributor license agreements. See the NOTICE file\n ~ distributed with this work for additional information\n ~ regarding copyright ownership. The ASF licenses this file\n ~ to you under the Apache License, Version 2.0 (the\n ~ \"License\"); you may not use this file except in compliance\n ~ with the License. You may obtain a copy of the License at\n ~\n ~ http://www.apache.org/licenses/LICENSE-2.0\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n <Configuration>\n <Appenders>\n <Console name=\"Console\
" target=\"SYSTEM_OUT\">\n <PatternLayout pattern=\"%d{ISO8601} %p [%t] %c - %m%n\"/>\n </Console>\n </Appenders>\n <Loggers>\n <Logger name=\"com.metamx\" level=\"{{metamx_log_level}}\"/>\n <Logger name=\"io.druid\" level=\"{{druid_log_level}}\"/>\n <Root level=\"{{root_log_level}}\">\n <AppenderRef ref=\"Console\"/>\n </Root>\n </Loggers>\n </Configuration>\n ]]>\n"
+ },
+ "druid-logrotate" : {
+ "content" : "<![CDATA[\n {{druid_log_dir}}/*.log {\n copytruncate\n rotate 7\n daily\n nocompress\n missingok\n notifempty\n create 660 druid users\n dateext\n dateformat -%Y-%m-%d-%s\n }\n ]]>\n"
+ },
+ "superset" : {
+ "SUPERSET_DATABASE_TYPE" : "sqllite"
+ }
+ },
+ "configuration_attributes": {
+ "sqoop-site": {},
+ "yarn-site": {
+ "final": {
+ "yarn.nodemanager.disk-health-checker.min-healthy-disks": "true",
+ "yarn.nodemanager.container-executor.class": "true",
+ "yarn.nodemanager.local-dirs": "true"
+ }
+ },
+ "yarn-site": {
+ "final": {
+ "is_supported_yarn_ranger": "true"
+ }
+ },
+ "hdfs-site": {
+ "final": {
+ "dfs.web.ugi": "true",
+ "dfs.support.append": "true",
+ "dfs.cluster.administrators": "true"
+ }
+ },
+ "core-site": {
+ "final": {
+ "hadoop.proxyuser.hive.groups": "true",
+ "webinterface.private.actions": "true",
+ "hadoop.proxyuser.oozie.hosts": "true"
+ }
+ },
+ "knox-env": {},
+ "gateway-site": {},
+ "users-ldif": {},
+ "kafka-env": {},
+ "kafka-log4j": {},
+ "kafka-broker": {},
+ "metadata-env": {},
+ "atlas-hbase-site": {},
+ "tagsync-application-properties": {},
+ "ranger-tagsync-site": {}
+ },
+ "configurationTags": {
+ "slider-client": {
+ "tag": "version1"
+ },
+ "slider-log4j": {
+ "tag": "version1"
+ },
+ "slider-env": {
+ "tag": "version1"
+ },
+ "core-site": {
+ "tag": "version1"
+ },
+ "hdfs-site": {
+ "tag": "version1"
+ },
+ "yarn-site": {
+ "tag": "version1"
+ },
+ "gateway-site": {
+ "tag": "version1"
+ },
+ "topology": {
+ "tag": "version1"
+ },
+ "users-ldif": {
+ "tag": "version1"
+ },
+ "kafka-env": {
+ "tag": "version1"
+ },
+ "kafka-log4j": {
+ "tag": "version1"
+ },
+ "kafka-broker": {
+ "tag": "version1"
+ },
+ "metadata-env": {
+ "tag": "version1"
+ },
+ "tagsync-application-properties": {
+ "tag": "version1"
+ },
+ "ranger-tagsync-site": {
+ "tag": "version1"
+ }
+ },
+ "commandId": "7-1",
+ "clusterHostInfo": {
+ "ambari_server_host": [
+ "c6401.ambari.apache.org"
+ ],
+ "all_ping_ports": [
+ "8670",
+ "8670"
+ ],
+ "rm_host": [
+ "c6402.ambari.apache.org"
+ ],
+ "all_hosts": [
+ "c6401.ambari.apache.org",
+ "c6402.ambari.apache.org"
+ ],
+ "knox_gateway_hosts": [
+ "jaimin-knox-1.c.pramod-thangali.internal"
+ ],
+ "kafka_broker_hosts": [
+ "c6401.ambari.apache.org"
+ ],
+ "infra_solr_hosts": [
+ "c6401.ambari.apache.org"
+ ],
+ "zookeeper_hosts": [
+ "c6401.ambari.apache.org"
+ ],
+ "ranger_tagsync_hosts": [
+ "c6401.ambari.apache.org"
+ ],
+ "atlas_server_hosts": [
+ "c6401.ambari.apache.org"
+ ],
+ "zeppelin_master_hosts": [
+ "c6401.ambari.apache.org"
+ ]
+ }
+}
[09/50] [abbrv] ambari git commit: AMBARI-22714 Log Search UI:
implement Summary tab for Access Logs page. (ababiichuk)
Posted by rl...@apache.org.
AMBARI-22714 Log Search UI: implement Summary tab for Access Logs page. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/aa5b0fe7
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/aa5b0fe7
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/aa5b0fe7
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: aa5b0fe7625249d497a8b50e4fe95ed0583b45b7
Parents: 1c602b0
Author: ababiichuk <ab...@hortonworks.com>
Authored: Tue Jan 2 15:08:44 2018 +0200
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Tue Jan 2 15:43:32 2018 +0200
----------------------------------------------------------------------
.../ambari-logsearch-web/package.json | 2 +
.../ambari-logsearch-web/src/app/app.module.ts | 15 +
.../components/graph/graph.component.less | 48 +++
.../classes/components/graph/graph.component.ts | 355 +++++++++++++++++++
.../components/logs-table-component.spec.ts | 61 ----
.../classes/components/logs-table-component.ts | 51 ---
.../logs-table/logs-table-component.spec.ts | 61 ++++
.../logs-table/logs-table-component.ts | 51 +++
.../src/app/classes/graph.ts | 42 +++
.../src/app/classes/histogram-options.ts | 35 --
.../src/app/classes/models/tab.ts | 7 +-
.../src/app/classes/object.ts | 19 +
.../classes/queries/audit-logs-query-params.ts | 19 +-
.../audit-logs-top-resources-query-params.ts | 23 ++
.../queries/service-logs-query-params.ts | 4 +-
.../src/app/classes/service-injector.ts | 23 ++
.../audit-logs-entries.component.html | 30 ++
.../audit-logs-entries.component.spec.ts | 110 ++++++
.../audit-logs-entries.component.ts | 86 +++++
.../audit-logs-table.component.ts | 2 +-
.../collapsible-panel.component.html | 2 +-
.../collapsible-panel.component.ts | 4 +-
.../dropdown-button.component.spec.ts | 10 +-
.../dropdown-button.component.ts | 6 +-
.../filter-button.component.spec.ts | 10 +-
.../filter-button/filter-button.component.ts | 7 +-
.../filter-dropdown.component.spec.ts | 14 +-
.../filter-dropdown.component.ts | 5 +-
.../filters-panel/filters-panel.component.ts | 7 +-
.../graph-legend-item.component.html | 19 +
.../graph-legend-item.component.less | 27 ++
.../graph-legend-item.component.spec.ts | 42 +++
.../graph-legend-item.component.ts | 37 ++
.../graph-legend/graph-legend.component.html | 19 +
.../graph-legend/graph-legend.component.spec.ts | 50 +++
.../graph-legend/graph-legend.component.ts | 32 ++
.../graph-tooltip/graph-tooltip.component.html | 22 ++
.../graph-tooltip/graph-tooltip.component.less | 69 ++++
.../graph-tooltip.component.spec.ts | 50 +++
.../graph-tooltip/graph-tooltip.component.ts | 36 ++
.../horizontal-histogram.component.html | 22 ++
.../horizontal-histogram.component.less | 22 ++
.../horizontal-histogram.component.spec.ts | 61 ++++
.../horizontal-histogram.component.ts | 114 ++++++
.../logs-container.component.html | 6 +-
.../logs-container/logs-container.component.ts | 10 +-
.../menu-button/menu-button.component.spec.ts | 10 +-
.../menu-button/menu-button.component.ts | 6 +-
.../search-box/search-box.component.ts | 3 +-
.../service-logs-table.component.ts | 2 +-
.../app/components/tabs/tabs.component.spec.ts | 4 -
.../src/app/components/tabs/tabs.component.ts | 1 +
.../time-histogram.component.html | 32 +-
.../time-histogram.component.less | 145 +-------
.../time-histogram.component.spec.ts | 104 +++---
.../time-histogram/time-histogram.component.ts | 314 +++-------------
.../components/top-menu/top-menu.component.ts | 3 +-
.../src/app/components/variables.less | 3 +
.../ambari-logsearch-web/src/app/mock-data.ts | 142 +++++---
.../app/services/component-actions.service.ts | 1 -
.../src/app/services/http-client.service.ts | 39 +-
.../app/services/logs-container.service.spec.ts | 4 +-
.../src/app/services/logs-container.service.ts | 85 ++++-
.../src/app/services/utils.service.spec.ts | 117 ++++++
.../src/app/services/utils.service.ts | 12 +
.../src/assets/i18n/en.json | 6 +-
.../ambari-logsearch-web/src/styles.less | 4 +
.../src/vendor/css/bootstrap-logsearch.min.css | 2 +-
.../src/vendor/js/bootstrap-logsearch.min.js | 2 +-
ambari-logsearch/ambari-logsearch-web/yarn.lock | 10 +
70 files changed, 2056 insertions(+), 742 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/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 b9ee179..2a3df23 100644
--- a/ambari-logsearch/ambari-logsearch-web/package.json
+++ b/ambari-logsearch/ambari-logsearch-web/package.json
@@ -30,6 +30,7 @@
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"d3": "^4.10.0",
+ "d3-scale-chromatic": "^1.1.1",
"font-awesome": "^4.7.0",
"jquery": "^1.12.4",
"moment": "^2.18.1",
@@ -43,6 +44,7 @@
"@angular/compiler-cli": "^4.0.0",
"@ngtools/webpack": "^1.7.1",
"@types/d3": "^4.10.0",
+ "@types/d3-scale-chromatic": "^1.1.0",
"@types/jasmine": "2.5.38",
"@types/jquery": "^1.10.33",
"@types/moment": "^2.13.0",
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/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 b76de20..da78a71 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/app.module.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/app.module.ts
@@ -30,6 +30,8 @@ import {MomentTimezoneModule} from 'angular-moment-timezone';
import {environment} from '@envs/environment';
+import {ServiceInjector} from '@app/classes/service-injector';
+
import {mockApiDataService} from '@app/services/mock-api-data.service'
import {HttpClientService} from '@app/services/http-client.service';
import {ComponentActionsService} from '@app/services/component-actions.service';
@@ -85,6 +87,11 @@ import {LogFileEntryComponent} from '@app/components/log-file-entry/log-file-ent
import {TabsComponent} from '@app/components/tabs/tabs.component';
import {ServiceLogsTableComponent} from '@app/components/service-logs-table/service-logs-table.component';
import {AuditLogsTableComponent} from '@app/components/audit-logs-table/audit-logs-table.component';
+import {AuditLogsEntriesComponent} from '@app/components/audit-logs-entries/audit-logs-entries.component';
+import {GraphLegendComponent} from '@app/components/graph-legend/graph-legend.component';
+import {HorizontalHistogramComponent} from '@app/components/horizontal-histogram/horizontal-histogram.component';
+import {GraphTooltipComponent} from '@app/components/graph-tooltip/graph-tooltip.component';
+import {GraphLegendItemComponent} from '@app/components/graph-legend-item/graph-legend-item.component';
import {TimeZoneAbbrPipe} from '@app/pipes/timezone-abbr.pipe';
import {TimerSecondsPipe} from '@app/pipes/timer-seconds.pipe';
@@ -141,6 +148,11 @@ export function getXHRBackend(injector: Injector, browser: BrowserXhr, xsrf: XSR
TabsComponent,
ServiceLogsTableComponent,
AuditLogsTableComponent,
+ AuditLogsEntriesComponent,
+ GraphLegendComponent,
+ HorizontalHistogramComponent,
+ GraphTooltipComponent,
+ GraphLegendItemComponent,
TimeZoneAbbrPipe,
TimerSecondsPipe
],
@@ -194,4 +206,7 @@ export function getXHRBackend(injector: Injector, browser: BrowserXhr, xsrf: XSR
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class AppModule {
+ constructor(private injector: Injector) {
+ ServiceInjector.injector = this.injector;
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/classes/components/graph/graph.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/components/graph/graph.component.less b/ambari-logsearch/ambari-logsearch-web/src/app/classes/components/graph/graph.component.less
new file mode 100644
index 0000000..0830193
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/components/graph/graph.component.less
@@ -0,0 +1,48 @@
+/**
+ * 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 '../../../components/variables';
+
+:host {
+ display: block;
+
+ /deep/ .axis {
+ .domain {
+ stroke: @base-font-color;
+ }
+ .tick {
+ line {
+ display: none;
+ }
+ }
+ }
+
+ /deep/ .value {
+ cursor: pointer;
+ rect {
+ transition: opacity 250ms;
+ opacity: .8;
+ &:hover {
+ opacity: 1;
+ }
+ }
+ }
+
+ graph-legend {
+ font-size: 1rem;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/classes/components/graph/graph.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/components/graph/graph.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/components/graph/graph.component.ts
new file mode 100644
index 0000000..1bb7f92
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/components/graph/graph.component.ts
@@ -0,0 +1,355 @@
+/**
+ * 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 {AfterViewInit, OnChanges, SimpleChanges, ViewChild, ElementRef, Input} from '@angular/core';
+import * as d3 from 'd3';
+import * as d3sc from 'd3-scale-chromatic';
+import {GraphPositionOptions, GraphMarginOptions, GraphTooltipInfo, LegendItem} from '@app/classes/graph';
+import {HomogeneousObject} from '@app/classes/object';
+import {ServiceInjector} from '@app/classes/service-injector';
+import {UtilsService} from '@app/services/utils.service';
+
+export class GraphComponent implements AfterViewInit, OnChanges {
+
+ constructor() {
+ this.utils = ServiceInjector.injector.get(UtilsService);
+ }
+
+ ngAfterViewInit() {
+ this.graphContainer = this.graphContainerRef.nativeElement;
+ this.tooltip = this.tooltipRef.nativeElement;
+ this.host = d3.select(this.graphContainer);
+ }
+
+ ngOnChanges(changes: SimpleChanges) {
+ const dataChange = changes.data;
+ if (dataChange && dataChange.currentValue && !this.utils.isEmptyObject(dataChange.currentValue)
+ && (!dataChange.previousValue || this.utils.isEmptyObject(dataChange.previousValue))
+ && this.utils.isEmptyObject(this.labels)) {
+ this.setDefaultLabels();
+ }
+ this.createGraph();
+ }
+
+ @Input()
+ data: HomogeneousObject<HomogeneousObject<number>> = {};
+
+ @Input()
+ svgId: string = 'graph-svg';
+
+ @Input()
+ margin: GraphMarginOptions = {
+ top: 5,
+ right: 50,
+ bottom: 30,
+ left: 50
+ };
+
+ @Input()
+ width: number;
+
+ @Input()
+ height: number = 150;
+
+ @Input()
+ tickPadding: number = 10;
+
+ @Input()
+ colors: HomogeneousObject<string> = {};
+
+ @Input()
+ labels: HomogeneousObject<string> = {};
+
+ /**
+ * Indicates whether the graph represents dependency on time
+ * @type {boolean}
+ */
+ @Input()
+ isTimeGraph: boolean = false;
+
+ /**
+ * Indicates whether X axis direction is right to left
+ * @type {boolean}
+ */
+ @Input()
+ reverseXRange: boolean = false;
+
+ /**
+ * Indicates whether Y axis direction is top to bottom
+ * @type {boolean}
+ */
+ @Input()
+ reverseYRange: boolean = false;
+
+ @ViewChild('graphContainer')
+ graphContainerRef: ElementRef;
+
+ @ViewChild('tooltip', {
+ read: ElementRef
+ })
+ tooltipRef: ElementRef;
+
+ protected utils: UtilsService;
+
+ protected graphContainer: HTMLElement;
+
+ private tooltip: HTMLElement;
+
+ protected host;
+
+ protected svg;
+
+ protected xScale;
+
+ protected yScale;
+
+ protected xAxis;
+
+ protected yAxis;
+
+ /**
+ * Ordered array of color strings for data representation
+ * @type {string[]}
+ */
+ protected orderedColors: string[];
+
+ /**
+ * This property is to hold the data of the bar where the mouse is over.
+ */
+ protected tooltipInfo: GraphTooltipInfo | {} = {};
+
+ /**
+ * This is the computed position of the tooltip relative to the @graphContainer which is the container of the histogram.
+ * It is set when the mousemoving over the bars in the @handleRectMouseMove method.
+ */
+ private tooltipPosition: GraphPositionOptions;
+
+ /**
+ * 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 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 {LegendItem[]}
+ */
+ get legendItems(): LegendItem[] {
+ return Object.keys(this.labels).map((key: string) => Object.assign({}, {
+ label: this.labels[key],
+ color: this.colors[key]
+ }));
+ }
+
+ protected createGraph(): void {
+ if (this.host && !this.utils.isEmptyObject(this.labels)) {
+ this.setup();
+ this.buildSVG();
+ this.populate();
+ }
+ }
+
+ /**
+ * Method that sets default labels map object based on data if no custom one is specified
+ */
+ protected setDefaultLabels() {
+ const data = this.data,
+ keys = Object.keys(data),
+ labels = keys.reduce((keys: HomogeneousObject<string>, dataKey: string): HomogeneousObject<string> => {
+ const newKeys = Object.keys(data[dataKey]),
+ newKeysObj = newKeys.reduce((subKeys: HomogeneousObject<string>, key: string): HomogeneousObject<string> => {
+ return Object.assign(subKeys, {
+ [key]: key
+ });
+ }, {});
+ return Object.assign(keys, newKeysObj);
+ }, {});
+ this.labels = labels;
+ }
+
+ protected setup(): void {
+ const margin = this.margin;
+ if (this.utils.isEmptyObject(this.colors)) {
+ // set default color scheme for different values if no custom colors specified
+ const keys = Object.keys(this.labels),
+ keysCount = keys.length,
+ specterLength = keysCount > 2 ? keysCount : 3; // length of minimal available spectral scheme is 3
+ let colorsArray;
+ if (keysCount > 2) {
+ colorsArray = Array.from(d3sc.schemeSpectral[keysCount]);
+ } else {
+ const minimalColorScheme = Array.from(d3sc.schemeSpectral[specterLength]);
+ colorsArray = minimalColorScheme.slice(0, keysCount);
+ }
+ this.orderedColors = colorsArray;
+ this.colors = keys.reduce((currentObject: HomogeneousObject<string>, currentKey: string, index: number) => {
+ return Object.assign(currentObject, {
+ [currentKey]: colorsArray[index]
+ });
+ }, {});
+ } else {
+ const keysWithColors = this.colors,
+ keys = Object.keys(keysWithColors);
+ this.orderedColors = keys.reduce((array: string[], key: string): string[] => [...array, keysWithColors[key]], []);
+ }
+ if (!this.width) {
+ this.width = this.graphContainer.clientWidth - margin.left - margin.right;
+ }
+ const xScale = this.isTimeGraph ? d3.scaleTime() : d3.scaleLinear();
+ const yScale = d3.scaleLinear();
+ const xScaleWithRange = this.reverseXRange ? xScale.range([this.width, 0]) : xScale.range([0, this.width]);
+ const yScaleWithRange = this.reverseYRange ? yScale.range([0, this.height]) : yScale.range([this.height, 0]);
+ this.xScale = xScaleWithRange;
+ this.yScale = yScaleWithRange;
+ }
+
+ protected buildSVG(): void {
+ const margin = this.margin;
+ this.host.html('');
+ this.svg = this.host.append('svg').attr('id', this.svgId).attr('width', this.graphContainer.clientWidth)
+ .attr('height', this.height + margin.top + margin.bottom).append('g')
+ .attr('transform', `translate(${margin.left},${margin.top})`);
+ }
+
+ protected populate(): void {}
+
+ protected setXScaleDomain(formattedData?: any): void {}
+
+ protected setYScaleDomain(formattedData?: any): void {}
+
+ /**
+ * 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.
+ * @param {number} ticksCount - optional parameter which sets number of ticks explicitly
+ */
+ protected drawXAxis(ticksCount?: number): void {
+ const axis = d3.axisBottom(this.xScale).tickFormat(this.xAxisTickFormatter).tickPadding(this.tickPadding);
+ if (ticksCount) {
+ axis.ticks(ticksCount);
+ }
+ this.xAxis = axis;
+ this.svg.append('g').attr('class', 'axis axis-x').attr('transform', `translate(0,${this.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.
+ * @param {number} ticksCount - optional parameter which sets number of ticks explicitly
+ */
+ protected drawYAxis(ticksCount?: number): void {
+ const axis = d3.axisLeft(this.yScale).tickFormat(this.yAxisTickFormatter).tickPadding(this.tickPadding);
+ if (ticksCount) {
+ axis.ticks(ticksCount);
+ }
+ this.yAxis = axis;
+ this.svg.append('g').attr('class', 'axis axis-y').call(this.yAxis).append('text');
+ };
+
+ /**
+ * Function that formats the labels for X axis ticks.
+ * Returns simple toString() conversion as default, can be overridden in ancestors.
+ * undefined value is returned for ticks to be skipped.
+ * @param tick
+ * @param {number} index
+ * @returns {string|undefined}
+ */
+ protected xAxisTickFormatter = (tick: any, index: number): string | undefined => {
+ return tick.toString();
+ };
+
+ /**
+ * Function that formats the labels for Y axis ticks.
+ * Returns simple toString() conversion as default, can be overridden in ancestors.
+ * undefined value is returned for ticks to be skipped.
+ * @param tick
+ * @param {number} index
+ * @returns {string|undefined}
+ */
+ protected yAxisTickFormatter = (tick: any, index: number): string | undefined => {
+ return tick.toString();
+ };
+
+ /**
+ * 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
+ */
+ protected handleRectMouseOver = (d: {data: any, [key: string]: 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.
+ */
+ protected handleRectMouseMove = (): void => {
+ this.setTooltipPosition();
+ };
+
+ /**
+ * The goal is to reset the tooltipInfo object so that the tooltip will be hidden.
+ */
+ protected handleRectMouseOut = (): void => {
+ this.tooltipInfo = {};
+ };
+
+ /**
+ * The goal is set the tooltip
+ * @param d
+ */
+ protected setTooltipDataFromChartData(d: {data: any, [key: string]: any}): void {
+ let {tick, ...data} = d.data;
+ let levelColors = this.colors;
+ this.tooltipInfo = {
+ data: Object.keys(levelColors).filter((key: string): boolean => data[key] > 0).map((key: string): object => Object.assign({}, {
+ color: this.colors[key],
+ label: this.labels[key],
+ value: data[key]
+ })),
+ title: tick
+ };
+ }
+
+ /**
+ * The goal of this function is to set the tooltip position regarding the d3.mouse event relative to the @graphContainer.
+ * Only if we have @tooltipInfo
+ */
+ protected setTooltipPosition(): void {
+ if (this.tooltipInfo.hasOwnProperty('data')) {
+ const tooltip = this.tooltip,
+ relativeMousePosition = d3.mouse(this.graphContainer),
+ absoluteMousePosition = d3.mouse(document.body),
+ absoluteMouseLeft = absoluteMousePosition[0],
+ top = relativeMousePosition[1] - (tooltip.offsetHeight / 2),
+ tooltipWidth = tooltip.offsetWidth,
+ windowSize = window.innerWidth;
+ let left = relativeMousePosition[0];
+ if (absoluteMouseLeft + tooltipWidth > windowSize) {
+ left = relativeMousePosition[0] - (tooltipWidth + 25);
+ }
+ this.tooltipOnTheLeft = left < relativeMousePosition[0];
+ this.tooltipPosition = {left, top};
+ }
+ };
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/classes/components/logs-table-component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/components/logs-table-component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/components/logs-table-component.spec.ts
deleted file mode 100644
index 05f80a7..0000000
--- a/ambari-logsearch/ambari-logsearch-web/src/app/classes/components/logs-table-component.spec.ts
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {LogsTableComponent} from './logs-table-component';
-
-describe('LogsTableComponent', () => {
- let component;
-
- beforeEach(() => {
- component = new LogsTableComponent();
- });
-
- describe('#isColumnDisplayed()', () => {
- const cases = [
- {
- name: 'v1',
- result: true,
- title: 'column is displayed'
- },
- {
- name: 'l1',
- result: false,
- title: 'column is not displayed'
- }
- ];
-
- beforeEach(() => {
- component.displayedColumns = [
- {
- label: 'l0',
- value: 'v0'
- },
- {
- label: 'l1',
- value: 'v1'
- }
- ];
- });
-
- cases.forEach(test => {
- it(test.title, () => {
- expect(component.isColumnDisplayed(test.name)).toEqual(test.result);
- });
- });
- });
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/classes/components/logs-table-component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/components/logs-table-component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/components/logs-table-component.ts
deleted file mode 100644
index 0b8866a..0000000
--- a/ambari-logsearch/ambari-logsearch-web/src/app/classes/components/logs-table-component.ts
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {OnChanges, SimpleChanges, Input} from '@angular/core';
-import {FormGroup} from '@angular/forms';
-import {ListItem} from '@app/classes/list-item';
-import {ServiceLog} from '@app/classes/models/service-log';
-import {AuditLog} from '@app/classes/models/audit-log';
-
-export class LogsTableComponent implements OnChanges {
-
- ngOnChanges(changes: SimpleChanges) {
- if (changes.hasOwnProperty('columns')) {
- this.displayedColumns = this.columns.filter((column: ListItem): boolean => column.isChecked);
- }
- }
-
- @Input()
- logs: ServiceLog[] | AuditLog[] = [];
-
- @Input()
- columns: ListItem[] = [];
-
- @Input()
- filtersForm: FormGroup;
-
- @Input()
- totalCount: number = 0;
-
- displayedColumns: ListItem[] = [];
-
- isColumnDisplayed(key: string): boolean {
- return this.displayedColumns.some((column: ListItem): boolean => column.value === key);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/classes/components/logs-table/logs-table-component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/components/logs-table/logs-table-component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/components/logs-table/logs-table-component.spec.ts
new file mode 100644
index 0000000..05f80a7
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/components/logs-table/logs-table-component.spec.ts
@@ -0,0 +1,61 @@
+/**
+ * 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 {LogsTableComponent} from './logs-table-component';
+
+describe('LogsTableComponent', () => {
+ let component;
+
+ beforeEach(() => {
+ component = new LogsTableComponent();
+ });
+
+ describe('#isColumnDisplayed()', () => {
+ const cases = [
+ {
+ name: 'v1',
+ result: true,
+ title: 'column is displayed'
+ },
+ {
+ name: 'l1',
+ result: false,
+ title: 'column is not displayed'
+ }
+ ];
+
+ beforeEach(() => {
+ component.displayedColumns = [
+ {
+ label: 'l0',
+ value: 'v0'
+ },
+ {
+ label: 'l1',
+ value: 'v1'
+ }
+ ];
+ });
+
+ cases.forEach(test => {
+ it(test.title, () => {
+ expect(component.isColumnDisplayed(test.name)).toEqual(test.result);
+ });
+ });
+ });
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/classes/components/logs-table/logs-table-component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/components/logs-table/logs-table-component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/components/logs-table/logs-table-component.ts
new file mode 100644
index 0000000..0b8866a
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/components/logs-table/logs-table-component.ts
@@ -0,0 +1,51 @@
+/**
+ * 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 {OnChanges, SimpleChanges, Input} from '@angular/core';
+import {FormGroup} from '@angular/forms';
+import {ListItem} from '@app/classes/list-item';
+import {ServiceLog} from '@app/classes/models/service-log';
+import {AuditLog} from '@app/classes/models/audit-log';
+
+export class LogsTableComponent implements OnChanges {
+
+ ngOnChanges(changes: SimpleChanges) {
+ if (changes.hasOwnProperty('columns')) {
+ this.displayedColumns = this.columns.filter((column: ListItem): boolean => column.isChecked);
+ }
+ }
+
+ @Input()
+ logs: ServiceLog[] | AuditLog[] = [];
+
+ @Input()
+ columns: ListItem[] = [];
+
+ @Input()
+ filtersForm: FormGroup;
+
+ @Input()
+ totalCount: number = 0;
+
+ displayedColumns: ListItem[] = [];
+
+ isColumnDisplayed(key: string): boolean {
+ return this.displayedColumns.some((column: ListItem): boolean => column.value === key);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/classes/graph.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/graph.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/graph.ts
new file mode 100644
index 0000000..3992828
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/graph.ts
@@ -0,0 +1,42 @@
+/**
+ * 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.
+ */
+
+export interface GraphPositionOptions {
+ top: number;
+ left: number;
+}
+
+export interface GraphMarginOptions extends GraphPositionOptions {
+ right: number;
+ bottom: number;
+}
+
+export interface GraphTooltipInfo {
+ data: object[];
+ title: string | number;
+}
+
+export interface LegendItem {
+ label: string;
+ color: string;
+}
+
+export interface GraphScaleItem {
+ tick: number;
+ [key: string]: number;
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/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
deleted file mode 100644
index 15fefde..0000000
--- a/ambari-logsearch/ambari-logsearch-web/src/app/classes/histogram-options.ts
+++ /dev/null
@@ -1,35 +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.
- */
-
-export interface HistogramMarginOptions {
- top: number;
- right: number;
- bottom: number;
- left: number;
-}
-
-export interface HistogramStyleOptions {
- margin?: HistogramMarginOptions;
- height?: number;
- tickPadding?: number;
- columnWidth?: {[key:string]: number};
-}
-
-export interface HistogramOptions extends HistogramStyleOptions {
- keysWithColors: {[key: string]: string};
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/tab.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/tab.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/tab.ts
index 05ea59d..718adf3 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/tab.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/models/tab.ts
@@ -16,19 +16,19 @@
* limitations under the License.
*/
+import {HomogeneousObject} from '@app/classes/object';
+
export interface Tab {
id: string;
- type: string;
isActive?: boolean;
isCloseable?: boolean;
label: string;
- appState?: object;
+ appState?: HomogeneousObject<any>;
}
export const initialTabs: Tab[] = [
{
id: 'serviceLogs',
- type: 'serviceLogs',
isActive: true,
label: 'common.serviceLogs',
appState: {
@@ -38,7 +38,6 @@ export const initialTabs: Tab[] = [
},
{
id: 'auditLogs',
- type: 'auditLogs',
isActive: false,
label: 'common.auditLogs',
appState: {
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/classes/object.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/object.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/object.ts
new file mode 100644
index 0000000..4d0c7f6
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/object.ts
@@ -0,0 +1,19 @@
+/**
+ * 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.
+ */
+
+export type HomogeneousObject<T> = {[key: string]: T};
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/audit-logs-query-params.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/audit-logs-query-params.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/audit-logs-query-params.ts
index 3b38a03..dc82b9e 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/audit-logs-query-params.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/audit-logs-query-params.ts
@@ -25,7 +25,17 @@ export const defaultParams = {
};
export class AuditLogsQueryParams extends QueryParams {
- constructor(options: AuditLogsQueryParams) {
+ clusters?: string;
+ mustBe?: string;
+ mustNot?: string;
+ includeQuery?: string;
+ excludeQuery?: string;
+ from?: string;
+ to?: string;
+}
+
+export class AuditLogsListQueryParams extends AuditLogsQueryParams {
+ constructor(options: AuditLogsListQueryParams) {
let finalParams = Object.assign({}, defaultParams, options);
const page = parseInt(finalParams.page),
pageSize = parseInt(finalParams.pageSize);
@@ -37,11 +47,4 @@ export class AuditLogsQueryParams extends QueryParams {
startIndex: string;
sortBy?: string;
sortType?: SortingType;
- clusters?: string;
- mustBe?: string;
- mustNot?: string;
- includeQuery?: string;
- excludeQuery?: string;
- from?: string;
- to?: string;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/audit-logs-top-resources-query-params.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/audit-logs-top-resources-query-params.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/audit-logs-top-resources-query-params.ts
new file mode 100644
index 0000000..0d12539
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/audit-logs-top-resources-query-params.ts
@@ -0,0 +1,23 @@
+/**
+ * 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 {AuditLogsQueryParams} from '@app/classes/queries/audit-logs-query-params';
+
+export class AuditLogsTopResourcesQueryParams extends AuditLogsQueryParams {
+ field: string;
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-query-params.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-query-params.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-query-params.ts
index 0700a98..60c3d5c 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-query-params.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/queries/service-logs-query-params.ts
@@ -16,9 +16,9 @@
* limitations under the License.
*/
-import {AuditLogsQueryParams} from '@app/classes/queries/audit-logs-query-params';
+import {AuditLogsListQueryParams} from '@app/classes/queries/audit-logs-query-params';
-export class ServiceLogsQueryParams extends AuditLogsQueryParams {
+export class ServiceLogsQueryParams extends AuditLogsListQueryParams {
level?: string;
file_name?: string;
bundle_id?: string;
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/classes/service-injector.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/classes/service-injector.ts b/ambari-logsearch/ambari-logsearch-web/src/app/classes/service-injector.ts
new file mode 100644
index 0000000..6db65cd
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/classes/service-injector.ts
@@ -0,0 +1,23 @@
+/**
+ * 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 {Injector} from '@angular/core';
+
+export class ServiceInjector {
+ static injector: Injector;
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/audit-logs-entries/audit-logs-entries.component.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/audit-logs-entries/audit-logs-entries.component.html b/ambari-logsearch/ambari-logsearch-web/src/app/components/audit-logs-entries/audit-logs-entries.component.html
new file mode 100644
index 0000000..3c5852a
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/audit-logs-entries/audit-logs-entries.component.html
@@ -0,0 +1,30 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<tabs [items]="tabs" (tabSwitched)="setActiveTab($event)"></tabs>
+<ng-container [ngSwitch]="activeTab">
+ <audit-logs-table *ngSwitchCase="'logs'" [totalCount]="totalCount" [logs]="logs" [columns]="columns"
+ [filtersForm]="filtersForm"></audit-logs-table>
+ <div *ngSwitchCase="'summary'" class="row">
+ <collapsible-panel title="{{'logs.topUsers' | translate: usersGraphTitleParams}}" class="col-md-6">
+ <horizontal-histogram [data]="topUsersGraphData"></horizontal-histogram>
+ </collapsible-panel>
+ <collapsible-panel title="{{'logs.topResources' | translate: resourcesGraphTitleParams}}" class="col-md-6">
+ <horizontal-histogram [data]="topResourcesGraphData"></horizontal-histogram>
+ </collapsible-panel>
+ </div>
+</ng-container>
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/audit-logs-entries/audit-logs-entries.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/audit-logs-entries/audit-logs-entries.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/audit-logs-entries/audit-logs-entries.component.spec.ts
new file mode 100644
index 0000000..260b383
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/audit-logs-entries/audit-logs-entries.component.spec.ts
@@ -0,0 +1,110 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core';
+import {async, ComponentFixture, TestBed} from '@angular/core/testing';
+import {TranslationModules} from '@app/test-config.spec';
+import {StoreModule} from '@ngrx/store';
+import {AuditLogsService, auditLogs} from '@app/services/storage/audit-logs.service';
+import {ServiceLogsService, serviceLogs} from '@app/services/storage/service-logs.service';
+import {AuditLogsFieldsService, auditLogsFields} from '@app/services/storage/audit-logs-fields.service';
+import {ServiceLogsFieldsService, serviceLogsFields} from '@app/services/storage/service-logs-fields.service';
+import {
+ ServiceLogsHistogramDataService, serviceLogsHistogramData
+} from '@app/services/storage/service-logs-histogram-data.service';
+import {AppSettingsService, appSettings} from '@app/services/storage/app-settings.service';
+import {AppStateService, appState} from '@app/services/storage/app-state.service';
+import {ClustersService, clusters} from '@app/services/storage/clusters.service';
+import {ComponentsService, components} from '@app/services/storage/components.service';
+import {HostsService, hosts} from '@app/services/storage/hosts.service';
+import {ServiceLogsTruncatedService, serviceLogsTruncated} from '@app/services/storage/service-logs-truncated.service';
+import {TabsService, tabs} from '@app/services/storage/tabs.service';
+import {TabsComponent} from '@app/components/tabs/tabs.component';
+import {LogsContainerService} from '@app/services/logs-container.service';
+import {HttpClientService} from '@app/services/http-client.service';
+
+import {AuditLogsEntriesComponent} from './audit-logs-entries.component';
+
+describe('AuditLogsEntriesComponent', () => {
+ let component: AuditLogsEntriesComponent;
+ let fixture: ComponentFixture<AuditLogsEntriesComponent>;
+
+ beforeEach(async(() => {
+ const httpClient = {
+ get: () => {
+ return {
+ subscribe: () => {
+ }
+ }
+ }
+ };
+ TestBed.configureTestingModule({
+ declarations: [
+ AuditLogsEntriesComponent,
+ TabsComponent
+ ],
+ imports: [
+ ...TranslationModules,
+ StoreModule.provideStore({
+ auditLogs,
+ serviceLogs,
+ auditLogsFields,
+ serviceLogsFields,
+ serviceLogsHistogramData,
+ appSettings,
+ appState,
+ clusters,
+ components,
+ hosts,
+ serviceLogsTruncated,
+ tabs
+ }),
+ ],
+ providers: [
+ LogsContainerService,
+ {
+ provide: HttpClientService,
+ useValue: httpClient
+ },
+ AuditLogsService,
+ ServiceLogsService,
+ AuditLogsFieldsService,
+ ServiceLogsFieldsService,
+ ServiceLogsHistogramDataService,
+ AppSettingsService,
+ AppStateService,
+ ClustersService,
+ ComponentsService,
+ HostsService,
+ ServiceLogsTruncatedService,
+ TabsService
+ ],
+ schemas: [CUSTOM_ELEMENTS_SCHEMA]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(AuditLogsEntriesComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create component', () => {
+ expect(component).toBeTruthy();
+ });
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/audit-logs-entries/audit-logs-entries.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/audit-logs-entries/audit-logs-entries.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/audit-logs-entries/audit-logs-entries.component.ts
new file mode 100644
index 0000000..44786f1
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/audit-logs-entries/audit-logs-entries.component.ts
@@ -0,0 +1,86 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import {Component, Input} from '@angular/core';
+import {FormGroup} from '@angular/forms';
+import {ListItem} from '@app/classes/list-item';
+import {HomogeneousObject} from '@app/classes/object';
+import {AuditLog} from '@app/classes/models/audit-log';
+import {Tab} from '@app/classes/models/tab';
+import {LogsContainerService} from '@app/services/logs-container.service';
+
+@Component({
+ selector: 'audit-logs-entries',
+ templateUrl: './audit-logs-entries.component.html'
+})
+export class AuditLogsEntriesComponent {
+
+ constructor(private logsContainer: LogsContainerService) {
+ }
+
+ @Input()
+ logs: AuditLog[] = [];
+
+ @Input()
+ columns: ListItem[] = [];
+
+ @Input()
+ filtersForm: FormGroup;
+
+ @Input()
+ totalCount: number = 0;
+
+ tabs: Tab[] = [
+ {
+ id: 'summary',
+ isActive: true,
+ label: 'common.summary'
+ },
+ {
+ id: 'logs',
+ isActive: false,
+ label: 'common.logs'
+ }
+ ];
+
+ /**
+ * Id of currently active tab (Summary or Logs)
+ * @type {string}
+ */
+ activeTab: string = 'summary';
+
+ readonly usersGraphTitleParams = {
+ number: this.logsContainer.topUsersCount
+ };
+
+ readonly resourcesGraphTitleParams = {
+ number: this.logsContainer.topResourcesCount
+ };
+
+ get topResourcesGraphData(): HomogeneousObject<HomogeneousObject<number>> {
+ return this.logsContainer.topResourcesGraphData;
+ }
+
+ get topUsersGraphData(): HomogeneousObject<HomogeneousObject<number>> {
+ return this.logsContainer.topUsersGraphData;
+ }
+
+ setActiveTab(tab: Tab): void {
+ this.activeTab = tab.id;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/audit-logs-table/audit-logs-table.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/audit-logs-table/audit-logs-table.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/audit-logs-table/audit-logs-table.component.ts
index 0e578ab..deca936 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/audit-logs-table/audit-logs-table.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/audit-logs-table/audit-logs-table.component.ts
@@ -18,7 +18,7 @@
import {Component} from '@angular/core';
import {ListItem} from '@app/classes/list-item';
-import {LogsTableComponent} from '@app/classes/components/logs-table-component';
+import {LogsTableComponent} from '@app/classes/components/logs-table/logs-table-component';
import {LogsContainerService} from '@app/services/logs-container.service';
@Component({
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/collapsible-panel/collapsible-panel.component.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/collapsible-panel/collapsible-panel.component.html b/ambari-logsearch/ambari-logsearch-web/src/app/components/collapsible-panel/collapsible-panel.component.html
index b73fa45..4d0bd39 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/collapsible-panel/collapsible-panel.component.html
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/collapsible-panel/collapsible-panel.component.html
@@ -22,6 +22,6 @@
</a>
</div>
<div [ngClass]="{'panel-body': true}" [attr.aria-collapsed]="isCollapsed">
- <ng-content></ng-content>
+ <ng-content></ng-content>
</div>
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/collapsible-panel/collapsible-panel.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/collapsible-panel/collapsible-panel.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/collapsible-panel/collapsible-panel.component.ts
index cbc0dd7..f82823a 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/collapsible-panel/collapsible-panel.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/collapsible-panel/collapsible-panel.component.ts
@@ -46,14 +46,14 @@ export class CollapsiblePanelComponent {
* @type {string}
*/
@Input()
- openTitle: string = 'common.hide';
+ openTitle?: string;
/**
* The panel's title fo the closed/collapsed state
* @type {string}
*/
@Input()
- collapsedTitle: string = 'common.show';
+ collapsedTitle?: string;
/**
* This property indicates the position of the caret. It can be 'left' or 'right'
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.spec.ts
index fc42e3c..9f2bb16 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.spec.ts
@@ -16,10 +16,11 @@
* limitations under the License.
*/
-import {NO_ERRORS_SCHEMA} from '@angular/core';
-import {async, ComponentFixture, TestBed} from '@angular/core/testing';
+import {NO_ERRORS_SCHEMA, Injector} from '@angular/core';
+import {async, ComponentFixture, TestBed, inject} from '@angular/core/testing';
import {TranslationModules} from '@app/test-config.spec';
import {StoreModule} from '@ngrx/store';
+import {ServiceInjector} from '@app/classes/service-injector';
import {AppSettingsService, appSettings} from '@app/services/storage/app-settings.service';
import {ClustersService, clusters} from '@app/services/storage/clusters.service';
import {ComponentsService, components} from '@app/services/storage/components.service';
@@ -99,11 +100,12 @@ describe('DropdownButtonComponent', () => {
.compileComponents();
}));
- beforeEach(() => {
+ beforeEach(inject([Injector], (injector: Injector) => {
+ ServiceInjector.injector = injector;
fixture = TestBed.createComponent(DropdownButtonComponent);
component = fixture.componentInstance;
fixture.detectChanges();
- });
+ }));
it('should create component', () => {
expect(component).toBeTruthy();
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.ts
index a8037d0..ead9e1a 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.ts
@@ -18,6 +18,7 @@
import {Component, Input} from '@angular/core';
import {ListItem} from '@app/classes/list-item';
+import {ServiceInjector} from '@app/classes/service-injector';
import {ComponentActionsService} from '@app/services/component-actions.service';
import {UtilsService} from '@app/services/utils.service';
@@ -28,7 +29,8 @@ import {UtilsService} from '@app/services/utils.service';
})
export class DropdownButtonComponent {
- constructor(protected actions: ComponentActionsService, protected utils: UtilsService) {
+ constructor(protected utils: UtilsService) {
+ this.actions = ServiceInjector.injector.get(ComponentActionsService);
}
@Input()
@@ -64,6 +66,8 @@ export class DropdownButtonComponent {
@Input()
isDropup: boolean = false;
+ private actions: ComponentActionsService;
+
protected selectedItems?: ListItem[] = [];
get selection(): ListItem[] {
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-button/filter-button.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-button/filter-button.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-button/filter-button.component.spec.ts
index 6a9aca5..082082c 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-button/filter-button.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-button/filter-button.component.spec.ts
@@ -16,10 +16,11 @@
* limitations under the License.
*/
-import {NO_ERRORS_SCHEMA} from '@angular/core';
-import {async, ComponentFixture, TestBed} from '@angular/core/testing';
+import {NO_ERRORS_SCHEMA, Injector} from '@angular/core';
+import {async, ComponentFixture, TestBed, inject} from '@angular/core/testing';
import {TranslationModules} from '@app/test-config.spec';
import {StoreModule} from '@ngrx/store';
+import {ServiceInjector} from '@app/classes/service-injector';
import {AppSettingsService, appSettings} from '@app/services/storage/app-settings.service';
import {ClustersService, clusters} from '@app/services/storage/clusters.service';
import {ComponentsService, components} from '@app/services/storage/components.service';
@@ -99,11 +100,12 @@ describe('FilterButtonComponent', () => {
.compileComponents();
}));
- beforeEach(() => {
+ beforeEach(inject([Injector], (injector: Injector) => {
+ ServiceInjector.injector = injector;
fixture = TestBed.createComponent(FilterButtonComponent);
component = fixture.componentInstance;
fixture.detectChanges();
- });
+ }));
it('should create component', () => {
expect(component).toBeTruthy();
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-button/filter-button.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-button/filter-button.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-button/filter-button.component.ts
index 2dcecd1..e1787a2 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-button/filter-button.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-button/filter-button.component.ts
@@ -16,10 +16,9 @@
* limitations under the License.
*/
-import {Component, Input, forwardRef} from '@angular/core';
+import {Component, forwardRef} from '@angular/core';
import {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms';
import {ListItem} from "@app/classes/list-item";
-import {ComponentActionsService} from '@app/services/component-actions.service';
import {UtilsService} from '@app/services/utils.service';
import {MenuButtonComponent} from '@app/components/menu-button/menu-button.component';
@@ -37,8 +36,8 @@ import {MenuButtonComponent} from '@app/components/menu-button/menu-button.compo
})
export class FilterButtonComponent extends MenuButtonComponent implements ControlValueAccessor {
- constructor(protected actions: ComponentActionsService, private utils: UtilsService) {
- super(actions);
+ constructor(private utils: UtilsService) {
+ super();
}
private selectedItems: ListItem[] = [];
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-dropdown/filter-dropdown.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-dropdown/filter-dropdown.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-dropdown/filter-dropdown.component.spec.ts
index 8293ba0..d085f3e 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-dropdown/filter-dropdown.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-dropdown/filter-dropdown.component.spec.ts
@@ -15,17 +15,20 @@
* limitations under the License.
*/
-import {NO_ERRORS_SCHEMA} from '@angular/core';
-import {async, ComponentFixture, TestBed} from '@angular/core/testing';
+import {NO_ERRORS_SCHEMA, Injector} from '@angular/core';
+import {async, ComponentFixture, TestBed, inject} from '@angular/core/testing';
import {TranslationModules} from '@app/test-config.spec';
import {StoreModule} from '@ngrx/store';
+import {ServiceInjector} from '@app/classes/service-injector';
import {AppSettingsService, appSettings} from '@app/services/storage/app-settings.service';
import {AppStateService, appState} from '@app/services/storage/app-state.service';
import {AuditLogsService, auditLogs} from '@app/services/storage/audit-logs.service';
import {AuditLogsFieldsService, auditLogsFields} from '@app/services/storage/audit-logs-fields.service';
import {ServiceLogsService, serviceLogs} from '@app/services/storage/service-logs.service';
import {ServiceLogsFieldsService, serviceLogsFields} from '@app/services/storage/service-logs-fields.service';
-import {ServiceLogsHistogramDataService, serviceLogsHistogramData} from '@app/services/storage/service-logs-histogram-data.service';
+import {
+ ServiceLogsHistogramDataService, serviceLogsHistogramData
+} from '@app/services/storage/service-logs-histogram-data.service';
import {ServiceLogsTruncatedService, serviceLogsTruncated} from '@app/services/storage/service-logs-truncated.service';
import {TabsService, tabs} from '@app/services/storage/tabs.service';
import {ClustersService, clusters} from '@app/services/storage/clusters.service';
@@ -118,11 +121,12 @@ describe('FilterDropdownComponent', () => {
.compileComponents();
}));
- beforeEach(() => {
+ beforeEach(inject([Injector], (injector: Injector) => {
+ ServiceInjector.injector = injector;
fixture = TestBed.createComponent(FilterDropdownComponent);
component = fixture.componentInstance;
fixture.detectChanges();
- });
+ }));
it('should create component', () => {
expect(component).toBeTruthy();
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-dropdown/filter-dropdown.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-dropdown/filter-dropdown.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-dropdown/filter-dropdown.component.ts
index d677d81..665386b 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-dropdown/filter-dropdown.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-dropdown/filter-dropdown.component.ts
@@ -17,7 +17,6 @@
import {Component, forwardRef} from '@angular/core';
import {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms';
-import {ComponentActionsService} from '@app/services/component-actions.service';
import {UtilsService} from '@app/services/utils.service';
import {DropdownButtonComponent} from '@app/components/dropdown-button/dropdown-button.component';
import {ListItem} from '@app/classes/list-item';
@@ -36,8 +35,8 @@ import {ListItem} from '@app/classes/list-item';
})
export class FilterDropdownComponent extends DropdownButtonComponent implements ControlValueAccessor {
- constructor(protected actions: ComponentActionsService, protected utils: UtilsService) {
- super(actions, utils);
+ constructor(protected utils: UtilsService) {
+ super(utils);
}
private onChange: (fn: any) => void;
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/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 480706a..cd372ec 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
@@ -23,6 +23,7 @@ import {Subject} from 'rxjs/Subject';
import 'rxjs/add/observable/from';
import {FilterCondition, SearchBoxParameter, SearchBoxParameterTriggered} from '@app/classes/filtering';
import {ListItem} from '@app/classes/list-item';
+import {HomogeneousObject} from '@app/classes/object';
import {LogsType} from '@app/classes/string';
import {LogsContainerService} from '@app/services/logs-container.service';
@@ -66,15 +67,15 @@ export class FiltersPanelComponent implements OnChanges {
return this.viewContainerRef.element.nativeElement;
}
- get filters(): {[key: string]: FilterCondition} {
+ get filters(): HomogeneousObject<FilterCondition> {
return this.logsContainer.filters;
}
/**
* Object with options for search box parameter values
- * @returns {[key: string]: ListItem[]}
+ * @returns HomogeneousObject<ListItem[]>
*/
- get options(): {[key: string]: ListItem[]} {
+ get options(): HomogeneousObject<ListItem[]> {
return Object.keys(this.filters).filter((key: string): boolean => {
const condition = this.filters[key];
return Boolean(condition.fieldName && condition.options);
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-legend-item/graph-legend-item.component.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-legend-item/graph-legend-item.component.html b/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-legend-item/graph-legend-item.component.html
new file mode 100644
index 0000000..e1ebb70
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-legend-item/graph-legend-item.component.html
@@ -0,0 +1,19 @@
+<!--
+ 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 class="color" [style.background-color]="color"></span>
+{{label}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-legend-item/graph-legend-item.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-legend-item/graph-legend-item.component.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-legend-item/graph-legend-item.component.less
new file mode 100644
index 0000000..dc20dca
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-legend-item/graph-legend-item.component.less
@@ -0,0 +1,27 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+:host {
+ padding-right: 1em;
+
+ .color {
+ border-radius: 100%;
+ display: inline-block;
+ height: .8em;
+ width: .8em;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-legend-item/graph-legend-item.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-legend-item/graph-legend-item.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-legend-item/graph-legend-item.component.spec.ts
new file mode 100644
index 0000000..f8a4beb
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-legend-item/graph-legend-item.component.spec.ts
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import {async, ComponentFixture, TestBed} from '@angular/core/testing';
+
+import {GraphLegendItemComponent} from './graph-legend-item.component';
+
+describe('GraphLegendItemComponent', () => {
+ let component: GraphLegendItemComponent;
+ let fixture: ComponentFixture<GraphLegendItemComponent>;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [GraphLegendItemComponent]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(GraphLegendItemComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create component', () => {
+ expect(component).toBeTruthy();
+ });
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-legend-item/graph-legend-item.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-legend-item/graph-legend-item.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-legend-item/graph-legend-item.component.ts
new file mode 100644
index 0000000..127eb8d
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-legend-item/graph-legend-item.component.ts
@@ -0,0 +1,37 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import {Component, Input} from '@angular/core';
+
+@Component({
+ selector: 'graph-legend-item',
+ templateUrl: './graph-legend-item.component.html',
+ styleUrls: ['./graph-legend-item.component.less']
+})
+export class GraphLegendItemComponent {
+
+ /**
+ * Color of the corresponding graph item. Should be string in any CSS allowable format.
+ * @type {string}
+ */
+ @Input()
+ color: string;
+
+ @Input()
+ label: string;
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-legend/graph-legend.component.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-legend/graph-legend.component.html b/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-legend/graph-legend.component.html
new file mode 100644
index 0000000..e756af6
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-legend/graph-legend.component.html
@@ -0,0 +1,19 @@
+<!--
+ 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.
+-->
+
+<graph-legend-item *ngFor="let item of items" label="{{item.label | translate}}"
+ color="{{item.color}}"></graph-legend-item>
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-legend/graph-legend.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-legend/graph-legend.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-legend/graph-legend.component.spec.ts
new file mode 100644
index 0000000..e297e14
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-legend/graph-legend.component.spec.ts
@@ -0,0 +1,50 @@
+/**
+ * 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 {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core';
+import {async, ComponentFixture, TestBed} from '@angular/core/testing';
+import {TranslationModules} from '@app/test-config.spec';
+import {GraphLegendItemComponent} from '@app/components/graph-legend-item/graph-legend-item.component';
+
+import {GraphLegendComponent} from './graph-legend.component';
+
+describe('GraphLegendComponent', () => {
+ let component: GraphLegendComponent;
+ let fixture: ComponentFixture<GraphLegendComponent>;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [
+ GraphLegendComponent,
+ GraphLegendItemComponent
+ ],
+ imports: TranslationModules,
+ schemas: [CUSTOM_ELEMENTS_SCHEMA]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(GraphLegendComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create component', () => {
+ expect(component).toBeTruthy();
+ });
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-legend/graph-legend.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-legend/graph-legend.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-legend/graph-legend.component.ts
new file mode 100644
index 0000000..e273d4e
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-legend/graph-legend.component.ts
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import {Component, Input} from '@angular/core';
+
+@Component({
+ selector: 'graph-legend',
+ templateUrl: './graph-legend.component.html'
+})
+export class GraphLegendComponent {
+
+ @Input()
+ items = [];
+
+ @Input()
+ labelClass: string = 'initial-color';
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-tooltip/graph-tooltip.component.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-tooltip/graph-tooltip.component.html b/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-tooltip/graph-tooltip.component.html
new file mode 100644
index 0000000..1711ffc
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-tooltip/graph-tooltip.component.html
@@ -0,0 +1,22 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<div class="title">{{title}}</div>
+<div *ngFor="let item of data" class="data-item">
+ <graph-legend-item label="{{item.label | translate}}" color="{{item.color}}"></graph-legend-item>
+ <span class="item-value">{{item.value}}</span>
+</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-tooltip/graph-tooltip.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-tooltip/graph-tooltip.component.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-tooltip/graph-tooltip.component.less
new file mode 100644
index 0000000..ec750e1
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-tooltip/graph-tooltip.component.less
@@ -0,0 +1,69 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+@import '../mixins';
+
+:host {
+ 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;
+ }
+
+ &::after {
+ .caret-mixin(6px, right, #fff);
+ right: -6px;
+ position: absolute;
+ top: calc(50% - 2px);
+ }
+ }
+
+ .title {
+ padding: 0 0 .1em 0;
+ text-align: center;
+ }
+
+ .data-item {
+ display: flex;
+ justify-content: space-between;
+
+ graph-legend-item {
+ flex-grow: 3;
+ }
+ }
+}
[23/50] [abbrv] ambari git commit: AMBARI-22736 Filter of Config
Versions should be case insensitive. (atkach)
Posted by rl...@apache.org.
AMBARI-22736 Filter of Config Versions should be case insensitive. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2b9a34b0
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2b9a34b0
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2b9a34b0
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 2b9a34b0fae681ed3d20459538f2c7711a314b51
Parents: cd5c1ca
Author: Andrii Tkach <at...@apache.org>
Authored: Fri Jan 5 18:26:14 2018 +0200
Committer: Andrii Tkach <at...@apache.org>
Committed: Fri Jan 5 18:26:14 2018 +0200
----------------------------------------------------------------------
ambari-web/app/assets/test/tests.js | 1 +
.../configs/config_versions_dropdown_view.js | 2 +-
.../config_versions_dropdown_view_test.js | 82 ++++++++++++++++++++
3 files changed, 84 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/2b9a34b0/ambari-web/app/assets/test/tests.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js
index 990c489..d20f531 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -373,6 +373,7 @@ var files = [
'test/views/main/admin/highAvailability/progress_view_test',
'test/views/common/host_progress_popup_body_view_test',
'test/views/common/configs/config_versions_control_view_test',
+ 'test/views/common/configs/config_versions_dropdown_view_test',
'test/views/common/configs/overriddenProperty_view_test',
'test/views/common/configs/service_config_view_test',
'test/views/common/configs/service_config_container_view_test',
http://git-wip-us.apache.org/repos/asf/ambari/blob/2b9a34b0/ambari-web/app/views/common/configs/config_versions_dropdown_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/config_versions_dropdown_view.js b/ambari-web/app/views/common/configs/config_versions_dropdown_view.js
index fc9cb02..917b52d 100644
--- a/ambari-web/app/views/common/configs/config_versions_dropdown_view.js
+++ b/ambari-web/app/views/common/configs/config_versions_dropdown_view.js
@@ -57,7 +57,7 @@ App.ConfigVersionsDropdownView = Em.View.extend({
return this.get('serviceVersions').filter((serviceVersion) => {
if (!this.get('filterValue').trim()) return true;
const searchString = Em.I18n.t('common.version') + ' ' + serviceVersion.get('version') + ' ' + serviceVersion.get('notes');
- return searchString.indexOf(this.get('filterValue').trim()) !== -1;
+ return searchString.toLowerCase().indexOf(this.get('filterValue').trim().toLowerCase()) !== -1;
});
}.property('serviceVersions.length', 'filterValue')
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/2b9a34b0/ambari-web/test/views/common/configs/config_versions_dropdown_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/config_versions_dropdown_view_test.js b/ambari-web/test/views/common/configs/config_versions_dropdown_view_test.js
new file mode 100644
index 0000000..59783c8
--- /dev/null
+++ b/ambari-web/test/views/common/configs/config_versions_dropdown_view_test.js
@@ -0,0 +1,82 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+require('views/common/configs/config_versions_dropdown_view');
+
+describe('App.ConfigVersionsDropdownView', function () {
+ var view;
+
+ beforeEach(function() {
+ view = App.ConfigVersionsDropdownView.create({
+ parentView: Em.Object.create({
+ compare: sinon.spy(),
+ switchPrimaryInCompare: sinon.spy()
+ })
+ });
+ });
+
+ describe('#mainClickAction', function() {
+ it('compare should be called', function() {
+ view.set('isSecondary', true);
+ view.mainClickAction({});
+ expect(view.get('parentView').compare.calledWith({})).to.be.true;
+ });
+
+ it('switchPrimaryInCompare should be called', function() {
+ view.set('isSecondary', false);
+ view.mainClickAction({});
+ expect(view.get('parentView').switchPrimaryInCompare.calledWith({})).to.be.true;
+ });
+ });
+
+ describe('#filteredServiceVersions', function() {
+ beforeEach(function() {
+ view.set('serviceVersions', [
+ Em.Object.create({
+ version: 1,
+ notes: 'lower case notes'
+ }),
+ Em.Object.create({
+ version: 2,
+ notes: 'UPPER CASE NOTES'
+ })
+ ]);
+ });
+
+ it('should show all versions when filter empty', function() {
+ view.set('filterValue', '');
+ expect(view.get('filteredServiceVersions').length).to.be.equal(2);
+ });
+
+ it('should show version 1 when filter "Version 1"', function() {
+ view.set('filterValue', 'Version 1');
+ expect(view.get('filteredServiceVersions').mapProperty('version')).to.be.eql([1]);
+ });
+
+ it('should show version 2 when filter "upper"', function() {
+ view.set('filterValue', 'upper');
+ expect(view.get('filteredServiceVersions').mapProperty('version')).to.be.eql([2]);
+ });
+
+ it('should show version 1 when filter "LOWER"', function() {
+ view.set('filterValue', 'LOWER');
+ expect(view.get('filteredServiceVersions').mapProperty('version')).to.be.eql([1]);
+ });
+ });
+});
[33/50] [abbrv] ambari git commit: AMBARI-22659. unable to proceed
with cluster install after component install fails. (mpapirkovskyy)
Posted by rl...@apache.org.
AMBARI-22659. unable to proceed with cluster install after component install fails. (mpapirkovskyy)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/72035ef3
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/72035ef3
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/72035ef3
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 72035ef381603119398c0b02e0eb71f1e497fe7d
Parents: bb21844
Author: Myroslav Papirkovskyi <mp...@hortonworks.com>
Authored: Fri Dec 15 18:13:49 2017 +0200
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Fri Jan 5 17:54:16 2018 -0500
----------------------------------------------------------------------
.../apache/ambari/server/orm/dao/HostVersionDAO.java | 15 +++++++++++++++
.../server/orm/entities/HostVersionEntity.java | 5 +++++
.../ambari/server/state/cluster/ClusterImpl.java | 10 ++++++++++
.../ambari/server/orm/dao/HostVersionDAOTest.java | 12 ++++++++++++
4 files changed, 42 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/72035ef3/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostVersionDAO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostVersionDAO.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostVersionDAO.java
index 158370f..feb4172 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostVersionDAO.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostVersionDAO.java
@@ -130,6 +130,21 @@ public class HostVersionDAO extends CrudDAO<HostVersionEntity, Long> {
}
/**
+ * Retrieve all of the cluster versions for the given cluster name.
+ *
+ * @param clusterName Cluster name
+ * @return Return all of the host versions that match the criteria.
+ */
+ @RequiresSession
+ public List<HostVersionEntity> findByCluster(String clusterName) {
+ final TypedQuery<HostVersionEntity> query = entityManagerProvider.get()
+ .createNamedQuery("findByCluster", HostVersionEntity.class);
+ query.setParameter("clusterName", clusterName);
+
+ return daoUtils.selectList(query);
+ }
+
+ /**
* Retrieve all of the host versions for the given cluster name, and state. <br/>
* @param clusterName Cluster name
* @param state repository version state
http://git-wip-us.apache.org/repos/asf/ambari/blob/72035ef3/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostVersionEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostVersionEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostVersionEntity.java
index 4a030af..2c61a3c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostVersionEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostVersionEntity.java
@@ -66,6 +66,11 @@ import org.apache.ambari.server.state.RepositoryVersionState;
query = "SELECT hostVersion FROM HostVersionEntity hostVersion JOIN hostVersion.hostEntity host JOIN host.clusterEntities clusters "
+ "WHERE clusters.clusterName=:clusterName AND hostVersion.state=:state"),
+ @NamedQuery(
+ name = "findByCluster",
+ query = "SELECT hostVersion FROM HostVersionEntity hostVersion JOIN hostVersion.hostEntity host JOIN host.clusterEntities clusters "
+ + "WHERE clusters.clusterName=:clusterName"),
+
@NamedQuery(name = "hostVersionByClusterHostnameAndState", query =
"SELECT hostVersion FROM HostVersionEntity hostVersion JOIN hostVersion.hostEntity host JOIN host.clusterEntities clusters " +
"WHERE clusters.clusterName=:clusterName AND hostVersion.hostEntity.hostName=:hostName AND hostVersion.state=:state"),
http://git-wip-us.apache.org/repos/asf/ambari/blob/72035ef3/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 c23b971..2266c62 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
@@ -1334,6 +1334,7 @@ public class ClusterImpl implements Cluster {
try {
refresh();
deleteAllServices();
+ resetHostVersions();
refresh(); // update one-to-many clusterServiceEntities
removeEntities();
@@ -1353,6 +1354,15 @@ public class ClusterImpl implements Cluster {
clusterDAO.removeByPK(clusterId);
}
+ private void resetHostVersions() {
+ for (HostVersionEntity hostVersionEntity : hostVersionDAO.findByCluster(getClusterName())) {
+ if (!hostVersionEntity.getState().equals(RepositoryVersionState.NOT_REQUIRED)) {
+ hostVersionEntity.setState(RepositoryVersionState.NOT_REQUIRED);
+ hostVersionDAO.merge(hostVersionEntity);
+ }
+ }
+ }
+
@Override
public ServiceConfigVersionResponse addDesiredConfig(String user, Set<Config> configs) {
return addDesiredConfig(user, configs, null);
http://git-wip-us.apache.org/repos/asf/ambari/blob/72035ef3/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/HostVersionDAOTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/HostVersionDAOTest.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/HostVersionDAOTest.java
index bb077d6..88f42d3 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/HostVersionDAOTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/HostVersionDAOTest.java
@@ -247,6 +247,18 @@ public class HostVersionDAOTest {
}
/**
+ * Test the {@link HostVersionDAO#findByCluster(String)} method.
+ */
+ @Test
+ public void testFindByCluster() {
+ Assert.assertEquals(3, hostVersionDAO.findByCluster("test_cluster1").size());
+
+ addMoreVersions();
+
+ Assert.assertEquals(9, hostVersionDAO.findByCluster("test_cluster1").size());
+ }
+
+ /**
* Test the {@link HostVersionDAO#findByClusterHostAndState(String, String, org.apache.ambari.server.state.RepositoryVersionState)} method.
*/
@Test
[50/50] [abbrv] ambari git commit: Merge branch 'trunk' into
branch-feature-AMBARI-20859
Posted by rl...@apache.org.
Merge branch 'trunk' into branch-feature-AMBARI-20859
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7ff4a96c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7ff4a96c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7ff4a96c
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 7ff4a96ca958e0d4b2a41fea5ad7754c5ac4712c
Parents: b74b05c 2b9a34b
Author: Robert Levas <rl...@hortonworks.com>
Authored: Fri Jan 5 18:03:38 2018 -0500
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Fri Jan 5 18:03:38 2018 -0500
----------------------------------------------------------------------
.../main/resources/ui/admin-web/app/index.html | 2 +
.../app/scripts/controllers/SideNavCtrl.js | 6 +-
.../controllers/ambariViews/ViewsListCtrl.js | 184 ++-
.../remoteClusters/RemoteClustersListCtrl.js | 109 +-
.../stackVersions/StackVersionsEditCtrl.js | 2 +-
.../stackVersions/StackVersionsListCtrl.js | 191 ++-
.../userManagement/GroupsListCtrl.js | 86 +-
.../controllers/userManagement/UsersListCtrl.js | 132 +-
.../app/scripts/directives/comboSearch.js | 66 +-
.../admin-web/app/scripts/services/Cluster.js | 3 +-
.../admin-web/app/scripts/services/Filters.js | 84 ++
.../ui/admin-web/app/scripts/services/Group.js | 11 +-
.../app/scripts/services/Pagination.js | 59 +
.../app/scripts/services/RemoteCluster.js | 10 +-
.../ui/admin-web/app/scripts/services/Stack.js | 34 +-
.../ui/admin-web/app/scripts/services/User.js | 13 +-
.../ui/admin-web/app/styles/user-management.css | 4 +
.../app/views/ambariViews/viewsList.html | 5 +-
.../app/views/remoteClusters/list.html | 33 +-
.../admin-web/app/views/stackVersions/list.html | 34 +-
.../app/views/userManagement/groupsList.html | 51 +-
.../app/views/userManagement/usersList.html | 61 +-
.../ambariViews/ViewsListCtrl_test.js | 66 +-
.../userManagement/GroupsListCtrl_test.js | 100 +-
.../userManagement/UsersListCtrl_test.js | 306 -----
.../test/unit/directives/comboSearch_test.js | 200 +++-
.../test/unit/services/Filters_test.js | 161 +++
.../test/unit/services/Pagination_test.js | 72 ++
.../src/main/python/ambari_agent/ActionQueue.py | 21 +-
.../python/ambari_agent/CommandStatusDict.py | 2 +-
.../src/main/python/ambari_agent/Controller.py | 25 +-
.../ambari_agent/CustomServiceOrchestrator.py | 4 +-
.../src/main/python/ambari_agent/DataCleaner.py | 4 +-
.../src/main/python/ambari_agent/Heartbeat.py | 17 +-
.../src/main/python/ambari_agent/LiveStatus.py | 3 +-
.../main/python/ambari_agent/PythonExecutor.py | 15 +-
.../ambari_agent/PythonReflectiveExecutor.py | 3 +-
.../main/python/ambari_agent/RecoveryManager.py | 17 +-
.../ambari_agent/StatusCommandsExecutor.py | 3 +-
.../python/ambari_agent/alerts/ams_alert.py | 8 +-
.../python/ambari_agent/alerts/metric_alert.py | 3 +-
.../src/main/python/ambari_agent/security.py | 8 +-
.../test/python/ambari_agent/TestController.py | 8 +-
.../ambari_agent/examples/ControllerTester.py | 6 +-
ambari-infra/ambari-infra-manager-it/pom.xml | 155 +++
.../org/apache/ambari/infra/InfraClient.java | 93 ++
.../ambari/infra/InfraManagerStories.java | 108 ++
.../ambari/infra/OffsetDateTimeConverter.java | 39 +
.../ambari/infra/steps/AbstractInfraSteps.java | 223 ++++
.../ambari/infra/steps/ExportJobsSteps.java | 148 +++
.../src/test/resources/log4j.properties | 16 +
.../resources/stories/infra_api_tests.story | 38 +
.../ambari-infra-manager/docker/Dockerfile | 6 +-
.../docker/docker-compose.yml | 81 ++
.../docker/infra-manager-docker-compose.sh | 107 ++
ambari-infra/ambari-infra-manager/pom.xml | 5 +
.../ambari/infra/job/CloseableIterator.java | 24 +
.../apache/ambari/infra/job/JobProperties.java | 47 +
.../apache/ambari/infra/job/JobPropertyMap.java | 57 +
.../apache/ambari/infra/job/ObjectSource.java | 23 +
.../apache/ambari/infra/job/PropertyMap.java | 25 +
.../apache/ambari/infra/job/SolrDAOBase.java | 65 +
.../infra/job/archive/AbstractFileAction.java | 38 +
.../infra/job/archive/CompositeFileAction.java | 3 +-
.../ambari/infra/job/archive/Document.java | 3 +-
.../archive/DocumentArchivingConfiguration.java | 142 +++
.../archive/DocumentExportConfiguration.java | 118 --
.../job/archive/DocumentExportJobListener.java | 35 -
.../job/archive/DocumentExportProperties.java | 173 ++-
.../job/archive/DocumentExportPropertyMap.java | 44 +
.../job/archive/DocumentExportStepListener.java | 47 -
.../infra/job/archive/DocumentItemReader.java | 8 +-
.../infra/job/archive/DocumentIterator.java | 25 -
.../infra/job/archive/DocumentSource.java | 24 -
.../ambari/infra/job/archive/DocumentWiper.java | 23 +
.../job/archive/FileNameSuffixFormatter.java | 56 +
.../infra/job/archive/ItemWriterListener.java | 23 +
.../job/archive/LocalDocumentItemWriter.java | 23 +-
.../job/archive/LocalItemWriterListener.java | 36 +
.../ambari/infra/job/archive/S3Properties.java | 64 +-
.../ambari/infra/job/archive/S3Uploader.java | 25 +-
.../ambari/infra/job/archive/SolrDAO.java | 68 ++
.../infra/job/archive/SolrDocumentIterator.java | 6 +-
.../infra/job/archive/SolrDocumentSource.java | 57 +-
.../job/archive/SolrParametrizedString.java | 77 ++
.../infra/job/archive/SolrProperties.java | 117 ++
.../infra/job/archive/SolrQueryBuilder.java | 59 +-
.../infra/job/archive/SolrQueryProperties.java | 40 +-
.../infra/job/archive/TarGzCompressor.java | 4 +-
.../infra/job/archive/WriteCompletedEvent.java | 45 +
.../deleting/DocumentDeletingConfiguration.java | 90 ++
.../deleting/DocumentDeletingProperties.java | 77 ++
.../deleting/DocumentDeletingPropertyMap.java | 44 +
.../job/deleting/DocumentWiperTasklet.java | 49 +
.../src/main/resources/infra-manager.properties | 52 +-
.../ambari/infra/job/JobPropertiesTest.java | 56 +
.../job/archive/DocumentItemReaderTest.java | 8 +-
.../archive/FileNameSuffixFormatterTest.java | 58 +
.../archive/LocalDocumentItemWriterTest.java | 27 +-
.../job/archive/SolrParametrizedStringTest.java | 57 +
.../infra/job/archive/SolrPropertiesTest.java | 54 +
.../infra/job/archive/SolrQueryBuilderTest.java | 55 +-
.../job/archive/SolrQueryPropertiesTest.java | 54 +
ambari-infra/pom.xml | 5 +-
.../package/rpm/logfeeder/postremove.sh~HEAD | 21 +
.../package/rpm/logfeeder/postremove.sh~trunk | 21 +
.../main/package/rpm/portal/postremove.sh~HEAD | 21 +
.../main/package/rpm/portal/postremove.sh~trunk | 21 +
.../src/main/scripts/logfeeder-env.sh~HEAD | 40 +
.../src/main/scripts/logfeeder-env.sh~trunk | 40 +
.../src/main/scripts/logsearch-env.sh~HEAD | 40 +
.../src/main/scripts/logsearch-env.sh~trunk | 40 +
.../ambari-logsearch-web/package.json | 2 +
.../ambari-logsearch-web/src/app/app.module.ts | 15 +
.../components/graph/graph.component.less | 48 +
.../classes/components/graph/graph.component.ts | 355 ++++++
.../components/logs-table-component.spec.ts | 61 -
.../classes/components/logs-table-component.ts | 51 -
.../logs-table/logs-table-component.spec.ts | 61 +
.../logs-table/logs-table-component.ts | 51 +
.../src/app/classes/graph.ts | 42 +
.../src/app/classes/histogram-options.ts | 35 -
.../src/app/classes/models/tab.ts | 7 +-
.../src/app/classes/object.ts | 19 +
.../classes/queries/audit-logs-query-params.ts | 19 +-
.../audit-logs-top-resources-query-params.ts | 23 +
.../queries/service-logs-query-params.ts | 4 +-
.../src/app/classes/service-injector.ts | 23 +
.../audit-logs-entries.component.html | 30 +
.../audit-logs-entries.component.spec.ts | 110 ++
.../audit-logs-entries.component.ts | 86 ++
.../audit-logs-table.component.ts | 2 +-
.../collapsible-panel.component.html | 2 +-
.../collapsible-panel.component.ts | 4 +-
.../dropdown-button.component.spec.ts | 10 +-
.../dropdown-button.component.ts | 6 +-
.../filter-button.component.spec.ts | 10 +-
.../filter-button/filter-button.component.ts | 7 +-
.../filter-dropdown.component.spec.ts | 14 +-
.../filter-dropdown.component.ts | 5 +-
.../filters-panel/filters-panel.component.ts | 7 +-
.../graph-legend-item.component.html | 19 +
.../graph-legend-item.component.less | 27 +
.../graph-legend-item.component.spec.ts | 42 +
.../graph-legend-item.component.ts | 37 +
.../graph-legend/graph-legend.component.html | 19 +
.../graph-legend/graph-legend.component.spec.ts | 50 +
.../graph-legend/graph-legend.component.ts | 32 +
.../graph-tooltip/graph-tooltip.component.html | 22 +
.../graph-tooltip/graph-tooltip.component.less | 69 ++
.../graph-tooltip.component.spec.ts | 50 +
.../graph-tooltip/graph-tooltip.component.ts | 36 +
.../horizontal-histogram.component.html | 22 +
.../horizontal-histogram.component.less | 22 +
.../horizontal-histogram.component.spec.ts | 61 +
.../horizontal-histogram.component.ts | 114 ++
.../logs-container.component.html | 6 +-
.../logs-container/logs-container.component.ts | 10 +-
.../menu-button/menu-button.component.spec.ts | 10 +-
.../menu-button/menu-button.component.ts | 6 +-
.../search-box/search-box.component.ts | 3 +-
.../service-logs-table.component.ts | 2 +-
.../app/components/tabs/tabs.component.spec.ts | 4 -
.../src/app/components/tabs/tabs.component.ts | 1 +
.../time-histogram.component.html | 32 +-
.../time-histogram.component.less | 145 +--
.../time-histogram.component.spec.ts | 104 +-
.../time-histogram/time-histogram.component.ts | 314 +----
.../components/top-menu/top-menu.component.ts | 3 +-
.../src/app/components/variables.less | 3 +
.../ambari-logsearch-web/src/app/mock-data.ts | 142 ++-
.../app/services/component-actions.service.ts | 1 -
.../src/app/services/http-client.service.ts | 39 +-
.../app/services/logs-container.service.spec.ts | 4 +-
.../src/app/services/logs-container.service.ts | 85 +-
.../src/app/services/utils.service.spec.ts | 117 ++
.../src/app/services/utils.service.ts | 12 +
.../src/assets/i18n/en.json | 6 +-
.../ambari-logsearch-web/src/styles.less | 4 +
.../src/vendor/css/bootstrap-logsearch.min.css | 2 +-
.../src/vendor/js/bootstrap-logsearch.min.js | 2 +-
ambari-logsearch/ambari-logsearch-web/yarn.lock | 10 +
.../ambari/server/agent/HeartBeatHandler.java | 122 +-
.../ambari/server/agent/HeartbeatProcessor.java | 33 +-
.../server/api/services/AmbariMetaInfo.java | 126 +-
.../server/configuration/Configuration.java | 1 -
.../ambari/server/controller/AmbariServer.java | 2 +-
.../controller/DeleteIdentityHandler.java | 5 +-
.../server/controller/KerberosHelper.java | 2 +-
.../server/controller/KerberosHelperImpl.java | 1129 +++++++++---------
.../HostKerberosIdentityResourceProvider.java | 15 +-
.../internal/RepositoryResourceProvider.java | 14 +-
.../internal/UpgradeResourceProvider.java | 27 +-
.../ambari/server/orm/DBAccessorImpl.java | 3 +
.../server/orm/dao/KerberosKeytabDAO.java | 154 ++-
.../orm/dao/KerberosKeytabPrincipalDAO.java | 309 +++++
.../server/orm/dao/KerberosPrincipalDAO.java | 9 -
.../orm/dao/KerberosPrincipalHostDAO.java | 252 ----
.../entities/HostGroupComponentEntityPK.java | 4 +-
.../orm/entities/KerberosKeytabEntity.java | 152 ++-
.../entities/KerberosKeytabPrincipalEntity.java | 236 ++++
.../KerberosKeytabServiceMappingEntity.java | 88 ++
.../orm/entities/KerberosPrincipalEntity.java | 25 -
.../entities/KerberosPrincipalHostEntity.java | 213 ----
.../entities/KerberosPrincipalHostEntityPK.java | 115 --
.../orm/entities/RepositoryVersionEntity.java | 5 +
.../AbstractPrepareKerberosServerAction.java | 31 +-
.../kerberos/CleanupServerAction.java | 6 +-
.../ConfigureAmbariIdentitiesServerAction.java | 141 ++-
.../kerberos/CreateKeytabFilesServerAction.java | 112 +-
.../kerberos/CreatePrincipalsServerAction.java | 47 +-
.../kerberos/DestroyPrincipalsServerAction.java | 62 +-
.../kerberos/FinalizeKerberosServerAction.java | 24 +-
.../kerberos/KerberosServerAction.java | 291 ++---
.../PrepareEnableKerberosServerAction.java | 16 +-
.../PrepareKerberosIdentitiesServerAction.java | 9 -
.../stageutils/KerberosKeytabController.java | 213 ++++
.../stageutils/ResolvedKerberosKeytab.java | 117 +-
.../stageutils/ResolvedKerberosPrincipal.java | 169 +++
.../upgrades/PreconfigureKerberosAction.java | 12 +-
.../ambari/server/state/UpgradeContext.java | 14 +
.../state/alert/AlertDefinitionFactory.java | 31 +-
.../ambari/server/state/alert/ScriptSource.java | 4 +
.../server/state/cluster/ClustersImpl.java | 8 +-
.../upgrade/AbstractFinalUpgradeCatalog.java | 58 +
.../server/upgrade/FinalUpgradeCatalog.java | 28 +-
.../server/upgrade/SchemaUpgradeHelper.java | 1 +
.../server/upgrade/UpdateAlertScriptPaths.java | 48 +
.../server/upgrade/UpgradeCatalog252.java | 7 +-
.../server/upgrade/UpgradeCatalog260.java | 3 +
.../main/resources/Ambari-DDL-Derby-CREATE.sql | 34 +-
.../main/resources/Ambari-DDL-MySQL-CREATE.sql | 33 +-
.../main/resources/Ambari-DDL-Oracle-CREATE.sql | 35 +-
.../resources/Ambari-DDL-Postgres-CREATE.sql | 35 +-
.../resources/Ambari-DDL-SQLAnywhere-CREATE.sql | 33 +-
.../resources/Ambari-DDL-SQLServer-CREATE.sql | 33 +-
.../src/main/resources/META-INF/persistence.xml | 3 +-
.../HIVE/0.12.0.2.0/configuration/hive-env.xml | 1 +
.../HIVE/2.1.0.3.0/configuration/hive-env.xml | 1 +
.../KAFKA/0.8.1/package/scripts/params.py | 6 +-
.../OOZIE/4.0.0.2.0/configuration/oozie-env.xml | 1 +
.../OOZIE/4.2.0.3.0/configuration/oozie-env.xml | 1 +
.../RANGER/0.4.0/package/scripts/params.py | 4 +-
.../0.4.0/package/scripts/ranger_admin.py | 10 +-
.../0.4.0/package/scripts/setup_ranger_xml.py | 19 +-
.../RANGER_KMS/0.5.0.2.3/package/scripts/kms.py | 13 +-
.../0.5.0.2.3/package/scripts/kms_server.py | 6 +-
.../SPARK/1.2.1/package/scripts/livy_service.py | 2 -
.../2.0.0/package/scripts/livy2_service.py | 2 -
.../SUPERSET/0.15.0/metainfo.xml | 2 +-
.../configuration-mapred/mapred-site.xml | 2 +-
.../ZEPPELIN/0.7.0/package/scripts/master.py | 11 +-
.../custom_actions/scripts/install_packages.py | 38 +-
.../HDP/2.0.6/properties/stack_packages.json | 122 +-
.../2.2/services/TEZ/configuration/tez-site.xml | 4 +-
.../YARN/configuration-mapred/mapred-site.xml | 2 +-
.../services/HIVE/configuration/hive-env.xml | 1 +
.../services/OOZIE/configuration/oozie-env.xml | 1 +
.../stacks/HDP/2.3/services/stack_advisor.py | 9 +-
.../stacks/HDP/2.6/upgrades/config-upgrade.xml | 6 +-
.../server/agent/TestHeartbeatHandler.java | 79 +-
.../server/api/services/AmbariMetaInfoTest.java | 91 +-
.../server/controller/KerberosHelperTest.java | 47 +-
...ostKerberosIdentityResourceProviderTest.java | 15 +-
.../RepositoryResourceProviderTest.java | 2 +
.../RepositoryVersionResourceProviderTest.java | 5 +-
.../VersionDefinitionResourceProviderTest.java | 2 +-
.../apache/ambari/server/orm/db/DDLTests.java | 2 +-
...nfigureAmbariIdentitiesServerActionTest.java | 36 +-
.../FinalizeKerberosServerActionTest.java | 5 +-
.../kerberos/KerberosServerActionTest.java | 26 +-
.../PreconfigureKerberosActionTest.java | 16 +-
.../state/stack/ConfigUpgradeValidityTest.java | 41 +-
.../server/upgrade/UpgradeCatalog260Test.java | 1 +
.../src/test/python/TestAmbariServer.py | 4 +-
.../stacks/2.3/common/test_stack_advisor.py | 17 +
.../2.6/KAFKA/test_kafka_broker_other_sasl.py | 16 +
.../stacks/2.6/RANGER/test_ranger_admin.py | 10 +-
.../2.6/configs/secure_kafka_sasl_ssl.json | 632 ++++++++++
ambari-web/app/assets/test/tests.js | 1 +
ambari-web/app/controllers/installer.js | 44 +-
.../hawq/addStandby/step3_controller.js | 3 +-
.../main/admin/kerberos/wizard_controller.js | 2 +-
.../main/admin/stack_and_upgrade_controller.js | 3 +-
.../main/host/bulk_operations_controller.js | 369 +++---
ambari-web/app/controllers/main/host/details.js | 38 +-
.../app/controllers/main/service/info/metric.js | 13 +
ambari-web/app/controllers/main/service/item.js | 29 +-
.../app/controllers/wizard/step3_controller.js | 2 +-
.../app/controllers/wizard/step6_controller.js | 12 -
.../app/controllers/wizard/step8_controller.js | 2 +-
ambari-web/app/messages.js | 52 +-
.../app/mixins/common/widgets/widget_mixin.js | 1 +
.../configs/component_actions_by_configs.js | 4 +-
ambari-web/app/models/host_component.js | 6 +
ambari-web/app/routes/create_widget.js | 3 +
ambari-web/app/styles/application.less | 44 +-
ambari-web/app/styles/common.less | 1 +
.../app/styles/config_versions_control.less | 10 +-
.../app/styles/enhanced_service_dashboard.less | 31 +-
ambari-web/app/styles/hosts.less | 5 +
ambari-web/app/styles/modal_popups.less | 19 +-
.../app/styles/theme/bootstrap-ambari.css | 7 +-
ambari-web/app/styles/wizard.less | 20 +
ambari-web/app/templates/application.hbs | 6 +-
.../common/assign_master_components.hbs | 24 +-
.../common/configs/config_versions_dropdown.hbs | 2 +-
.../service_config_layout_tab_compare.hbs | 6 +-
.../templates/common/host_progress_popup.hbs | 115 +-
.../modal_popups/widget_browser_footer.hbs | 1 -
.../templates/common/widget/gauge_widget.hbs | 2 +-
.../templates/common/widget/graph_widget.hbs | 2 +-
.../templates/common/widget/number_widget.hbs | 2 +-
.../templates/common/widget/template_widget.hbs | 2 +-
.../main/host/bulk_add_delete_confirm_popup.hbs | 40 +
.../main/host/delete_hosts_dry_run_popup.hbs | 32 -
.../templates/main/host/delete_hosts_popup.hbs | 21 +-
.../main/host/delete_hosts_result_popup.hbs | 4 +-
.../app/templates/main/service/menu_item.hbs | 6 +-
ambari-web/app/templates/wizard/step3.hbs | 12 +-
ambari-web/app/templates/wizard/step6.hbs | 30 +-
.../wizard/step6/step6_issues_popup.hbs | 43 -
ambari-web/app/utils/ajax/ajax.js | 36 +-
.../common/assign_master_components_view.js | 4 +-
.../configs/config_versions_dropdown_view.js | 13 +-
.../service_config_layout_tab_compare_view.js | 10 +
.../configs/widgets/combo_config_widget_view.js | 8 +
ambari-web/app/views/common/controls_view.js | 2 +-
.../common/form/manage_credentials_form_view.js | 3 +-
.../common/host_progress_popup_body_view.js | 12 +
.../common/modal_popups/confirmation_popup.js | 11 +-
ambari-web/app/views/main/host/details.js | 4 +
ambari-web/app/views/main/service/item.js | 4 +
.../main/service/widgets/create/wizard_view.js | 2 +-
.../kerberos/kerberos_wizard_controler_test.js | 8 +-
ambari-web/test/utils/date/timezone_test.js | 2 +-
.../config_versions_dropdown_view_test.js | 82 ++
docs/src/site/site.xml | 14 +-
338 files changed, 10835 insertions(+), 5064 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/7ff4a96c/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsEditCtrl.js
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/7ff4a96c/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/User.js
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/7ff4a96c/ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/logfeeder/postremove.sh~HEAD
----------------------------------------------------------------------
diff --cc ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/logfeeder/postremove.sh~HEAD
index 0000000,0000000..5f1c623
new file mode 100755
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/logfeeder/postremove.sh~HEAD
@@@ -1,0 -1,0 +1,21 @@@
++#!/bin/bash
++# 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
++
++LOGFEEDER_SCRIPT_LINK_NAME="/usr/bin/logfeeder"
++LOGFEEDER_CONF_DIR_LINK="/etc/ambari-logsearch-logfeeder/conf"
++
++rm -f $LOGFEEDER_SCRIPT_LINK_NAME
++rm -f $LOGFEEDER_CONF_DIR_LINK
http://git-wip-us.apache.org/repos/asf/ambari/blob/7ff4a96c/ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/logfeeder/postremove.sh~trunk
----------------------------------------------------------------------
diff --cc ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/logfeeder/postremove.sh~trunk
index 0000000,0000000..5f1c623
new file mode 100755
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/logfeeder/postremove.sh~trunk
@@@ -1,0 -1,0 +1,21 @@@
++#!/bin/bash
++# 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
++
++LOGFEEDER_SCRIPT_LINK_NAME="/usr/bin/logfeeder"
++LOGFEEDER_CONF_DIR_LINK="/etc/ambari-logsearch-logfeeder/conf"
++
++rm -f $LOGFEEDER_SCRIPT_LINK_NAME
++rm -f $LOGFEEDER_CONF_DIR_LINK
http://git-wip-us.apache.org/repos/asf/ambari/blob/7ff4a96c/ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/portal/postremove.sh~HEAD
----------------------------------------------------------------------
diff --cc ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/portal/postremove.sh~HEAD
index 0000000,0000000..8de05c1
new file mode 100644
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/portal/postremove.sh~HEAD
@@@ -1,0 -1,0 +1,21 @@@
++#!/bin/bash
++# 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
++
++LOGSEARCH_SCRIPT_LINK_NAME="/usr/bin/logsearch"
++LOGSEARCH_CONF_DIR_LINK="/etc/ambari-logsearch-portal/conf"
++
++rm -f $LOGSEARCH_SCRIPT_LINK_NAME
++rm -f $LOGSEARCH_CONF_DIR_LINK
http://git-wip-us.apache.org/repos/asf/ambari/blob/7ff4a96c/ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/portal/postremove.sh~trunk
----------------------------------------------------------------------
diff --cc ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/portal/postremove.sh~trunk
index 0000000,0000000..8de05c1
new file mode 100644
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-assembly/src/main/package/rpm/portal/postremove.sh~trunk
@@@ -1,0 -1,0 +1,21 @@@
++#!/bin/bash
++# 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
++
++LOGSEARCH_SCRIPT_LINK_NAME="/usr/bin/logsearch"
++LOGSEARCH_CONF_DIR_LINK="/etc/ambari-logsearch-portal/conf"
++
++rm -f $LOGSEARCH_SCRIPT_LINK_NAME
++rm -f $LOGSEARCH_CONF_DIR_LINK
http://git-wip-us.apache.org/repos/asf/ambari/blob/7ff4a96c/ambari-logsearch/ambari-logsearch-logfeeder/src/main/scripts/logfeeder-env.sh~HEAD
----------------------------------------------------------------------
diff --cc ambari-logsearch/ambari-logsearch-logfeeder/src/main/scripts/logfeeder-env.sh~HEAD
index 0000000,0000000..37e9930
new file mode 100755
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/scripts/logfeeder-env.sh~HEAD
@@@ -1,0 -1,0 +1,40 @@@
++#!/bin/bash
++# 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.
++
++# Log Feeder extra options
++export LOGFEEDER_JAVA_OPTS=${LOGFEEDER_JAVA_OPTS:-""}
++
++# Log Feeder debug options
++# export LOGFEEDER_DEBUG=true
++# exoprt LOGFEEDER_DEBUG_SUSPEND=n
++export LOGFEEDER_DEBUG_PORT=5006
++
++# Log Feeder memory
++# export LOGFEEDER_JAVA_MEM="-Xmx512m"
++
++# export LOG_PATH=/var/log/ambari-logsearch-logfeeder/
++# export LOG_FILE=logfeeder.log
++
++# Pid file of the application
++# export LOGFEEDER_PID_DIR=/var/run/ambari-logsearch-logfeeder
++# export LOGFEEDER_PID_FILE=logfeeder.pid
++
++# SSL settings"
++# export LOGFEEDER_SSL="true"
++# export LOGFEEDER_KEYSTORE_LOCATION="/my/path/keystore.jks"
++# export LOGFEEDER_KEYSTORE_TYPE="jks"
++# export LOGFEEDER_TRUSTSTORE_LOCATION="/my/path/trutstore.jks"
++# export LOGFEEDER_TRUSTSTORE_TYPE="jks"
http://git-wip-us.apache.org/repos/asf/ambari/blob/7ff4a96c/ambari-logsearch/ambari-logsearch-logfeeder/src/main/scripts/logfeeder-env.sh~trunk
----------------------------------------------------------------------
diff --cc ambari-logsearch/ambari-logsearch-logfeeder/src/main/scripts/logfeeder-env.sh~trunk
index 0000000,0000000..37e9930
new file mode 100755
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/scripts/logfeeder-env.sh~trunk
@@@ -1,0 -1,0 +1,40 @@@
++#!/bin/bash
++# 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.
++
++# Log Feeder extra options
++export LOGFEEDER_JAVA_OPTS=${LOGFEEDER_JAVA_OPTS:-""}
++
++# Log Feeder debug options
++# export LOGFEEDER_DEBUG=true
++# exoprt LOGFEEDER_DEBUG_SUSPEND=n
++export LOGFEEDER_DEBUG_PORT=5006
++
++# Log Feeder memory
++# export LOGFEEDER_JAVA_MEM="-Xmx512m"
++
++# export LOG_PATH=/var/log/ambari-logsearch-logfeeder/
++# export LOG_FILE=logfeeder.log
++
++# Pid file of the application
++# export LOGFEEDER_PID_DIR=/var/run/ambari-logsearch-logfeeder
++# export LOGFEEDER_PID_FILE=logfeeder.pid
++
++# SSL settings"
++# export LOGFEEDER_SSL="true"
++# export LOGFEEDER_KEYSTORE_LOCATION="/my/path/keystore.jks"
++# export LOGFEEDER_KEYSTORE_TYPE="jks"
++# export LOGFEEDER_TRUSTSTORE_LOCATION="/my/path/trutstore.jks"
++# export LOGFEEDER_TRUSTSTORE_TYPE="jks"
http://git-wip-us.apache.org/repos/asf/ambari/blob/7ff4a96c/ambari-logsearch/ambari-logsearch-server/src/main/scripts/logsearch-env.sh~HEAD
----------------------------------------------------------------------
diff --cc ambari-logsearch/ambari-logsearch-server/src/main/scripts/logsearch-env.sh~HEAD
index 0000000,0000000..d8a837f
new file mode 100755
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/scripts/logsearch-env.sh~HEAD
@@@ -1,0 -1,0 +1,40 @@@
++#!/bin/bash
++# 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.
++
++# Log Search extra options
++export LOGSEARCH_JAVA_OPTS=${LOGSEARCH_JAVA_OPTS:-""}
++
++# Log Search debug options
++# export LOGSEARCH_DEBUG=true
++# exoprt LOGSEARCH_DEBUG_SUSPEND=n
++export LOGSEARCH_DEBUG_PORT=5005
++
++# Log Search memory
++# export LOGSEARCH_JAVA_MEM="--Xmx1024m"
++
++# export LOG_PATH=/var/log/ambari-logsearch-logfeeder/
++# export LOG_FILE=logsearch.log
++
++# Pid file of the application
++# export LOGSEARCH_PID_DIR=/var/run/ambari-logsearch-logfeeder
++# export LOGSEARCH_PID_FILE=logfeeder.pid
++
++# SSL settings"
++# export LOGSEARCH_SSL="true"
++# export LOGSEARCH_KEYSTORE_LOCATION="/my/path/keystore.jks"
++# export LOGSEARCH_KEYSTORE_TYPE="jks"
++# export LOGSEARCH_TRUSTSTORE_LOCATION="/my/path/trutstore.jks"
++# export LOGSEARCH_TRUSTSTORE_TYPE="jks"
http://git-wip-us.apache.org/repos/asf/ambari/blob/7ff4a96c/ambari-logsearch/ambari-logsearch-server/src/main/scripts/logsearch-env.sh~trunk
----------------------------------------------------------------------
diff --cc ambari-logsearch/ambari-logsearch-server/src/main/scripts/logsearch-env.sh~trunk
index 0000000,0000000..d8a837f
new file mode 100755
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/scripts/logsearch-env.sh~trunk
@@@ -1,0 -1,0 +1,40 @@@
++#!/bin/bash
++# 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.
++
++# Log Search extra options
++export LOGSEARCH_JAVA_OPTS=${LOGSEARCH_JAVA_OPTS:-""}
++
++# Log Search debug options
++# export LOGSEARCH_DEBUG=true
++# exoprt LOGSEARCH_DEBUG_SUSPEND=n
++export LOGSEARCH_DEBUG_PORT=5005
++
++# Log Search memory
++# export LOGSEARCH_JAVA_MEM="--Xmx1024m"
++
++# export LOG_PATH=/var/log/ambari-logsearch-logfeeder/
++# export LOG_FILE=logsearch.log
++
++# Pid file of the application
++# export LOGSEARCH_PID_DIR=/var/run/ambari-logsearch-logfeeder
++# export LOGSEARCH_PID_FILE=logfeeder.pid
++
++# SSL settings"
++# export LOGSEARCH_SSL="true"
++# export LOGSEARCH_KEYSTORE_LOCATION="/my/path/keystore.jks"
++# export LOGSEARCH_KEYSTORE_TYPE="jks"
++# export LOGSEARCH_TRUSTSTORE_LOCATION="/my/path/trutstore.jks"
++# export LOGSEARCH_TRUSTSTORE_TYPE="jks"
http://git-wip-us.apache.org/repos/asf/ambari/blob/7ff4a96c/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
----------------------------------------------------------------------
diff --cc ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
index 9cc7ad0,7003c98..d31aa93
--- a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
@@@ -2777,20 -2786,6 +2777,19 @@@ public class Configuration
@Markdown(description = "Whether security password encryption is enabled or not. In case it is we store passwords in their own file(s); otherwise we store passwords in the Ambari credential store.")
public static final ConfigurationProperty<Boolean> SECURITY_PASSWORD_ENCRYPTON_ENABLED = new ConfigurationProperty<Boolean>("security.passwords.encryption.enabled", false);
-
+ /**
+ * The maximum number of authentication attempts permitted to a local user. Once the number of failures reaches this limit the user will be locked out. 0 indicates unlimited failures
+ */
+ @Markdown(description = "The maximum number of authentication attempts permitted to a local user. Once the number of failures reaches this limit the user will be locked out. 0 indicates unlimited failures.")
+ public static final ConfigurationProperty<Integer> MAX_LOCAL_AUTHENTICATION_FAILURES = new ConfigurationProperty<>(
+ "authentication.local.max.failures", 10);
+
+ /**
+ * A flag to determine whether locked out messages are to be shown to users, if relevant, when authenticating into Ambari
+ */
+ @Markdown(description = "Show or hide whether the user account is disabled or locked out, if relevant, when an authentication attempt fails.")
+ public static final ConfigurationProperty<String> SHOW_LOCKED_OUT_USER_MESSAGE = new ConfigurationProperty<>(
+ "authentication.local.show.locked.account.messages", "false");
private static final Logger LOG = LoggerFactory.getLogger(
Configuration.class);
http://git-wip-us.apache.org/repos/asf/ambari/blob/7ff4a96c/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/7ff4a96c/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/7ff4a96c/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/7ff4a96c/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/7ff4a96c/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/7ff4a96c/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/7ff4a96c/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/7ff4a96c/ambari-server/src/main/resources/META-INF/persistence.xml
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/7ff4a96c/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
----------------------------------------------------------------------
diff --cc ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
index 6a0eadd,c3d0d9b..bb5a588
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
@@@ -1064,15 -1091,17 +1091,23 @@@
"livy": [
{
"conf_dir": "/etc/livy/conf",
- "current_dir": "{0}/current/livy-client/conf"
+ "current_dir": "{0}/current/livy-client/conf",
+ "component": "livy-client"
+ }
+ ],
+ "livy2": [
+ {
+ "conf_dir": "/etc/livy2/conf",
+ "current_dir": "{0}/current/livy2-client/conf",
+ "component": "livy2-client"
}
],
+ "livy2": [
+ {
+ "conf_dir": "/etc/livy2/conf",
+ "current_dir": "{0}/current/livy2-client/conf"
+ }
+ ],
"mahout": [
{
"conf_dir": "/etc/mahout/conf",
[32/50] [abbrv] ambari git commit: AMBARI-22655 - Livy/Livy2 Unable
To Start Due to Address Already In Use (jonathanhurley)
Posted by rl...@apache.org.
AMBARI-22655 - Livy/Livy2 Unable To Start Due to Address Already In Use (jonathanhurley)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f4e1a2bf
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f4e1a2bf
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f4e1a2bf
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: f4e1a2bff9b93f28ddc5fa958739a81fe3148aa5
Parents: 7749e65
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Thu Dec 14 21:59:19 2017 -0500
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Fri Jan 5 17:54:16 2018 -0500
----------------------------------------------------------------------
.../SPARK/1.2.1/package/scripts/livy_service.py | 22 +++++++++------
.../SPARK/2.2.0/package/scripts/livy_service.py | 29 +++++++++-----------
.../2.0.0/package/scripts/livy2_service.py | 27 ++++++++----------
.../SPARK2/2.0.0/package/scripts/setup_livy2.py | 2 ++
.../HDP/2.0.6/properties/stack_packages.json | 8 +++++-
.../HDP/3.0/properties/stack_packages.json | 8 +++++-
.../python/stacks/2.5/SPARK/test_spark_livy.py | 3 +-
.../stacks/2.6/SPARK2/test_spark_livy2.py | 5 +++-
8 files changed, 60 insertions(+), 44 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/f4e1a2bf/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/livy_service.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/livy_service.py b/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/livy_service.py
index cce2148..add5a77 100644
--- a/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/livy_service.py
+++ b/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/livy_service.py
@@ -21,28 +21,32 @@ limitations under the License.
from resource_management.libraries.functions import format
from resource_management.core.resources.system import File, Execute
from resource_management.libraries.functions import get_user_call_output
-import threading
def livy_service(name, upgrade_type=None, action=None):
import params
- livyserver_no_op_test = format(
- 'ls {livy_server_pid_file} >/dev/null 2>&1 && ps -p `cat {livy_server_pid_file}` >/dev/null 2>&1')
+ # use the livy user to get the PID (it is protected on non-root systems)
+ livy_server_pid = get_user_call_output.get_user_call_output(format("cat {livy_server_pid_file}"),
+ user=params.livy_user, is_checked_call=False)[1]
+
+ livy_server_pid = livy_server_pid.replace("\n", " ")
+
+ process_id_exists_command = format("ls {livy_server_pid_file} >/dev/null 2>&1 && ps -p {livy_server_pid} >/dev/null 2>&1")
+
if action == 'start':
Execute(format('{livy_server_start}'),
user=params.livy_user,
environment={'JAVA_HOME': params.java_home},
- not_if=livyserver_no_op_test)
+ not_if=process_id_exists_command
+ )
elif action == 'stop':
- pid = get_user_call_output.get_user_call_output(
- format("! test -f {livy_server_pid_file} || cat {livy_server_pid_file}"), user=params.livy_user)[1]
- pid = pid.replace("\n", " ")
Execute(format('{livy_server_stop}'),
user=params.livy_user,
- only_if=livyserver_no_op_test,
+ only_if=process_id_exists_command,
timeout=10,
- on_timeout=format("! ( {livyserver_no_op_test} ) || {sudo} -H -E kill -9 {pid}"),
+ on_timeout=format("! ( {process_id_exists_command} ) || {sudo} -H -E kill -9 {livy_server_pid}"),
environment={'JAVA_HOME': params.java_home}
)
+
File(params.livy_server_pid_file, action="delete")
http://git-wip-us.apache.org/repos/asf/ambari/blob/f4e1a2bf/ambari-server/src/main/resources/common-services/SPARK/2.2.0/package/scripts/livy_service.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SPARK/2.2.0/package/scripts/livy_service.py b/ambari-server/src/main/resources/common-services/SPARK/2.2.0/package/scripts/livy_service.py
index 273b056..add5a77 100644
--- a/ambari-server/src/main/resources/common-services/SPARK/2.2.0/package/scripts/livy_service.py
+++ b/ambari-server/src/main/resources/common-services/SPARK/2.2.0/package/scripts/livy_service.py
@@ -21,35 +21,32 @@ limitations under the License.
from resource_management.libraries.functions import format
from resource_management.core.resources.system import File, Execute
from resource_management.libraries.functions import get_user_call_output
-import threading
def livy_service(name, upgrade_type=None, action=None):
import params
- livyserver_no_op_test = format(
- 'ls {livy_server_pid_file} >/dev/null 2>&1 && ps -p `cat {livy_server_pid_file}` >/dev/null 2>&1')
+ # use the livy user to get the PID (it is protected on non-root systems)
+ livy_server_pid = get_user_call_output.get_user_call_output(format("cat {livy_server_pid_file}"),
+ user=params.livy_user, is_checked_call=False)[1]
+
+ livy_server_pid = livy_server_pid.replace("\n", " ")
+
+ process_id_exists_command = format("ls {livy_server_pid_file} >/dev/null 2>&1 && ps -p {livy_server_pid} >/dev/null 2>&1")
+
if action == 'start':
Execute(format('{livy_server_start}'),
user=params.livy_user,
environment={'JAVA_HOME': params.java_home},
- not_if=livyserver_no_op_test
- )
+ not_if=process_id_exists_command
+ )
elif action == 'stop':
- pid = get_user_call_output.get_user_call_output(
- format("! test -f {livy_server_pid_file} || cat {livy_server_pid_file}"), user=params.livy_user)[1]
- pid = pid.replace("\n", " ")
Execute(format('{livy_server_stop}'),
user=params.livy_user,
- only_if=livyserver_no_op_test,
+ only_if=process_id_exists_command,
timeout=10,
- on_timeout=format("! ( {livyserver_no_op_test} ) || {sudo} -H -E kill -9 {pid}"),
+ on_timeout=format("! ( {process_id_exists_command} ) || {sudo} -H -E kill -9 {livy_server_pid}"),
environment={'JAVA_HOME': params.java_home}
)
- File(params.livy_server_pid_file,
- action="delete"
- )
-
-
-
+ File(params.livy_server_pid_file, action="delete")
http://git-wip-us.apache.org/repos/asf/ambari/blob/f4e1a2bf/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/livy2_service.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/livy2_service.py b/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/livy2_service.py
index dfadd84..0180a31 100644
--- a/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/livy2_service.py
+++ b/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/livy2_service.py
@@ -21,35 +21,32 @@ limitations under the License.
from resource_management.libraries.functions import format
from resource_management.core.resources.system import File, Execute
from resource_management.libraries.functions import get_user_call_output
-import threading
def livy2_service(name, upgrade_type=None, action=None):
import params
- livyserver_no_op_test = format(
- 'ls {livy2_server_pid_file} >/dev/null 2>&1 && ps -p `cat {livy2_server_pid_file}` >/dev/null 2>&1')
+ # use the livy2 user to get the PID (it is protected on non-root systems)
+ livy2_server_pid = get_user_call_output.get_user_call_output(format("cat {livy2_server_pid_file}"),
+ user=params.livy2_user, is_checked_call=False)[1]
+
+ livy2_server_pid = livy2_server_pid.replace("\n", " ")
+
+ process_id_exists_command = format("ls {livy2_server_pid_file} >/dev/null 2>&1 && ps -p {livy2_server_pid} >/dev/null 2>&1")
+
if action == 'start':
Execute(format('{livy2_server_start}'),
user=params.livy2_user,
environment={'JAVA_HOME': params.java_home},
- not_if=livyserver_no_op_test
+ not_if=process_id_exists_command
)
elif action == 'stop':
- pid = get_user_call_output.get_user_call_output(
- format("! test -f {livy2_server_pid_file} || cat {livy2_server_pid_file}"), user=params.livy2_user)[1]
- pid = pid.replace("\n", " ")
Execute(format('{livy2_server_stop}'),
user=params.livy2_user,
- only_if=livyserver_no_op_test,
+ only_if=process_id_exists_command,
timeout=10,
- on_timeout=format("! ( {livyserver_no_op_test} ) || {sudo} -H -E kill -9 {pid}"),
+ on_timeout=format("! ( {process_id_exists_command} ) || {sudo} -H -E kill -9 {livy2_server_pid}"),
environment={'JAVA_HOME': params.java_home}
)
- File(params.livy2_server_pid_file,
- action="delete"
- )
-
-
-
+ File(params.livy2_server_pid_file, action="delete")
http://git-wip-us.apache.org/repos/asf/ambari/blob/f4e1a2bf/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/setup_livy2.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/setup_livy2.py b/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/setup_livy2.py
index c428488..59ec190 100644
--- a/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/setup_livy2.py
+++ b/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/setup_livy2.py
@@ -29,8 +29,10 @@ def setup_livy(env, type, upgrade_type = None, action = None):
owner=params.livy2_user,
group=params.user_group,
mode=0775,
+ cd_access = 'a',
create_parents = True
)
+
if type == 'server' and action == 'config':
params.HdfsResource(params.livy2_hdfs_user_dir,
type="directory",
http://git-wip-us.apache.org/repos/asf/ambari/blob/f4e1a2bf/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json b/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
index 01a30f3..6a0eadd 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
@@ -1067,6 +1067,12 @@
"current_dir": "{0}/current/livy-client/conf"
}
],
+ "livy2": [
+ {
+ "conf_dir": "/etc/livy2/conf",
+ "current_dir": "{0}/current/livy2-client/conf"
+ }
+ ],
"mahout": [
{
"conf_dir": "/etc/mahout/conf",
@@ -1241,7 +1247,7 @@
"packages": ["spark", "livy"]
},
"SPARK2": {
- "packages": ["spark2", "livy"]
+ "packages": ["spark2", "livy2"]
},
"SQOOP": {
"packages": ["sqoop"]
http://git-wip-us.apache.org/repos/asf/ambari/blob/f4e1a2bf/ambari-server/src/main/resources/stacks/HDP/3.0/properties/stack_packages.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/3.0/properties/stack_packages.json b/ambari-server/src/main/resources/stacks/HDP/3.0/properties/stack_packages.json
index 28efbfa..63fcf4b 100644
--- a/ambari-server/src/main/resources/stacks/HDP/3.0/properties/stack_packages.json
+++ b/ambari-server/src/main/resources/stacks/HDP/3.0/properties/stack_packages.json
@@ -944,6 +944,12 @@
"current_dir": "{0}/current/livy-client/conf"
}
],
+ "livy2": [
+ {
+ "conf_dir": "/etc/livy2/conf",
+ "current_dir": "{0}/current/livy2-client/conf"
+ }
+ ],
"mahout": [
{
"conf_dir": "/etc/mahout/conf",
@@ -1118,7 +1124,7 @@
"packages": ["spark", "livy"]
},
"SPARK2": {
- "packages": ["spark2", "livy"]
+ "packages": ["spark2", "livy2"]
},
"SQOOP": {
"packages": ["sqoop"]
http://git-wip-us.apache.org/repos/asf/ambari/blob/f4e1a2bf/ambari-server/src/test/python/stacks/2.5/SPARK/test_spark_livy.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.5/SPARK/test_spark_livy.py b/ambari-server/src/test/python/stacks/2.5/SPARK/test_spark_livy.py
index 4f1fb17..e37c6fa 100644
--- a/ambari-server/src/test/python/stacks/2.5/SPARK/test_spark_livy.py
+++ b/ambari-server/src/test/python/stacks/2.5/SPARK/test_spark_livy.py
@@ -25,6 +25,7 @@ from only_for_platform import not_for_platform, PLATFORM_WINDOWS
@not_for_platform(PLATFORM_WINDOWS)
@patch("resource_management.libraries.functions.get_stack_version", new=MagicMock(return_value="2.5.0.0-1597"))
+@patch("resource_management.libraries.functions.get_user_call_output.get_user_call_output", new=MagicMock(return_value=(0,'12345','')))
class TestSparkClient(RMFTestCase):
COMMON_SERVICES_PACKAGE_DIR = "SPARK/1.2.1/package"
STACK_VERSION = "2.5"
@@ -146,6 +147,6 @@ class TestSparkClient(RMFTestCase):
)
self.assertResourceCalled('Execute', '/usr/hdp/current/livy-server/bin/livy-server start',
environment = {'JAVA_HOME': '/usr/jdk64/jdk1.7.0_45'},
- not_if = 'ls /var/run/livy/livy-livy-server.pid >/dev/null 2>&1 && ps -p `cat /var/run/livy/livy-livy-server.pid` >/dev/null 2>&1',
+ not_if = 'ls /var/run/livy/livy-livy-server.pid >/dev/null 2>&1 && ps -p 12345 >/dev/null 2>&1',
user = 'livy'
)
http://git-wip-us.apache.org/repos/asf/ambari/blob/f4e1a2bf/ambari-server/src/test/python/stacks/2.6/SPARK2/test_spark_livy2.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.6/SPARK2/test_spark_livy2.py b/ambari-server/src/test/python/stacks/2.6/SPARK2/test_spark_livy2.py
index 60e7fd2..f0a173b 100644
--- a/ambari-server/src/test/python/stacks/2.6/SPARK2/test_spark_livy2.py
+++ b/ambari-server/src/test/python/stacks/2.6/SPARK2/test_spark_livy2.py
@@ -25,6 +25,7 @@ from only_for_platform import not_for_platform, PLATFORM_WINDOWS
@not_for_platform(PLATFORM_WINDOWS)
@patch("resource_management.libraries.functions.get_stack_version", new=MagicMock(return_value="2.5.0.0-1597"))
+@patch("resource_management.libraries.functions.get_user_call_output.get_user_call_output", new=MagicMock(return_value=(0,'12345','')))
class TestSparkClient(RMFTestCase):
COMMON_SERVICES_PACKAGE_DIR = "SPARK2/2.0.0/package"
STACK_VERSION = "2.6"
@@ -45,12 +46,14 @@ class TestSparkClient(RMFTestCase):
owner = 'livy',
group = 'hadoop',
create_parents = True,
+ cd_access = 'a',
mode = 0775
)
self.assertResourceCalled('Directory', '/var/log/livy2',
owner = 'livy',
group = 'hadoop',
create_parents = True,
+ cd_access = 'a',
mode = 0775
)
self.assertResourceCalled('HdfsResource', '/user/livy',
@@ -146,6 +149,6 @@ class TestSparkClient(RMFTestCase):
)
self.assertResourceCalled('Execute', '/usr/hdp/current/livy2-server/bin/livy-server start',
environment = {'JAVA_HOME': '/usr/jdk64/jdk1.7.0_45'},
- not_if = 'ls /var/run/livy2/livy-livy-server.pid >/dev/null 2>&1 && ps -p `cat /var/run/livy2/livy-livy-server.pid` >/dev/null 2>&1',
+ not_if = 'ls /var/run/livy2/livy-livy-server.pid >/dev/null 2>&1 && ps -p 12345 >/dev/null 2>&1',
user = 'livy'
)
[20/50] [abbrv] ambari git commit: AMBARI-22419 Ambari upgrade failed
(dgrinenko)
Posted by rl...@apache.org.
AMBARI-22419 Ambari upgrade failed (dgrinenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d6f26fb1
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d6f26fb1
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d6f26fb1
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: d6f26fb1c7d79fa6ba9a289daf51f6151c6bb3de
Parents: 72812bd
Author: Dmytro Grinenko <ha...@apache.org>
Authored: Fri Jan 5 10:01:16 2018 +0200
Committer: Dmytro Grinenko <ha...@apache.org>
Committed: Fri Jan 5 10:01:16 2018 +0200
----------------------------------------------------------------------
.../server/api/services/AmbariMetaInfo.java | 80 +++++++++-----------
.../server/api/services/AmbariMetaInfoTest.java | 53 +++++++++++++
2 files changed, 89 insertions(+), 44 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d6f26fb1/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
index 5f63c76..af0b700 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
@@ -1035,6 +1035,30 @@ public class AmbariMetaInfo {
}
/**
+ * Returns new definitions for the merge
+ *
+ * @param definitions List of the definitions
+ * @param clusterId Cluster ID
+ * @param mappedEntities Mapped entities
+ * @return Entities to merge
+ */
+ private List<AlertDefinitionEntity> getDefinitionsForMerge(List<AlertDefinition> definitions, long clusterId,
+ Map<String, AlertDefinitionEntity> mappedEntities ) {
+ List<AlertDefinitionEntity> definitionsForMerge = new ArrayList<>();
+
+ for (AlertDefinition definition: definitions) {
+ AlertDefinitionEntity entity = mappedEntities.get(definition.getName());
+
+ // no entity means this is new; create a new entity
+ if (null == entity) {
+ entity = alertDefinitionFactory.coerce(clusterId, definition);
+ definitionsForMerge.add(entity);
+ }
+ }
+ return definitionsForMerge;
+ }
+
+ /**
* Compares the alert definitions defined on the stack with those in the
* database and merges any new or updated definitions. This method will first
* determine the services that are installed on each cluster to prevent alert
@@ -1058,18 +1082,12 @@ public class AmbariMetaInfo {
// for every cluster
for (Cluster cluster : clusterMap.values()) {
- long clusterId = cluster.getClusterId();
- // creating a mapping between names and service/component for fast lookups
-// Collection<ServiceInfo> stackServices = new ArrayList<>();
+ long clusterId = cluster.getClusterId();
Map<String, ServiceInfo> stackServiceMap = new HashMap<>();
Map<String, ComponentInfo> stackComponentMap = new HashMap<>();
-
- Map<String, Service> clusterServiceMap = cluster.getServices();
- Set<String> clusterServiceNames = clusterServiceMap.keySet();
-
- // for every service installed in that cluster, get the service metainfo
+ // for every service installed in that cluster, get the service MetaInfo
// and off of that the alert definitions
List<AlertDefinition> stackDefinitions = new ArrayList<>(50);
@@ -1116,11 +1134,6 @@ public class AmbariMetaInfo {
// use the REST APIs to modify them instead
AlertDefinition databaseDefinition = alertDefinitionFactory.coerce(entity);
if (!stackDefinition.deeplyEquals(databaseDefinition)) {
- // this is the code that would normally merge the stack definition
- // into the database; this is not the behavior we want today
-
- // entity = alertDefinitionFactory.merge(stackDefinition, entity);
- // persist.add(entity);
LOG.debug(
"The alert named {} has been modified from the stack definition and will not be merged",
@@ -1149,28 +1162,10 @@ public class AmbariMetaInfo {
}
// ambari agent host-only alert definitions
- List<AlertDefinition> agentDefinitions = ambariServiceAlertDefinitions.getAgentDefinitions();
- for (AlertDefinition agentDefinition : agentDefinitions) {
- AlertDefinitionEntity entity = mappedEntities.get(agentDefinition.getName());
-
- // no entity means this is new; create a new entity
- if (null == entity) {
- entity = alertDefinitionFactory.coerce(clusterId, agentDefinition);
- persist.add(entity);
- }
- }
+ persist.addAll(getDefinitionsForMerge(ambariServiceAlertDefinitions.getAgentDefinitions(), clusterId, mappedEntities));
// ambari server host-only alert definitions
- List<AlertDefinition> serverDefinitions = ambariServiceAlertDefinitions.getServerDefinitions();
- for (AlertDefinition serverDefinition : serverDefinitions) {
- AlertDefinitionEntity entity = mappedEntities.get(serverDefinition.getName());
-
- // no entity means this is new; create a new entity
- if (null == entity) {
- entity = alertDefinitionFactory.coerce(clusterId, serverDefinition);
- persist.add(entity);
- }
- }
+ persist.addAll(getDefinitionsForMerge(ambariServiceAlertDefinitions.getServerDefinitions(), clusterId, mappedEntities));
// persist any new or updated definition
for (AlertDefinitionEntity entity : persist) {
@@ -1205,20 +1200,17 @@ public class AmbariMetaInfo {
continue;
}
- StackId stackId = cluster.getService(serviceName).getDesiredStackId();
-
if (!stackServiceMap.containsKey(serviceName)) {
- LOG.info(
- "The {} service has been marked as deleted for stack {}, disabling alert {}",
- serviceName, stackId, definition.getDefinitionName());
+
+ LOG.info( "The {} service has been marked as deleted for cluster {}, disabling alert {}",
+ serviceName, cluster.getClusterName(), definition.getDefinitionName());
definitionsToDisable.add(definition);
- } else if (null != componentName
- && !stackComponentMap.containsKey(componentName)) {
- LOG.info(
- "The {} component {} has been marked as deleted for stack {}, disabling alert {}",
- serviceName, componentName, stackId,
- definition.getDefinitionName());
+ } else if (null != componentName && !stackComponentMap.containsKey(componentName)) {
+
+ StackId stackId = cluster.getService(serviceName).getDesiredStackId();
+ LOG.info( "The {} component {} has been marked as deleted for stack {}, disabling alert {}",
+ serviceName, componentName, stackId, definition.getDefinitionName());
definitionsToDisable.add(definition);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d6f26fb1/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
index 83b8f87..b7d977e 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
@@ -1791,6 +1791,59 @@ public class AmbariMetaInfoTest {
assertFalse(entity.getEnabled());
}
+ /**
+ * Test scenario when service were removed and not mapped alerts need to be disabled
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testAlertDefinitionMergingRemoveScenario() throws Exception {
+ final String repoVersion = "2.0.6-1234";
+ final String stackVersion = "2.0.6";
+
+ Injector injector = Guice.createInjector(Modules.override(
+ new InMemoryDefaultTestModule()).with(new MockModule()));
+
+ EventBusSynchronizer.synchronizeAmbariEventPublisher(injector);
+
+ injector.getInstance(GuiceJpaInitializer.class);
+ injector.getInstance(EntityManager.class);
+
+ OrmTestHelper ormHelper = injector.getInstance(OrmTestHelper.class);
+ long clusterId = ormHelper.createCluster("cluster" + System.currentTimeMillis());
+
+ Class<?> c = metaInfo.getClass().getSuperclass();
+
+ Field f = c.getDeclaredField("alertDefinitionDao");
+ f.setAccessible(true);
+ f.set(metaInfo, injector.getInstance(AlertDefinitionDAO.class));
+
+ f = c.getDeclaredField("ambariServiceAlertDefinitions");
+ f.setAccessible(true);
+ f.set(metaInfo, injector.getInstance(AmbariServiceAlertDefinitions.class));
+
+ Clusters clusters = injector.getInstance(Clusters.class);
+ Cluster cluster = clusters.getClusterById(clusterId);
+ cluster.setDesiredStackVersion(
+ new StackId(STACK_NAME_HDP, stackVersion));
+
+ RepositoryVersionEntity repositoryVersion = ormHelper.getOrCreateRepositoryVersion(
+ cluster.getCurrentStackVersion(), repoVersion);
+
+ cluster.addService("HDFS", repositoryVersion);
+
+ metaInfo.reconcileAlertDefinitions(clusters, false);
+
+ AlertDefinitionDAO dao = injector.getInstance(AlertDefinitionDAO.class);
+ List<AlertDefinitionEntity> definitions = dao.findAll(clusterId);
+ assertEquals(13, definitions.size());
+
+ cluster.deleteService("HDFS");
+ metaInfo.reconcileAlertDefinitions(clusters, false);
+ List<AlertDefinitionEntity> updatedDefinitions = dao.findAll(clusterId);
+ assertEquals(7, updatedDefinitions.size());
+ }
+
@Test
public void testKerberosDescriptor() throws Exception {
ServiceInfo service;
[15/50] [abbrv] ambari git commit: AMBARI-22719. Regenerate Keytabs
resets security.inter.broker.protocol to PLAINTEXTSASL
Posted by rl...@apache.org.
AMBARI-22719. Regenerate Keytabs resets security.inter.broker.protocol to PLAINTEXTSASL
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e2be62d5
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e2be62d5
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e2be62d5
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: e2be62d598054c822ecc0c7039ed8a433e1212d9
Parents: 13056cf
Author: Doroszlai, Attila <ad...@hortonworks.com>
Authored: Wed Jan 3 11:13:16 2018 +0100
Committer: Doroszlai, Attila <ad...@hortonworks.com>
Committed: Thu Jan 4 12:53:12 2018 +0100
----------------------------------------------------------------------
.../stacks/HDP/2.3/services/stack_advisor.py | 9 ++++++++-
.../python/stacks/2.3/common/test_stack_advisor.py | 17 +++++++++++++++++
2 files changed, 25 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/e2be62d5/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
index 201efff..c4c493d 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
@@ -339,7 +339,14 @@ class HDP23StackAdvisor(HDP22StackAdvisor):
putKafkaBrokerProperty("super.users", kafka_super_users)
putKafkaBrokerProperty("principal.to.local.class", "kafka.security.auth.KerberosPrincipalToLocal")
- putKafkaBrokerProperty("security.inter.broker.protocol", "PLAINTEXTSASL")
+
+ recommended_inter_broker_protocol = 'PLAINTEXTSASL'
+ if 'security.inter.broker.protocol' in kafka_broker:
+ current_inter_broker_protocol = kafka_broker['security.inter.broker.protocol']
+ if current_inter_broker_protocol in ('PLAINTEXTSASL', 'SASL_PLAINTEXT', 'SASL_SSL'):
+ recommended_inter_broker_protocol = current_inter_broker_protocol
+ putKafkaBrokerProperty("security.inter.broker.protocol", recommended_inter_broker_protocol)
+
putKafkaBrokerProperty("zookeeper.set.acl", "true")
else: # not security_enabled
http://git-wip-us.apache.org/repos/asf/ambari/blob/e2be62d5/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
index 2112fa0..1a58522 100644
--- a/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
@@ -364,6 +364,22 @@ class TestHDP23StackAdvisor(TestCase):
self.stackAdvisor.recommendKAFKAConfigurations(configurations, clusterData, services, None)
self.assertEquals(configurations['kafka-broker']['properties']['authorizer.class.name'], 'kafka.security.auth.SimpleAclAuthorizer' , "Test authorizer.class.name with Ranger Kafka plugin disabled in kerberos environment")
+ # Advise 'PLAINTEXTSASL' for secure cluster by default
+ services['configurations']['cluster-env']['properties']['security_enabled'] = "true"
+ configurations['kafka-broker']['properties'] = {}
+ configurations['kafka-broker']['property_attributes'] = {}
+ self.stackAdvisor.recommendKAFKAConfigurations(configurations, clusterData, services, None)
+ self.assertEqual(configurations['kafka-broker']['properties']['security.inter.broker.protocol'], 'PLAINTEXTSASL')
+
+ # Secure security.inter.broker.protocol values should be retained by stack advisor
+ services['configurations']['cluster-env']['properties']['security_enabled'] = "true"
+ configurations['kafka-broker']['properties'] = {}
+ configurations['kafka-broker']['property_attributes'] = {}
+ for proto in ('PLAINTEXTSASL', 'SASL_PLAINTEXT', 'SASL_SSL'):
+ services['configurations']['kafka-broker']['properties']['security.inter.broker.protocol'] = proto
+ self.stackAdvisor.recommendKAFKAConfigurations(configurations, clusterData, services, None)
+ self.assertEqual(configurations['kafka-broker']['properties']['security.inter.broker.protocol'], proto)
+
# Test authorizer.class.name with Ranger Kafka plugin enabled in non-kerberos environment
services['configurations']['cluster-env']['properties']['security_enabled'] = "false"
configurations['kafka-broker']['properties'] = {}
@@ -383,6 +399,7 @@ class TestHDP23StackAdvisor(TestCase):
self.stackAdvisor.recommendKAFKAConfigurations(configurations, clusterData, services, None)
self.assertEquals(configurations['kafka-broker']['properties']['authorizer.class.name'], 'org.apache.ranger.authorization.kafka.authorizer.RangerKafkaAuthorizer', "Test authorizer.class.name with Ranger Kafka plugin enabled in kerberos environment")
self.assertEquals(configurations['ranger-kafka-plugin-properties']['properties']['zookeeper.connect'], 'host1:2181')
+ self.assertTrue('security.inter.broker.protocol' not in configurations['kafka-broker']['properties'])
# Test kafka-log4j content when Ranger plugin for Kafka is enabled
[19/50] [abbrv] ambari git commit: AMBARI-22678. Fix Broken Symlinks
on Stack Distribution (dlysnichenko)
Posted by rl...@apache.org.
AMBARI-22678. Fix Broken Symlinks on Stack Distribution (dlysnichenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/72812bd2
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/72812bd2
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/72812bd2
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 72812bd2bdd496056407d930c4c7e232bd487703
Parents: dfb9785
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Thu Jan 4 18:42:11 2018 +0200
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Thu Jan 4 18:42:11 2018 +0200
----------------------------------------------------------------------
.../SPARK/1.2.1/package/scripts/livy_service.py | 2 -
.../2.0.0/package/scripts/livy2_service.py | 2 -
.../custom_actions/scripts/install_packages.py | 38 ++++---
.../HDP/2.0.6/properties/stack_packages.json | 102 ++++++++++++-------
4 files changed, 92 insertions(+), 52 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/72812bd2/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/livy_service.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/livy_service.py b/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/livy_service.py
index add5a77..0e78881 100644
--- a/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/livy_service.py
+++ b/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/livy_service.py
@@ -48,5 +48,3 @@ def livy_service(name, upgrade_type=None, action=None):
on_timeout=format("! ( {process_id_exists_command} ) || {sudo} -H -E kill -9 {livy_server_pid}"),
environment={'JAVA_HOME': params.java_home}
)
-
- File(params.livy_server_pid_file, action="delete")
http://git-wip-us.apache.org/repos/asf/ambari/blob/72812bd2/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/livy2_service.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/livy2_service.py b/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/livy2_service.py
index 0180a31..2ac8fd4 100644
--- a/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/livy2_service.py
+++ b/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/livy2_service.py
@@ -48,5 +48,3 @@ def livy2_service(name, upgrade_type=None, action=None):
on_timeout=format("! ( {process_id_exists_command} ) || {sudo} -H -E kill -9 {livy2_server_pid}"),
environment={'JAVA_HOME': params.java_home}
)
-
- File(params.livy2_server_pid_file, action="delete")
http://git-wip-us.apache.org/repos/asf/ambari/blob/72812bd2/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py b/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
index 4cdb0e5..11b571b 100644
--- a/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
+++ b/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
@@ -154,15 +154,12 @@ class InstallPackages(Script):
if num_errors > 0:
raise Fail("Failed to distribute repositories/install packages")
- self._fix_default_links("livy", "livy-server")
- self._fix_default_links("livy2", "livy2-server")
-
+ self._fix_default_links_for_current()
# if installing a version of HDP that needs some symlink love, then create them
if is_package_install_successful and 'actual_version' in self.structured_output:
self._relink_configurations_with_conf_select(stack_id, self.structured_output['actual_version'])
-
- def _fix_default_links(self, package_name, component_name):
+ def _fix_default_links_for_current(self):
"""
If a prior version of Ambari did not correctly reverse the conf symlinks, then they would
be put into a bad state when distributing a new stack. For example:
@@ -181,19 +178,32 @@ class InstallPackages(Script):
:return: None
"""
+ Logger.info("Attempting to fix any configuration symlinks which are not in the correct state")
from resource_management.libraries.functions import stack_select
- package_dirs = conf_select.get_package_dirs()
- if package_name in package_dirs:
- Logger.info("Determining if the default conf links for {0} need to be fixed".format(package_name))
+ restricted_packages = conf_select.get_restricted_packages()
+
+ if 0 == len(restricted_packages):
+ Logger.info("There are no restricted conf-select packages for this installation")
+ else:
+ Logger.info("Restricting conf-select packages to {0}".format(restricted_packages))
- directories = package_dirs[package_name]
- Logger.info("The following directories will be checked for {0}: {1}".format(package_name,
- str(directories)))
+ for package_name, directories in conf_select.get_package_dirs().iteritems():
+ Logger.info("Attempting to fix the default conf links for {0}".format(package_name))
+ Logger.info("The following directories will be fixed for {0}: {1}".format(package_name, str(directories)))
- stack_version = stack_select.get_stack_version_before_install(component_name)
- if stack_version:
- conf_select.convert_conf_directories_to_symlinks(package_name, stack_version, directories)
+ component_name = None
+ for directory_struct in directories:
+ if "component" in directory_struct:
+ component_name = directory_struct["component"]
+ if component_name:
+ stack_version = stack_select.get_stack_version_before_install(component_name)
+ if 0 == len(restricted_packages) or package_name in restricted_packages:
+ if stack_version:
+ conf_select.convert_conf_directories_to_symlinks(package_name, stack_version, directories)
+ else:
+ Logger.warning(
+ "Unable to fix {0} since there is no known installed version for this component".format(package_name))
def _relink_configurations_with_conf_select(self, stack_id, stack_version):
"""
http://git-wip-us.apache.org/repos/asf/ambari/blob/72812bd2/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json b/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
index 68da0dd..c3d0d9b 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
@@ -1000,205 +1000,239 @@
"accumulo": [
{
"conf_dir": "/etc/accumulo/conf",
- "current_dir": "{0}/current/accumulo-client/conf"
+ "current_dir": "{0}/current/accumulo-client/conf",
+ "component": "accumulo-client"
}
],
"atlas": [
{
"conf_dir": "/etc/atlas/conf",
- "current_dir": "{0}/current/atlas-client/conf"
+ "current_dir": "{0}/current/atlas-client/conf",
+ "component": "atlas-client"
}
],
"druid": [
{
"conf_dir": "/etc/druid/conf",
- "current_dir": "{0}/current/druid-overlord/conf"
+ "current_dir": "{0}/current/druid-overlord/conf",
+ "component": "druid-overlord"
}
],
"falcon": [
{
"conf_dir": "/etc/falcon/conf",
- "current_dir": "{0}/current/falcon-client/conf"
+ "current_dir": "{0}/current/falcon-client/conf",
+ "component": "falcon-client"
}
],
"flume": [
{
"conf_dir": "/etc/flume/conf",
- "current_dir": "{0}/current/flume-server/conf"
+ "current_dir": "{0}/current/flume-server/conf",
+ "component": "flume-server"
}
],
"hadoop": [
{
"conf_dir": "/etc/hadoop/conf",
- "current_dir": "{0}/current/hadoop-client/conf"
+ "current_dir": "{0}/current/hadoop-client/conf",
+ "component": "hadoop-client"
}
],
"hbase": [
{
"conf_dir": "/etc/hbase/conf",
- "current_dir": "{0}/current/hbase-client/conf"
+ "current_dir": "{0}/current/hbase-client/conf",
+ "component": "hbase-client"
}
],
"hive": [
{
"conf_dir": "/etc/hive/conf",
- "current_dir": "{0}/current/hive-client/conf"
+ "current_dir": "{0}/current/hive-client/conf",
+ "component": "hive-client"
}
],
"hive2": [
{
"conf_dir": "/etc/hive2/conf",
- "current_dir": "{0}/current/hive-server2-hive2/conf"
+ "current_dir": "{0}/current/hive-server2-hive2/conf",
+ "component": "hive-server2-hive2"
}
],
"hive-hcatalog": [
{
"conf_dir": "/etc/hive-webhcat/conf",
"prefix": "/etc/hive-webhcat",
- "current_dir": "{0}/current/hive-webhcat/etc/webhcat"
+ "current_dir": "{0}/current/hive-webhcat/etc/webhcat",
+ "component": "hive-webhcat"
},
{
"conf_dir": "/etc/hive-hcatalog/conf",
"prefix": "/etc/hive-hcatalog",
- "current_dir": "{0}/current/hive-webhcat/etc/hcatalog"
+ "current_dir": "{0}/current/hive-webhcat/etc/hcatalog",
+ "component": "hive-webhcat"
}
],
"kafka": [
{
"conf_dir": "/etc/kafka/conf",
- "current_dir": "{0}/current/kafka-broker/conf"
+ "current_dir": "{0}/current/kafka-broker/conf",
+ "component": "kafka-broker"
}
],
"knox": [
{
"conf_dir": "/etc/knox/conf",
- "current_dir": "{0}/current/knox-server/conf"
+ "current_dir": "{0}/current/knox-server/conf",
+ "component": "knox-server"
}
],
"livy": [
{
"conf_dir": "/etc/livy/conf",
- "current_dir": "{0}/current/livy-client/conf"
+ "current_dir": "{0}/current/livy-client/conf",
+ "component": "livy-client"
}
],
"livy2": [
{
"conf_dir": "/etc/livy2/conf",
- "current_dir": "{0}/current/livy2-client/conf"
+ "current_dir": "{0}/current/livy2-client/conf",
+ "component": "livy2-client"
}
],
"mahout": [
{
"conf_dir": "/etc/mahout/conf",
- "current_dir": "{0}/current/mahout-client/conf"
+ "current_dir": "{0}/current/mahout-client/conf",
+ "component": "mahout-client"
}
],
"nifi": [
{
"conf_dir": "/etc/nifi/conf",
- "current_dir": "{0}/current/nifi/conf"
+ "current_dir": "{0}/current/nifi/conf",
+ "component": "nifi"
}
],
"oozie": [
{
"conf_dir": "/etc/oozie/conf",
- "current_dir": "{0}/current/oozie-client/conf"
+ "current_dir": "{0}/current/oozie-client/conf",
+ "component": "oozie-client"
}
],
"phoenix": [
{
"conf_dir": "/etc/phoenix/conf",
- "current_dir": "{0}/current/phoenix-client/conf"
+ "current_dir": "{0}/current/phoenix-client/conf",
+ "component": "phoenix-client"
}
],
"pig": [
{
"conf_dir": "/etc/pig/conf",
- "current_dir": "{0}/current/pig-client/conf"
+ "current_dir": "{0}/current/pig-client/conf",
+ "component": "pig-client"
}
],
"ranger-admin": [
{
"conf_dir": "/etc/ranger/admin/conf",
- "current_dir": "{0}/current/ranger-admin/conf"
+ "current_dir": "{0}/current/ranger-admin/conf",
+ "component": "ranger-admin"
}
],
"ranger-kms": [
{
"conf_dir": "/etc/ranger/kms/conf",
- "current_dir": "{0}/current/ranger-kms/conf"
+ "current_dir": "{0}/current/ranger-kms/conf",
+ "component": "ranger-kms"
}
],
"ranger-tagsync": [
{
"conf_dir": "/etc/ranger/tagsync/conf",
- "current_dir": "{0}/current/ranger-tagsync/conf"
+ "current_dir": "{0}/current/ranger-tagsync/conf",
+ "component": "ranger-tagsync"
}
],
"ranger-usersync": [
{
"conf_dir": "/etc/ranger/usersync/conf",
- "current_dir": "{0}/current/ranger-usersync/conf"
+ "current_dir": "{0}/current/ranger-usersync/conf",
+ "component": "ranger-usersync"
}
],
"slider": [
{
"conf_dir": "/etc/slider/conf",
- "current_dir": "{0}/current/slider-client/conf"
+ "current_dir": "{0}/current/slider-client/conf",
+ "component": "slider-client"
}
],
"spark": [
{
"conf_dir": "/etc/spark/conf",
- "current_dir": "{0}/current/spark-client/conf"
+ "current_dir": "{0}/current/spark-client/conf",
+ "component": "spark-client"
}
],
"spark2": [
{
"conf_dir": "/etc/spark2/conf",
- "current_dir": "{0}/current/spark2-client/conf"
+ "current_dir": "{0}/current/spark2-client/conf",
+ "component": "spark2-client"
}
],
"sqoop": [
{
"conf_dir": "/etc/sqoop/conf",
- "current_dir": "{0}/current/sqoop-client/conf"
+ "current_dir": "{0}/current/sqoop-client/conf",
+ "component": "sqoop-client"
}
],
"storm": [
{
"conf_dir": "/etc/storm/conf",
- "current_dir": "{0}/current/storm-client/conf"
+ "current_dir": "{0}/current/storm-client/conf",
+ "component": "storm-client"
}
],
"storm-slider-client": [
{
"conf_dir": "/etc/storm-slider-client/conf",
- "current_dir": "{0}/current/storm-slider-client/conf"
+ "current_dir": "{0}/current/storm-slider-client/conf",
+ "component": "storm-slider-client"
}
],
"superset": [
{
"conf_dir": "/etc/druid-superset/conf",
- "current_dir": "{0}/current/druid-superset/conf"
+ "current_dir": "{0}/current/druid-superset/conf",
+ "component": "druid-superset"
}
],
"tez": [
{
"conf_dir": "/etc/tez/conf",
- "current_dir": "{0}/current/tez-client/conf"
+ "current_dir": "{0}/current/tez-client/conf",
+ "component": "tez-client"
}
],
"zeppelin": [
{
"conf_dir": "/etc/zeppelin/conf",
- "current_dir": "{0}/current/zeppelin-server/conf"
+ "current_dir": "{0}/current/zeppelin-server/conf",
+ "component": "zeppelin-server"
}
],
"zookeeper": [
{
"conf_dir": "/etc/zookeeper/conf",
- "current_dir": "{0}/current/zookeeper-client/conf"
+ "current_dir": "{0}/current/zookeeper-client/conf",
+ "component": "zookeeper-client"
}
]
},
[04/50] [abbrv] ambari git commit: AMBARI-22689. Restart agent
command sent by server (Xianghao Lu via adoroszlai)
Posted by rl...@apache.org.
AMBARI-22689. Restart agent command sent by server (Xianghao Lu via adoroszlai)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e0b085af
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e0b085af
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e0b085af
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: e0b085afdbcfd85e80be314a7effdb562a52951a
Parents: 6db30d8
Author: Xianghao Lu <lu...@gmail.com>
Authored: Sun Dec 31 23:34:01 2017 +0100
Committer: Doroszlai, Attila <ad...@hortonworks.com>
Committed: Sun Dec 31 23:34:01 2017 +0100
----------------------------------------------------------------------
ambari-agent/src/main/python/ambari_agent/Controller.py | 2 +-
ambari-agent/src/test/python/ambari_agent/TestController.py | 8 ++++----
.../test/python/ambari_agent/examples/ControllerTester.py | 6 +++---
3 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/e0b085af/ambari-agent/src/main/python/ambari_agent/Controller.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/Controller.py b/ambari-agent/src/main/python/ambari_agent/Controller.py
index e4f148f..6862cbb 100644
--- a/ambari-agent/src/main/python/ambari_agent/Controller.py
+++ b/ambari-agent/src/main/python/ambari_agent/Controller.py
@@ -418,7 +418,7 @@ class Controller(threading.Thread):
logger.log(logging_level, "Executing alert commands")
self.alert_scheduler_handler.execute_alert(response['alertExecutionCommands'])
- if "true" == response['restartAgent']:
+ if response['restartAgent']:
logger.error("Received the restartAgent command")
self.restartAgent()
else:
http://git-wip-us.apache.org/repos/asf/ambari/blob/e0b085af/ambari-agent/src/test/python/ambari_agent/TestController.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestController.py b/ambari-agent/src/test/python/ambari_agent/TestController.py
index 20da81f..cb69e5d 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestController.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestController.py
@@ -447,7 +447,7 @@ class TestController(unittest.TestCase):
self.controller.sendRequest = sendRequest
self.controller.responseId = 1
- response = {"responseId":"2", "restartAgent":"false"}
+ response = {"responseId":"2", "restartAgent":False}
sendRequest.return_value = response
def one_heartbeat(*args, **kwargs):
@@ -521,7 +521,7 @@ class TestController(unittest.TestCase):
# wrong responseId => restart
self.controller.responseId = 2
- response = {"responseId":"2", "restartAgent":"false"}
+ response = {"responseId":"2", "restartAgent":False}
restartAgent = MagicMock(name="restartAgent")
self.controller.restartAgent = restartAgent
@@ -553,7 +553,7 @@ class TestController(unittest.TestCase):
# restartAgent command
self.controller.responseId = 1
self.controller.DEBUG_STOP_HEARTBEATING = False
- response["restartAgent"] = "true"
+ response["restartAgent"] = True
restartAgent = MagicMock(name="restartAgent")
self.controller.restartAgent = restartAgent
self.controller.heartbeatWithServer()
@@ -564,7 +564,7 @@ class TestController(unittest.TestCase):
self.controller.responseId = 1
self.controller.DEBUG_STOP_HEARTBEATING = False
actionQueue.isIdle.return_value = False
- response["restartAgent"] = "false"
+ response["restartAgent"] = False
self.controller.heartbeatWithServer()
http://git-wip-us.apache.org/repos/asf/ambari/blob/e0b085af/ambari-agent/src/test/python/ambari_agent/examples/ControllerTester.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/examples/ControllerTester.py b/ambari-agent/src/test/python/ambari_agent/examples/ControllerTester.py
index bc46ac6..4a6e781 100644
--- a/ambari-agent/src/test/python/ambari_agent/examples/ControllerTester.py
+++ b/ambari-agent/src/test/python/ambari_agent/examples/ControllerTester.py
@@ -47,7 +47,7 @@ responces = [
"""
{
"responseId":"n",
- "restartAgent": "False",
+ "restartAgent": false,
"executionCommands":
[{
"commandId": "31-1",
@@ -89,7 +89,7 @@ responces = [
"""
{
"responseId":"n",
- "restartAgent": "False",
+ "restartAgent": false,
"executionCommands": [],
"statusCommands":[]
}
@@ -183,7 +183,7 @@ if __name__ == '__main__':
# s = """
# {
# "responseId":"n",
-# "restartAgent": "False",
+# "restartAgent": false,
# "executionCommands":
# [{
# "commandId": "31-1",
[27/50] [abbrv] ambari git commit: AMBARI-22640 - HBase Cannot Find
LZO Classes After Being Patched (jonathanhurley)
Posted by rl...@apache.org.
AMBARI-22640 - HBase Cannot Find LZO Classes After Being Patched (jonathanhurley)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/10711361
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/10711361
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/10711361
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 10711361ba2d158500b82b30662f2c062da1fee2
Parents: 26a33e5
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Tue Dec 12 16:18:47 2017 -0500
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Fri Jan 5 17:54:16 2018 -0500
----------------------------------------------------------------------
.../HBASE/0.96.0.2.0/package/scripts/hbase.py | 26 ++++++++-----
.../HBASE/2.0.0.3.0/package/scripts/hbase.py | 39 ++++++++++++--------
2 files changed, 41 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/10711361/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase.py b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase.py
index cec6b2a..6490b59 100644
--- a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase.py
+++ b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase.py
@@ -18,18 +18,23 @@ limitations under the License.
"""
from urlparse import urlparse
+
import os
-import sys
-from resource_management.libraries.script.script import Script
-from resource_management.libraries.resources.xml_config import XmlConfig
-from resource_management.libraries.resources.template_config import TemplateConfig
-from resource_management.libraries.functions.format import format
-from resource_management.core.source import Template, InlineTemplate
-from resource_management.core.resources import Package
-from resource_management.core.resources.service import ServiceConfig
-from resource_management.core.resources.system import Directory, Execute, File
+
from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
from ambari_commons import OSConst
+from resource_management.core.resources import Directory
+from resource_management.core.resources import Execute
+from resource_management.core.resources import File
+from resource_management.core.resources import Package
+from resource_management.core.resources import ServiceConfig
+from resource_management.core.source import InlineTemplate
+from resource_management.core.source import Template
+from resource_management.libraries import Script
+from resource_management.libraries.functions import format
+from resource_management.libraries.functions import lzo_utils
+from resource_management.libraries.resources import TemplateConfig
+from resource_management.libraries.resources import XmlConfig
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
@@ -55,6 +60,9 @@ def hbase(name=None):
def hbase(name=None):
import params
+ # ensure that matching LZO libraries are installed for HBase
+ lzo_utils.install_lzo_if_needed()
+
Directory( params.etc_prefix_dir,
mode=0755
)
http://git-wip-us.apache.org/repos/asf/ambari/blob/10711361/ambari-server/src/main/resources/common-services/HBASE/2.0.0.3.0/package/scripts/hbase.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HBASE/2.0.0.3.0/package/scripts/hbase.py b/ambari-server/src/main/resources/common-services/HBASE/2.0.0.3.0/package/scripts/hbase.py
index fced4fc..1a25095 100644
--- a/ambari-server/src/main/resources/common-services/HBASE/2.0.0.3.0/package/scripts/hbase.py
+++ b/ambari-server/src/main/resources/common-services/HBASE/2.0.0.3.0/package/scripts/hbase.py
@@ -17,18 +17,24 @@ See the License for the specific language governing permissions and
limitations under the License.
"""
+from urlparse import urlparse
+
import os
-import sys
-from resource_management.libraries.script.script import Script
-from resource_management.libraries.resources.xml_config import XmlConfig
-from resource_management.libraries.resources.template_config import TemplateConfig
-from resource_management.libraries.functions.format import format
-from resource_management.core.source import Template, InlineTemplate
-from resource_management.core.resources import Package
-from resource_management.core.resources.service import ServiceConfig
-from resource_management.core.resources.system import Directory, Execute, File
+
from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
from ambari_commons import OSConst
+from resource_management.core.resources import Directory
+from resource_management.core.resources import Execute
+from resource_management.core.resources import File
+from resource_management.core.resources import Package
+from resource_management.core.resources import ServiceConfig
+from resource_management.core.source import InlineTemplate
+from resource_management.core.source import Template
+from resource_management.libraries import Script
+from resource_management.libraries.functions import format
+from resource_management.libraries.functions import lzo_utils
+from resource_management.libraries.resources import TemplateConfig
+from resource_management.libraries.resources import XmlConfig
from resource_management.libraries.functions.constants import StackFeature
from resource_management.libraries.functions.stack_features import check_stack_feature
@@ -54,6 +60,9 @@ def hbase(name=None):
def hbase(name=None):
import params
+ # ensure that matching LZO libraries are installed for HBase
+ lzo_utils.install_lzo_if_needed()
+
Directory( params.etc_prefix_dir,
mode=0755
)
@@ -63,7 +72,7 @@ def hbase(name=None):
group = params.user_group,
create_parents = True
)
-
+
Directory(params.java_io_tmpdir,
create_parents = True,
mode=0777
@@ -83,7 +92,7 @@ def hbase(name=None):
create_parents = True,
mode = 0755
)
-
+
parent_dir = os.path.dirname(params.tmp_dir)
# In case if we have several placeholders in path
while ("${" in parent_dir):
@@ -136,7 +145,7 @@ def hbase(name=None):
group = params.user_group
)
# Manually overriding ownership of file installed by hadoop package
- else:
+ else:
File( format("{params.hbase_conf_dir}/hbase-policy.xml"),
owner = params.hbase_user,
group = params.user_group
@@ -147,14 +156,14 @@ def hbase(name=None):
content=InlineTemplate(params.hbase_env_sh_template),
group = params.user_group,
)
-
+
# On some OS this folder could be not exists, so we will create it before pushing there files
Directory(params.limits_conf_dir,
create_parents = True,
owner='root',
group='root'
)
-
+
File(os.path.join(params.limits_conf_dir, 'hbase.conf'),
owner='root',
group='root',
@@ -174,7 +183,7 @@ def hbase(name=None):
cd_access = "a",
mode = 0755,
)
-
+
Directory (params.log_dir,
owner = params.hbase_user,
create_parents = True,
[34/50] [abbrv] ambari git commit: AMBARI-22665 - Livy2 Does Not
Start On HDP 2.6.0 to 2.6.3 (jonathanhurley)
Posted by rl...@apache.org.
AMBARI-22665 - Livy2 Does Not Start On HDP 2.6.0 to 2.6.3 (jonathanhurley)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/df19a693
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/df19a693
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/df19a693
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: df19a69364b470b063e0790847af640c99262daa
Parents: 9e9f68f
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Mon Dec 18 12:23:06 2017 -0500
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Fri Jan 5 17:54:16 2018 -0500
----------------------------------------------------------------------
.../resource_management/libraries/functions/conf_select.py | 7 +++++++
.../main/resources/custom_actions/scripts/install_packages.py | 4 ++--
2 files changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/df19a693/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py b/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py
index d38e273..9de2f8f 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/conf_select.py
@@ -211,6 +211,13 @@ def convert_conf_directories_to_symlinks(package, version, dirs):
# determine which directories would be created, if any are needed
dry_run_directory = create(stack_name, package, version, dry_run = True)
+ # if the dry run reported an error, then we must assume that the package does not exist in
+ # the conf-select tool
+ if len(dry_run_directory) == 0:
+ Logger.info("The conf-select tool reported an error for the package {0}. The configuration linking will be skipped.".format(package))
+ return
+
+
need_dirs = []
for d in dry_run_directory:
if not os.path.exists(d):
http://git-wip-us.apache.org/repos/asf/ambari/blob/df19a693/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py b/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
index c3fbc48..4cdb0e5 100644
--- a/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
+++ b/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
@@ -184,10 +184,10 @@ class InstallPackages(Script):
from resource_management.libraries.functions import stack_select
package_dirs = conf_select.get_package_dirs()
if package_name in package_dirs:
- Logger.info("Attempting to fix the default conf links for {0}".format(package_name))
+ Logger.info("Determining if the default conf links for {0} need to be fixed".format(package_name))
directories = package_dirs[package_name]
- Logger.info("The following directories will be fixed for {0}: {1}".format(package_name,
+ Logger.info("The following directories will be checked for {0}: {1}".format(package_name,
str(directories)))
stack_version = stack_select.get_stack_version_before_install(component_name)
[18/50] [abbrv] ambari git commit: AMBARI-22723. Ambari Upgrade
failed in case if database have no cluster_version table already. The issue
with idempotence (dlysnichenko)
Posted by rl...@apache.org.
AMBARI-22723. Ambari Upgrade failed in case if database have no cluster_version table already. The issue with idempotence (dlysnichenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/dfb97855
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/dfb97855
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/dfb97855
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: dfb97855196ff3e40ae4b6742eabe31082560fe6
Parents: c088e59
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Thu Jan 4 18:36:34 2018 +0200
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Thu Jan 4 18:36:34 2018 +0200
----------------------------------------------------------------------
.../main/java/org/apache/ambari/server/orm/DBAccessorImpl.java | 3 +++
.../java/org/apache/ambari/server/upgrade/UpgradeCatalog260.java | 3 +++
.../org/apache/ambari/server/upgrade/UpgradeCatalog260Test.java | 1 +
3 files changed, 7 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/dfb97855/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java
index d36367d..3a42342 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java
@@ -1449,6 +1449,9 @@ public class DBAccessorImpl implements DBAccessor {
public List<Integer> getIntColumnValues(String tableName, String columnName, String[] ConditionColumnNames,
String[] values, boolean ignoreFailure) throws SQLException {
+ if (!tableExists(tableName)) {
+ throw new IllegalArgumentException(String.format("%s table does not exist", tableName));
+ }
if (!tableHasColumn(tableName, columnName)) {
throw new IllegalArgumentException(String.format("%s table does not contain %s column", tableName, columnName));
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/dfb97855/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog260.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog260.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog260.java
index 11b765c..6bcf8a9 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog260.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog260.java
@@ -531,6 +531,9 @@ public class UpgradeCatalog260 extends AbstractUpgradeCatalog {
* @throws SQLException
*/
public Integer getCurrentVersionID() throws AmbariException, SQLException {
+ if (!dbAccessor.tableExists(CLUSTER_VERSION_TABLE)) {
+ return null;
+ }
List<Integer> currentVersionList = dbAccessor.getIntColumnValues(CLUSTER_VERSION_TABLE, REPO_VERSION_ID_COLUMN,
new String[]{STATE_COLUMN}, new String[]{CURRENT}, false);
if (currentVersionList.isEmpty()) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/dfb97855/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog260Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog260Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog260Test.java
index c88d1a1..90fb029 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog260Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog260Test.java
@@ -517,6 +517,7 @@ public class UpgradeCatalog260Test {
}
public void expectGetCurrentVersionID(List<Integer> current, Capture<String[]> scdcaptureKey, Capture<String[]> scdcaptureValue) throws SQLException {
+ expect(dbAccessor.tableExists(eq("cluster_version"))).andReturn(true).once();
expect(dbAccessor.getIntColumnValues(eq("cluster_version"), eq("repo_version_id"),
capture(scdcaptureKey), capture(scdcaptureValue), eq(false))).andReturn(current).once();
}
[39/50] [abbrv] ambari git commit: AMBARI-22639. Log Feeder refactor:
integrate with spring boot (oleewere)
Posted by rl...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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
[42/50] [abbrv] ambari git commit: AMBARI-22648: zeppelin server
keytab missing from zeppelin-site.xml (Bikas Saha via jluniya)
Posted by rl...@apache.org.
AMBARI-22648: zeppelin server keytab missing from zeppelin-site.xml (Bikas Saha via jluniya)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/67b06423
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/67b06423
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/67b06423
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 67b06423b8872e67c7ec75b73f2ac415f55914ca
Parents: ada1ea5
Author: Jayush Luniya <jl...@hortonworks.com>
Authored: Thu Dec 14 16:41:43 2017 -0800
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Fri Jan 5 17:54:16 2018 -0500
----------------------------------------------------------------------
.../common-services/ZEPPELIN/0.7.0/package/scripts/master.py | 8 +++++++-
.../src/test/python/stacks/2.6/configs/default.json | 2 ++
2 files changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/67b06423/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 ee264a4..df892f8 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
@@ -137,9 +137,15 @@ class Master(Script):
self.chown_zeppelin_pid_dir(env)
# write out zeppelin-site.xml
+ my_map = {}
+ for key, value in params.config['configurations']['zeppelin-config'].iteritems():
+ my_map[key]=value
+ my_map['zeppelin.server.kerberos.keytab']=params.zeppelin_kerberos_keytab
+ my_map['zeppelin.server.kerberos.principal']=params.zeppelin_kerberos_principal
+
XmlConfig("zeppelin-site.xml",
conf_dir=params.conf_dir,
- configurations=params.config['configurations']['zeppelin-config'],
+ configurations=my_map,
owner=params.zeppelin_user,
group=params.zeppelin_group
)
http://git-wip-us.apache.org/repos/asf/ambari/blob/67b06423/ambari-server/src/test/python/stacks/2.6/configs/default.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.6/configs/default.json b/ambari-server/src/test/python/stacks/2.6/configs/default.json
index 10647fd..fb7cb49 100644
--- a/ambari-server/src/test/python/stacks/2.6/configs/default.json
+++ b/ambari-server/src/test/python/stacks/2.6/configs/default.json
@@ -362,6 +362,8 @@
"zeppelin.notebook.s3.bucket": "zeppelin",
"zeppelin.notebook.homescreen.hide": "false",
"zeppelin.server.allowed.origins": "*",
+ "zeppelin.server.kerberos.keytab": "",
+ "zeppelin.server.kerberos.principal": "",
"zeppelin.interpreter.config.upgrade": "true"
},
"zoo.cfg": {
[45/50] [abbrv] ambari git commit: AMBARI-22672. Error on add version
view in web admin (alexantonenko)
Posted by rl...@apache.org.
AMBARI-22672. Error on add version view in web admin (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e077bd27
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e077bd27
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e077bd27
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: e077bd2793826205eb5a300dde25eb75569c3cfd
Parents: 72657b6
Author: Alex Antonenko <aa...@hortonworks.com>
Authored: Tue Dec 19 16:42:37 2017 +0300
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Fri Jan 5 17:54:17 2018 -0500
----------------------------------------------------------------------
.../scripts/controllers/stackVersions/StackVersionsCreateCtrl.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/e077bd27/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsCreateCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsCreateCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsCreateCtrl.js
index 3d93b0d..2a2151d 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsCreateCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsCreateCtrl.js
@@ -43,7 +43,7 @@ angular.module('ambariAdminConsole')
$scope.isGPLAccepted = false;
$scope.isGPLRepo = function (repository) {
- return repository.Repositories.tags.indexOf('GPL') >= 0;
+ return repository.Repositories.tags && repository.Repositories.tags.indexOf('GPL') >= 0;
};
$scope.showRepo = function (repository) {
[16/50] [abbrv] ambari git commit: AMBARI-21559. Alert definition
paths should be updated on upgrade
Posted by rl...@apache.org.
AMBARI-21559. Alert definition paths should be updated on upgrade
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/217620b0
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/217620b0
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/217620b0
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 217620b0a2d13e1ac8432d6dcb38ae27316d1aab
Parents: e2be62d
Author: Attila Doroszlai <ad...@hortonworks.com>
Authored: Mon Jul 24 13:06:29 2017 +0200
Committer: Doroszlai, Attila <ad...@hortonworks.com>
Committed: Thu Jan 4 15:59:59 2018 +0100
----------------------------------------------------------------------
.../server/api/services/AmbariMetaInfo.java | 34 ++++++++++--
.../ambari/server/controller/AmbariServer.java | 2 +-
.../state/alert/AlertDefinitionFactory.java | 31 ++++++++---
.../ambari/server/state/alert/ScriptSource.java | 4 ++
.../upgrade/AbstractFinalUpgradeCatalog.java | 58 ++++++++++++++++++++
.../server/upgrade/FinalUpgradeCatalog.java | 28 +---------
.../server/upgrade/SchemaUpgradeHelper.java | 1 +
.../server/upgrade/UpdateAlertScriptPaths.java | 48 ++++++++++++++++
.../server/api/services/AmbariMetaInfoTest.java | 6 +-
9 files changed, 168 insertions(+), 44 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/217620b0/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
index 9fee0ae..5f63c76 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
@@ -34,6 +34,7 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Scanner;
import java.util.Set;
@@ -70,6 +71,9 @@ import org.apache.ambari.server.state.StackId;
import org.apache.ambari.server.state.StackInfo;
import org.apache.ambari.server.state.alert.AlertDefinition;
import org.apache.ambari.server.state.alert.AlertDefinitionFactory;
+import org.apache.ambari.server.state.alert.ScriptSource;
+import org.apache.ambari.server.state.alert.Source;
+import org.apache.ambari.server.state.alert.SourceType;
import org.apache.ambari.server.state.kerberos.KerberosDescriptor;
import org.apache.ambari.server.state.kerberos.KerberosDescriptorFactory;
import org.apache.ambari.server.state.kerberos.KerberosServiceDescriptor;
@@ -1041,9 +1045,10 @@ public class AmbariMetaInfo {
* service.
*
* @param clusters all clusters
- * @throws AmbariException
+ * @param updateScriptPaths whether existing script-based alerts should be updated
+ * with possibly new paths from the stack definition
*/
- public void reconcileAlertDefinitions(Clusters clusters)
+ public void reconcileAlertDefinitions(Clusters clusters, boolean updateScriptPaths)
throws AmbariException {
Map<String, Cluster> clusterMap = clusters.getClusters();
@@ -1120,6 +1125,26 @@ public class AmbariMetaInfo {
LOG.debug(
"The alert named {} has been modified from the stack definition and will not be merged",
stackDefinition.getName());
+
+ if (updateScriptPaths) {
+ Source databaseSource = databaseDefinition.getSource();
+ Source stackSource = stackDefinition.getSource();
+ if (databaseSource.getType() == SourceType.SCRIPT && stackSource.getType() == SourceType.SCRIPT) {
+ ScriptSource databaseScript = (ScriptSource) databaseSource;
+ ScriptSource stackScript = (ScriptSource) stackSource;
+ String oldPath = databaseScript.getPath();
+ String newPath = stackScript.getPath();
+ if (!Objects.equals(oldPath, newPath)) {
+ databaseScript.setPath(newPath);
+ entity = alertDefinitionFactory.mergeSource(databaseScript, entity);
+ persist.add(entity);
+
+ LOG.info("Updating script path for the alert named {} from '{}' to '{}'",
+ stackDefinition.getName(), oldPath, newPath
+ );
+ }
+ }
+ }
}
}
@@ -1149,10 +1174,7 @@ public class AmbariMetaInfo {
// persist any new or updated definition
for (AlertDefinitionEntity entity : persist) {
- if (LOG.isDebugEnabled()) {
- LOG.info("Merging Alert Definition {} into the database",
- entity.getDefinitionName());
- }
+ LOG.debug("Merging Alert Definition {} into the database", entity.getDefinitionName());
alertDefinitionDao.createOrUpdate(entity);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/217620b0/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
index 64a4338..cb93e47 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
@@ -533,7 +533,7 @@ public class AmbariServer {
LOG.info(clusterDump.toString());
LOG.info("********* Reconciling Alert Definitions **********");
- ambariMetaInfo.reconcileAlertDefinitions(clusters);
+ ambariMetaInfo.reconcileAlertDefinitions(clusters, false);
LOG.info("********* Initializing ActionManager **********");
ActionManager manager = injector.getInstance(ActionManager.class);
http://git-wip-us.apache.org/repos/asf/ambari/blob/217620b0/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AlertDefinitionFactory.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AlertDefinitionFactory.java b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AlertDefinitionFactory.java
index 2e309e5..ecf025f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AlertDefinitionFactory.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/AlertDefinitionFactory.java
@@ -249,7 +249,6 @@ public class AlertDefinitionFactory {
entity.setDefinitionName(definition.getName());
entity.setEnabled(definition.isEnabled());
entity.setHostIgnored(definition.isHostIgnored());
- entity.setHash(UUID.randomUUID().toString());
entity.setLabel(definition.getLabel());
entity.setDescription(definition.getDescription());
entity.setScheduleInterval(definition.getInterval());
@@ -263,24 +262,42 @@ public class AlertDefinitionFactory {
entity.setScope(scope);
- Source source = definition.getSource();
+ return mergeSource(definition.getSource(), entity);
+ }
+
+ /**
+ * Updates source and source type of <code>entity</code> from <code>source</code>.
+ * Also updates UUID, which must be done for any change in to the entity for it
+ * to take effect on the agents.
+ *
+ * @return the updated entity to be persisted, or null if alert source cannot be serialized to JSON
+ */
+ public AlertDefinitionEntity mergeSource(Source source, AlertDefinitionEntity entity) {
entity.setSourceType(source.getType());
try {
String sourceJson = m_gson.toJson(source);
entity.setSource(sourceJson);
- } catch (Exception exception) {
- LOG.error(
- "Unable to serialize the alert definition source during coercion",
- exception);
-
+ } catch (Exception e) {
+ LOG.error("Unable to serialize the alert definition source during merge", e);
return null;
}
+ assignNewUUID(entity);
+
return entity;
}
/**
+ * Updates <code>entity</code> with a new UUID.
+ */
+ private static void assignNewUUID(AlertDefinitionEntity entity) {
+ if (entity != null) {
+ entity.setHash(UUID.randomUUID().toString());
+ }
+ }
+
+ /**
* Gets an instance of {@link Gson} that can correctly serialize and
* deserialize an {@link AlertDefinition}.
*
http://git-wip-us.apache.org/repos/asf/ambari/blob/217620b0/ambari-server/src/main/java/org/apache/ambari/server/state/alert/ScriptSource.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/ScriptSource.java b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/ScriptSource.java
index a5ed440..a4f9b27 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/alert/ScriptSource.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/alert/ScriptSource.java
@@ -37,6 +37,10 @@ public class ScriptSource extends ParameterizedSource {
return m_path;
}
+ public void setPath(String path) {
+ m_path = path;
+ }
+
/**
* {@inheritDoc}
*/
http://git-wip-us.apache.org/repos/asf/ambari/blob/217620b0/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractFinalUpgradeCatalog.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractFinalUpgradeCatalog.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractFinalUpgradeCatalog.java
new file mode 100644
index 0000000..9abf548
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractFinalUpgradeCatalog.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.upgrade;
+
+import java.sql.SQLException;
+
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.utils.VersionUtils;
+
+import com.google.inject.Injector;
+
+/**
+ * Upgrade catalog which is executed after all version-dependent catalogs.
+ */
+public abstract class AbstractFinalUpgradeCatalog extends AbstractUpgradeCatalog {
+ AbstractFinalUpgradeCatalog(Injector injector) {
+ super(injector);
+ }
+
+ @Override
+ protected void executeDDLUpdates() throws AmbariException, SQLException {
+ //no-op
+ }
+
+ @Override
+ protected void executePreDMLUpdates() throws AmbariException, SQLException {
+ //no-op
+ }
+
+ @Override
+ public String getTargetVersion() {
+ return getFinalVersion();
+ }
+
+ @Override
+ public boolean isFinal() {
+ return true;
+ }
+
+ private String getFinalVersion() {
+ return VersionUtils.getVersionSubstring(configuration.getServerVersion());
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/217620b0/ambari-server/src/main/java/org/apache/ambari/server/upgrade/FinalUpgradeCatalog.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/FinalUpgradeCatalog.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/FinalUpgradeCatalog.java
index 052edba..591ec38 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/FinalUpgradeCatalog.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/FinalUpgradeCatalog.java
@@ -35,7 +35,6 @@ import org.apache.ambari.server.state.PropertyInfo;
import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.StackId;
import org.apache.ambari.server.state.StackInfo;
-import org.apache.ambari.server.utils.VersionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,7 +44,7 @@ import com.google.inject.Injector;
/**
* Final upgrade catalog which simply updates database version (in case if no db changes between releases)
*/
-public class FinalUpgradeCatalog extends AbstractUpgradeCatalog {
+public class FinalUpgradeCatalog extends AbstractFinalUpgradeCatalog {
/**
* Logger.
@@ -58,16 +57,6 @@ public class FinalUpgradeCatalog extends AbstractUpgradeCatalog {
}
@Override
- protected void executeDDLUpdates() throws AmbariException, SQLException {
- //noop
- }
-
- @Override
- protected void executePreDMLUpdates() throws AmbariException, SQLException {
- //noop
- }
-
- @Override
protected void executeDMLUpdates() throws AmbariException, SQLException {
updateClusterEnv();
}
@@ -82,8 +71,6 @@ public class FinalUpgradeCatalog extends AbstractUpgradeCatalog {
*
* Note: Config properties stack_features and stack_tools should always be updated to latest values as defined
* in the stack on an Ambari upgrade.
- *
- * @throws Exception
*/
protected void updateClusterEnv() throws AmbariException {
@@ -117,17 +104,4 @@ public class FinalUpgradeCatalog extends AbstractUpgradeCatalog {
}
}
- @Override
- public String getTargetVersion() {
- return getFinalVersion();
- }
-
- @Override
- public boolean isFinal() {
- return true;
- }
-
- private String getFinalVersion() {
- return VersionUtils.getVersionSubstring(configuration.getServerVersion());
- }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/217620b0/ambari-server/src/main/java/org/apache/ambari/server/upgrade/SchemaUpgradeHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/SchemaUpgradeHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/SchemaUpgradeHelper.java
index 039e041..89fd1fb 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/SchemaUpgradeHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/SchemaUpgradeHelper.java
@@ -187,6 +187,7 @@ public class SchemaUpgradeHelper {
catalogBinder.addBinding().to(UpgradeCatalog260.class);
catalogBinder.addBinding().to(UpgradeCatalog261.class);
catalogBinder.addBinding().to(UpgradeCatalog300.class);
+ catalogBinder.addBinding().to(UpdateAlertScriptPaths.class);
catalogBinder.addBinding().to(FinalUpgradeCatalog.class);
EventBusSynchronizer.synchronizeAmbariEventPublisher(binder());
http://git-wip-us.apache.org/repos/asf/ambari/blob/217620b0/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpdateAlertScriptPaths.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpdateAlertScriptPaths.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpdateAlertScriptPaths.java
new file mode 100644
index 0000000..087a5af
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpdateAlertScriptPaths.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.upgrade;
+
+import java.sql.SQLException;
+
+import javax.inject.Inject;
+
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.api.services.AmbariMetaInfo;
+import org.apache.ambari.server.controller.AmbariManagementController;
+import org.apache.ambari.server.state.Clusters;
+
+import com.google.inject.Injector;
+
+/**
+ * Updates script-based alert definitions with paths from the stack.
+ */
+public class UpdateAlertScriptPaths extends AbstractFinalUpgradeCatalog {
+
+ @Inject
+ public UpdateAlertScriptPaths(Injector injector) {
+ super(injector);
+ }
+
+ @Override
+ protected void executeDMLUpdates() throws AmbariException, SQLException {
+ AmbariManagementController ambariManagementController = injector.getInstance(AmbariManagementController.class);
+ AmbariMetaInfo ambariMetaInfo = injector.getInstance(AmbariMetaInfo.class);
+ Clusters clusters = ambariManagementController.getClusters();
+ ambariMetaInfo.reconcileAlertDefinitions(clusters, true);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/217620b0/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
index f98cffd..83b8f87 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
@@ -1718,7 +1718,7 @@ public class AmbariMetaInfoTest {
cluster.addService("HDFS", repositoryVersion);
- metaInfo.reconcileAlertDefinitions(clusters);
+ metaInfo.reconcileAlertDefinitions(clusters, false);
AlertDefinitionDAO dao = injector.getInstance(AlertDefinitionDAO.class);
List<AlertDefinitionEntity> definitions = dao.findAll(clusterId);
@@ -1742,7 +1742,7 @@ public class AmbariMetaInfoTest {
dao.merge(definition);
}
- metaInfo.reconcileAlertDefinitions(clusters);
+ metaInfo.reconcileAlertDefinitions(clusters, false);
definitions = dao.findAll();
assertEquals(13, definitions.size());
@@ -1776,7 +1776,7 @@ public class AmbariMetaInfoTest {
assertEquals(13, definitions.size());
// reconcile, which should disable our bad definition
- metaInfo.reconcileAlertDefinitions(clusters);
+ metaInfo.reconcileAlertDefinitions(clusters, false);
// find all enabled for the cluster should find 6
definitions = dao.findAllEnabled(cluster.getClusterId());
[40/50] [abbrv] ambari git commit: AMBARI-22639. Log Feeder refactor:
integrate with spring boot (oleewere)
Posted by rl...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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);
[17/50] [abbrv] ambari git commit: AMBARI-22699. Update FE to
initiate regenerate keytab file operations for a service and a host
(alexantonenko)
Posted by rl...@apache.org.
AMBARI-22699. Update FE to initiate regenerate keytab file operations for a service and a host (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c088e59e
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c088e59e
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c088e59e
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: c088e59ebcf099b01603d883dce7700d44cabc68
Parents: 217620b
Author: Alex Antonenko <aa...@hortonworks.com>
Authored: Thu Jan 4 19:04:40 2018 +0300
Committer: Alex Antonenko <aa...@hortonworks.com>
Committed: Thu Jan 4 19:04:40 2018 +0300
----------------------------------------------------------------------
ambari-web/app/controllers/main/host/details.js | 32 +++++++++++++++++++-
ambari-web/app/controllers/main/service/item.js | 25 +++++++++++++++
ambari-web/app/messages.js | 4 +++
ambari-web/app/models/host_component.js | 6 ++++
ambari-web/app/utils/ajax/ajax.js | 30 ++++++++++++++++++
ambari-web/app/views/main/host/details.js | 4 +++
ambari-web/app/views/main/service/item.js | 4 +++
ambari-web/test/utils/date/timezone_test.js | 2 +-
8 files changed, 105 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/c088e59e/ambari-web/app/controllers/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js
index 20a72bf..e52eec0 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -2305,6 +2305,9 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
case "checkHost":
this.runHostCheckConfirmation();
break;
+ case "regenerateKeytabFileOperations":
+ this.regenerateKeytabFileOperations();
+ break;
}
},
@@ -3241,6 +3244,33 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
}
});
}
- }
+ },
+
+
+ regenerateKeytabFileOperations: function () {
+ var self = this;
+ var hostName = this.content.get('hostName');
+ var clusterName = App.get('clusterName');
+ return App.showConfirmationPopup(function() {
+ return App.ajax.send({
+ name: "admin.kerberos_security.regenerate_keytabs.host",
+ sender: self,
+ data: {
+ clusterName: clusterName,
+ hostName: hostName
+ },
+ success: 'regenerateKeytabFileOperationsRequestSuccess',
+ error: 'regenerateKeytabFileOperationsRequestError'
+ });
+ }, Em.I18n.t('question.sure.regenerateKeytab.host').format(hostName));
+ },
+
+ regenerateKeytabFileOperationsRequestSuccess: function(){
+ App.router.get('backgroundOperationsController').showPopup();
+ },
+
+ regenerateKeytabFileOperationsRequestError: function () {
+ App.showAlertPopup(Em.I18n.t('common.error'), Em.I18n.t('alerts.notifications.regenerateKeytab.host.error').format(this.content.get('hostName')));
+ },
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/c088e59e/ambari-web/app/controllers/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/item.js b/ambari-web/app/controllers/main/service/item.js
index f8a6e62..690869b 100644
--- a/ambari-web/app/controllers/main/service/item.js
+++ b/ambari-web/app/controllers/main/service/item.js
@@ -780,6 +780,31 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
App.showAlertPopup(Em.I18n.t('services.service.actions.run.rebalanceHdfsNodes.error'), error);
},
+ regenerateKeytabFileOperations: function () {
+ var self = this;
+ var serviceName = this.content.get('serviceName');
+ var clusterName = App.get('clusterName');
+ return App.showConfirmationPopup(function() {
+ return App.ajax.send({
+ name: "admin.kerberos_security.regenerate_keytabs.service",
+ sender: self,
+ data: {
+ clusterName: clusterName,
+ serviceName: serviceName
+ },
+ success: 'regenerateKeytabFileOperationsRequestSuccess',
+ error: 'regenerateKeytabFileOperationsRequestError'
+ });
+ }, Em.I18n.t('question.sure.regenerateKeytab.service').format(serviceName));
+ },
+
+ regenerateKeytabFileOperationsRequestSuccess: function(){
+ App.router.get('backgroundOperationsController').showPopup();
+ },
+
+ regenerateKeytabFileOperationsRequestError: function () {
+ App.showAlertPopup(Em.I18n.t('common.error'), Em.I18n.t('alerts.notifications.regenerateKeytab.service.error').format(this.content.get('serviceName')));
+ },
/**
* On click callback for <code>run compaction</code> button
* @param event
http://git-wip-us.apache.org/repos/asf/ambari/blob/c088e59e/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 6da0368..bfd4264 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -439,6 +439,8 @@ Em.I18n.translations = {
'question.sure.startAll':'Are you sure you want to start all the components?',
'question.sure.stopAll':'Are you sure you want to stop all the components?',
'question.sure.restartAll':'Are you sure you want to restart all the components?',
+ 'question.sure.regenerateKeytab.service': 'Are you sure you want to regenerate keytab file operations for a {0} service?',
+ 'question.sure.regenerateKeytab.host': 'Are you sure you want to regenerate keytab file operations for a {0} host?',
'popup.highlight':'click to highlight',
'popup.confirmation.commonHeader':'Confirmation',
@@ -1189,6 +1191,8 @@ Em.I18n.translations = {
'alerts.notifications.addCustomPropertyPopup.header': 'Add Property',
'alerts.notifications.addCustomPropertyPopup.error.propertyExists': 'Custom Property with current name already exists',
'alerts.notifications.addCustomPropertyPopup.error.invalidPropertyName': 'Property name can only contain letters, numbers or . -_* characters',
+ 'alerts.notifications.regenerateKeytab.service.error' : 'Keytabs for {0} service could not be regenerated',
+ 'alerts.notifications.regenerateKeytab.host.error' : 'Keytabs for {0} host could not be regenerated',
'wizard.progressPage.notice.completed':'Please proceed to the next step.',
http://git-wip-us.apache.org/repos/asf/ambari/blob/c088e59e/ambari-web/app/models/host_component.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/host_component.js b/ambari-web/app/models/host_component.js
index cdcf991..19eb085 100644
--- a/ambari-web/app/models/host_component.js
+++ b/ambari-web/app/models/host_component.js
@@ -311,6 +311,12 @@ App.HostComponentActionMap = {
cssClass: 'glyphicon glyphicon-refresh',
disabled: false
},
+ REGENERATE_KEYTAB_FILE_OPERATIONS: {
+ action: 'regenerateKeytabFileOperations',
+ label: Em.I18n.t('admin.kerberos.button.regenerateKeytabs'),
+ cssClass: 'glyphicon glyphicon-repeat',
+ isHidden: !App.get('isKerberosEnabled')
+ },
REFRESHQUEUES: {
action: 'refreshYarnQueues',
customCommand: 'REFRESHQUEUES',
http://git-wip-us.apache.org/repos/asf/ambari/blob/c088e59e/ambari-web/app/utils/ajax/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js
index 483be5e..10e62d1 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -1911,6 +1911,36 @@ var urls = {
}
},
+ 'admin.kerberos_security.regenerate_keytabs.service' : {
+ 'real': '/clusters/{clusterName}?regenerate_keytabs=all®enerate_components={serviceName}',
+ 'mock': '',
+ 'type': 'PUT',
+ 'format': function (data) {
+ return {
+ data: JSON.stringify({
+ "Clusters" : {
+ "security_type" : "KERBEROS"
+ }
+ })
+ }
+ }
+ },
+
+ 'admin.kerberos_security.regenerate_keytabs.host' : {
+ 'real': '/clusters/{clusterName}?regenerate_keytabs=all®enerate_hosts={hostName}',
+ 'mock': '',
+ 'type': 'PUT',
+ 'format': function (data) {
+ return {
+ data: JSON.stringify({
+ "Clusters" : {
+ "security_type" : "KERBEROS"
+ }
+ })
+ }
+ }
+ },
+
'wizard.step1.post_version_definition_file.xml': {
'real': '/version_definitions?dry_run=true',
'mock': '',
http://git-wip-us.apache.org/repos/asf/ambari/blob/c088e59e/ambari-web/app/views/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/details.js b/ambari-web/app/views/main/host/details.js
index 54e3a76..2cf4f42 100644
--- a/ambari-web/app/views/main/host/details.js
+++ b/ambari-web/app/views/main/host/details.js
@@ -80,6 +80,10 @@ App.MainHostDetailsView = Em.View.extend({
label: this.t('passiveState.turn' + onOff)
});
}
+ if (App.get('isKerberosEnabled')){
+ var actionMap = App.HostComponentActionMap.getMap(this);
+ result.push(actionMap.REGENERATE_KEYTAB_FILE_OPERATIONS);
+ }
if (App.isAuthorized("HOST.ADD_DELETE_HOSTS")) {
result.push({
action: 'deleteHost',
http://git-wip-us.apache.org/repos/asf/ambari/blob/c088e59e/ambari-web/app/views/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/item.js b/ambari-web/app/views/main/service/item.js
index 945dc8f..72e5e39 100644
--- a/ambari-web/app/views/main/service/item.js
+++ b/ambari-web/app/views/main/service/item.js
@@ -259,6 +259,10 @@ App.MainServiceItemView = Em.View.extend({
});
}
+ if (App.get('isKerberosEnabled')){
+ options.push(actionMap.REGENERATE_KEYTAB_FILE_OPERATIONS);
+ }
+
allMasters.forEach(function(master) {
var component = App.StackServiceComponent.find(master);
var commands = component.get('customCommands');
http://git-wip-us.apache.org/repos/asf/ambari/blob/c088e59e/ambari-web/test/utils/date/timezone_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/date/timezone_test.js b/ambari-web/test/utils/date/timezone_test.js
index 37a8c8c..ebf5e68 100644
--- a/ambari-web/test/utils/date/timezone_test.js
+++ b/ambari-web/test/utils/date/timezone_test.js
@@ -139,7 +139,7 @@ describe('timezoneUtils', function () {
it('Detect UTC+1', function () {
mockTimezoneOffset(0, 60);
var tz = timezoneUtils.detectUserTimezone();
- expect(tz).to.contain('0-60|Atlantic');
+ expect(tz).to.contain('0-60|Africa');
});
it('Detect UTC+1 for Europe', function () {
[36/50] [abbrv] ambari git commit: AMBARI-22638.
yarn.timeline-service property enabled overriding preset secure blueprint
config for the same
Posted by rl...@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/da6a2010
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/da6a2010
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/da6a2010
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: da6a201058b9c94aaf413621d615483ae177c36e
Parents: 15d8d1a
Author: Doroszlai, Attila <ad...@hortonworks.com>
Authored: Wed Dec 13 07:14:38 2017 +0100
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Fri Jan 5 17:54:16 2018 -0500
----------------------------------------------------------------------
.../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/da6a2010/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
+}
[11/50] [abbrv] ambari git commit: AMBARI-22712. Update install
Wizard layout (akovalenko)
Posted by rl...@apache.org.
AMBARI-22712. Update install Wizard layout (akovalenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c813e055
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c813e055
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c813e055
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: c813e055a5c7db127e67185194b07b2b415f1ec6
Parents: a95759d
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Tue Jan 2 15:27:30 2018 +0200
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Tue Jan 2 17:27:04 2018 +0200
----------------------------------------------------------------------
.../HIVE/0.12.0.2.0/configuration/hive-env.xml | 1 +
.../HIVE/2.1.0.3.0/configuration/hive-env.xml | 1 +
.../OOZIE/4.0.0.2.0/configuration/oozie-env.xml | 1 +
.../OOZIE/4.2.0.3.0/configuration/oozie-env.xml | 1 +
.../services/HIVE/configuration/hive-env.xml | 1 +
.../services/OOZIE/configuration/oozie-env.xml | 1 +
ambari-web/app/controllers/installer.js | 2 +-
.../hawq/addStandby/step3_controller.js | 3 +-
.../main/admin/kerberos/wizard_controller.js | 2 +-
.../main/admin/stack_and_upgrade_controller.js | 2 +-
ambari-web/app/controllers/main/host/details.js | 2 +-
ambari-web/app/controllers/main/service/item.js | 4 +-
.../app/controllers/wizard/step3_controller.js | 2 +-
.../app/controllers/wizard/step6_controller.js | 12 ------
ambari-web/app/messages.js | 5 +--
.../configs/component_actions_by_configs.js | 4 +-
ambari-web/app/styles/application.less | 2 -
ambari-web/app/styles/hosts.less | 5 +++
.../app/styles/theme/bootstrap-ambari.css | 7 ++--
ambari-web/app/styles/wizard.less | 20 +++++++++
.../common/assign_master_components.hbs | 24 +++++------
ambari-web/app/templates/wizard/step3.hbs | 12 +++---
ambari-web/app/templates/wizard/step6.hbs | 30 +++++++++++---
.../wizard/step6/step6_issues_popup.hbs | 43 --------------------
.../common/assign_master_components_view.js | 4 +-
.../configs/widgets/combo_config_widget_view.js | 8 ++++
ambari-web/app/views/common/controls_view.js | 2 +-
.../common/form/manage_credentials_form_view.js | 3 +-
.../common/modal_popups/confirmation_popup.js | 11 +++--
.../kerberos/kerberos_wizard_controler_test.js | 8 ++--
30 files changed, 111 insertions(+), 112 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/c813e055/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-env.xml b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-env.xml
index 730b0e8..5bb2a26 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-env.xml
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-env.xml
@@ -92,6 +92,7 @@
<value-attributes>
<overridable>false</overridable>
<type>value-list</type>
+ <entries_editable>false</entries_editable>
<entries>
<entry>
<value>New MySQL Database</value>
http://git-wip-us.apache.org/repos/asf/ambari/blob/c813e055/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/configuration/hive-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/configuration/hive-env.xml b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/configuration/hive-env.xml
index 759a7bb..4703b6b 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/configuration/hive-env.xml
+++ b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/configuration/hive-env.xml
@@ -321,6 +321,7 @@
<value-attributes>
<overridable>false</overridable>
<type>value-list</type>
+ <entries_editable>false</entries_editable>
<entries>
<entry>
<value>New MySQL Database</value>
http://git-wip-us.apache.org/repos/asf/ambari/blob/c813e055/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/configuration/oozie-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/configuration/oozie-env.xml b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/configuration/oozie-env.xml
index 4eafe1c..f0c1e57 100644
--- a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/configuration/oozie-env.xml
+++ b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/configuration/oozie-env.xml
@@ -56,6 +56,7 @@
<value-attributes>
<overridable>false</overridable>
<type>value-list</type>
+ <entries_editable>false</entries_editable>
<entries>
<entry>
<value>New Derby Database</value>
http://git-wip-us.apache.org/repos/asf/ambari/blob/c813e055/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/configuration/oozie-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/configuration/oozie-env.xml b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/configuration/oozie-env.xml
index 225764e..d05bdb4 100644
--- a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/configuration/oozie-env.xml
+++ b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.3.0/configuration/oozie-env.xml
@@ -237,6 +237,7 @@ export HADOOP_OPTS="-Dhdp.version=${HDP_VERSION} ${HADOOP_OPTS}"
<value-attributes>
<overridable>false</overridable>
<type>value-list</type>
+ <entries_editable>false</entries_editable>
<entries>
<entry>
<value>New Derby Database</value>
http://git-wip-us.apache.org/repos/asf/ambari/blob/c813e055/ambari-server/src/main/resources/stacks/HDP/2.3/services/HIVE/configuration/hive-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/HIVE/configuration/hive-env.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/services/HIVE/configuration/hive-env.xml
index 01fd6ab..9391d0f 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/HIVE/configuration/hive-env.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/HIVE/configuration/hive-env.xml
@@ -90,6 +90,7 @@ export JAVA_LIBRARY_PATH="$JAVA_LIBRARY_PATH:{{jdbc_libs_dir}}"
<value-attributes>
<overridable>false</overridable>
<type>value-list</type>
+ <entries_editable>false</entries_editable>
<entries>
<entry>
<value>New MySQL Database</value>
http://git-wip-us.apache.org/repos/asf/ambari/blob/c813e055/ambari-server/src/main/resources/stacks/HDP/2.3/services/OOZIE/configuration/oozie-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/OOZIE/configuration/oozie-env.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/services/OOZIE/configuration/oozie-env.xml
index c4bc4c1..e742234 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/OOZIE/configuration/oozie-env.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/OOZIE/configuration/oozie-env.xml
@@ -115,6 +115,7 @@ export HADOOP_OPTS="-Dhdp.version=${HDP_VERSION} ${HADOOP_OPTS}"
<value-attributes>
<overridable>false</overridable>
<type>value-list</type>
+ <entries_editable>false</entries_editable>
<entries>
<entry>
<value>New Derby Database</value>
http://git-wip-us.apache.org/repos/asf/ambari/blob/c813e055/ambari-web/app/controllers/installer.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/installer.js b/ambari-web/app/controllers/installer.js
index 4ecdc9b..4aa57c3 100644
--- a/ambari-web/app/controllers/installer.js
+++ b/ambari-web/app/controllers/installer.js
@@ -1120,7 +1120,7 @@ App.InstallerController = App.WizardController.extend(App.Persist, {
}
var versionsString = stringUtils.getFormattedStringFromArray(versionsList, t('or'));
var popupBody = t('popup.jdkValidation.body').format(selectedStack.get('stackName') + ' ' + selectedStack.get('stackVersion'), versionsString, currentJDKVersion);
- App.showConfirmationPopup(sCallback, popupBody, fCallback, t('popup.jdkValidation.header'), t('common.proceedAnyway'), true);
+ App.showConfirmationPopup(sCallback, popupBody, fCallback, t('popup.jdkValidation.header'), t('common.proceedAnyway'), 'danger');
return;
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c813e055/ambari-web/app/controllers/main/admin/highAvailability/hawq/addStandby/step3_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/hawq/addStandby/step3_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/hawq/addStandby/step3_controller.js
index 81ece37..bc454c2 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/hawq/addStandby/step3_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/hawq/addStandby/step3_controller.js
@@ -150,8 +150,7 @@ App.AddHawqStandbyWizardStep3Controller = Em.Controller.extend({
Em.I18n.t('admin.addHawqStandby.wizard.step3.confirm.dataDir.body').format(dataDir, hawqStandby),
null,
Em.I18n.t('admin.addHawqStandby.wizard.step3.confirm.dataDir.title'),
- "Confirm",
- false
+ "Confirm"
);
}
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/c813e055/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js b/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js
index 64b2065..41a8006 100644
--- a/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js
+++ b/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js
@@ -345,7 +345,7 @@ App.KerberosWizardController = App.WizardController.extend(App.InstallComponent,
var primaryText = Em.I18n.t('common.exitAnyway');
var msg = isCritical ? Em.I18n.t('admin.kerberos.wizard.exit.critical.msg')
: Em.I18n.t('admin.kerberos.wizard.exit.warning.msg');
- return App.showConfirmationPopup(primary, msg, null, null, primaryText, isCritical);
+ return App.showConfirmationPopup(primary, msg, null, null, primaryText, isCritical ? 'danger' : 'success');
},
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/c813e055/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
index 35041bf..051af05 100644
--- a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
+++ b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
@@ -1488,7 +1488,7 @@ App.MainAdminStackAndUpgradeController = Em.Controller.extend(App.LocalStorage,
},
Em.I18n.t('admin.stackUpgrade.upgrade.retry.confirm.body').format(version.get('displayName')),
null,
- this.getUpgradeDowngradeHeader(version.get('upgradeTypeDislayName'), version.get('displayName'), false)
+ this.getUpgradeDowngradeHeader(version.get('upgradeTypeDislayName'), version.get('displayName'))
);
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/c813e055/ambari-web/app/controllers/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js
index 25a27b1..20a72bf 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -407,7 +407,7 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
// not available
return App.showConfirmationPopup(
callback, Em.I18n.t('services.service.stop.HDFS.warningMsg.checkPointNA'), null,
- Em.I18n.t('common.warning'), Em.I18n.t('common.proceedAnyway'), true
+ Em.I18n.t('common.warning'), Em.I18n.t('common.proceedAnyway'), 'danger'
);
} else {
// still young
http://git-wip-us.apache.org/repos/asf/ambari/blob/c813e055/ambari-web/app/controllers/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/item.js b/ambari-web/app/controllers/main/service/item.js
index 4f53391..f8a6e62 100644
--- a/ambari-web/app/controllers/main/service/item.js
+++ b/ambari-web/app/controllers/main/service/item.js
@@ -342,7 +342,7 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
// not available
return App.showConfirmationPopup(
callback, Em.I18n.t('services.service.stop.HDFS.warningMsg.checkPointNA'), null,
- Em.I18n.t('common.warning'), Em.I18n.t('common.proceedAnyway'), true
+ Em.I18n.t('common.warning'), Em.I18n.t('common.proceedAnyway'), 'danger'
);
} else {
// still young
@@ -1249,7 +1249,7 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
null,
popupHeader,
Em.I18n.t('common.delete'),
- true
+ 'danger'
);
} else {
this.showLastWarning(serviceName, interDependentServices, dependentServicesToDeleteFmt);
http://git-wip-us.apache.org/repos/asf/ambari/blob/c813e055/ambari-web/app/controllers/wizard/step3_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step3_controller.js b/ambari-web/app/controllers/wizard/step3_controller.js
index 29393e3..55f4323 100644
--- a/ambari-web/app/controllers/wizard/step3_controller.js
+++ b/ambari-web/app/controllers/wizard/step3_controller.js
@@ -843,7 +843,7 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, App.Check
function () {
self._submitProceed();
},
- Em.I18n.t('installer.step3.hostWarningsPopup.hostHasWarnings'));
+ Em.I18n.t('installer.step3.hostWarningsPopup.hostHasWarnings'), null, null, null, 'warning');
}
this._submitProceed();
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/c813e055/ambari-web/app/controllers/wizard/step6_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step6_controller.js b/ambari-web/app/controllers/wizard/step6_controller.js
index 68ec3ed..5e7358d 100644
--- a/ambari-web/app/controllers/wizard/step6_controller.js
+++ b/ambari-web/app/controllers/wizard/step6_controller.js
@@ -161,18 +161,6 @@ App.WizardStep6Controller = Em.Controller.extend(App.HostComponentValidationMixi
*/
anyWarnings: Em.computed.or('anyGeneralWarnings', 'anyHostWarnings'),
- openSlavesAndClientsIssues: function () {
- App.ModalPopup.show({
- 'data-qa': 'slave-clients-issues-modal',
- header: Em.I18n.t('installer.step6.validationSlavesAndClients.popup.header'),
- bodyClass: Em.View.extend({
- controller: this,
- templateName: require('templates/wizard/step6/step6_issues_popup')
- }),
- secondary: null
- });
- },
-
/**
* Verify condition that at least one checkbox of each component was checked
* @method clearError
http://git-wip-us.apache.org/repos/asf/ambari/blob/c813e055/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index f570608..6da0368 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -844,7 +844,7 @@ Em.I18n.translations = {
'installer.step3.hostWarningsPopup.moreHosts':'{0} more hosts...<br>Click on link to view all hosts.',
'installer.step3.hostWarningsPopup.allHosts':'List of hosts',
'installer.step3.hostWarningsPopup.rerunChecks':'Rerun Checks',
- 'installer.step3.hostWarningsPopup.hostHasWarnings':'Warning: Host checks failed on some of your hosts. It is highly recommended that you fix these problems first before proceeding to prevent potentially major problems with cluster installation. Are you sure you want to ignore these warnings and proceed?',
+ 'installer.step3.hostWarningsPopup.hostHasWarnings':'Host checks failed on some of your hosts. It is highly recommended that you fix these problems first before proceeding to prevent potentially major problems with cluster installation. Are you sure you want to ignore these warnings and proceed?',
'installer.step3.warningsWindow.allHosts':'Warnings across all hosts',
'installer.step3.warningsWindow.warningsOn':'Warnings on ',
'installer.step3.warningsWindow.directoriesAndFiles':'DIRECTORIES AND FILES',
@@ -920,10 +920,7 @@ Em.I18n.translations = {
'installer.step6.wizardStep6Host.title':'master components hosted on {0}',
'installer.step6.addHostWizard.body':'Assign HBase master and ZooKeeper server.',
'installer.step6.error.mustSelectOneForSlaveHost': 'You must assign at least one slave/client component to each host with no master component',
- 'installer.step6.validationSlavesAndClients.hasIssues': 'Your slave and client assignment has issues. ',
'installer.step6.validationSlavesAndClients.click': 'Click',
- 'installer.step6.validationSlavesAndClients.forDetails': ' for details.',
- 'installer.step6.validationSlavesAndClients.popup.header': 'Assign Slaves and Clients Issues',
'installer.step6.validationSlavesAndClients.popup.body': 'Assignment of slave and client components has the following issues',
'installer.step6.validationIssuesAttention.header': 'Validation Issues',
'installer.step6.validationIssuesAttention': 'Slave and Client component assignments have issues that need attention.',
http://git-wip-us.apache.org/repos/asf/ambari/blob/c813e055/ambari-web/app/mixins/main/service/configs/component_actions_by_configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/main/service/configs/component_actions_by_configs.js b/ambari-web/app/mixins/main/service/configs/component_actions_by_configs.js
index b687752..4656c2e 100644
--- a/ambari-web/app/mixins/main/service/configs/component_actions_by_configs.js
+++ b/ambari-web/app/mixins/main/service/configs/component_actions_by_configs.js
@@ -86,7 +86,7 @@ App.ComponentActionsByConfigs = Em.Mixin.create({
}
App.showConfirmationPopup(function () {
self.popupPrimaryButtonCallback(config_action);
- }, body, null, Em.I18n.t('popup.confirmation.commonHeader'), config_action.get('popupProperties').primaryButton.label, false, 'refresh_yarn_queues')
+ }, body, null, Em.I18n.t('popup.confirmation.commonHeader'), config_action.get('popupProperties').primaryButton.label, 'success', 'refresh_yarn_queues')
}
}
}
@@ -99,7 +99,7 @@ App.ComponentActionsByConfigs = Em.Mixin.create({
var self = this;
App.showConfirmationPopup(function () {
self.hsiRestartPopupPrimaryButtonCallback(components);
- }, Em.I18n.t('popup.confirmation.hsiRestart.body'), null, Em.I18n.t('popup.confirmation.commonHeader'), Em.I18n.t('popup.confirmation.hsiRestart.buttonText'), false, 'restart_hsi')
+ }, Em.I18n.t('popup.confirmation.hsiRestart.body'), null, Em.I18n.t('popup.confirmation.commonHeader'), Em.I18n.t('popup.confirmation.hsiRestart.buttonText'), 'success', 'restart_hsi')
},
hsiRestartPopupPrimaryButtonCallback: function (components) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/c813e055/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index 670ae7d..8bbd4cc 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -2474,8 +2474,6 @@ a.abort-icon:hover {
.step-marker {
.step-index {
display: block;
- margin-top: -1px;
- margin-left: 0.3px;
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c813e055/ambari-web/app/styles/hosts.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/hosts.less b/ambari-web/app/styles/hosts.less
index 9f0da8b..e3677f8 100644
--- a/ambari-web/app/styles/hosts.less
+++ b/ambari-web/app/styles/hosts.less
@@ -298,6 +298,11 @@
}
}
margin-top: 10px;
+ .panel-heading {
+ i {
+ line-height: 19px;
+ }
+ }
}
}
.glyphicon-warning-sign {
http://git-wip-us.apache.org/repos/asf/ambari/blob/c813e055/ambari-web/app/styles/theme/bootstrap-ambari.css
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/theme/bootstrap-ambari.css b/ambari-web/app/styles/theme/bootstrap-ambari.css
index e85bb32..2bd3292 100644
--- a/ambari-web/app/styles/theme/bootstrap-ambari.css
+++ b/ambari-web/app/styles/theme/bootstrap-ambari.css
@@ -599,8 +599,8 @@ h2.table-title {
top: 9px;
line-height: 16px;
text-align: center;
- width: 20px;
- height: 20px;
+ width: 23px;
+ height: 23px;
border: 2px solid #1EB475;
border-radius: 50%;
font-size: 12px;
@@ -617,6 +617,7 @@ h2.table-title {
font-size: 14px;
color: #999;
margin-left: 30px;
+ margin-bottom: 5px;
}
.wizard .wizard-body .wizard-nav .nav li .step-index {
line-height: 18px;
@@ -654,7 +655,7 @@ h2.table-title {
background-color: #1EB475;
content: "";
top: 25px;
- left: 29px;
+ left: 31px;
}
.wizard .wizard-body .wizard-nav .nav li.completed:last-child:after {
content: none;
http://git-wip-us.apache.org/repos/asf/ambari/blob/c813e055/ambari-web/app/styles/wizard.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/wizard.less b/ambari-web/app/styles/wizard.less
index 7d425d9..4e680ca 100644
--- a/ambari-web/app/styles/wizard.less
+++ b/ambari-web/app/styles/wizard.less
@@ -60,6 +60,9 @@
#get-started {
.cluster-name-input {
padding: 4px 0px;
+ input[placeholder] {
+ text-transform: uppercase;
+ }
}
}
@@ -439,9 +442,14 @@
height: 100px;
color: #ccc;
}
+ .hosts-dropdown {
+ padding-left: 10px;
+ }
.dropdown {
button {
width: 100%;
+ text-align: left;
+ padding: 10px;
.selected-item {
width: 95%;
margin-right: 5px;
@@ -451,6 +459,18 @@
}
}
}
+ .assign-masters-controls {
+ padding-left: 30px;
+ div {
+ display: inline-block;
+ width: 22px;
+ div {
+ display: inline-block;
+ width: 100%;
+ }
+ }
+
+ }
}
label.host-name {
http://git-wip-us.apache.org/repos/asf/ambari/blob/c813e055/ambari-web/app/templates/common/assign_master_components.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/assign_master_components.hbs b/ambari-web/app/templates/common/assign_master_components.hbs
index d5dec3a..7095742 100644
--- a/ambari-web/app/templates/common/assign_master_components.hbs
+++ b/ambari-web/app/templates/common/assign_master_components.hbs
@@ -74,7 +74,7 @@
</label>
</div>
</div>
- <div class="col-md-6">
+ <div class="col-md-6 hosts-dropdown">
{{#if isServiceCoHost}}
<div class="hostName" {{QAAttr "service-co-host"}}>
{{selectedHost}}<i class="glyphicon glyphicon-asterisks">✵</i>
@@ -106,16 +106,14 @@
</div>
{{/if}}
</div>
- <div class="col-md-1 pts">
+ <div class="col-md-2 pts assign-masters-controls">
{{#if showAddControl}}
- <div class="pull-right">
+ <div>
{{view App.AddControlView componentNameBinding="component_name"}}
</div>
{{/if}}
- </div>
- <div class="col-md-1 pts">
{{#if showRemoveControl}}
- <div class="pull-left">
+ <div>
{{view App.RemoveControlView componentNameBinding="component_name" serviceComponentIdBinding="serviceComponentId"}}
</div>
{{/if}}
@@ -129,14 +127,12 @@
<div class="host-assignments col-md-4">
{{#each masterHostMapping}}
- <div class="well side-menu-well">
- <div class="row">
- <div class="col-md-10 col-md-offset-1">
- <div class="hostString"><span>{{hostInfo}}</span></div>
- {{#each masterServicesToDisplay}}
- <span {{QAAttr "component-on-host"}} {{bindAttr class="isInstalled:assigned-service:new-service :service-component :label"}}>{{display_name}}</span>
- {{/each}}
- </div>
+ <div class="well">
+ <div>
+ <div class="hostString"><span>{{hostInfo}}</span></div>
+ {{#each masterServicesToDisplay}}
+ <span {{QAAttr "component-on-host"}} {{bindAttr class="isInstalled:assigned-service:new-service :service-component :label"}}>{{display_name}}</span>
+ {{/each}}
</div>
</div>
{{/each}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c813e055/ambari-web/app/templates/wizard/step3.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/wizard/step3.hbs b/ambari-web/app/templates/wizard/step3.hbs
index e00012c..ff436a8 100644
--- a/ambari-web/app/templates/wizard/step3.hbs
+++ b/ambari-web/app/templates/wizard/step3.hbs
@@ -62,6 +62,9 @@
<table id="confirm-hosts-table" class="table table-hover" {{QAAttr "confirm-hosts-table"}}>
<thead>
<tr>
+ <th {{QAAttr "confirm-hosts-table-heading-cell"}}>
+ {{view App.CheckboxView checkedBinding="view.pageChecked"}}
+ </th>
<th class="col-md-5" {{QAAttr "confirm-hosts-table-heading-cell"}}>{{t common.host}}</th>
<!-- retrieved from local storage initially -->
<th class="col-md-2" {{QAAttr "confirm-hosts-table-heading-cell"}}>{{t common.progress}}</th>
@@ -70,15 +73,15 @@
<th class="col-md-2" {{QAAttr "confirm-hosts-table-heading-cell"}}>{{t common.action}}</th>
<!-- trash icon -->
<!-- retry icon -->
- <th {{QAAttr "confirm-hosts-table-heading-cell"}}>
- {{view App.CheckboxView checkedBinding="view.pageChecked"}}
- </th>
</tr>
</thead>
<tbody {{QAAttr "confirm-hosts-table-body"}}>
{{#if view.pageContent}}
{{#each host in view.pageContent}}
{{#view App.WizardHostView categoryBinding="controller.category" hostInfoBinding="host" data-qa="confirm-hosts-table-body-row"}}
+ <td class="step3-table-checkbox" {{QAAttr "confirm-hosts-table-body-cell"}}>
+ {{view App.CheckboxView checkedBinding="host.isChecked" labelIdentifier="select-host-checkbox"}}
+ </td>
<td class="host" {{QAAttr "confirm-hosts-table-body-cell"}}>
<span title="{{unbound host.name}}" class="trim_hostname" {{QAAttr "confirm-hosts-table-host-name"}}>{{host.name}}</span>
</td>
@@ -100,9 +103,6 @@
<i class="glyphicon glyphicon-trash" {{translateAttr title="common.remove"}}></i>
</a>
</td>
- <td class="step3-table-checkbox" {{QAAttr "confirm-hosts-table-body-cell"}}>
- {{view App.CheckboxView checkedBinding="host.isChecked" labelIdentifier="select-host-checkbox"}}
- </td>
{{/view}}
{{/each}}
{{else}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c813e055/ambari-web/app/templates/wizard/step6.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/wizard/step6.hbs b/ambari-web/app/templates/wizard/step6.hbs
index 6128b88..ac538b6 100644
--- a/ambari-web/app/templates/wizard/step6.hbs
+++ b/ambari-web/app/templates/wizard/step6.hbs
@@ -22,11 +22,31 @@
<div class="panel panel-default">
<div class="panel-body">
- {{#if anyGeneralIssues}}
- <div class="alert alert-danger" {{QAAttr "error-message"}}>
- {{t installer.step6.validationSlavesAndClients.hasIssues}}
- <a href="javascript:void(null);" {{action openSlavesAndClientsIssues target="controller"}}>{{t installer.step6.validationSlavesAndClients.click}}</a>
- {{t installer.step6.validationSlavesAndClients.forDetails}}
+ {{#if anyErrors}}
+ <p>{{t installer.step6.validationSlavesAndClients.popup.body}}</p>
+ <div class="limited-height-2">
+ {{#if anyGeneralErrors}}
+ <div class="alert alert-danger">
+ <ul>
+ {{#if errorMessage}}
+ <li>{{errorMessage}}</li>
+ {{/if}}
+ {{#each msg in controller.generalErrorMessages}}
+ <li>{{msg}}</li>
+ {{/each}}
+ </ul>
+ </div>
+ {{/if}}
+
+ {{#if anyGeneralWarnings}}
+ <div class="alert alert-warning">
+ <ul>
+ {{#each msg in controller.generalWarningMessages}}
+ <li>{{msg}}</li>
+ {{/each}}
+ </ul>
+ </div>
+ {{/if}}
</div>
{{/if}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c813e055/ambari-web/app/templates/wizard/step6/step6_issues_popup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/wizard/step6/step6_issues_popup.hbs b/ambari-web/app/templates/wizard/step6/step6_issues_popup.hbs
deleted file mode 100644
index c2201d3..0000000
--- a/ambari-web/app/templates/wizard/step6/step6_issues_popup.hbs
+++ /dev/null
@@ -1,43 +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.
-}}
-
-<p>{{t installer.step6.validationSlavesAndClients.popup.body}}</p>
-<div class="limited-height-2">
- {{#if anyGeneralErrors}}
- <div class="alert alert-danger">
- <ul>
- {{#if errorMessage}}
- <li>{{errorMessage}}</li>
- {{/if}}
- {{#each msg in controller.generalErrorMessages}}
- <li>{{msg}}</li>
- {{/each}}
- </ul>
- </div>
- {{/if}}
-
- {{#if anyGeneralWarnings}}
- <div class="alert alert-warning">
- <ul>
- {{#each msg in controller.generalWarningMessages}}
- <li>{{msg}}</li>
- {{/each}}
- </ul>
- </div>
- {{/if}}
-</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/c813e055/ambari-web/app/views/common/assign_master_components_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/assign_master_components_view.js b/ambari-web/app/views/common/assign_master_components_view.js
index 001667a..0217aae 100644
--- a/ambari-web/app/views/common/assign_master_components_view.js
+++ b/ambari-web/app/views/common/assign_master_components_view.js
@@ -172,7 +172,7 @@ App.AddControlView = Em.View.extend({
*/
componentName: null,
- tagName: "span",
+ tagName: "div",
classNames: ["label", 'extra-component'],
@@ -213,7 +213,7 @@ App.RemoveControlView = Em.View.extend({
*/
componentName: null,
- tagName: "span",
+ tagName: "div",
'data-qa': 'remove-master',
http://git-wip-us.apache.org/repos/asf/ambari/blob/c813e055/ambari-web/app/views/common/configs/widgets/combo_config_widget_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/widgets/combo_config_widget_view.js b/ambari-web/app/views/common/configs/widgets/combo_config_widget_view.js
index 5efc4f7..b8f957e 100644
--- a/ambari-web/app/views/common/configs/widgets/combo_config_widget_view.js
+++ b/ambari-web/app/views/common/configs/widgets/combo_config_widget_view.js
@@ -43,11 +43,19 @@ App.ComboConfigWidgetView = App.ConfigWidgetView.extend({
this._super();
this.toggleWidgetState();
this.initPopover();
+ this.disableSwitchToTextBox();
this.addObserver('config.stackConfigProperty.valueAttributes.entries.[]', this, this.updateValuesList);
this.addObserver('controller.forceUpdateBoundaries', this, this.updateValuesList);
this.addObserver('config.value', this, this.isValueCompatibleWithWidget);
},
+ disableSwitchToTextBox: function () {
+ var valueAttributes = this.get('config.valueAttributes');
+ if (valueAttributes && valueAttributes.hasOwnProperty('entriesEditable') && !valueAttributes.entriesEditable) {
+ this.set('supportSwitchToTextBox', false);
+ }
+ },
+
/**
* Update options list by recommendations
* @method updateValuesList
http://git-wip-us.apache.org/repos/asf/ambari/blob/c813e055/ambari-web/app/views/common/controls_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/controls_view.js b/ambari-web/app/views/common/controls_view.js
index 747d96c..4d3089a 100644
--- a/ambari-web/app/views/common/controls_view.js
+++ b/ambari-web/app/views/common/controls_view.js
@@ -41,7 +41,7 @@ App.ServiceConfigPopoverSupport = Ember.Mixin.create({
serviceConfig: null,
attributeBindings:['readOnly'],
isPopoverEnabled: true,
- popoverPlacement: 'right',
+ popoverPlacement: 'auto right',
didInsertElement: function () {
App.tooltip(this.$('[data-toggle=tooltip]'), {placement: 'top'});
http://git-wip-us.apache.org/repos/asf/ambari/blob/c813e055/ambari-web/app/views/common/form/manage_credentials_form_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/form/manage_credentials_form_view.js b/ambari-web/app/views/common/form/manage_credentials_form_view.js
index 7e46431..b869446 100644
--- a/ambari-web/app/views/common/form/manage_credentials_form_view.js
+++ b/ambari-web/app/views/common/form/manage_credentials_form_view.js
@@ -219,8 +219,7 @@ App.ManageCredentialsFormView = Em.View.extend({
}, t('admin.kerberos.credentials.remove.confirmation.body'),
function () {},
null,
- t('yes'),
- false);
+ t('yes'));
popup.set('secondary', t('no'));
return {
deferred: dfd,
http://git-wip-us.apache.org/repos/asf/ambari/blob/c813e055/ambari-web/app/views/common/modal_popups/confirmation_popup.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/modal_popups/confirmation_popup.js b/ambari-web/app/views/common/modal_popups/confirmation_popup.js
index c7d95f4..8592300 100644
--- a/ambari-web/app/views/common/modal_popups/confirmation_popup.js
+++ b/ambari-web/app/views/common/modal_popups/confirmation_popup.js
@@ -26,10 +26,15 @@ var App = require('app');
* @param {Function} secondary
* @param {String} header
* @param {String} primaryText
- * @param {Boolean} isCritical
+ * @param {String} primaryStyle
* @return {*}
*/
-App.showConfirmationPopup = function (primary, body, secondary, header, primaryText, isCritical, staticId) {
+App.showConfirmationPopup = function (primary, body, secondary, header, primaryText, primaryStyle = 'success', staticId) {
+ var primaryClass = {
+ 'success': 'btn-success',
+ 'warning': 'btn-warning',
+ 'danger': 'btn-danger'
+ }[primaryStyle];
if (!primary) {
return false;
}
@@ -39,7 +44,7 @@ App.showConfirmationPopup = function (primary, body, secondary, header, primaryT
primary: primaryText || Em.I18n.t('ok'),
header: header || Em.I18n.t('popup.confirmation.commonHeader'),
body: body || Em.I18n.t('question.sure'),
- primaryClass: isCritical ? 'btn-danger' : 'btn-success',
+ primaryClass: primaryClass,
primaryId: staticId ? staticId + '_primary' : '',
secondaryId: staticId ? staticId + '_secondary' : '',
thirdId: staticId ? staticId + '_third' : '',
http://git-wip-us.apache.org/repos/asf/ambari/blob/c813e055/ambari-web/test/controllers/main/admin/kerberos/kerberos_wizard_controler_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/kerberos/kerberos_wizard_controler_test.js b/ambari-web/test/controllers/main/admin/kerberos/kerberos_wizard_controler_test.js
index f6754d5..c158a89 100644
--- a/ambari-web/test/controllers/main/admin/kerberos/kerberos_wizard_controler_test.js
+++ b/ambari-web/test/controllers/main/admin/kerberos/kerberos_wizard_controler_test.js
@@ -36,13 +36,13 @@ describe('App.KerberosWizardController', function() {
it('should open warning confirmation popup', function () {
var f = Em.K;
controller.warnBeforeExitPopup(f, false);
- expect(App.showConfirmationPopup.calledWith(f, Em.I18n.t('admin.kerberos.wizard.exit.warning.msg'), null, null, Em.I18n.t('common.exitAnyway'), false)).to.be.true;
+ expect(App.showConfirmationPopup.calledWith(f, Em.I18n.t('admin.kerberos.wizard.exit.warning.msg'), null, null, Em.I18n.t('common.exitAnyway'), 'success')).to.be.true;
});
it('should open critical confirmation popup', function () {
var f = Em.K;
controller.warnBeforeExitPopup(f, true);
- expect(App.showConfirmationPopup.calledWith(f, Em.I18n.t('admin.kerberos.wizard.exit.critical.msg'), null, null, Em.I18n.t('common.exitAnyway'), true)).to.be.true;
+ expect(App.showConfirmationPopup.calledWith(f, Em.I18n.t('admin.kerberos.wizard.exit.critical.msg'), null, null, Em.I18n.t('common.exitAnyway'), 'danger')).to.be.true;
});
});
@@ -467,12 +467,12 @@ describe('App.KerberosWizardController', function() {
it("isCritical is true", function() {
controller.warnBeforeExitPopup(Em.K, true);
- expect(App.showConfirmationPopup.calledWith(Em.K, Em.I18n.t('admin.kerberos.wizard.exit.critical.msg'), null, null, Em.I18n.t('common.exitAnyway'), true)).to.be.true;
+ expect(App.showConfirmationPopup.calledWith(Em.K, Em.I18n.t('admin.kerberos.wizard.exit.critical.msg'), null, null, Em.I18n.t('common.exitAnyway'), 'danger')).to.be.true;
});
it("isCritical is false", function() {
controller.warnBeforeExitPopup(Em.K, false);
- expect(App.showConfirmationPopup.calledWith(Em.K, Em.I18n.t('admin.kerberos.wizard.exit.warning.msg'), null, null, Em.I18n.t('common.exitAnyway'), false)).to.be.true;
+ expect(App.showConfirmationPopup.calledWith(Em.K, Em.I18n.t('admin.kerberos.wizard.exit.warning.msg'), null, null, Em.I18n.t('common.exitAnyway'), 'success')).to.be.true;
});
});
[28/50] [abbrv] ambari git commit: AMBARI-22647. Rafactor: Package
Log Search and Log Feeder into jars + cleanup start scripts (oleewere)
Posted by rl...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-server/src/main/scripts/logsearch.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/scripts/logsearch.sh b/ambari-logsearch/ambari-logsearch-server/src/main/scripts/logsearch.sh
new file mode 100755
index 0000000..128617c
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/scripts/logsearch.sh
@@ -0,0 +1,274 @@
+#!/bin/bash
+# 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.
+
+JVM="java"
+
+if [ -x $JAVA_HOME/bin/java ]; then
+ JVM=$JAVA_HOME/bin/java
+fi
+
+if [ "$LOGSEARCH_JAVA_MEM" = "" ]; then
+ LOGSEARCH_JAVA_MEM="-Xmx1g"
+fi
+
+readlinkf(){
+ # get real path on mac OSX
+ perl -MCwd -e 'print Cwd::abs_path shift' "$1";
+}
+
+if [ "$(uname -s)" = 'Linux' ]; then
+ SCRIPT_DIR="`dirname "$(readlink -f "$0")"`"
+else
+ SCRIPT_DIR="`dirname "$(readlinkf "$0")"`"
+fi
+
+LOGSEARCH_ROOT_DIR="`dirname \"$SCRIPT_DIR\"`"
+LOGSEARCH_LIBS_DIR="$LOGSEARCH_ROOT_DIR/libs"
+LOGSEARCH_WEBAPP_DIR="$LOGSEARCH_ROOT_DIR/webapp"
+
+if [ "$LOGSEARCH_CONF_DIR" = "" ]; then
+ if [ -d "$LOGSEARCH_ROOT_DIR/conf" ]; then
+ LOGSEARCH_CONF_DIR="$LOGSEARCH_ROOT_DIR/conf"
+ fi
+fi
+
+if [ -f "$LOGSEARCH_CONF_DIR/logsearch-env.sh" ]; then
+ source $LOGSEARCH_CONF_DIR/logsearch-env.sh
+fi
+
+if [ ! -z "$LOGSEARCH_SOLR_CLIENT_SSL_INCLUDE" ]; then
+ source $LOGSEARCH_SOLR_CLIENT_SSL_INCLUDE
+fi
+
+if [ -z "$LOGSEARCH_PID_FILE" ]; then
+ LOGSEARCH_PID_DIR=$HOME
+ export LOGSEARCH_PID_FILE=$LOGSEARCH_PID_DIR/logsearch.pid
+fi
+
+if [ -z "$LOG_FILE" ]; then
+ export LOG_FILE="logsearch.log"
+fi
+
+LOGSEARCH_GC_LOGFILE="logsearch_gc.log"
+
+if [ -z "$LOG_PATH" ]; then
+ LOG_FILE="$HOME/$LOG_FILE"
+ LOGSEARCH_GC_LOGFILE="$HOME/$LOGSEARCH_GC_LOGFILE"
+else
+ LOG_PATH_WITHOUT_SLASH=${LOG_PATH%/}
+ LOG_FILE="$LOG_PATH_WITHOUT_SLASH/$LOG_FILE"
+ LOGSEARCH_GC_LOGFILE="$LOG_PATH_WITHOUT_SLASH/$LOGSEARCH_GC_LOGFILE"
+fi
+
+LOGSEARCH_GC_OPTS="-XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:$LOGSEARCH_GC_LOGFILE"
+
+function print_usage() {
+ cat << EOF
+
+ Usage: [<command>] [<arguments with flags>]
+
+ commands:
+ start Start Log Search
+ stop Stop Log Search
+ status Check Log Search status (pid file)
+ help Print usage
+
+
+ start command arguments:
+ -d, --debug Start java process in debug mode
+ -f, --foreground Start java process in foreground
+
+EOF
+}
+
+function spinner() {
+ local pid=$1
+ local delay=0.5
+ local spinstr='|/-\'
+ while [ "$(ps aux | awk '{print $2}' | grep -w $pid)" ]; do
+ local temp=${spinstr#?}
+ printf " [%c] " "$spinstr"
+ local spinstr=$temp${spinstr%"$temp"}
+ sleep $delay
+ printf "\b\b\b\b\b\b"
+ done
+ printf " \b\b\b\b"
+}
+
+function status() {
+ echo "Checking Log Search status ..."
+ if [ -f "$LOGSEARCH_PID_FILE" ]; then
+ LOGSEARCH_PID=`cat "$LOGSEARCH_PID_FILE"`
+ else
+ echo "Log Search pid not exists. (probably the process is not running)"
+ exit 1
+ fi
+
+ if ps -p $LOGSEARCH_PID > /dev/null
+ then
+ echo "Log Search process is running. (pid: $LOGSEARCH_PID)"
+ exit 0
+ else
+ echo "Log Search process is not running."
+ exit 1
+ fi
+}
+
+function start() {
+ (status);
+ exit_status=$(echo $?)
+ if [ "$exit_status" = "0" ]; then
+ echo "Skipping start process."
+ exit 0
+ fi
+
+ FG="false"
+ LOGSEARCH_DEBUG_SUSPEND=${LOGSEARCH_DEBUG_SUSPEND:-n}
+ LOGSEARCH_DEBUG_PORT=${LOGSEARCH_DEBUG_PORT:-"5005"}
+
+ if [ "$LOGSEARCH_DEBUG" = "true" ]; then
+ LOGSEARCH_JAVA_OPTS="$LOGSEARCH_JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=$LOGSEARCH_DEBUG_PORT,server=y,suspend=$LOGSEARCH_DEBUG_SUSPEND "
+ fi
+
+ if [ "$LOGSEARCH_SSL" = "true" ]; then
+ LOGSEARCH_JAVA_OPTS="$LOGSEARCH_JAVA_OPTS -Djavax.net.ssl.keyStore=$LOGSEARCH_KEYSTORE_LOCATION -Djavax.net.ssl.keyStoreType=$LOGSEARCH_KEYSTORE_TYPE -Djavax.net.ssl.trustStore=$LOGSEARCH_TRUSTSTORE_LOCATION -Djavax.net.ssl.trustStoreType=$LOGSEARCH_TRUSTSTORE_TYPE"
+ fi
+
+ if [ "$LOGSEARCH_JMX" = "true" ]; then
+ LOGSEARCH_JAVA_OPTS="$LOGSEARCH_JAVA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=2099"
+ fi
+
+ if [ $# -gt 0 ]; then
+ while true; do
+ case "$1" in
+ -f|--foreground)
+ FG="true"
+ shift
+ ;;
+ -d|--debug)
+ if [ "$LOGSEARCH_DEBUG" != "true" ]; then
+ LOGSEARCH_JAVA_OPTS="$LOGSEARCH_JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=$LOGSEARCH_DEBUG_PORT,server=y,suspend=$LOGSEARCH_DEBUG_SUSPEND "
+ fi
+ shift
+ ;;
+ *)
+ if [ "${1:0:2}" == "-D" ]; then
+ # pass thru any opts that begin with -D (java system props)
+ LOGSEARCH_JAVA_OPTS+=("$1")
+ echo "$LOGSEARCH_JAVA_OPTS"
+ shift
+ else
+ if [ "$1" != "" ]; then
+ print_usage
+ exit 1
+ else
+ break
+ fi
+ fi
+ ;;
+ esac
+ done
+ fi
+
+ if [ $FG == "true" ]; then
+ echo "Starting Log Search... (foreground) pid_file=$LOGSEARCH_PID_FILE"
+ echo "Run command $JVM -cp '$LOGSEARCH_CONF_DIR:$LOGSEARCH_WEBAPP_DIR:$LOGSEARCH_LIBS_DIR/*' $LOGSEARCH_GC_OPTS $LOGSEARCH_JAVA_OPTS $LOGSEARCH_JAVA_MEM org.apache.ambari.logsearch.LogSearch"
+ $JVM -cp "$LOGSEARCH_CONF_DIR:$LOGSEARCH_WEBAPP_DIR:$LOGSEARCH_LIBS_DIR/*" $LOGSEARCH_GC_OPTS $LOGSEARCH_JAVA_OPTS $LOGSEARCH_JAVA_MEM org.apache.ambari.logsearch.LogSearch
+ else
+ echo "Starting Log Search... Output file=$LOG_FILE pid_file=$LOGSEARCH_PID_FILE"
+ echo "Run command nohup $JVM -cp '$LOGSEARCH_CONF_DIR:$LOGSEARCH_WEBAPP_DIR:$LOGSEARCH_LIBS_DIR/*' $LOGSEARCH_GC_OPTS $LOGSEARCH_JAVA_OPTS $LOGSEARCH_JAVA_MEM org.apache.ambari.logsearch.LogSearch"
+ nohup $JVM -cp "$LOGSEARCH_CONF_DIR:$LOGSEARCH_WEBAPP_DIR:$LOGSEARCH_LIBS_DIR/*" $LOGSEARCH_GC_OPTS $LOGSEARCH_JAVA_OPTS $LOGSEARCH_JAVA_MEM org.apache.ambari.logsearch.LogSearch > $LOG_FILE 2>&1 &
+ fi
+}
+
+function stop() {
+ LOGSEARCH_STOP_WAIT=3
+ if [ -f "$LOGSEARCH_PID_FILE" ]; then
+ LOGSEARCH_PID=`cat "$LOGSEARCH_PID_FILE"`
+ fi
+
+ if [ "$LOGSEARCH_PID" != "" ]; then
+ echo -e "Sending stop command to Log Search... Checking PID: $LOGSEARCH_PID."
+ kill $LOGSEARCH_PID
+ (loops=0
+ while true
+ do
+ CHECK_PID=`ps auxww | awk '{print $2}' | grep -w $LOGSEARCH_PID | sort -r | tr -d ' '`
+ if [ "$CHECK_PID" != "" ]; then
+ slept=$((loops * 2))
+ if [ $slept -lt $LOGSEARCH_STOP_WAIT ]; then
+ sleep 2
+ loops=$[$loops+1]
+ else
+ exit # subshell!
+ fi
+ else
+ exit # subshell!
+ fi
+ done) &
+ spinner $!
+ rm -f "$LOGSEARCH_PID_FILE"
+ else
+ echo -e "No Log Search process found to stop."
+ exit 0
+ fi
+
+ CHECK_PID=`ps auxww | awk '{print $2}' | grep -w $LOGSEARCH_PID | sort -r | tr -d ' '`
+ if [ "$CHECK_PID" != "" ]; then
+ echo -e "Log Search process $LOGSEARCH_PID is still running; forcefully killing it now."
+ kill -9 $LOGSEARCH_PID
+ echo "Killed process $LOGSEARCH_PID"
+ rm -f "$LOGSEARCH_PID_FILE"
+ sleep 1
+ else
+ echo "Log Search is stopped."
+ fi
+
+ CHECK_PID=`ps auxww | awk '{print $2}' | grep -w $LOGSEARCH_PID | sort -r | tr -d ' '`
+ if [ "$CHECK_PID" != "" ]; then
+ echo "ERROR: Failed to kill Log Search Java process $LOGSEARCH_PID ... script fails."
+ exit 1
+ fi
+}
+
+if [ $# -gt 0 ]; then
+ SCRIPT_CMD="$1"
+ shift
+else
+ print_usage
+ exit 1
+fi
+
+case $SCRIPT_CMD in
+ start)
+ start ${1+"$@"}
+ ;;
+ stop)
+ stop
+ ;;
+ status)
+ status
+ ;;
+ help)
+ print_usage
+ exit 0
+ ;;
+ *)
+ print_usage
+ exit 1
+ ;;
+
+esac
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-server/src/main/scripts/run.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/scripts/run.sh b/ambari-logsearch/ambari-logsearch-server/src/main/scripts/run.sh
deleted file mode 100755
index 241b32f..0000000
--- a/ambari-logsearch/ambari-logsearch-server/src/main/scripts/run.sh
+++ /dev/null
@@ -1,99 +0,0 @@
-#!/bin/bash
-# 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.
-
-curr_dir=`pwd`
-cd `dirname $0`; script_dir=`pwd`; cd $curr_dir
-
-if [ ! -z "$LOGSEARCH_INCLUDE" ]; then
- source $LOGSEARCH_INCLUDE
-fi
-
-if [ ! -z "$LOGSEARCH_SOLR_CLIENT_SSL_INCLUDE" ]; then
- source $LOGSEARCH_SOLR_CLIENT_SSL_INCLUDE
-fi
-
-JAVA=java
-if [ -x $JAVA_HOME/bin/java ]; then
- JAVA=$JAVA_HOME/bin/java
-fi
-
-if [ "$LOGSEARCH_JAVA_MEM" = "" ]; then
- LOGSEARCH_JAVA_MEM="-Xmx1g"
-fi
-
-if [ "$LOGFILE" = "" ]; then
- LOGFILE="/var/log/logsearch/logsearch.out"
- touch $LOGFILE 2> /dev/null
- if [ $? -ne 0 ]; then
- LOGFILE=/tmp/${USER}_logsearch.out
- fi
-fi
-
-
-#Temporarily enabling JMX so we can monitor the memory and CPU utilization of the process
-#JMX="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=3098"
-
-LOGSEARCH_DEBUG_SUSPEND=${LOGSEARCH_DEBUG_SUSPEND:-n}
-if [ "$LOGSEARCH_DEBUG" = "true" ] && [ ! -z "$LOGSEARCH_DEBUG_PORT" ]; then
- LOGSEARCH_JAVA_OPTS="$LOGSEARCH_JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=$LOGSEARCH_DEBUG_PORT,server=y,suspend=$LOGSEARCH_DEBUG_SUSPEND "
-fi
-
-if [ "$LOGSEARCH_SSL" = "true" ]; then
- LOGSEARCH_JAVA_OPTS="$LOGSEARCH_JAVA_OPTS -Djavax.net.ssl.keyStore=$LOGSEARCH_KEYSTORE_LOCATION -Djavax.net.ssl.keyStoreType=$LOGSEARCH_KEYSTORE_TYPE -Djavax.net.ssl.trustStore=$LOGSEARCH_TRUSTSTORE_LOCATION -Djavax.net.ssl.trustStoreType=$LOGSEARCH_TRUSTSTORE_TYPE"
-fi
-
-if [ "$PID_FILE" = "" ]; then
- LOGSEARCH_PID_DIR=$HOME
- PID_FILE=$LOGSEARCH_PID_DIR/logsearch-search-$USER.pid
-fi
-
-if [ -f ${PID_FILE} ]; then
- PID=`cat ${PID_FILE}`
- if kill -0 $PID 2>/dev/null; then
- echo "logsearch already running (${PID}) killing..."
- kill $PID 2>/dev/null
- sleep 5
- if kill -0 $PID 2>/dev/null; then
- echo "logsearch still running. Will kill process forcefully in another 10 seconds..."
- sleep 10
- kill -9 $PID 2>/dev/null
- sleep 2
- fi
- fi
-
- if kill -0 $PID 2>/dev/null; then
- echo "ERROR: Even after all efforts to stop logsearch, it is still running. pid=$PID. Please manually kill the service and try again."
- exit 1
- fi
-fi
-
-if [ -z "$LOGSEARCH_CONF_DIR" ]; then
- LOGSEARCH_CONF_DIR="/etc/logsearch/conf"
- if [ ! -d $LOGSEARCH_CONF_DIR ]; then
- if [ -d $script_dir/classes ]; then
- LOGSEARCH_CONF_DIR=$script_dir/classes
- fi
- fi
- echo "LOGSEARCH_CONF_DIR not found. Use default: $LOGSEARCH_CONF_DIR"
-fi
-
-LOGSEARCH_GC_LOGFILE=`dirname $LOGFILE`/logsearch_gc.log
-LOGSEARCH_GC_OPTS="-XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:$LOGSEARCH_GC_LOGFILE"
-
-echo "Starting logsearch. Output file=$LOGFILE pid_file=$PID_FILE"
-#LOGSEARCH_CLI_CLASSPATH=
-#set -x
-nohup $JAVA -cp "$LOGSEARCH_CLI_CLASSPATH:$LOGSEARCH_CONF_DIR:$script_dir/libs/*:$script_dir/classes" $LOGSEARCH_GC_OPTS $LOGSEARCH_JAVA_MEM $LOGSEARCH_JAVA_OPTS $JMX org.apache.ambari.logsearch.LogSearch $* > $LOGFILE 2>&1 &
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/ambari-logsearch-server/src/main/scripts/stop.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/scripts/stop.sh b/ambari-logsearch/ambari-logsearch-server/src/main/scripts/stop.sh
deleted file mode 100755
index 3612f08..0000000
--- a/ambari-logsearch/ambari-logsearch-server/src/main/scripts/stop.sh
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/bin/bash
-# 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.
-
-curr_dir=`pwd`
-cd `dirname $0`; script_dir=`pwd`; cd $curr_dir
-
-if [ "$PID_FILE" = "" ]; then
- LOGSEARCH_PID_DIR=$HOME
- PID_FILE=$LOGSEARCH_PID_DIR/logsearch-search-$USER.pid
-fi
-
-if [ -f ${PID_FILE} ]; then
- PID=`cat ${PID_FILE}`
- if kill -0 $PID 2>/dev/null; then
- echo "logsearch running with process id (${PID}). Killing..."
- kill $PID 2>/dev/null
- sleep 5
- if kill -0 $PID 2>/dev/null; then
- echo "logsearch still running. Will kill process forcefully in another 10 seconds..."
- sleep 10
- kill -9 $PID 2>/dev/null
- sleep 2
- fi
- fi
-
- if kill -0 $PID 2>/dev/null; then
- echo "ERROR: Even after all efforts to stop logsearch, it is still running. pid=$PID. Please manually kill the service and try again."
- exit 1
- fi
-fi
-
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/docker/Dockerfile
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/Dockerfile b/ambari-logsearch/docker/Dockerfile
index e79f61b..8bfcae3 100644
--- a/ambari-logsearch/docker/Dockerfile
+++ b/ambari-logsearch/docker/Dockerfile
@@ -64,11 +64,9 @@ RUN chmod -R 777 /root/test-config
RUN chmod +x /root/start.sh
ENV SOLR_CONFIG_LOCATION /root/config/solr
-ENV LOGSEARCH_CONFIG_LOCATION /root/config/logsearch
-ENV LOGFEEDER_CONFIG_LOCATION /root/config/logfeeder
+ENV LOGSEARCH_CONF_DIR /root/config/logsearch
+ENV LOGFEEDER_CONF_DIR /root/config/logfeeder
ENV SOLR_INCLUDE /root/config/solr/solr-env.sh
-ENV LOGSEARCH_INCLUDE /root/config/logsearch/logsearch-env.sh
-ENV LOGFEEDER_INCLUDE /root/config/logfeeder/logfeeder-env.sh
RUN mkdir -p /var/run/ambari-logsearch-solr /var/log/ambari-logsearch-solr /var/run/ambari-infra-solr-client \
/var/log/ambari-infra-solr-client /root/logsearch_solr_index/data \
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/docker/all.yml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/all.yml b/ambari-logsearch/docker/all.yml
index 369db39..a5afb9a 100644
--- a/ambari-logsearch/docker/all.yml
+++ b/ambari-logsearch/docker/all.yml
@@ -35,6 +35,4 @@ services:
- $MAVEN_REPOSITORY_LOCATION:/root/.m2
- $AMBARI_LOCATION:/root/ambari
- $AMBARI_LOCATION/ambari-logsearch/docker/test-logs:/root/test-logs
- - $AMBARI_LOCATION/ambari-logsearch/docker/test-config:/root/test-config
- - $AMBARI_LOCATION/ambari-logsearch/ambari-logsearch-logfeeder/target/classes:/root/ambari/ambari-logsearch/ambari-logsearch-logfeeder/target/package/classes
- - $AMBARI_LOCATION/ambari-logsearch/ambari-logsearch-server/target/classes/org:/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/classes/org
\ No newline at end of file
+ - $AMBARI_LOCATION/ambari-logsearch/docker/test-config:/root/test-config
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/docker/bin/start.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/bin/start.sh b/ambari-logsearch/docker/bin/start.sh
index bea06de..f2acf9b 100644
--- a/ambari-logsearch/docker/bin/start.sh
+++ b/ambari-logsearch/docker/bin/start.sh
@@ -49,6 +49,7 @@ function create_logsearch_configs() {
mkdir /root/config/logsearch
cp /root/test-config/logsearch/log4j.xml /root/config/logsearch/
cp /root/test-config/logsearch/logsearch-env.sh /root/config/logsearch/
+ cp $LOGSEARCH_SERVER_PATH/conf/user_pass.json /root/config/logsearch/user_pass.json
if [ $LOGSEARCH_HTTPS_ENABLED == 'true' ]
then
cp /root/test-config/logsearch/logsearch-https.properties /root/config/logsearch/logsearch.properties
@@ -87,7 +88,7 @@ function generate_keys() {
fi
}
-function start_solr() {
+function start_solr_d() {
echo "Starting Solr..."
/root/solr-$SOLR_VERSION/bin/solr start -cloud -s /root/logsearch_solr_index/data -verbose -force
touch /var/log/ambari-logsearch-solr/solr.log
@@ -102,16 +103,25 @@ function start_solr() {
}
function start_logsearch() {
- $LOGSEARCH_SERVER_PATH/run.sh
+ $LOGSEARCH_SERVER_PATH/bin/logsearch.sh start -f
+}
+
+function start_logsearch_d() {
+ $LOGSEARCH_SERVER_PATH/bin/logsearch.sh start
touch /var/log/ambari-logsearch-portal/logsearch-app.log
}
function start_logfeeder() {
- $LOGFEEDER_PATH/run.sh
+ $LOGFEEDER_PATH/bin/logfeeder.sh start -f
+}
+
+
+function start_logfeeder_d() {
+ $LOGFEEDER_PATH/bin/logfeeder.sh start
touch /var/log/ambari-logsearch-logfeeder/logsearch-logfeeder.log
}
-function start_selenium_server() {
+function start_selenium_server_d() {
nohup java -jar /root/selenium-server-standalone.jar > /var/log/selenium-test.log &
}
@@ -141,7 +151,7 @@ function main() {
echo "Start Solr only.."
export COMPONENT_LOG="solr"
generate_keys
- start_solr
+ start_solr_d
log
;;
"logfeeder")
@@ -150,7 +160,6 @@ function main() {
export COMPONENT_LOG="logfeeder"
generate_keys
start_logfeeder
- log
;;
"logsearch")
create_logsearch_configs
@@ -158,15 +167,14 @@ function main() {
export COMPONENT_LOG="logsearch"
generate_keys
start_logsearch
- log
;;
*)
create_configs
generate_keys
- start_selenium_server
- start_solr
- start_logfeeder
- start_logsearch
+ start_selenium_server_d
+ start_solr_d
+ start_logfeeder_d
+ start_logsearch_d
log
;;
esac
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/docker/docker-compose.yml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/docker-compose.yml b/ambari-logsearch/docker/docker-compose.yml
index 725af36..e865ec3 100644
--- a/ambari-logsearch/docker/docker-compose.yml
+++ b/ambari-logsearch/docker/docker-compose.yml
@@ -64,7 +64,6 @@ services:
- $AMBARI_LOCATION:/root/ambari
- $AMBARI_LOCATION/ambari-logsearch/docker/test-logs:/root/test-logs
- $AMBARI_LOCATION/ambari-logsearch/docker/test-config:/root/test-config
- - $AMBARI_LOCATION/ambari-logsearch/ambari-logsearch-server/target/classes/org:/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/classes/org
logfeeder:
image: ambari-logsearch:v1.0
restart: always
@@ -83,7 +82,6 @@ services:
- $AMBARI_LOCATION:/root/ambari
- $AMBARI_LOCATION/ambari-logsearch/docker/test-logs:/root/test-logs
- $AMBARI_LOCATION/ambari-logsearch/docker/test-config:/root/test-config
- - $AMBARI_LOCATION/ambari-logsearch/ambari-logsearch-logfeeder/target/classes:/root/ambari/ambari-logsearch/ambari-logsearch-logfeeder/target/package/classes
networks:
logsearch-network:
driver: bridge
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/docker/logsearch-logfeeder.yml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/logsearch-logfeeder.yml b/ambari-logsearch/docker/logsearch-logfeeder.yml
index 4d48501..75d4391 100644
--- a/ambari-logsearch/docker/logsearch-logfeeder.yml
+++ b/ambari-logsearch/docker/logsearch-logfeeder.yml
@@ -29,7 +29,6 @@ services:
- $AMBARI_LOCATION:/root/ambari
- $AMBARI_LOCATION/ambari-logsearch/docker/test-logs:/root/test-logs
- $AMBARI_LOCATION/ambari-logsearch/docker/test-config:/root/test-config
- - $AMBARI_LOCATION/ambari-logsearch/ambari-logsearch-logfeeder/target/classes:/root/ambari/ambari-logsearch/ambari-logsearch-logfeeder/target/package/classes
networks:
logsearch-network:
driver: bridge
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/docker/logsearch-server.yml
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/logsearch-server.yml b/ambari-logsearch/docker/logsearch-server.yml
index 6a0d71e..00c08a2 100644
--- a/ambari-logsearch/docker/logsearch-server.yml
+++ b/ambari-logsearch/docker/logsearch-server.yml
@@ -29,7 +29,6 @@ services:
- $AMBARI_LOCATION:/root/ambari
- $AMBARI_LOCATION/ambari-logsearch/docker/test-logs:/root/test-logs
- $AMBARI_LOCATION/ambari-logsearch/docker/test-config:/root/test-config
- - $AMBARI_LOCATION/ambari-logsearch/ambari-logsearch-server/target/classes/org:/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/classes/org
networks:
logsearch-network:
driver: bridge
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/docker/test-config/logfeeder/logfeeder-env.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/test-config/logfeeder/logfeeder-env.sh b/ambari-logsearch/docker/test-config/logfeeder/logfeeder-env.sh
index 5beb093..a57b1f1 100644
--- a/ambari-logsearch/docker/test-config/logfeeder/logfeeder-env.sh
+++ b/ambari-logsearch/docker/test-config/logfeeder/logfeeder-env.sh
@@ -21,10 +21,11 @@ export LOGFEEDER_PATH=/root/ambari/ambari-logsearch/ambari-logsearch-logfeeder/t
export LOGFEEDER_CONF_DIR=/root/config/logfeeder
#Logfile e.g. /var/log/logfeeder.log
-export LOGFILE=/var/log/ambari-logsearch-logfeeder/logfeeder.out
+export LOG_PATH=/var/log/ambari-logsearch-logfeeder
+export LOG_FILE=logfeeder.out
#pid file e.g. /var/run/logfeeder.pid
-export PID_FILE=/var/run/ambari-logsearch-logfeeder/logfeeder.pid
+export LOGFEEDER_PID_FILE=/var/run/ambari-logsearch-logfeeder/logfeeder.pid
export JAVA_HOME=/usr/java/default
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/docker/test-config/logfeeder/logfeeder.properties
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/test-config/logfeeder/logfeeder.properties b/ambari-logsearch/docker/test-config/logfeeder/logfeeder.properties
index 1ae57bb..028cb9f 100644
--- a/ambari-logsearch/docker/test-config/logfeeder/logfeeder.properties
+++ b/ambari-logsearch/docker/test-config/logfeeder/logfeeder.properties
@@ -16,7 +16,7 @@
cluster.name=cl1
logfeeder.checkpoint.folder=/root/checkpoints
logfeeder.metrics.collector.hosts=
-logfeeder.config.dir=/root/test-config/logfeeder/shipper-conf/
+logfeeder.config.dir=/root/config/logfeeder/shipper-conf/
logfeeder.config.files=shipper-conf/global.config.json,\
shipper-conf/output.config.json
logfeeder.log.filter.enable=true
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/docker/test-config/logsearch/logsearch-env.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/test-config/logsearch/logsearch-env.sh b/ambari-logsearch/docker/test-config/logsearch/logsearch-env.sh
index 80f9c4c..2a2efd8 100644
--- a/ambari-logsearch/docker/test-config/logsearch/logsearch-env.sh
+++ b/ambari-logsearch/docker/test-config/logsearch/logsearch-env.sh
@@ -20,9 +20,10 @@ export LOGSEARCH_PATH=/root/ambari/ambari-logsearch/ambari-logsearch-server/targ
export LOGSEARCH_CONF_DIR=/root/config/logsearch
-export LOGFILE=/var/log/ambari-logsearch-portal/logsearch-app.log
+export LOG_PATH=/var/log/ambari-logsearch-portal
+export LOG_FILE=logsearch-app.log
-export PID_FILE=/var/run/ambari-logsearch-portal/logsearch.pid
+export LOGSEARCH_PID_FILE=/var/run/ambari-logsearch-portal/logsearch.pid
export JAVA_HOME=/usr/java/default
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/docker/test-config/logsearch/logsearch-https.properties
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/test-config/logsearch/logsearch-https.properties b/ambari-logsearch/docker/test-config/logsearch/logsearch-https.properties
index 5e7853d..6b59ac8 100644
--- a/ambari-logsearch/docker/test-config/logsearch/logsearch-https.properties
+++ b/ambari-logsearch/docker/test-config/logsearch/logsearch-https.properties
@@ -36,8 +36,8 @@ logsearch.solr.collection.history=history
logsearch.solr.history.config.name=history
logsearch.collection.history.replication.factor=1
-logsearch.solr.config_set.folder=/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/solr_configsets
-logsearch.solr.audit.logs.config_set.folder=/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/solr_configsets
+logsearch.solr.config_set.folder=/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/conf/solr_configsets
+logsearch.solr.audit.logs.config_set.folder=/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/conf/solr_configsets
# Metrics
logsearch.solr.metrics.collector.hosts=
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-logsearch/docker/test-config/logsearch/logsearch.properties
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/test-config/logsearch/logsearch.properties b/ambari-logsearch/docker/test-config/logsearch/logsearch.properties
index 5bde17c..22edf76 100644
--- a/ambari-logsearch/docker/test-config/logsearch/logsearch.properties
+++ b/ambari-logsearch/docker/test-config/logsearch/logsearch.properties
@@ -31,8 +31,8 @@ logsearch.audit.logs.split.interval.mins=15
logsearch.collection.audit.logs.numshards=3
logsearch.collection.audit.logs.replication.factor=2
-logsearch.solr.config_set.folder=/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/solr_configsets
-logsearch.solr.audit.logs.config_set.folder=/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/solr_configsets
+logsearch.solr.config_set.folder=/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/conf/solr_configsets
+logsearch.solr.audit.logs.config_set.folder=/root/ambari/ambari-logsearch/ambari-logsearch-server/target/package/conf/solr_configsets
# History logs
logsearch.solr.collection.history=history
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logfeeder-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logfeeder-env.xml b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logfeeder-env.xml
index e308479..4afd7b6 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logfeeder-env.xml
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logfeeder-env.xml
@@ -160,6 +160,6 @@
<property-file-name>logfeeder-env.sh.j2</property-file-name>
<property-file-type>text</property-file-type>
</value-attributes>
- <on-ambari-upgrade add="true"/>
+ <on-ambari-upgrade add="true" update="true"/>
</property>
</configuration>
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logfeeder-properties.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logfeeder-properties.xml b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logfeeder-properties.xml
index a38f961..b43aaa6 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logfeeder-properties.xml
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logfeeder-properties.xml
@@ -29,7 +29,7 @@
</property>
<property>
<name>logfeeder.checkpoint.folder</name>
- <value>/etc/ambari-logsearch-logfeeder/conf/checkpoints</value>
+ <value>/usr/lib/ambari-logsearch-logfeeder/conf/checkpoints</value>
<description>Checkpoint folder for Log Feeder</description>
<display-name>Log Feeder checkpoint dir</display-name>
<value-attributes>
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logsearch-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logsearch-env.xml b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logsearch-env.xml
index 5c263db..cfc3504 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logsearch-env.xml
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logsearch-env.xml
@@ -107,7 +107,7 @@
</property>
<property>
<name>logsearch_truststore_location</name>
- <value>/etc/ambari-logsearch-portal/conf/keys/logsearch.jks</value>
+ <value>/usr/lib/ambari-logsearch-portal/conf/keys/logsearch.jks</value>
<display-name>Log Search trust store location</display-name>
<description>Location of the trust store file.</description>
<on-ambari-upgrade add="true"/>
@@ -133,7 +133,7 @@
</property>
<property>
<name>logsearch_keystore_location</name>
- <value>/etc/ambari-logsearch-portal/conf/keys/logsearch.jks</value>
+ <value>/usr/lib/ambari-logsearch-portal/conf/keys/logsearch.jks</value>
<display-name>Log Search key store location</display-name>
<description>Location of the key store file.</description>
<on-ambari-upgrade add="true"/>
@@ -183,6 +183,6 @@
<property-file-name>logsearch-env.sh.j2</property-file-name>
<property-file-type>text</property-file-type>
</value-attributes>
- <on-ambari-upgrade add="true"/>
+ <on-ambari-upgrade add="true" update="true"/>
</property>
</configuration>
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logfeeder.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logfeeder.py b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logfeeder.py
index fbc29c8..2f6c13c 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logfeeder.py
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logfeeder.py
@@ -23,7 +23,6 @@ from resource_management.libraries.functions.format import format
from resource_management.libraries.functions.check_process_status import check_process_status
from resource_management.libraries.script.script import Script
from setup_logfeeder import setup_logfeeder
-from logsearch_common import kill_process
class LogFeeder(Script):
def install(self, env):
@@ -43,15 +42,15 @@ class LogFeeder(Script):
env.set_params(params)
self.configure(env)
- Execute((format('{logfeeder_dir}/run.sh'),),
- environment={'LOGFEEDER_INCLUDE': format('{logsearch_logfeeder_conf}/logfeeder-env.sh')},
+ Execute((format('{logfeeder_dir}/bin/logfeeder.sh start'),),
sudo=True)
def stop(self, env, upgrade_type=None):
import params
env.set_params(params)
- kill_process(params.logfeeder_pid_file, getpass.getuser(), params.logfeeder_log_dir)
+ Execute((format('{logfeeder_dir}/bin/logfeeder.sh stop'),),
+ sudo=True)
def status(self, env):
import status_params
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logsearch.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logsearch.py b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logsearch.py
index 4410712..a276357 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logsearch.py
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logsearch.py
@@ -22,7 +22,6 @@ from resource_management.libraries.functions.check_process_status import check_p
from resource_management.libraries.functions.format import format
from resource_management.libraries.script.script import Script
from setup_logsearch import setup_logsearch
-from logsearch_common import kill_process
class LogSearch(Script):
def install(self, env):
@@ -41,8 +40,7 @@ class LogSearch(Script):
env.set_params(params)
self.configure(env)
- Execute(format("{logsearch_dir}/run.sh"),
- environment={'LOGSEARCH_INCLUDE': format('{logsearch_server_conf}/logsearch-env.sh')},
+ Execute(format("{logsearch_dir}/bin/logsearch.sh start"),
user=params.logsearch_user
)
@@ -50,7 +48,9 @@ class LogSearch(Script):
import params
env.set_params(params)
- kill_process(params.logsearch_pid_file, params.logsearch_user, params.logsearch_log_dir)
+ Execute(format("{logsearch_dir}/bin/logsearch.sh stop"),
+ user=params.logsearch_user
+ )
def status(self, env):
import status_params
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logsearch_common.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logsearch_common.py b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logsearch_common.py
deleted file mode 100644
index c4e0c16..0000000
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logsearch_common.py
+++ /dev/null
@@ -1,54 +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.
-
-"""
-
-from resource_management.core.resources.system import Execute, File
-from resource_management.libraries.functions.format import format
-from resource_management.libraries.functions.get_user_call_output import get_user_call_output
-from resource_management.libraries.functions.show_logs import show_logs
-
-def kill_process(pid_file, user, log_dir):
- import params
- """
- Kill the process by pid file, then check the process is running or not. If the process is still running after the kill
- command, it will try to kill with -9 option (hard kill)
- """
- pid = get_user_call_output(format("cat {pid_file}"), user=user, is_checked_call=False)[1]
- process_id_exists_command = format("ls {pid_file} >/dev/null 2>&1 && ps -p {pid} >/dev/null 2>&1")
-
- kill_cmd = format("{sudo} kill {pid}")
- Execute(kill_cmd,
- not_if=format("! ({process_id_exists_command})"))
- wait_time = 5
-
- hard_kill_cmd = format("{sudo} kill -9 {pid}")
- Execute(hard_kill_cmd,
- not_if=format("! ({process_id_exists_command}) || ( sleep {wait_time} && ! ({process_id_exists_command}) )"),
- ignore_failures = True)
- try:
- Execute(format("! ({process_id_exists_command})"),
- tries=20,
- try_sleep=3,
- )
- except:
- show_logs(log_dir, user)
- raise
-
- File(pid_file,
- action="delete"
- )
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
index 884d32a..4ea2018 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
@@ -56,9 +56,9 @@ credential_store_enabled = False
if 'credentialStoreEnabled' in config:
credential_store_enabled = config['credentialStoreEnabled']
-logsearch_server_conf = "/etc/ambari-logsearch-portal/conf"
+logsearch_server_conf = "/usr/lib/ambari-logsearch-portal/conf"
logsearch_server_keys_folder = logsearch_server_conf + "/keys"
-logsearch_logfeeder_conf = "/etc/ambari-logsearch-logfeeder/conf"
+logsearch_logfeeder_conf = "/usr/lib/ambari-logsearch-logfeeder/conf"
logsearch_logfeeder_keys_folder = logsearch_logfeeder_conf + "/keys"
logsearch_config_set_dir = format("{logsearch_server_conf}/solr_configsets")
@@ -170,7 +170,7 @@ zookeeper_quorum = logsearch_solr_zk_quorum
# logsearch-env configs
logsearch_user = config['configurations']['logsearch-env']['logsearch_user']
logsearch_log_dir = config['configurations']['logsearch-env']['logsearch_log_dir']
-logsearch_log = logsearch_log_dir + '/logsearch.out'
+logsearch_log = 'logsearch.out'
logsearch_debug_enabled = str(config['configurations']['logsearch-env']["logsearch_debug_enabled"]).lower()
logsearch_debug_port = config['configurations']['logsearch-env']["logsearch_debug_port"]
logsearch_app_max_memory = config['configurations']['logsearch-env']['logsearch_app_max_memory']
@@ -304,7 +304,7 @@ logfeeder_json_log_maxbackupindex = default('/configurations/logfeeder-log4j/log
# logfeeder-env configs
logfeeder_log_dir = config['configurations']['logfeeder-env']['logfeeder_log_dir']
-logfeeder_log = logfeeder_log_dir + '/logfeeder.out'
+logfeeder_log = 'logfeeder.out'
logfeeder_max_mem = config['configurations']['logfeeder-env']['logfeeder_max_mem']
solr_service_logs_enable = default('/configurations/logfeeder-env/logfeeder_solr_service_logs_enable', True)
solr_audit_logs_enable = default('/configurations/logfeeder-env/logfeeder_solr_audit_logs_enable', True)
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logfeeder.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logfeeder.py b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logfeeder.py
index 653d604..52b1d76 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logfeeder.py
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logfeeder.py
@@ -40,7 +40,7 @@ def setup_logfeeder():
recursive_ownership=True
)
- File(params.logfeeder_log,
+ File(format("{logfeeder_log_dir}/{logfeeder_log}"),
mode=0644,
content=''
)
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logsearch.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logsearch.py b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logsearch.py
index 7738cc1..e804b9a 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logsearch.py
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/setup_logsearch.py
@@ -53,7 +53,7 @@ def setup_logsearch():
owner=params.logsearch_user,
group=params.user_group)
- File(params.logsearch_log,
+ File(format("{logsearch_log_dir}/{logsearch_log}"),
mode=0644,
owner=params.logsearch_user,
group=params.user_group,
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logfeeder-env.sh.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logfeeder-env.sh.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logfeeder-env.sh.j2
index f2dd06b..f9f7e40 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logfeeder-env.sh.j2
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logfeeder-env.sh.j2
@@ -21,10 +21,11 @@ export LOGFEEDER_PATH={{logfeeder_dir}}
export LOGFEEDER_CONF_DIR={{logsearch_logfeeder_conf}}
#Logfile e.g. /var/log/logfeeder.log
-export LOGFILE={{logfeeder_log}}
+export LOG_PATH={{logfeeder_log_dir}}
+export LOG_FILE={{logfeeder_log}}
#pid file e.g. /var/run/logfeeder.pid
-export PID_FILE={{logfeeder_pid_file}}
+export LOGFEEDER_PID_FILE={{logfeeder_pid_file}}
export JAVA_HOME={{java64_home}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logsearch-env.sh.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logsearch-env.sh.j2 b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logsearch-env.sh.j2
index 7d9b5de..e823094 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logsearch-env.sh.j2
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/properties/logsearch-env.sh.j2
@@ -21,9 +21,10 @@ export LOGSEARCH_PATH={{logsearch_dir}}
export LOGSEARCH_CONF_DIR={{logsearch_server_conf}}
-export LOGFILE={{logsearch_log_dir}}/logsearch.log
+export LOG_PATH={{logsearch_log_dir}}
+export LOG_FILE={{logsearch_log}}
-export PID_FILE={{logsearch_pid_file}}
+export LOGSEARCH_PID_FILE={{logsearch_pid_file}}
export JAVA_HOME={{java64_home}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-server/src/main/resources/stack-hooks/after-INSTALL/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stack-hooks/after-INSTALL/scripts/params.py b/ambari-server/src/main/resources/stack-hooks/after-INSTALL/scripts/params.py
index bf9d79b..4eecfa2 100644
--- a/ambari-server/src/main/resources/stack-hooks/after-INSTALL/scripts/params.py
+++ b/ambari-server/src/main/resources/stack-hooks/after-INSTALL/scripts/params.py
@@ -47,7 +47,7 @@ major_stack_version = get_major_version(stack_version_formatted)
service_name = config['serviceName']
# logsearch configuration
-logsearch_logfeeder_conf = "/etc/ambari-logsearch-logfeeder/conf"
+logsearch_logfeeder_conf = "/usr/lib/ambari-logsearch-logfeeder/conf"
agent_cache_dir = config['hostLevelParams']['agentCacheDir']
service_package_folder = config['commandParams']['service_package_folder']
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-server/src/test/python/stacks/2.0.6/hooks/after-INSTALL/test_after_install.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/hooks/after-INSTALL/test_after_install.py b/ambari-server/src/test/python/stacks/2.0.6/hooks/after-INSTALL/test_after_install.py
index 19c81a8..1f1d3f7 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/hooks/after-INSTALL/test_after_install.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/hooks/after-INSTALL/test_after_install.py
@@ -58,7 +58,7 @@ class TestHookAfterInstall(RMFTestCase):
configuration_attributes = self.getConfig()['configuration_attributes']['core-site'],
only_if="ls /etc/hadoop/conf")
self.assertResourceCalled('Directory',
- '/etc/ambari-logsearch-logfeeder/conf',
+ '/usr/lib/ambari-logsearch-logfeeder/conf',
mode = 0755,
cd_access = 'a',
create_parents = True)
@@ -106,7 +106,7 @@ class TestHookAfterInstall(RMFTestCase):
only_if="ls /usr/hdp/2.3.0.0-1234/hadoop/conf")
self.assertResourceCalled('Directory',
- '/etc/ambari-logsearch-logfeeder/conf',
+ '/usr/lib/ambari-logsearch-logfeeder/conf',
mode = 0755,
cd_access = 'a',
create_parents = True)
@@ -174,7 +174,7 @@ class TestHookAfterInstall(RMFTestCase):
only_if="ls /usr/hdp/2.3.0.0-1234/hadoop/conf")
self.assertResourceCalled('Directory',
- '/etc/ambari-logsearch-logfeeder/conf',
+ '/usr/lib/ambari-logsearch-logfeeder/conf',
mode = 0755,
cd_access = 'a',
create_parents = True)
@@ -277,7 +277,7 @@ class TestHookAfterInstall(RMFTestCase):
only_if="ls /usr/hdp/2.3.0.0-1234/hadoop/conf")
self.assertResourceCalled('Directory',
- '/etc/ambari-logsearch-logfeeder/conf',
+ '/usr/lib/ambari-logsearch-logfeeder/conf',
mode = 0755,
cd_access = 'a',
create_parents = True)
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logfeeder.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logfeeder.py b/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logfeeder.py
index 159cb81..13774f7 100644
--- a/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logfeeder.py
+++ b/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logfeeder.py
@@ -37,7 +37,7 @@ class TestLogFeeder(RMFTestCase):
cd_access='a',
mode=0755
)
- self.assertResourceCalled('Directory', '/etc/ambari-logsearch-logfeeder/conf/checkpoints',
+ self.assertResourceCalled('Directory', '/usr/lib/ambari-logsearch-logfeeder/conf/checkpoints',
create_parents=True,
cd_access='a',
mode=0755
@@ -49,7 +49,7 @@ class TestLogFeeder(RMFTestCase):
cd_access='a',
mode=0755
)
- self.assertResourceCalled('Directory', '/etc/ambari-logsearch-logfeeder/conf',
+ self.assertResourceCalled('Directory', '/usr/lib/ambari-logsearch-logfeeder/conf',
create_parents=True,
recursive_ownership=True,
cd_access='a',
@@ -60,18 +60,18 @@ class TestLogFeeder(RMFTestCase):
mode=0644,
content=''
)
- self.assertResourceCalled('File', '/etc/ambari-logsearch-logfeeder/conf/keys/ks_pass.txt',
+ self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-logfeeder/conf/keys/ks_pass.txt',
action = ['delete']
)
- self.assertResourceCalled('File', '/etc/ambari-logsearch-logfeeder/conf/keys/ts_pass.txt',
+ self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-logfeeder/conf/keys/ts_pass.txt',
action = ['delete']
)
- self.assertResourceCalled('PropertiesFile', '/etc/ambari-logsearch-logfeeder/conf/logfeeder.properties',
+ self.assertResourceCalled('PropertiesFile', '/usr/lib/ambari-logsearch-logfeeder/conf/logfeeder.properties',
properties={'cluster.name': 'c1',
'common-property': 'common-value',
- 'hadoop.security.credential.provider.path': 'jceks://file/etc/ambari-logsearch-logfeeder/conf/logfeeder.jceks',
- 'logfeeder.checkpoint.folder': '/etc/ambari-logsearch-logfeeder/conf/checkpoints',
- 'logfeeder.config.dir': '/etc/ambari-logsearch-logfeeder/conf',
+ 'hadoop.security.credential.provider.path': 'jceks://file/usr/lib/ambari-logsearch-logfeeder/conf/logfeeder.jceks',
+ 'logfeeder.checkpoint.folder': '/usr/lib/ambari-logsearch-logfeeder/conf/checkpoints',
+ 'logfeeder.config.dir': '/usr/lib/ambari-logsearch-logfeeder/conf',
'logfeeder.config.files': 'output.config.json,global.config.json',
'logfeeder.metrics.collector.hosts': '',
'logfeeder.metrics.collector.path': '/ws/v1/timeline/metrics',
@@ -82,25 +82,25 @@ class TestLogFeeder(RMFTestCase):
'logsearch.config.zk_connect_string': 'c6401.ambari.apache.org:2181'
}
)
- self.assertResourceCalled('File', '/etc/ambari-logsearch-logfeeder/conf/logfeeder-env.sh',
+ self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-logfeeder/conf/logfeeder-env.sh',
mode=0755,
content=InlineTemplate(self.getConfig()['configurations']['logfeeder-env']['content'])
)
- self.assertResourceCalled('File', '/etc/ambari-logsearch-logfeeder/conf/log4j.xml',
+ self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-logfeeder/conf/log4j.xml',
content=InlineTemplate(self.getConfig()['configurations']['logfeeder-log4j']['content'])
)
- self.assertResourceCalled('File', '/etc/ambari-logsearch-logfeeder/conf/grok-patterns',
+ self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-logfeeder/conf/grok-patterns',
content=InlineTemplate('GP'),
encoding='utf-8'
)
- self.assertResourceCalled('File', '/etc/ambari-logsearch-logfeeder/conf/global.config.json',
+ self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-logfeeder/conf/global.config.json',
content=Template('global.config.json.j2')
)
- self.assertResourceCalled('File', '/etc/ambari-logsearch-logfeeder/conf/input.config-ambari.json',
+ self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-logfeeder/conf/input.config-ambari.json',
content=InlineTemplate('ambari-grok-filter'),
encoding='utf-8'
)
- self.assertResourceCalled('File', '/etc/ambari-logsearch-logfeeder/conf/output.config.json',
+ self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-logfeeder/conf/output.config.json',
content=InlineTemplate('output-grok-filter'),
encoding='utf-8'
)
@@ -127,8 +127,6 @@ class TestLogFeeder(RMFTestCase):
)
self.configureResourcesCalled()
- self.assertResourceCalled('Execute', ('/usr/lib/ambari-logsearch-logfeeder/run.sh',),
- sudo=True,
- environment={
- 'LOGFEEDER_INCLUDE': '/etc/ambari-logsearch-logfeeder/conf/logfeeder-env.sh'}
+ self.assertResourceCalled('Execute', ('/usr/lib/ambari-logsearch-logfeeder/bin/logfeeder.sh start',),
+ sudo=True
)
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logsearch.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logsearch.py b/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logsearch.py
index db19e0f..292773b 100644
--- a/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logsearch.py
+++ b/ambari-server/src/test/python/stacks/2.4/LOGSEARCH/test_logsearch.py
@@ -47,7 +47,7 @@ class TestLogSearch(RMFTestCase):
cd_access = 'a',
mode = 0755
)
- self.assertResourceCalled('Directory', '/etc/ambari-logsearch-portal/conf',
+ self.assertResourceCalled('Directory', '/usr/lib/ambari-logsearch-portal/conf',
owner = 'logsearch',
group = 'hadoop',
create_parents = True,
@@ -55,7 +55,7 @@ class TestLogSearch(RMFTestCase):
cd_access = 'a',
mode = 0755
)
- self.assertResourceCalled('Directory', '/etc/ambari-logsearch-portal/conf/solr_configsets',
+ self.assertResourceCalled('Directory', '/usr/lib/ambari-logsearch-portal/conf/solr_configsets',
owner = 'logsearch',
group = 'hadoop',
create_parents = True,
@@ -63,7 +63,7 @@ class TestLogSearch(RMFTestCase):
cd_access = 'a',
mode = 0755
)
- self.assertResourceCalled('Directory', '/etc/ambari-logsearch-portal/conf/keys',
+ self.assertResourceCalled('Directory', '/usr/lib/ambari-logsearch-portal/conf/keys',
owner = 'logsearch',
group = 'hadoop',
cd_access = 'a',
@@ -76,15 +76,15 @@ class TestLogSearch(RMFTestCase):
mode = 0644,
content = ''
)
- self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/keys/ks_pass.txt',
+ self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-portal/conf/keys/ks_pass.txt',
action = ['delete']
)
- self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/keys/ts_pass.txt',
+ self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-portal/conf/keys/ts_pass.txt',
action = ['delete']
)
- self.assertResourceCalled('PropertiesFile', '/etc/ambari-logsearch-portal/conf/logsearch.properties',
+ self.assertResourceCalled('PropertiesFile', '/usr/lib/ambari-logsearch-portal/conf/logsearch.properties',
properties = {'common-property': 'common-value',
- 'hadoop.security.credential.provider.path': 'jceks://file/etc/ambari-logsearch-portal/conf/logsearch.jceks',
+ 'hadoop.security.credential.provider.path': 'jceks://file/usr/lib/ambari-logsearch-portal/conf/logsearch.jceks',
'logsearch.audit.logs.split.interval.mins': '1',
'logsearch.auth.external_auth.enabled': 'false',
'logsearch.auth.external_auth.host_url': 'http://c6401.ambari.apache.org:8080',
@@ -115,38 +115,38 @@ class TestLogSearch(RMFTestCase):
'logsearch.spnego.kerberos.host': 'localhost'
}
)
- self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/HadoopServiceConfig.json',
+ self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-portal/conf/HadoopServiceConfig.json',
owner = 'logsearch',
group='hadoop',
content = Template('HadoopServiceConfig.json.j2')
)
- self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/log4j.xml',
+ self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-portal/conf/log4j.xml',
owner = 'logsearch',
group='hadoop',
content = InlineTemplate(self.getConfig()['configurations']['logsearch-log4j']['content'])
)
- self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/logsearch-env.sh',
+ self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-portal/conf/logsearch-env.sh',
content = InlineTemplate(self.getConfig()['configurations']['logsearch-env']['content']),
mode = 0755,
owner = "logsearch",
group='hadoop'
)
- self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/logsearch-admin.json',
+ self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-portal/conf/logsearch-admin.json',
owner = 'logsearch',
group='hadoop',
content = InlineTemplate(self.getConfig()['configurations']['logsearch-admin-json']['content'])
)
- self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/solr_configsets/hadoop_logs/conf/solrconfig.xml',
+ self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-portal/conf/solr_configsets/hadoop_logs/conf/solrconfig.xml',
owner = 'logsearch',
group='hadoop',
content = InlineTemplate(self.getConfig()['configurations']['logsearch-service_logs-solrconfig']['content'])
)
- self.assertResourceCalled('File', '/etc/ambari-logsearch-portal/conf/solr_configsets/audit_logs/conf/solrconfig.xml',
+ self.assertResourceCalled('File', '/usr/lib/ambari-logsearch-portal/conf/solr_configsets/audit_logs/conf/solrconfig.xml',
owner = 'logsearch',
group='hadoop',
content = InlineTemplate(self.getConfig()['configurations']['logsearch-audit_logs-solrconfig']['content'])
)
- self.assertResourceCalled('Execute', ('chmod', '-R', 'ugo+r', '/etc/ambari-logsearch-portal/conf/solr_configsets'),
+ self.assertResourceCalled('Execute', ('chmod', '-R', 'ugo+r', '/usr/lib/ambari-logsearch-portal/conf/solr_configsets'),
sudo = True
)
self.assertResourceCalled('Execute', 'ambari-sudo.sh JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /usr/lib/ambari-infra-solr-client/solrCloudCli.sh --zookeeper-connect-string c6401.ambari.apache.org:2181 --znode /infra-solr --check-znode --retry 30 --interval 5')
@@ -174,7 +174,6 @@ class TestLogSearch(RMFTestCase):
)
self.configureResourcesCalled()
- self.assertResourceCalled('Execute', "/usr/lib/ambari-logsearch-portal/run.sh",
- environment = {'LOGSEARCH_INCLUDE': '/etc/ambari-logsearch-portal/conf/logsearch-env.sh'},
+ self.assertResourceCalled('Execute', "/usr/lib/ambari-logsearch-portal/bin/logsearch.sh start",
user = "logsearch"
)
http://git-wip-us.apache.org/repos/asf/ambari/blob/26a33e54/ambari-server/src/test/python/stacks/2.4/configs/default.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.4/configs/default.json b/ambari-server/src/test/python/stacks/2.4/configs/default.json
index 9966f3e..701132a 100644
--- a/ambari-server/src/test/python/stacks/2.4/configs/default.json
+++ b/ambari-server/src/test/python/stacks/2.4/configs/default.json
@@ -315,7 +315,7 @@
"logsearch.roles.allowed": "AMBARI.ADMINISTRATOR,CLUSTER.ADMINISTRATOR"
},
"logfeeder-properties": {
- "logfeeder.checkpoint.folder" : "/etc/ambari-logsearch-logfeeder/conf/checkpoints",
+ "logfeeder.checkpoint.folder" : "/usr/lib/ambari-logsearch-logfeeder/conf/checkpoints",
"logfeeder.metrics.collector.hosts" : "{metrics_collector_hosts}",
"logfeeder.config.files" : "{default_config_files}"
},
[46/50] [abbrv] ambari git commit: Updating Ambari docs for Ambari
2.6.1 and Ambari 2.6.0
Posted by rl...@apache.org.
Updating Ambari docs for Ambari 2.6.1 and Ambari 2.6.0
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b171ae33
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b171ae33
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b171ae33
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: b171ae33e0b450a40297857a03cf67522e7a7605
Parents: 297e5b9
Author: Swapan Shridhar <ss...@hortonworks.com>
Authored: Mon Dec 18 22:39:17 2017 -0800
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Fri Jan 5 17:54:17 2018 -0500
----------------------------------------------------------------------
docs/pom.xml | 2 +-
docs/src/site/apt/index.apt | 2 +-
docs/src/site/apt/whats-new.apt | 14 +++++++++++++-
docs/src/site/site.xml | 4 ++++
4 files changed, 19 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/b171ae33/docs/pom.xml
----------------------------------------------------------------------
diff --git a/docs/pom.xml b/docs/pom.xml
index f3de652..e24a340 100644
--- a/docs/pom.xml
+++ b/docs/pom.xml
@@ -28,7 +28,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.ambari</groupId>
- <version>2.5.2</version>
+ <version>2.6.1</version>
<artifactId>ambari</artifactId>
<packaging>pom</packaging>
http://git-wip-us.apache.org/repos/asf/ambari/blob/b171ae33/docs/src/site/apt/index.apt
----------------------------------------------------------------------
diff --git a/docs/src/site/apt/index.apt b/docs/src/site/apt/index.apt
index d9bbe6d..3ffe78e 100644
--- a/docs/src/site/apt/index.apt
+++ b/docs/src/site/apt/index.apt
@@ -52,7 +52,7 @@ Introduction
Getting Started with Ambari
- Follow the {{{https://cwiki.apache.org/confluence/display/AMBARI/Installation+Guide+for+Ambari+2.5.2} installation guide for Ambari 2.5.2}}.
+ Follow the {{{https://cwiki.apache.org/confluence/display/AMBARI/Installation+Guide+for+Ambari+2.6.1} installation guide for Ambari 2.6.1}}.
Note: Ambari currently supports the 64-bit version of the following Operating Systems:
http://git-wip-us.apache.org/repos/asf/ambari/blob/b171ae33/docs/src/site/apt/whats-new.apt
----------------------------------------------------------------------
diff --git a/docs/src/site/apt/whats-new.apt b/docs/src/site/apt/whats-new.apt
index a1625ce..6ab75a1 100644
--- a/docs/src/site/apt/whats-new.apt
+++ b/docs/src/site/apt/whats-new.apt
@@ -16,7 +16,19 @@
What's New with Ambari?
- * The latest release of Ambari is Ambari 2.5.2.
+ * The latest release of Ambari is Ambari 2.6.1.
+
+ * Ambari 2.6.1 added the following feature:
+
+ * Conditionally Install LZO packages through Ambari (AMBARI-22457)
+
+ * Ambari 2.6.0 added the following features:
+
+ * Ambari Metrics System's (AMS) distributed mode with multiple Collectors (General Availability) (AMBARI-15901)
+
+ * Improvements in Host Recovery (Restart only), moving masters with minimum impact and scale testing (AMBARI-21898, AMBARI-21929, AMBARI-21834)
+
+ * Improvement in Data Archival & Purging in Ambari Infra (AMBARI-21810)
* Ambari 2.5.2 added the following features:
http://git-wip-us.apache.org/repos/asf/ambari/blob/b171ae33/docs/src/site/site.xml
----------------------------------------------------------------------
diff --git a/docs/src/site/site.xml b/docs/src/site/site.xml
index f2d0d07..66d7ad4 100644
--- a/docs/src/site/site.xml
+++ b/docs/src/site/site.xml
@@ -107,6 +107,8 @@
<item name="Quick Start Guide" href="https://cwiki.apache.org/confluence/display/AMBARI/Quick+Start+Guide"/>
<item name="Features + Roadmap" href="https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=30755705"/>
<item name="API Reference" href="https://github.com/apache/ambari/blob/trunk/ambari-server/docs/api/v1/index.md"/>
+ <item name="Install Guide for 2.6.1" href="https://cwiki.apache.org/confluence/display/AMBARI/Installation+Guide+for+Ambari+2.6.1"/>
+ <item name="Install Guide for 2.6.0" href="https://cwiki.apache.org/confluence/display/AMBARI/Installation+Guide+for+Ambari+2.6.0"/>
<item name="Install Guide for 2.5.2" href="https://cwiki.apache.org/confluence/display/AMBARI/Installation+Guide+for+Ambari+2.5.2"/>
<item name="Install Guide for 2.5.1" href="https://cwiki.apache.org/confluence/display/AMBARI/Installation+Guide+for+Ambari+2.5.1"/>
<item name="Install Guide for 2.5.0" href="https://cwiki.apache.org/confluence/display/AMBARI/Installation+Guide+for+Ambari+2.5.0"/>
@@ -142,6 +144,8 @@
</menu>
<menu name="Releases">
+ <item name="2.6.1" href="http://www.apache.org/dyn/closer.cgi/ambari/ambari-2.6.1"/>
+ <item name="2.6.0" href="http://www.apache.org/dyn/closer.cgi/ambari/ambari-2.6.0"/>
<item name="2.5.2" href="http://www.apache.org/dyn/closer.cgi/ambari/ambari-2.5.2"/>
<item name="2.5.1" href="http://www.apache.org/dyn/closer.cgi/ambari/ambari-2.5.1"/>
<item name="2.5.0" href="http://www.apache.org/dyn/closer.cgi/ambari/ambari-2.5.0"/>
[22/50] [abbrv] ambari git commit: AMBARI-22724. Idempotent issue on
Ambari Upgrade,
renameServiceDeletedColumn failed with column already exists
exception.(vbrodetskyi)
Posted by rl...@apache.org.
AMBARI-22724. Idempotent issue on Ambari Upgrade, renameServiceDeletedColumn failed with column already exists exception.(vbrodetskyi)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/cd5c1cad
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/cd5c1cad
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/cd5c1cad
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: cd5c1cad8f62c45de62094de2b5e442d161c9b34
Parents: e13bfb9
Author: Vitaly Brodetskyi <vb...@hortonworks.com>
Authored: Fri Jan 5 16:29:39 2018 +0200
Committer: Vitaly Brodetskyi <vb...@hortonworks.com>
Committed: Fri Jan 5 16:32:21 2018 +0200
----------------------------------------------------------------------
.../org/apache/ambari/server/upgrade/UpgradeCatalog252.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/cd5c1cad/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog252.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog252.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog252.java
index 1b706d6..62e56fc 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog252.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog252.java
@@ -59,6 +59,7 @@ public class UpgradeCatalog252 extends AbstractUpgradeCatalog {
static final String CLUSTERCONFIG_TABLE = "clusterconfig";
static final String SERVICE_DELETED_COLUMN = "service_deleted";
+ static final String UNMAPPED_COLUMN = "unmapped";
private static final String UPGRADE_TABLE = "upgrade";
private static final String UPGRADE_TABLE_FROM_REPO_COLUMN = "from_repo_version_id";
@@ -141,8 +142,10 @@ public class UpgradeCatalog252 extends AbstractUpgradeCatalog {
* @throws java.sql.SQLException
*/
private void addServiceDeletedColumnToClusterConfigTable() throws SQLException {
- dbAccessor.addColumn(CLUSTERCONFIG_TABLE,
- new DBColumnInfo(SERVICE_DELETED_COLUMN, Short.class, null, 0, false));
+ if (!dbAccessor.tableHasColumn(CLUSTERCONFIG_TABLE, UNMAPPED_COLUMN)) {
+ dbAccessor.addColumn(CLUSTERCONFIG_TABLE,
+ new DBColumnInfo(SERVICE_DELETED_COLUMN, Short.class, null, 0, false));
+ }
}
/**
[26/50] [abbrv] ambari git commit: AMBARI-22647. ADDENDUM -Rafactor:
Package Log Search and Log Feeder into jars + cleanup start scripts
(oleewere)
Posted by rl...@apache.org.
AMBARI-22647. ADDENDUM -Rafactor: Package Log Search and Log Feeder into jars + cleanup start scripts (oleewere)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/85ef6119
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/85ef6119
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/85ef6119
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 85ef6119d808563adcc5989a245242368bc220de
Parents: df19a69
Author: Oliver Szabo <ol...@gmail.com>
Authored: Mon Dec 18 22:01:09 2017 +0100
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Fri Jan 5 17:54:16 2018 -0500
----------------------------------------------------------------------
.../src/main/resources/logfeeder.properties | 5 +----
.../src/main/scripts/logfeeder.sh | 17 ++++++++---------
.../src/main/scripts/logsearch.sh | 17 ++++++++---------
ambari-logsearch/docker/bin/start.sh | 9 +++++----
4 files changed, 22 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/85ef6119/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 4b49446..5217309 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/resources/logfeeder.properties
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/resources/logfeeder.properties
@@ -23,9 +23,8 @@ logfeeder.config.files=${LOGFEEDER_RELATIVE_LOCATION:}target/classes/log-samples
${LOGFEEDER_RELATIVE_LOCATION:}target/classes/log-samples/shipper-conf/output.config-sample.json
logfeeder.log.filter.enable=true
+logfeeder.include.default.level=FATAL,ERROR,WARN,INFO,DEBUG,TRACE,UNKNOWN
-logfeeder.solr.config.interval=5
-logfeeder.solr.core.config.name=history
logfeeder.solr.zk_connect_string=localhost:2181
logfeeder.cache.enabled=true
@@ -34,7 +33,5 @@ logfeeder.cache.key.field=log_message
logfeeder.cache.dedup.interval=1000
logfeeder.cache.last.dedup.enabled=true
-logfeeder.include.default.level=FATAL,ERROR,WARN,INFO,DEBUG,TRACE,UNKNOWN
-
#logfeeder tmp dir
logfeeder.tmp.dir=${LOGFEEDER_RELATIVE_LOCATION:}target/tmp
http://git-wip-us.apache.org/repos/asf/ambari/blob/85ef6119/ambari-logsearch/ambari-logsearch-logfeeder/src/main/scripts/logfeeder.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/scripts/logfeeder.sh b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/scripts/logfeeder.sh
index cfacea5..5f4edea 100755
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/scripts/logfeeder.sh
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/scripts/logfeeder.sh
@@ -119,27 +119,26 @@ function spinner() {
}
function status() {
- echo "Checking Log Feeder status ..."
+ echo "Checking Log Feeder status ..." >&2
if [ -f "$LOGFEEDER_PID_FILE" ]; then
LOGFEEDER_PID=`cat "$LOGFEEDER_PID_FILE"`
else
- echo "Log Feeder pid not exists. (probably the process is not running)"
- exit 1
+ echo "Log Feeder pid not exists. (probably the process is not running)" >&2
+ return 1
fi
if ps -p $LOGFEEDER_PID > /dev/null
then
- echo "Log Feeder process is running. (pid: $LOGFEEDER_PID)"
- exit 0
+ echo "Log Feeder process is running. (pid: $LOGFEEDER_PID)" >&2
+ return 0
else
- echo "Log Feeder process is not running."
- exit 1
+ echo "Log Feeder process is not running." >&2
+ return 1
fi
}
function start() {
- (status);
- exit_status=$(echo $?)
+ exit_status=$(status; echo $?)
if [ "$exit_status" = "0" ]; then
echo "Skipping start process."
exit 0
http://git-wip-us.apache.org/repos/asf/ambari/blob/85ef6119/ambari-logsearch/ambari-logsearch-server/src/main/scripts/logsearch.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/scripts/logsearch.sh b/ambari-logsearch/ambari-logsearch-server/src/main/scripts/logsearch.sh
index 128617c..8439065 100755
--- a/ambari-logsearch/ambari-logsearch-server/src/main/scripts/logsearch.sh
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/scripts/logsearch.sh
@@ -109,27 +109,26 @@ function spinner() {
}
function status() {
- echo "Checking Log Search status ..."
+ echo "Checking Log Search status ..." >&2
if [ -f "$LOGSEARCH_PID_FILE" ]; then
LOGSEARCH_PID=`cat "$LOGSEARCH_PID_FILE"`
else
- echo "Log Search pid not exists. (probably the process is not running)"
- exit 1
+ echo "Log Search pid not exists. (probably the process is not running)" >&2
+ return 1
fi
if ps -p $LOGSEARCH_PID > /dev/null
then
- echo "Log Search process is running. (pid: $LOGSEARCH_PID)"
- exit 0
+ echo "Log Search process is running. (pid: $LOGSEARCH_PID)" >&2
+ return 0
else
- echo "Log Search process is not running."
- exit 1
+ echo "Log Search process is not running." >&2
+ return 1
fi
}
function start() {
- (status);
- exit_status=$(echo $?)
+ exit_status=$(status; echo $?)
if [ "$exit_status" = "0" ]; then
echo "Skipping start process."
exit 0
http://git-wip-us.apache.org/repos/asf/ambari/blob/85ef6119/ambari-logsearch/docker/bin/start.sh
----------------------------------------------------------------------
diff --git a/ambari-logsearch/docker/bin/start.sh b/ambari-logsearch/docker/bin/start.sh
index f2acf9b..6ba20fb 100644
--- a/ambari-logsearch/docker/bin/start.sh
+++ b/ambari-logsearch/docker/bin/start.sh
@@ -46,7 +46,7 @@ function create_logfeeder_configs() {
}
function create_logsearch_configs() {
- mkdir /root/config/logsearch
+ mkdir -p /root/config/logsearch
cp /root/test-config/logsearch/log4j.xml /root/config/logsearch/
cp /root/test-config/logsearch/logsearch-env.sh /root/config/logsearch/
cp $LOGSEARCH_SERVER_PATH/conf/user_pass.json /root/config/logsearch/user_pass.json
@@ -148,7 +148,7 @@ function main() {
case $component in
"solr")
create_solr_configs
- echo "Start Solr only.."
+ echo "Start Solr only ..."
export COMPONENT_LOG="solr"
generate_keys
start_solr_d
@@ -156,17 +156,18 @@ function main() {
;;
"logfeeder")
create_logfeeder_configs
- echo "Start Log Feeder only.."
+ echo "Start Log Feeder only ..."
export COMPONENT_LOG="logfeeder"
generate_keys
start_logfeeder
;;
"logsearch")
create_logsearch_configs
- echo "Start Log Search only.."
+ echo "Start Log Search only ..."
export COMPONENT_LOG="logsearch"
generate_keys
start_logsearch
+ log
;;
*)
create_configs
[25/50] [abbrv] ambari git commit: AMBARI-22663 Log Search UI:
incorrect caption for graph gap in weeks. (ababiichuk)
Posted by rl...@apache.org.
AMBARI-22663 Log Search UI: incorrect caption for graph gap in weeks. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2244d973
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2244d973
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2244d973
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 2244d973833ba1ce12bb73dc861ced618f3b9344
Parents: d5120aa
Author: ababiichuk <ab...@hortonworks.com>
Authored: Mon Dec 18 13:30:27 2017 +0200
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Fri Jan 5 17:54:16 2018 -0500
----------------------------------------------------------------------
ambari-logsearch/ambari-logsearch-web/src/assets/i18n/en.json | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/2244d973/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 3f4f5c8..9561ca0 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/assets/i18n/en.json
+++ b/ambari-logsearch/ambari-logsearch-web/src/assets/i18n/en.json
@@ -169,5 +169,7 @@
"histogram.gap.hour": "hour",
"histogram.gap.hours": "hours",
"histogram.gap.day": "day",
- "histogram.gap.days": "days"
+ "histogram.gap.days": "days",
+ "histogram.gap.week": "week",
+ "histogram.gap.weeks": "weeks"
}
[03/50] [abbrv] ambari git commit: AMBARI-22710 Post-install: Create
Widget wizard style fixes. (atkach)
Posted by rl...@apache.org.
AMBARI-22710 Post-install: Create Widget wizard style fixes. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6db30d89
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6db30d89
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6db30d89
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 6db30d89fd0098bec0dacf74b085ccc4ace56947
Parents: c1b8cda
Author: Andrii Tkach <at...@apache.org>
Authored: Fri Dec 29 15:56:19 2017 +0200
Committer: Andrii Tkach <at...@apache.org>
Committed: Fri Dec 29 15:56:19 2017 +0200
----------------------------------------------------------------------
.../app/controllers/main/service/info/metric.js | 13 ++++++++++++
.../app/mixins/common/widgets/widget_mixin.js | 1 +
ambari-web/app/routes/create_widget.js | 3 +++
ambari-web/app/styles/common.less | 1 +
.../app/styles/config_versions_control.less | 4 +++-
.../app/styles/enhanced_service_dashboard.less | 22 ++++++++++++++++----
.../modal_popups/widget_browser_footer.hbs | 1 -
.../templates/common/widget/gauge_widget.hbs | 2 +-
.../templates/common/widget/graph_widget.hbs | 2 +-
.../templates/common/widget/number_widget.hbs | 2 +-
.../templates/common/widget/template_widget.hbs | 2 +-
.../configs/config_versions_dropdown_view.js | 11 ++++++++++
.../main/service/widgets/create/wizard_view.js | 2 +-
13 files changed, 55 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/6db30d89/ambari-web/app/controllers/main/service/info/metric.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/info/metric.js b/ambari-web/app/controllers/main/service/info/metric.js
index 9dfc32c..b9e0fb1 100644
--- a/ambari-web/app/controllers/main/service/info/metric.js
+++ b/ambari-web/app/controllers/main/service/info/metric.js
@@ -374,6 +374,19 @@ App.MainServiceInfoMetricsController = Em.Controller.extend(App.WidgetSectionMix
}
}),
isShowMineOnly: false,
+ showTopShadow: false,
+
+ didInsertElement: function() {
+ this._super();
+ this.$().find('.modal-body').on('scroll', (event) => {
+ const modalBody = $(event.currentTarget);
+ if (modalBody.scrollTop() > 0) {
+ modalBody.addClass('top-shadow');
+ } else {
+ modalBody.removeClass('top-shadow');
+ }
+ });
+ },
bodyClass: Ember.View.extend({
templateName: require('templates/common/modal_popups/widget_browser_popup'),
controller: self,
http://git-wip-us.apache.org/repos/asf/ambari/blob/6db30d89/ambari-web/app/mixins/common/widgets/widget_mixin.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/widgets/widget_mixin.js b/ambari-web/app/mixins/common/widgets/widget_mixin.js
index 0c40fd7..cb10d8c 100644
--- a/ambari-web/app/mixins/common/widgets/widget_mixin.js
+++ b/ambari-web/app/mixins/common/widgets/widget_mixin.js
@@ -695,6 +695,7 @@ App.WidgetMixin = Ember.Mixin.create({
App.WidgetPreviewMixin = Ember.Mixin.create({
beforeRender: Em.K,
isLoaded: true,
+ isPreview: true,
metrics: [],
content: Em.Object.create({
id: 1,
http://git-wip-us.apache.org/repos/asf/ambari/blob/6db30d89/ambari-web/app/routes/create_widget.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/create_widget.js b/ambari-web/app/routes/create_widget.js
index f014a7f..1e4a30e 100644
--- a/ambari-web/app/routes/create_widget.js
+++ b/ambari-web/app/routes/create_widget.js
@@ -62,6 +62,7 @@ module.exports = App.WizardRoute.extend({
step1: Em.Route.extend({
route: '/step1',
+ breadcrumbs: null,
connectOutlets: function (router) {
var controller = router.get('widgetWizardController');
@@ -95,6 +96,7 @@ module.exports = App.WizardRoute.extend({
step2: Em.Route.extend({
route: '/step2',
+ breadcrumbs: null,
connectOutlets: function (router) {
var controller = router.get('widgetWizardController');
@@ -125,6 +127,7 @@ module.exports = App.WizardRoute.extend({
step3: Em.Route.extend({
route: '/step3',
+ breadcrumbs: null,
connectOutlets: function (router) {
var controller = router.get('widgetWizardController');
http://git-wip-us.apache.org/repos/asf/ambari/blob/6db30d89/ambari-web/app/styles/common.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/common.less b/ambari-web/app/styles/common.less
index 4a4f9ec..b666ab3 100644
--- a/ambari-web/app/styles/common.less
+++ b/ambari-web/app/styles/common.less
@@ -60,6 +60,7 @@
@restart-indicator-color: #FDB82F;
+@border-color: #EBECF1;
@top-nav-bg-color-from: #555;
@top-nav-bg-color-to: #333;
@top-nav-brand-color: #999;
http://git-wip-us.apache.org/repos/asf/ambari/blob/6db30d89/ambari-web/app/styles/config_versions_control.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/config_versions_control.less b/ambari-web/app/styles/config_versions_control.less
index 5b947a4..0b7f131 100644
--- a/ambari-web/app/styles/config_versions_control.less
+++ b/ambari-web/app/styles/config_versions_control.less
@@ -18,7 +18,6 @@
@import 'common.less';
@button-width: 150px;
-@border-color: #EBECF1;
#config-versions-control {
.dropdown-menu {
@@ -37,6 +36,9 @@
list-style-type: none;
}
}
+ .bottom-shadow {
+ box-shadow: inset 0 0 0 @border-color, inset 0px -10px 8px -8px @border-color;
+ }
.grey-text {
color: @top-nav-brand-color;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/6db30d89/ambari-web/app/styles/enhanced_service_dashboard.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/enhanced_service_dashboard.less b/ambari-web/app/styles/enhanced_service_dashboard.less
index 4c97539..d12f5a8 100644
--- a/ambari-web/app/styles/enhanced_service_dashboard.less
+++ b/ambari-web/app/styles/enhanced_service_dashboard.less
@@ -18,7 +18,6 @@
@import 'common.less';
-@border-color: #ddd;
@invalid-color: red;
@add-widget-btn-color: #f5f5f5;
@@ -66,6 +65,15 @@
}
}
+.widgets-browser-popup {
+ .modal-body {
+ box-shadow: inset 0 0 0 @border-color, inset 0px -10px 8px -8px @border-color;
+ }
+ .top-shadow {
+ box-shadow: inset 0 10px 8px -8px @border-color, inset 0px -10px 8px -8px @border-color;
+ }
+}
+
#widget_layout,
#widget-preview {
.frame {
@@ -83,6 +91,11 @@
.img-thumbnail {
position: relative;
box-sizing: content-box;
+ .widget-icons {
+ position: absolute;
+ right: 5px;
+ top: 6px;
+ }
}
.spinner {
margin: 55px auto;
@@ -243,9 +256,6 @@
}
}
.widget-icons {
- position: absolute;
- right: 5px;
- top: 6px;
ul {
display: none;
border-radius: 2px;
@@ -481,6 +491,9 @@
border: 1px solid @invalid-color;
}
}
+ .add-number {
+ width: 30%;
+ }
}
.template {
margin-bottom: 10px;
@@ -735,6 +748,7 @@ select.form-control + .chosen-container {
text-decoration: none;
background-color: #428BCA;
background-image:none;
+ white-space: normal;
}
li.disabled-result{
background-color: #fff !important;
http://git-wip-us.apache.org/repos/asf/ambari/blob/6db30d89/ambari-web/app/templates/common/modal_popups/widget_browser_footer.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/modal_popups/widget_browser_footer.hbs b/ambari-web/app/templates/common/modal_popups/widget_browser_footer.hbs
index 6c781e5..e65611b 100644
--- a/ambari-web/app/templates/common/modal_popups/widget_browser_footer.hbs
+++ b/ambari-web/app/templates/common/modal_popups/widget_browser_footer.hbs
@@ -21,7 +21,6 @@
<div class="checkbox pull-left">
{{view App.CheckboxView classNames="footer-checkbox" checkedBinding="view.parentView.isShowMineOnly" labelTranslate="dashboard.widgets.browser.footer.checkbox"}}
</div>
- <div class="clearfix"></div>
{{/isAuthorized}}
<button class="btn btn-success" {{action onPrimary target="view"}}>{{t common.close}}</button>
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/6db30d89/ambari-web/app/templates/common/widget/gauge_widget.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/widget/gauge_widget.hbs b/ambari-web/app/templates/common/widget/gauge_widget.hbs
index 9c776b3..fee24ca 100644
--- a/ambari-web/app/templates/common/widget/gauge_widget.hbs
+++ b/ambari-web/app/templates/common/widget/gauge_widget.hbs
@@ -19,7 +19,7 @@
<div class="gauge-widget img-thumbnail">
{{#if view.isLoaded}}
<div class="caption title col-md-11">{{view.content.widgetName}}</div>
- <div {{bindAttr class="view.parentView.isMoving:hidden :corner-icon :widget-icons"}}>
+ <div {{bindAttr class="view.parentView.isMoving:hidden :corner-icon :widget-icons view.isPreview:hidden"}}>
<button class="dropdown-toggle ellipsis-menu button-border" data-toggle="dropdown" href="#"></button>
<ul class="dropdown-menu">
{{#if controller.isAmbariMetricsInstalled}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/6db30d89/ambari-web/app/templates/common/widget/graph_widget.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/widget/graph_widget.hbs b/ambari-web/app/templates/common/widget/graph_widget.hbs
index 010b77f..4978d9d 100644
--- a/ambari-web/app/templates/common/widget/graph_widget.hbs
+++ b/ambari-web/app/templates/common/widget/graph_widget.hbs
@@ -19,7 +19,7 @@
<div class="graph-widget img-thumbnail">
{{#if view.isLoaded}}
<div class="caption title col-md-11">{{view.content.widgetName}}</div>
- <div {{bindAttr class="view.parentView.isMoving:hidden :corner-icon :widget-icons"}}>
+ <div {{bindAttr class="view.parentView.isMoving:hidden :corner-icon :widget-icons view.isPreview:hidden"}}>
<button class="dropdown-toggle ellipsis-menu button-border" data-toggle="dropdown" href="#"></button>
<ul class="dropdown-menu">
<li>
http://git-wip-us.apache.org/repos/asf/ambari/blob/6db30d89/ambari-web/app/templates/common/widget/number_widget.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/widget/number_widget.hbs b/ambari-web/app/templates/common/widget/number_widget.hbs
index c145912..6197ea6 100644
--- a/ambari-web/app/templates/common/widget/number_widget.hbs
+++ b/ambari-web/app/templates/common/widget/number_widget.hbs
@@ -19,7 +19,7 @@
<div class="number-widget img-thumbnail">
{{#if view.isLoaded}}
<div class="caption title col-md-11">{{view.content.widgetName}}</div>
- <div {{bindAttr class="view.parentView.isMoving:hidden :corner-icon :widget-icons"}}>
+ <div {{bindAttr class="view.parentView.isMoving:hidden :corner-icon :widget-icons view.isPreview:hidden"}}>
<button class="dropdown-toggle ellipsis-menu button-border" data-toggle="dropdown" href="#"></button>
<ul class="dropdown-menu">
{{#if controller.isAmbariMetricsInstalled}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/6db30d89/ambari-web/app/templates/common/widget/template_widget.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/widget/template_widget.hbs b/ambari-web/app/templates/common/widget/template_widget.hbs
index 20438f9..98b6f0d 100644
--- a/ambari-web/app/templates/common/widget/template_widget.hbs
+++ b/ambari-web/app/templates/common/widget/template_widget.hbs
@@ -19,7 +19,7 @@
<div class="template-widget img-thumbnail">
{{#if view.isLoaded}}
<div class="caption title col-md-11">{{view.content.widgetName}}</div>
- <div {{bindAttr class="view.parentView.isMoving:hidden :corner-icon :widget-icons"}}>
+ <div {{bindAttr class="view.parentView.isMoving:hidden :corner-icon :widget-icons view.isPreview:hidden"}}>
<button class="dropdown-toggle ellipsis-menu button-border" data-toggle="dropdown" href="#"></button>
<ul class="dropdown-menu">
{{#if controller.isAmbariMetricsInstalled}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/6db30d89/ambari-web/app/views/common/configs/config_versions_dropdown_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/config_versions_dropdown_view.js b/ambari-web/app/views/common/configs/config_versions_dropdown_view.js
index 8e5cb76..fc9cb02 100644
--- a/ambari-web/app/views/common/configs/config_versions_dropdown_view.js
+++ b/ambari-web/app/views/common/configs/config_versions_dropdown_view.js
@@ -34,6 +34,17 @@ App.ConfigVersionsDropdownView = Em.View.extend({
isCompareMode: false,
displayedServiceVersion: Em.computed.findBy('serviceVersions', 'isDisplayed', true),
+ didInsertElement: function() {
+ this.$().on("shown.bs.dropdown", function() {
+ const versionsBlock = $(this).find('.versions-list');
+ if (versionsBlock.height() < versionsBlock.prop('scrollHeight')) {
+ versionsBlock.addClass('bottom-shadow');
+ } else {
+ versionsBlock.removeClass('bottom-shadow');
+ }
+ });
+ },
+
mainClickAction: function (event) {
if (this.get('isSecondary')) {
this.get('parentView').compare(event);
http://git-wip-us.apache.org/repos/asf/ambari/blob/6db30d89/ambari-web/app/views/main/service/widgets/create/wizard_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/widgets/create/wizard_view.js b/ambari-web/app/views/main/service/widgets/create/wizard_view.js
index 70d43be..e39d494 100644
--- a/ambari-web/app/views/main/service/widgets/create/wizard_view.js
+++ b/ambari-web/app/views/main/service/widgets/create/wizard_view.js
@@ -28,7 +28,7 @@ App.WidgetWizardView = Em.View.extend(App.WizardMenuMixin, {
previewWidgetClass: function () {
switch (this.get('controller.content.widgetType')) {
case 'GRAPH':
- return App.GraphWidgetView.extend(App.WidgetPreviewMixin, {isPreview: true});
+ return App.GraphWidgetView.extend(App.WidgetPreviewMixin);
case 'TEMPLATE':
return App.TemplateWidgetView.extend(App.WidgetPreviewMixin);
case 'NUMBER':
[41/50] [abbrv] ambari git commit: AMBARI-22639. Log Feeder refactor:
integrate with spring boot (oleewere)
Posted by rl...@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/4a668f0b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4a668f0b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4a668f0b
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 4a668f0b69426f7a2c4379e0930fea739a1b6c0b
Parents: e99867a
Author: Oliver Szabo <ol...@gmail.com>
Authored: Tue Dec 12 22:34:09 2017 +0100
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Fri Jan 5 17:54:16 2018 -0500
----------------------------------------------------------------------
.../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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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/4a668f0b/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));
}
[21/50] [abbrv] ambari git commit: AMBARI-22732 Make Select Metric
dropdown in Create Widget wizard wider. (atkach)
Posted by rl...@apache.org.
AMBARI-22732 Make Select Metric dropdown in Create Widget wizard wider. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e13bfb95
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e13bfb95
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e13bfb95
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: e13bfb95ce15cfe38e9d9d5409cbe44de59d44b8
Parents: d6f26fb
Author: Andrii Tkach <at...@apache.org>
Authored: Fri Jan 5 15:49:59 2018 +0200
Committer: Andrii Tkach <at...@apache.org>
Committed: Fri Jan 5 15:49:59 2018 +0200
----------------------------------------------------------------------
ambari-web/app/styles/enhanced_service_dashboard.less | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/e13bfb95/ambari-web/app/styles/enhanced_service_dashboard.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/enhanced_service_dashboard.less b/ambari-web/app/styles/enhanced_service_dashboard.less
index d12f5a8..bb59a8b 100644
--- a/ambari-web/app/styles/enhanced_service_dashboard.less
+++ b/ambari-web/app/styles/enhanced_service_dashboard.less
@@ -554,11 +554,14 @@
}
li.metric-select {
padding: 5px;
- padding-bottom: 0px;
+ padding-bottom: 0;
border-left: 1px #ccc solid;
border-right: 1px #ccc solid;
border-bottom: none;
border-top: none;
+ .chosen-drop {
+ width: 190%;
+ }
}
li.aggregator-select {
padding: 5px;
[47/50] [abbrv] ambari git commit: AMBARI-22675 LogSearch Title Bar
Fixes. (Istvan Tobias via ababiichuk)
Posted by rl...@apache.org.
AMBARI-22675 LogSearch Title Bar Fixes. (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/b74b05c2
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b74b05c2
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b74b05c2
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: b74b05c22f4dec6791e53944a0f6385625e33362
Parents: e077bd2
Author: Istvan Tobias <to...@gmail.com>
Authored: Tue Dec 19 19:14:17 2017 +0200
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Fri Jan 5 17:54:17 2018 -0500
----------------------------------------------------------------------
.../src/app/components/app.component.html | 11 ++----
.../src/app/components/app.component.less | 4 +--
.../filters-panel/filters-panel.component.ts | 8 +++--
.../logs-container.component.html | 6 ++--
.../logs-container.component.less | 17 ++++++++--
.../logs-container/logs-container.component.ts | 35 +++++++++++++++++++-
.../main-container.component.html | 1 -
.../main-container.component.less | 1 -
.../main-container/main-container.component.ts | 5 +--
9 files changed, 63 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/b74b05c2/ambari-logsearch/ambari-logsearch-web/src/app/components/app.component.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/app.component.html b/ambari-logsearch/ambari-logsearch-web/src/app/components/app.component.html
index 833f43f..495c8d9 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/app.component.html
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/app.component.html
@@ -16,7 +16,7 @@
-->
<header>
- <nav class="navbar navbar-fixed-top">
+ <nav class="navbar">
<div class="container-fluid">
<h1 [ngClass]="{'full-flex-width': !isAuthorized, 'pull-left': true}">{{'common.title' | translate}}</h1>
<top-menu *ngIf="isAuthorized"></top-menu>
@@ -24,11 +24,4 @@
</nav>
</header>
-<main-container>
- <ng-template>
- <!-- hidden element for moving the main bar outside the fixed header -->
- <div class="navbar invisible">
- <h1> </h1>
- </div>
- </ng-template>
-</main-container>
+<main-container></main-container>
http://git-wip-us.apache.org/repos/asf/ambari/blob/b74b05c2/ambari-logsearch/ambari-logsearch-web/src/app/components/app.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/app.component.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/app.component.less
index f0fecfc..476465c 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/app.component.less
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/app.component.less
@@ -18,11 +18,11 @@
@import 'mixins';
:host {
- .full-size;
+ background-color: @main-background-color; // TODO implement actual color
display: flex;
flex-direction: column;
- background-color: @main-background-color; // TODO implement actual color
line-height: @default-line-height;
+ min-height: 100vh;
.navbar {
margin-bottom: 0;
http://git-wip-us.apache.org/repos/asf/ambari/blob/b74b05c2/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 f9fe94b..480706a 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
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-import {Component, OnChanges, SimpleChanges, Input} from '@angular/core';
+import {Component, OnChanges, SimpleChanges, Input, ViewContainerRef} from '@angular/core';
import {FormGroup} from '@angular/forms';
import {Observable} from 'rxjs/Observable';
import {Subject} from 'rxjs/Subject';
@@ -33,7 +33,7 @@ import {LogsContainerService} from '@app/services/logs-container.service';
})
export class FiltersPanelComponent implements OnChanges {
- constructor(private logsContainer: LogsContainerService) {
+ constructor(private logsContainer: LogsContainerService, public viewContainerRef: ViewContainerRef) {
}
ngOnChanges(changes: SimpleChanges): void {
@@ -62,6 +62,10 @@ export class FiltersPanelComponent implements OnChanges {
searchBoxItems: Observable<ListItem[]>;
+ get containerEl(): Element {
+ return this.viewContainerRef.element.nativeElement;
+ }
+
get filters(): {[key: string]: FilterCondition} {
return this.logsContainer.filters;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b74b05c2/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 5e401d8..d1b11e6 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
@@ -24,9 +24,9 @@
</div>
</div>
</div>
-<div class="container-fluid">
- <filters-panel class="row" [filtersForm]="filtersForm" [logsType]="logsType"></filters-panel>
- <div class="row">
+<div #container [ngClass]="{'container-fluid': true, 'fixed-filterbar': isFilterPanelFixedPostioned}">
+ <filters-panel class="row" [filtersForm]="filtersForm" [logsType]="logsType" #filtersPanel></filters-panel>
+ <div class="row events-count">
<div *ngIf="autoRefreshRemainingSeconds" class="col-md-12">
<div class="auto-refresh-message pull-right">
{{'filter.capture.triggeringRefresh' | translate: autoRefreshMessageParams}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b74b05c2/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 b4d44fb..243bb5b 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
@@ -32,7 +32,20 @@
}
}
- filters-panel {
- margin-bottom: @block-margin-top;
+ .fixed-filterbar {
+ filters-panel {
+ background-color: fadeout(@filters-panel-background-color, 35%);
+ left: 0;
+ margin: 0;
+ position: fixed;
+ top: 0;
+ width: 100%;
+ z-index: 1;
+ }
+ }
+
+ .events-count {
+ margin-top: @block-margin-top;
}
+
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b74b05c2/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.ts
index 86709fb..cf28a8b 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.ts
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-import {Component} from '@angular/core';
+import {Component, ElementRef, ViewChild, HostListener} from '@angular/core';
import {FormGroup} from '@angular/forms';
import {Observable} from 'rxjs/Observable';
import {LogsContainerService} from '@app/services/logs-container.service';
@@ -31,6 +31,7 @@ import {ActiveServiceLogEntry} from '@app/classes/active-service-log-entry';
import {HistogramOptions} from '@app/classes/histogram-options';
import {ListItem} from '@app/classes/list-item';
import {LogsType} from '@app/classes/string';
+import {FiltersPanelComponent} from "@app/components/filters-panel/filters-panel.component";
@Component({
selector: 'logs-container',
@@ -51,6 +52,16 @@ export class LogsContainerComponent {
appState.getParameter('isServiceLogContextView').subscribe((value: boolean) => this.isServiceLogContextView = value);
}
+ @ViewChild('container') containerRef: ElementRef;
+ @ViewChild('filtersPanel') filtersPanelRef: FiltersPanelComponent;
+
+ @HostListener("window:scroll", ['$event'])
+ onWindowScroll(): void {
+ this.setFixedPositionValue();
+ }
+
+ private isFilterPanelFixedPostioned: boolean = false;
+
tabs: Observable<Tab[]> = this.tabsStorage.getAll();
get filtersForm(): FormGroup {
@@ -115,6 +126,28 @@ export class LogsContainerComponent {
return this.logsContainer.serviceLogsColumns;
}
+ /**
+ * The goal is to set the fixed position of the filter panel when it is scrolled to the top. So that the panel
+ * can be always visible for the user.
+ */
+ private setFixedPositionValue(): void {
+ const el:Element = this.containerRef.nativeElement;
+ const top:number = el.getBoundingClientRect().top;
+ const valueBefore: boolean = this.isFilterPanelFixedPostioned;
+ if (valueBefore != (top <= 0)) {
+ const fpEl:Element = this.filtersPanelRef.containerEl;
+ this.isFilterPanelFixedPostioned = top <= 0;
+ const filtersPanelHeight: number = fpEl.getBoundingClientRect().height;
+ const containerPaddingTop: number = parseFloat(window.getComputedStyle(el).paddingTop);
+ const htmlEl:HTMLElement = this.containerRef.nativeElement;
+ if (this.isFilterPanelFixedPostioned) {
+ htmlEl.style.paddingTop = (containerPaddingTop + filtersPanelHeight) + 'px';
+ } else {
+ htmlEl.style.paddingTop = (containerPaddingTop - filtersPanelHeight) + 'px';
+ }
+ }
+ }
+
setCustomTimeRange(startTime: number, endTime: number): void {
this.logsContainer.setCustomTimeRange(startTime, endTime);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b74b05c2/ambari-logsearch/ambari-logsearch-web/src/app/components/main-container/main-container.component.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/main-container/main-container.component.html b/ambari-logsearch/ambari-logsearch-web/src/app/components/main-container/main-container.component.html
index 95dd238..b85cd87 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/main-container/main-container.component.html
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/main-container/main-container.component.html
@@ -15,7 +15,6 @@
limitations under the License.
-->
-<ng-template [ngTemplateOutlet]="template"></ng-template>
<div *ngIf="isInitialLoading" class="text-center">
<span class="fa fa-spinner fa-spin"></span>
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/b74b05c2/ambari-logsearch/ambari-logsearch-web/src/app/components/main-container/main-container.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/main-container/main-container.component.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/main-container/main-container.component.less
index bca668d..115f822 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/main-container/main-container.component.less
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/main-container/main-container.component.less
@@ -19,6 +19,5 @@
@import '../mixins';
:host {
- .full-size;
overflow-x: hidden;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/b74b05c2/ambari-logsearch/ambari-logsearch-web/src/app/components/main-container/main-container.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/main-container/main-container.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/main-container/main-container.component.ts
index 6747a0c..f83d22b 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/main-container/main-container.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/main-container/main-container.component.ts
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-import {Component, ContentChild, TemplateRef} from '@angular/core';
+import {Component} from '@angular/core';
import {AppStateService} from '@app/services/storage/app-state.service';
@Component({
@@ -31,9 +31,6 @@ export class MainContainerComponent {
appState.getParameter('isInitialLoading').subscribe((value: boolean) => this.isInitialLoading = value);
}
- @ContentChild(TemplateRef)
- template;
-
isAuthorized: boolean = false;
isInitialLoading: boolean = false;
[38/50] [abbrv] 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 rl...@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/e99867a0
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e99867a0
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e99867a0
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: e99867a0b4efb2955b82b9116dd3720a3ea8507a
Parents: da6a201
Author: Siddharth Wagle <sw...@hortonworks.com>
Authored: Wed Dec 13 13:41:33 2017 -0800
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Fri Jan 5 17:54:16 2018 -0500
----------------------------------------------------------------------
.../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/e99867a0/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/e99867a0/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/e99867a0/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/e99867a0/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/e99867a0/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/e99867a0/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/e99867a0/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",
[08/50] [abbrv] ambari git commit: AMBARI-22714 Log Search UI:
implement Summary tab for Access Logs page. (ababiichuk)
Posted by rl...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-tooltip/graph-tooltip.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-tooltip/graph-tooltip.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-tooltip/graph-tooltip.component.spec.ts
new file mode 100644
index 0000000..14fa60e
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-tooltip/graph-tooltip.component.spec.ts
@@ -0,0 +1,50 @@
+/**
+ * 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 {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core';
+import {async, ComponentFixture, TestBed} from '@angular/core/testing';
+import {TranslationModules} from '@app/test-config.spec';
+import {GraphLegendItemComponent} from '@app/components/graph-legend-item/graph-legend-item.component';
+
+import {GraphTooltipComponent} from './graph-tooltip.component';
+
+describe('GraphTooltipComponent', () => {
+ let component: GraphTooltipComponent;
+ let fixture: ComponentFixture<GraphTooltipComponent>;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [
+ GraphTooltipComponent,
+ GraphLegendItemComponent
+ ],
+ imports: TranslationModules,
+ schemas: [CUSTOM_ELEMENTS_SCHEMA]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(GraphTooltipComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create component', () => {
+ expect(component).toBeTruthy();
+ });
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-tooltip/graph-tooltip.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-tooltip/graph-tooltip.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-tooltip/graph-tooltip.component.ts
new file mode 100644
index 0000000..9d26a2e
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/graph-tooltip/graph-tooltip.component.ts
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import {Component, Input} from '@angular/core';
+
+@Component({
+ selector: 'graph-tooltip',
+ templateUrl: './graph-tooltip.component.html',
+ styleUrls: ['./graph-tooltip.component.less']
+})
+export class GraphTooltipComponent {
+
+ @Input()
+ title: string | number = '';
+
+ @Input()
+ data = [];
+
+ @Input()
+ labelClass: string = 'initial-color';
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/horizontal-histogram/horizontal-histogram.component.html
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/horizontal-histogram/horizontal-histogram.component.html b/ambari-logsearch/ambari-logsearch-web/src/app/components/horizontal-histogram/horizontal-histogram.component.html
new file mode 100644
index 0000000..015013f
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/horizontal-histogram/horizontal-histogram.component.html
@@ -0,0 +1,22 @@
+<!--
+ 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 #graphContainer></div>
+<graph-legend class="col-md-12" [items]="legendItems"></graph-legend>
+<graph-tooltip #tooltip [data]="tooltipInfo.data" [title]="tooltipInfo.title" [ngClass]="{'hide': !tooltipInfo.data}"
+ [style.top]="tooltipInfo.data ? tooltipPosition.top + 'px' : ''"
+ [style.left]="tooltipInfo.data ? tooltipPosition.left + 'px' : ''"></graph-tooltip>
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/horizontal-histogram/horizontal-histogram.component.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/horizontal-histogram/horizontal-histogram.component.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/horizontal-histogram/horizontal-histogram.component.less
new file mode 100644
index 0000000..395737a
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/horizontal-histogram/horizontal-histogram.component.less
@@ -0,0 +1,22 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+@import '../variables';
+
+:host {
+ padding-top: @graph-padding;
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/horizontal-histogram/horizontal-histogram.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/horizontal-histogram/horizontal-histogram.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/horizontal-histogram/horizontal-histogram.component.spec.ts
new file mode 100644
index 0000000..2c59916
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/horizontal-histogram/horizontal-histogram.component.spec.ts
@@ -0,0 +1,61 @@
+/**
+ * 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 {Injector} from '@angular/core';
+import {async, ComponentFixture, TestBed, inject} from '@angular/core/testing';
+import {TranslationModules} from '@app/test-config.spec';
+import {ServiceInjector} from '@app/classes/service-injector';
+import {GraphLegendComponent} from '@app/components/graph-legend/graph-legend.component';
+import {GraphLegendItemComponent} from '@app/components/graph-legend-item/graph-legend-item.component';
+import {GraphTooltipComponent} from '@app/components/graph-tooltip/graph-tooltip.component';
+import {UtilsService} from '@app/services/utils.service';
+
+import {HorizontalHistogramComponent} from './horizontal-histogram.component';
+
+describe('HorizontalHistogramComponent', () => {
+ let component: HorizontalHistogramComponent;
+ let fixture: ComponentFixture<HorizontalHistogramComponent>;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [
+ HorizontalHistogramComponent,
+ GraphLegendComponent,
+ GraphLegendItemComponent,
+ GraphTooltipComponent
+ ],
+ imports: [
+ ...TranslationModules
+ ],
+ providers: [
+ UtilsService
+ ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(inject([Injector], (injector: Injector) => {
+ ServiceInjector.injector = injector;
+ fixture = TestBed.createComponent(HorizontalHistogramComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ }));
+
+ it('should create component', () => {
+ expect(component).toBeTruthy();
+ });
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/horizontal-histogram/horizontal-histogram.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/horizontal-histogram/horizontal-histogram.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/horizontal-histogram/horizontal-histogram.component.ts
new file mode 100644
index 0000000..9553e2e
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/horizontal-histogram/horizontal-histogram.component.ts
@@ -0,0 +1,114 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import {Component, Input} from '@angular/core';
+import * as d3 from 'd3';
+import {GraphComponent} from '@app/classes/components/graph/graph.component';
+import {HomogeneousObject} from '@app/classes/object';
+
+@Component({
+ selector: 'horizontal-histogram',
+ templateUrl: './horizontal-histogram.component.html',
+ styleUrls: ['../../classes/components/graph/graph.component.less', './horizontal-histogram.component.less']
+})
+export class HorizontalHistogramComponent extends GraphComponent {
+
+ /**
+ * Thickness of horizontal bar o the graph
+ * @type {number}
+ */
+ @Input()
+ barSize: number = 5;
+
+ rowsCount: number;
+
+ readonly reverseYRange: boolean = true;
+
+ protected populate(): void {
+ const barSize = this.barSize,
+ data = this.data,
+ yValues = Object.keys(data),
+ keys = Object.keys(this.labels),
+ rowsCount = yValues.reduce((currentCount: number, currentKey: string): number => {
+ return currentCount + Object.keys(this.data[currentKey]).length;
+ }, 0),
+ formattedData = yValues.reduce((currentData, currentKey: string) => {
+ const currentValues = data[currentKey],
+ currentObjects = keys.map((key: string): HomogeneousObject<number> => {
+ return {
+ [key]: currentValues[key] || 0
+ };
+ });
+ return [...currentData, Object.assign({
+ tick: currentKey
+ }, ...currentObjects)];
+ }, []),
+ layers = d3.stack().keys(keys)(formattedData),
+ formattedLayers = d3.transpose<any>(layers);
+
+ this.rowsCount = rowsCount;
+
+ this.setXScaleDomain();
+ this.setYScaleDomain();
+
+ // drawing the axis
+ this.drawXAxis();
+ this.drawYAxis(rowsCount);
+
+ let i = 0;
+
+ // populate the data and drawing the bars
+ this.svg.selectAll().data(formattedLayers).enter().append('g').attr('class', 'value')
+ .selectAll().data(item => item).enter().append('rect')
+ .attr('x', item => this.xScale(0) + 1).attr('y', item => {
+ if (item [0] !== item[1]) {
+ return this.yScale(i++) - this.barSize / 2;
+ }
+ }).attr('height', item => item[0] === item[1] ? '0' : barSize.toString())
+ .attr('width', item => this.xScale(item[1]) - this.xScale(item[0]))
+ .style('fill', (item, index) => this.orderedColors[index])
+ .on('mouseover', this.handleRectMouseOver)
+ .on('mousemove', this.handleRectMouseMove)
+ .on('mouseout', this.handleRectMouseOut);
+ }
+
+ protected setXScaleDomain(): void {
+ const keys = Object.keys(this.data),
+ maxValues = keys.map((currentKey: string): number => this.utils.getMaxNumberInObject(this.data[currentKey]), 0),
+ maximum = Math.max(...maxValues);
+ this.xScale.domain([0, maximum]);
+ }
+
+ protected setYScaleDomain(): void {
+ this.yScale.domain([0, this.rowsCount]);
+ }
+
+ protected yAxisTickFormatter = (tick: any, index: number): string | undefined => {
+ const data = this.data,
+ keys = Object.keys(data);
+ let currentIndex = 0;
+ for (let i = 0; i < keys.length && i <= index; i++) {
+ const currentKey = keys[i];
+ if (currentIndex === index) {
+ return currentKey;
+ } else {
+ currentIndex += Object.keys(data[currentKey]).length;
+ }
+ }
+ };
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/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 d1b11e6..8e507ae 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
@@ -41,14 +41,14 @@
}}</div>
</div>
<collapsible-panel openTitle="logs.hideGraph" collapsedTitle="logs.showGraph">
- <time-histogram [data]="histogramData" [customOptions]="histogramOptions" svgId="service-logs-histogram"
+ <time-histogram [data]="histogramData" [colors]="serviceLogsHistogramColors" svgId="service-logs-histogram"
(selectArea)="setCustomTimeRange($event[0], $event[1])"></time-histogram>
</collapsible-panel>
<ng-container [ngSwitch]="logsType">
<service-logs-table *ngSwitchCase="'serviceLogs'" [totalCount]="totalCount" [logs]="serviceLogs | async"
[columns]="serviceLogsColumns | async" [filtersForm]="filtersForm"></service-logs-table>
- <audit-logs-table *ngSwitchCase="'auditLogs'" [totalCount]="totalCount" [logs]="auditLogs | async"
- [columns]="auditLogsColumns | async" [filtersForm]="filtersForm"></audit-logs-table>
+ <audit-logs-entries *ngSwitchCase="'auditLogs'" [totalCount]="totalCount" [logs]="auditLogs | async"
+ [columns]="auditLogsColumns | async" [filtersForm]="filtersForm"></audit-logs-entries>
</ng-container>
<log-context *ngIf="isServiceLogContextView" [id]="activeLog.id" [hostName]="activeLog.host_name"
[componentName]="activeLog.component_name"></log-context>
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.ts
index cf28a8b..6d50a17 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-container/logs-container.component.ts
@@ -28,8 +28,8 @@ import {ServiceLog} from '@app/classes/models/service-log';
import {Tab} from '@app/classes/models/tab';
import {BarGraph} from '@app/classes/models/bar-graph';
import {ActiveServiceLogEntry} from '@app/classes/active-service-log-entry';
-import {HistogramOptions} from '@app/classes/histogram-options';
import {ListItem} from '@app/classes/list-item';
+import {HomogeneousObject} from '@app/classes/object';
import {LogsType} from '@app/classes/string';
import {FiltersPanelComponent} from "@app/components/filters-panel/filters-panel.component";
@@ -74,11 +74,11 @@ export class LogsContainerComponent {
return this.logsContainer.totalCount;
}
- histogramData: {[key: string]: number};
+ histogramData: HomogeneousObject<HomogeneousObject<number>>;
- readonly histogramOptions: HistogramOptions = {
- keysWithColors: this.logsContainer.colors
- };
+ get serviceLogsHistogramColors(): HomogeneousObject<string> {
+ return this.logsContainer.colors;
+ }
get autoRefreshRemainingSeconds(): number {
return this.logsContainer.autoRefreshRemainingSeconds;
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.spec.ts
index 3836e7a..67d9423 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.spec.ts
@@ -16,9 +16,10 @@
* limitations under the License.
*/
-import {NO_ERRORS_SCHEMA} from '@angular/core';
-import {async, ComponentFixture, TestBed} from '@angular/core/testing';
+import {NO_ERRORS_SCHEMA, Injector} from '@angular/core';
+import {async, ComponentFixture, TestBed, inject} from '@angular/core/testing';
import {TranslationModules} from '@app/test-config.spec';
+import {ServiceInjector} from '@app/classes/service-injector';
import {StoreModule} from '@ngrx/store';
import {AppSettingsService, appSettings} from '@app/services/storage/app-settings.service';
import {AppStateService, appState} from '@app/services/storage/app-state.service';
@@ -97,11 +98,12 @@ describe('MenuButtonComponent', () => {
.compileComponents();
}));
- beforeEach(() => {
+ beforeEach(inject([Injector], (injector: Injector) => {
+ ServiceInjector.injector = injector;
fixture = TestBed.createComponent(MenuButtonComponent);
component = fixture.componentInstance;
fixture.detectChanges();
- });
+ }));
it('should create component', () => {
expect(component).toBeTruthy();
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.ts
index ca89935..12da4ac 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.ts
@@ -18,6 +18,7 @@
import {Component, Input, ViewChild, ElementRef} from '@angular/core';
import {ListItem} from '@app/classes/list-item';
+import {ServiceInjector} from '@app/classes/service-injector';
import {ComponentActionsService} from '@app/services/component-actions.service';
@Component({
@@ -27,7 +28,8 @@ import {ComponentActionsService} from '@app/services/component-actions.service';
})
export class MenuButtonComponent {
- constructor(protected actions: ComponentActionsService) {
+ constructor() {
+ this.actions = ServiceInjector.injector.get(ComponentActionsService);
}
@ViewChild('dropdown')
@@ -82,6 +84,8 @@ export class MenuButtonComponent {
@Input()
maxLongClickDelay: number = 0;
+ private actions: ComponentActionsService;
+
/**
* This is a private property to indicate the mousedown timestamp, so that we can check it when teh click event
* has been triggered.
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/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 b2136f4..9dd8e26 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
@@ -21,6 +21,7 @@ import {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms';
import {Subject} from 'rxjs/Subject';
import {SearchBoxParameter, SearchBoxParameterProcessed, SearchBoxParameterTriggered} from '@app/classes/filtering';
import {ListItem} from '@app/classes/list-item';
+import {HomogeneousObject} from '@app/classes/object';
import {UtilsService} from '@app/services/utils.service';
@Component({
@@ -88,7 +89,7 @@ export class SearchBoxComponent implements OnInit, OnDestroy, ControlValueAccess
items: ListItem[] = [];
@Input()
- itemsOptions: {[key: string]: ListItem[]} = {};
+ itemsOptions: HomogeneousObject<ListItem[]> = {};
/**
* Name of parameter to be used if there are no matching values
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/service-logs-table/service-logs-table.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/service-logs-table/service-logs-table.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/service-logs-table/service-logs-table.component.ts
index 9f38371..84a59b9 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/service-logs-table/service-logs-table.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/service-logs-table/service-logs-table.component.ts
@@ -18,7 +18,7 @@
import {Component, AfterViewInit, ViewChild, ElementRef} from '@angular/core';
import {ListItem} from '@app/classes/list-item';
-import {LogsTableComponent} from '@app/classes/components/logs-table-component';
+import {LogsTableComponent} from '@app/classes/components/logs-table/logs-table-component';
import {LogsContainerService} from '@app/services/logs-container.service';
import {UtilsService} from '@app/services/utils.service';
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/tabs/tabs.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/tabs/tabs.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/tabs/tabs.component.spec.ts
index 2df5090..7eef0e1 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/tabs/tabs.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/tabs/tabs.component.spec.ts
@@ -47,7 +47,6 @@ describe('TabsComponent', () => {
let activeTab;
const tab = {
id: 'tab0',
- type: '',
isActive: true,
label: '',
appState: null
@@ -64,21 +63,18 @@ describe('TabsComponent', () => {
const items = [
{
id: 'serviceLogs',
- type: '',
isActive: false,
label: '',
appState: null
},
{
id: 'auditLogs',
- type: '',
isActive: false,
label: '',
appState: null
},
{
id: 'newTab',
- type: '',
isActive: false,
label: '',
appState: null
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/tabs/tabs.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/tabs/tabs.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/tabs/tabs.component.ts
index ef941e6..e202c2d 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/tabs/tabs.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/tabs/tabs.component.ts
@@ -35,6 +35,7 @@ export class TabsComponent {
tabClosed: EventEmitter<Tab[]> = new EventEmitter();
switchTab(tab: Tab): void {
+ this.items.forEach((item: Tab) => item.isActive = item.id === tab.id);
this.tabSwitched.emit(tab);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/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 1193b2e..720f55e 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
@@ -18,30 +18,20 @@
<header>
<div class="container-fluid">
<div class="row">
- <div *ngIf="chartTimeGap" class="time-gap col-lg-2 col-md-offset-5">
+ <div *ngIf="isTimeGraph && chartTimeGap" class="time-gap col-md-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>
+ <graph-legend [ngClass]="{'col-md-5 text-right': true, 'md-offset-7': !chartTimeGap}"
+ [items]="legendItems"></graph-legend>
</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>
+<div #graphContainer></div>
+<footer *ngIf="isTimeGraph && (firstDateTick || lastDateTick)">
+ <div *ngIf="firstDateTick">{{firstDateTick | amTz: timeZone | amDateFormat: historyStartEndTimeFormat}}</div>
+ <div *ngIf="lastDateTick">{{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>
-
+<graph-tooltip #tooltip [data]="tooltipInfo.data" [ngClass]="{'hide': !tooltipInfo.data}"
+ [style.top]="tooltipInfo.data ? tooltipPosition.top + 'px' : ''"
+ [style.left]="tooltipInfo.data ? tooltipPosition.left + 'px' : ''"
+ [title]="tooltipInfo.title | amTz: timeZone | amDateFormat: tickTimeFormat"></graph-tooltip>
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/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 1d3766d..364517c 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
@@ -20,28 +20,11 @@
:host {
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;
- }
}
}
@@ -49,137 +32,21 @@
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');
- }
+ padding: @graph-padding;
}
.time-gap {
- color: #666;
+ color: @base-font-color;
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;
- }
+ .default-flex;
+ font-size: 1.2rem;
+ color: @base-font-color;
+ padding: 0 1em .5em;
}
/deep/ rect.drag-area {
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/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 ee14780..09cd5d8 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
@@ -16,34 +16,41 @@
* limitations under the License.
*/
-import {async, ComponentFixture, TestBed} from '@angular/core/testing';
+import {Injector} from '@angular/core';
+import {async, ComponentFixture, TestBed, inject} 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 {ServiceInjector} from '@app/classes/service-injector';
import {TimeZoneAbbrPipe} from '@app/pipes/timezone-abbr.pipe';
+import {GraphLegendComponent} from '@app/components/graph-legend/graph-legend.component';
+import {GraphLegendItemComponent} from '@app/components/graph-legend-item/graph-legend-item.component';
+import {GraphTooltipComponent} from '@app/components/graph-tooltip/graph-tooltip.component';
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";
+import {HttpClientService} from '@app/services/http-client.service';
+import {UtilsService} from '@app/services/utils.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';
+import {HomogeneousObject} from '@app/classes/object';
describe('TimeHistogramComponent', () => {
let component: TimeHistogramComponent;
let fixture: ComponentFixture<TimeHistogramComponent>;
let histogramData: any;
- let customOptions: any;
+ let colors: HomogeneousObject<string>;
beforeEach(async(() => {
const httpClient = {
@@ -54,29 +61,42 @@ describe('TimeHistogramComponent', () => {
}
};
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'
+ 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
}
};
+ colors = {
+ FATAL: '#830A0A',
+ ERROR: '#E81D1D',
+ WARN: '#FF8916',
+ INFO: '#2577B5',
+ DEBUG: '#65E8FF',
+ TRACE: '#888',
+ UNKNOWN: '#BDBDBD'
+ };
TestBed.configureTestingModule({
- declarations: [TimeHistogramComponent, TimeZoneAbbrPipe],
+ declarations: [
+ TimeHistogramComponent,
+ GraphLegendComponent,
+ GraphLegendItemComponent,
+ GraphTooltipComponent,
+ TimeZoneAbbrPipe
+ ],
imports: [
StoreModule.provideStore({
appSettings
@@ -93,6 +113,7 @@ describe('TimeHistogramComponent', () => {
provide: HttpClientService,
useValue: httpClient
},
+ UtilsService,
AppStateService,
AuditLogsService,
AuditLogsFieldsService,
@@ -109,14 +130,15 @@ describe('TimeHistogramComponent', () => {
.compileComponents();
}));
- beforeEach(() => {
- fixture = TestBed.createComponent(TimeHistogramComponent);
- component = fixture.componentInstance;
- component.customOptions = customOptions;
- component.svgId = "HistogramSvg";
- component.data = histogramData;
- fixture.detectChanges();
- });
+ beforeEach(inject([Injector], (injector: Injector) => {
+ ServiceInjector.injector = injector;
+ fixture = TestBed.createComponent(TimeHistogramComponent);
+ component = fixture.componentInstance;
+ component.colors = colors;
+ component.svgId = 'HistogramSvg';
+ component.data = histogramData;
+ fixture.detectChanges();
+ }));
it('should create component', () => {
expect(component).toBeTruthy();
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/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 fb3092f..8544677 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
@@ -16,100 +16,48 @@
* limitations under the License.
*/
-import {Component, OnInit, AfterViewInit, OnChanges, Input, Output, ViewChild, ElementRef, EventEmitter} from '@angular/core';
-import {ContainerElement, Selection} from 'd3';
+import {Component, OnInit, Input, Output, EventEmitter} from '@angular/core';
import * as d3 from 'd3';
import * as moment from 'moment-timezone';
import {AppSettingsService} from '@app/services/storage/app-settings.service';
-import {HistogramStyleOptions, HistogramOptions} from '@app/classes/histogram-options';
+import {GraphComponent} from '@app/classes/components/graph/graph.component';
+import {GraphScaleItem} from '@app/classes/graph';
@Component({
selector: 'time-histogram',
templateUrl: './time-histogram.component.html',
- styleUrls: ['./time-histogram.component.less']
+ styleUrls: ['../../classes/components/graph/graph.component.less', './time-histogram.component.less']
})
-export class TimeHistogramComponent implements OnInit, AfterViewInit, OnChanges {
+export class TimeHistogramComponent extends GraphComponent implements OnInit {
- constructor(private appSettings: AppSettingsService) {}
+ constructor(private appSettings: AppSettingsService) {
+ super();
+ }
ngOnInit() {
this.appSettings.getParameter('timeZone').subscribe((value: string): void => {
this.timeZone = value;
- this.createHistogram();
+ this.createGraph();
});
- 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);
- }
-
- ngOnChanges() {
- this.createHistogram();
}
- @ViewChild('container')
- element: ElementRef;
-
- @ViewChild('tooltipEl')
- tooltipEl: ElementRef;
-
- @Input()
- svgId: string;
-
@Input()
- customOptions: HistogramOptions;
-
- @Input()
- data: {[key: string]: number};
+ columnWidth = {
+ second: 40,
+ minute: 30,
+ hour: 25,
+ day: 20,
+ base: 20
+ };
@Output()
selectArea: EventEmitter<number[]> = new EventEmitter();
- private readonly defaultOptions: HistogramStyleOptions = {
- margin: {
- top: 5,
- right: 50,
- bottom: 30,
- left: 50
- },
- height: 150,
- tickPadding: 10,
- columnWidth: {
- second: 40,
- minute: 30,
- hour: 25,
- day: 20,
- base: 20
- }
- };
-
- private options: HistogramOptions;
+ readonly isTimeGraph: boolean = true;
private timeZone: string;
- private host;
-
- private svg;
-
- private width: number;
-
- private xScale;
-
- private yScale;
-
- private colorScale;
-
- private xAxis;
-
- private yAxis;
-
- private htmlElement: HTMLElement;
- private tooltipElement: HTMLElement;
-
- private dragArea: Selection<SVGGraphicsElement, undefined, SVGGraphicsElement, undefined>;
+ private dragArea: d3.Selection<SVGGraphicsElement, undefined, SVGGraphicsElement, undefined>;
private dragStartX: number;
@@ -118,26 +66,12 @@ export class TimeHistogramComponent implements OnInit, AfterViewInit, OnChanges
private maxDragX: number;
private readonly tickTimeFormat: string = 'MM/DD HH:mm';
- private readonly historyStartEndTimeFormat = 'dddd, MMMM DD, YYYY';
+
+ private readonly historyStartEndTimeFormat: string = '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.
@@ -146,11 +80,11 @@ export class TimeHistogramComponent implements OnInit, AfterViewInit, OnChanges
/**
* 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>;
+ private leftDragArea: d3.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>;
+ private rightDragArea: d3.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.
*/
@@ -166,134 +100,12 @@ export class TimeHistogramComponent implements OnInit, AfterViewInit, OnChanges
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();
- this.buildSVG();
- this.populate();
- }
- }
-
- private setup(): void {
- const margin = this.options.margin,
- keysWithColors = this.options.keysWithColors,
- keys = Object.keys(keysWithColors),
- colors = keys.reduce((array: string[], key: string): string[] => [...array, keysWithColors[key]], []);
- this.width = this.htmlElement.clientWidth - margin.left - margin.right;
- this.xScale = d3.scaleTime().range([0, this.width]);
- this.yScale = d3.scaleLinear().range([this.options.height, 0]);
- this.colorScale = d3.scaleOrdinal(colors);
- }
-
- private buildSVG(): void {
- const margin = this.options.margin;
- this.host.html('');
- this.svg = this.host.append('svg').attr('id', this.svgId).attr('width', this.htmlElement.clientWidth)
- .attr('height', this.options.height + margin.top + margin.bottom).append('g')
- .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.tickTimeFormat))
- .tickPadding(this.options.tickPadding);
- 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)) {
- return tick.toFixed(0);
- } else {
- return;
- }
- }).tickPadding(this.options.tickPadding);
- 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();
+ protected xAxisTickFormatter = (tick: Date): string => {
+ return moment(tick).tz(this.timeZone).format(this.tickTimeFormat);
};
- /**
- * 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};
- }
+ protected yAxisTickFormatter = (tick: number): string | undefined => {
+ return Number.isInteger(tick) ? tick.toFixed(0) : undefined;
};
/**
@@ -361,33 +173,33 @@ export class TimeHistogramComponent implements OnInit, AfterViewInit, OnChanges
/**
* 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
+ * An example data: [{tick: 1233455677, WARN: 12, ERROR: 123}]
+ * @param {GraphScaleItem[]} data
*/
- private setYScaleDomain(data: Array<{timeStamp: number, [key: string]: number}>): void {
- const keys = Object.keys(this.options.keysWithColors);
+ protected setYScaleDomain(data: GraphScaleItem[]): void {
+ const keys = Object.keys(this.labels);
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
+ * An example data: [{tick: 1233455677, WARN: 12, ERROR: 123}]
+ * @param {GraphScaleItem[]} data
*/
- private setXScaleDomain(data: Array<{timeStamp: number, [key: string]: any}>): void {
- this.xScale.domain(d3.extent(data, item => item.timeStamp)).nice();
+ protected setXScaleDomain(data: GraphScaleItem[]): void {
+ this.xScale.domain(d3.extent(data, item => item.tick)).nice();
}
- private populate(): void {
- const keys = Object.keys(this.options.keysWithColors);
+ protected populate(): void {
+ const keys = Object.keys(this.colors);
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)
+ const formattedData = timeStamps.map((timeStamp: string): {tick: number, [key: string]: number} => Object.assign({
+ tick: Number(timeStamp)
}, data[timeStamp]));
- const layers = (d3.stack().keys(keys)(formattedData));
+ const layers = d3.stack().keys(keys)(formattedData);
// after we have the data we set the domain values both scales
this.setXScaleDomain(formattedData);
@@ -396,39 +208,32 @@ export class TimeHistogramComponent implements OnInit, AfterViewInit, OnChanges
// Setting the timegap label above the chart
this.setChartTimeGapByXScale();
- let unitD3TimeProp = this.chartTimeGap.unit.charAt(0).toUpperCase() + this.chartTimeGap.unit.slice(1);
+ const 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;
+ const columnWidth = this.columnWidth[this.chartTimeGap.unit] || this.columnWidth.base;
// drawing the axis
this.drawXAxis();
this.drawYAxis();
// 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)
+ 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.tick) - 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))
+ .style('fill', (item, index) => this.orderedColors[index])
.on('mouseover', this.handleRectMouseOver)
.on('mousemove', this.handleRectMouseMove)
.on('mouseout', this.handleRectMouseOut);
this.setDragBehavior();
}
- private getTimeRangeByXRanges(startX: number, endX:number): [number, number] {
+ 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;
@@ -442,7 +247,7 @@ export class TimeHistogramComponent implements OnInit, AfterViewInit, OnChanges
* @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;
+ const height: number = this.height + this.margin.top + this.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);
@@ -456,9 +261,8 @@ export class TimeHistogramComponent implements OnInit, AfterViewInit, OnChanges
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;
+ const rightAreaWidth: number = Math.max(0, this.width - right);
+ const leftAreaWidth: number = Math.max(0, left);
this.leftDragArea.attr('x', 0).attr('width', leftAreaWidth);
this.rightDragArea.attr('x', right).attr('width', rightAreaWidth);
}
@@ -472,20 +276,20 @@ export class TimeHistogramComponent implements OnInit, AfterViewInit, OnChanges
}
private setDragBehavior(): void {
- this.minDragX = this.options.margin.left;
- this.maxDragX = this.htmlElement.clientWidth;
+ this.minDragX = this.margin.left;
+ this.maxDragX = this.graphContainer.clientWidth;
d3.selectAll(`svg#${this.svgId}`).call(d3.drag()
- .on('start', (datum: undefined, index: number, containers: ContainerElement[]): void => {
+ .on('start', (datum: undefined, index: number, containers: d3.ContainerElement[]): void => {
if (this.dragArea) {
this.dragArea.remove();
}
- this.dragStartX = Math.max(0, this.getDragX(containers[0]) - this.options.margin.left);
+ this.dragStartX = Math.max(0, this.getDragX(containers[0]) - this.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).attr('class', 'drag-area');
+ .attr('height', this.height).attr('class', 'drag-area');
})
- .on('drag', (datum: undefined, index: number, containers: ContainerElement[]): void => {
+ .on('drag', (datum: undefined, index: number, containers: d3.ContainerElement[]): void => {
const mousePos = this.getDragX(containers[0]);
- const currentX = Math.max(mousePos, this.minDragX) - this.options.margin.left;
+ const currentX = Math.max(mousePos, this.minDragX) - this.margin.left;
const startX = Math.min(currentX, this.dragStartX);
const currentWidth = Math.abs(currentX - this.dragStartX);
this.dragArea.attr('x', startX).attr('width', currentWidth);
@@ -507,7 +311,7 @@ export class TimeHistogramComponent implements OnInit, AfterViewInit, OnChanges
}));
}
- private getDragX(element: ContainerElement): number {
+ private getDragX(element: d3.ContainerElement): number {
return d3.mouse(element)[0];
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.ts
index 6df7ab3..8d739ec 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/top-menu/top-menu.component.ts
@@ -20,6 +20,7 @@ import {Component} from '@angular/core';
import {FormGroup} from '@angular/forms';
import {FilterCondition, TimeUnitListItem} from '@app/classes/filtering';
import {ListItem} from '@app/classes/list-item';
+import {HomogeneousObject} from '@app/classes/object';
import {LogsContainerService} from '@app/services/logs-container.service';
@Component({
@@ -36,7 +37,7 @@ export class TopMenuComponent {
return this.logsContainer.filtersForm;
};
- get filters(): {[key: string]: FilterCondition} {
+ get filters(): HomogeneousObject<FilterCondition> {
return this.logsContainer.filters;
};
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/components/variables.less
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/variables.less b/ambari-logsearch/ambari-logsearch-web/src/app/components/variables.less
index a9ca3b4..9b9bbfd 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/variables.less
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/variables.less
@@ -65,3 +65,6 @@
// Table
@table-border-color: #EEE;
+
+// Graph
+@graph-padding: .5rem;
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/mock-data.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/mock-data.ts b/ambari-logsearch/ambari-logsearch-web/src/app/mock-data.ts
index 7578867..aa86f4f 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/mock-data.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/mock-data.ts
@@ -18,6 +18,8 @@
import * as moment from 'moment';
+const currentTime = moment();
+
export const mockData = {
login: {},
logout: {},
@@ -153,34 +155,82 @@ export const mockData = {
},
components: {},
resources: {
- graphData: [
- {
- dataCount: [
- {
- name: 'n16',
- value: 800
- },
- {
- name: 'n17',
- value: 400
- }
- ],
- name: 'graph8'
- },
- {
- dataCount: [
- {
- name: 'n18',
- value: 600
- },
- {
- name: 'n19',
- value: 300
- }
- ],
- name: 'graph9'
- }
- ]
+ 6: {
+ graphData: [
+ {
+ dataCount: [
+ {
+ name: 'hdfs',
+ value: 800
+ },
+ {
+ name: 'zookeeper',
+ value: 400
+ },
+ {
+ name: 'ambari_metrics',
+ value: 200
+ }
+ ],
+ name: 'admin'
+ },
+ {
+ dataCount: [
+ {
+ name: 'ambari_agent',
+ value: 400
+ },
+ {
+ name: 'hdfs',
+ value: 600
+ },
+ {
+ name: 'ambari_metrics',
+ value: 300
+ }
+ ],
+ name: 'user'
+ }
+ ]
+ },
+ 10: {
+ graphData: [
+ {
+ dataCount: [
+ {
+ name: 'ambari',
+ value: 800
+ },
+ {
+ name: 'hdfs',
+ value: 400
+ },
+ {
+ name: 'hbase',
+ value: 200
+ },
+ ],
+ name: '/user'
+ },
+ {
+ dataCount: [
+ {
+ name: 'hdfs',
+ value: 400
+ },
+ {
+ name: 'hbase',
+ value: 600
+ },
+ {
+ name: 'kafka',
+ value: 300
+ }
+ ],
+ name: '/root'
+ }
+ ]
+ }
},
schema: {
fields: {
@@ -299,7 +349,7 @@ export const mockData = {
path: '/var/log/ambari-metrics-collector/ambari-metrics-collector.log',
host: 'h0',
level: 'WARN',
- logtime: moment().valueOf(),
+ logtime: currentTime.valueOf(),
ip: '192.168.0.1',
logfile_line_number: 8,
type: 'ams_collector',
@@ -316,14 +366,14 @@ export const mockData = {
event_md5: '1908755391',
event_dur_ms: 200,
_ttl_: '+5DAYS',
- _expire_at_: moment().add(5, 'd').valueOf(),
+ _expire_at_: currentTime.clone().add(5, 'd').valueOf(),
_router_field_: 20
},
{
path: '/var/log/ambari-metrics-collector/ambari-metrics-collector.log',
host: 'h1',
level: 'ERROR',
- logtime: moment().subtract(2, 'd').valueOf(),
+ logtime: currentTime.clone().subtract(2, 'd').valueOf(),
ip: '192.168.0.2',
type: 'ams_collector',
_version_: 14,
@@ -340,14 +390,14 @@ export const mockData = {
event_md5: '1029384756',
event_dur_ms: 700,
_ttl_: '+5DAYS',
- _expire_at_: moment().add(3, 'd').valueOf(),
+ _expire_at_: currentTime.clone().add(3, 'd').valueOf(),
_router_field_: 5
},
{
path: '/var/log/ambari-metrics-collector/ambari-metrics-collector.log',
host: 'h1',
level: 'FATAL',
- logtime: moment().subtract(10, 'd').valueOf(),
+ logtime: currentTime.clone().subtract(10, 'd').valueOf(),
ip: '192.168.0.3',
type: 'ambari_agent',
_version_: 14,
@@ -364,14 +414,14 @@ export const mockData = {
event_md5: '67589403',
event_dur_ms: 100,
_ttl_: '+5DAYS',
- _expire_at_: moment().subtract(5, 'd').valueOf(),
+ _expire_at_: currentTime.clone().subtract(5, 'd').valueOf(),
_router_field_: 45
},
{
path: '/var/log/ambari-metrics-collector/zookeeper-server.log',
host: 'h1',
level: 'INFO',
- logtime: moment().subtract(25, 'h').valueOf(),
+ logtime: currentTime.clone().subtract(25, 'h').valueOf(),
ip: '192.168.0.4',
type: 'zookeeper_server',
_version_: 14,
@@ -388,14 +438,14 @@ export const mockData = {
event_md5: '67589403',
event_dur_ms: 1000,
_ttl_: '+5DAYS',
- _expire_at_: moment().subtract(25, 'h').add(5, 'd').valueOf(),
+ _expire_at_: currentTime.clone().subtract(25, 'h').add(5, 'd').valueOf(),
_router_field_: 55
},
{
path: '/var/log/ambari-metrics-collector/zookeeper-server.log',
host: 'h1',
level: 'DEBUG',
- logtime: moment().subtract(25, 'd').valueOf(),
+ logtime: currentTime.clone().subtract(25, 'd').valueOf(),
ip: '192.168.0.4',
type: 'zookeeper_server',
_version_: 14,
@@ -412,14 +462,14 @@ export const mockData = {
event_md5: '67589403',
event_dur_ms: 1000,
_ttl_: '+5DAYS',
- _expire_at_: moment().subtract(20, 'd').valueOf(),
+ _expire_at_: currentTime.clone().subtract(20, 'd').valueOf(),
_router_field_: 55
},
{
path: '/var/log/ambari-metrics-collector/zookeeper-client.log',
host: 'h1',
level: 'TRACE',
- logtime: moment().subtract(2, 'h').valueOf(),
+ logtime: currentTime.clone().subtract(2, 'h').valueOf(),
ip: '192.168.0.4',
type: 'zookeeper_client',
_version_: 14,
@@ -436,14 +486,14 @@ export const mockData = {
event_md5: '67589403',
event_dur_ms: 1000,
_ttl_: '+5DAYS',
- _expire_at_: moment().subtract(2, 'h').add(5, 'd').valueOf(),
+ _expire_at_: currentTime.clone().subtract(2, 'h').add(5, 'd').valueOf(),
_router_field_: 55
},
{
path: '/var/log/ambari-metrics-collector/zookeeper-client.log',
host: 'h1',
level: 'UNKNOWN',
- logtime: moment().subtract(31, 'd').valueOf(),
+ logtime: currentTime.clone().subtract(31, 'd').valueOf(),
ip: '192.168.0.4',
type: 'zookeeper_client',
_version_: 14,
@@ -460,7 +510,7 @@ export const mockData = {
event_md5: '67589403',
event_dur_ms: 1000,
_ttl_: '+5DAYS',
- _expire_at_: moment().subtract(26, 'd').valueOf(),
+ _expire_at_: currentTime.clone().subtract(26, 'd').valueOf(),
_router_field_: 55
}
],
@@ -637,11 +687,11 @@ export const mockData = {
{
dataCount: [
{
- name: moment().toISOString(),
+ name: currentTime.toISOString(),
value: '1000'
},
{
- name: moment().subtract(1, 'h').toISOString(),
+ name: currentTime.clone().subtract(1, 'h').toISOString(),
value: '2000'
}
],
@@ -650,11 +700,11 @@ export const mockData = {
{
dataCount: [
{
- name: moment().toISOString(),
+ name: currentTime.toISOString(),
value: '700'
},
{
- name: moment().subtract(1, 'h').toISOString(),
+ name: currentTime.clone().subtract(1, 'h').toISOString(),
value: '900'
}
],
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/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 51b0c0b..36c4d8d 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
@@ -83,7 +83,6 @@ export class ComponentActionsService {
openLog(log: ServiceLog): void {
const tab = {
id: log.id,
- type: 'serviceLogs',
isCloseable: true,
label: `${log.host} >> ${log.type}`,
appState: {
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/services/http-client.service.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/services/http-client.service.ts b/ambari-logsearch/ambari-logsearch-web/src/app/services/http-client.service.ts
index 9b61bf6..6f98bf5 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/services/http-client.service.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/services/http-client.service.ts
@@ -19,8 +19,12 @@
import {Injectable} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import 'rxjs/add/operator/first';
-import {Http, XHRBackend, Request, RequestOptions, RequestOptionsArgs, Response, Headers, URLSearchParams} from '@angular/http';
-import {AuditLogsQueryParams} from '@app/classes/queries/audit-logs-query-params';
+import {
+ Http, XHRBackend, Request, RequestOptions, RequestOptionsArgs, Response, Headers, URLSearchParams
+} from '@angular/http';
+import {HomogeneousObject} from '@app/classes/object';
+import {AuditLogsListQueryParams} from '@app/classes/queries/audit-logs-query-params';
+import {AuditLogsTopResourcesQueryParams} from '@app/classes/queries/audit-logs-top-resources-query-params';
import {ServiceLogsQueryParams} from '@app/classes/queries/service-logs-query-params';
import {ServiceLogsHistogramQueryParams} from '@app/classes/queries/service-logs-histogram-query-params';
import {ServiceLogsTruncatedQueryParams} from '@app/classes/queries/service-logs-truncated-query-params';
@@ -41,7 +45,7 @@ export class HttpClientService extends Http {
},
auditLogs: {
url: 'audit/logs',
- params: opts => new AuditLogsQueryParams(opts)
+ params: opts => new AuditLogsListQueryParams(opts)
},
auditLogsFields: {
url: 'audit/logs/schema/fields'
@@ -69,14 +73,31 @@ export class HttpClientService extends Http {
},
hosts: {
url: 'service/logs/tree'
+ },
+ topAuditLogsResources: {
+ url: variables => `audit/logs/resources/${variables.number}`,
+ params: opts => new AuditLogsTopResourcesQueryParams(opts)
}
};
private readonly unauthorizedStatuses = [401, 403, 419];
- private generateUrlString(url: string): string {
+ private generateUrlString(url: string, urlVariables?: HomogeneousObject<string>): string {
const preset = this.endPoints[url];
- return preset ? `${this.apiPrefix}${preset.url}` : url;
+ let generatedUrl: string;
+ if (preset) {
+ const urlExpression = preset.url;
+ let path: string;
+ if (typeof urlExpression === 'function') {
+ path = preset.url(urlVariables);
+ } else if (typeof urlExpression === 'string') {
+ path = preset.url;
+ }
+ generatedUrl = `${this.apiPrefix}${path}`;
+ } else {
+ generatedUrl = url;
+ }
+ return generatedUrl;
}
private generateUrl(request: string | Request): string | Request {
@@ -89,7 +110,7 @@ export class HttpClientService extends Http {
}
}
- private generateOptions(url: string, params: {[key: string]: string}): RequestOptionsArgs {
+ private generateOptions(url: string, params: HomogeneousObject<string>): RequestOptionsArgs {
const preset = this.endPoints[url],
rawParams = preset && preset.params ? preset.params(params) : params;
if (rawParams) {
@@ -122,11 +143,11 @@ export class HttpClientService extends Http {
return req;
}
- get(url, params?: {[key: string]: string}): Observable<Response> {
- return super.get(this.generateUrlString(url), this.generateOptions(url, params));
+ get(url, params?: HomogeneousObject<string>, urlVariables?: HomogeneousObject<string>): Observable<Response> {
+ return super.get(this.generateUrlString(url, urlVariables), this.generateOptions(url, params));
}
- postFormData(url: string, params: {[key: string]: string}, options?: RequestOptionsArgs): Observable<Response> {
+ postFormData(url: string, params: HomogeneousObject<string>, options?: RequestOptionsArgs): Observable<Response> {
const encodedParams = this.generateOptions(url, params).params;
let body;
if (encodedParams && encodedParams instanceof URLSearchParams) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/ambari-logsearch/ambari-logsearch-web/src/app/services/logs-container.service.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/services/logs-container.service.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/services/logs-container.service.spec.ts
index 870058b..acdc0c2 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/services/logs-container.service.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/services/logs-container.service.spec.ts
@@ -23,7 +23,9 @@ import {AuditLogsService, auditLogs} from '@app/services/storage/audit-logs.serv
import {ServiceLogsService, serviceLogs} from '@app/services/storage/service-logs.service';
import {AuditLogsFieldsService, auditLogsFields} from '@app/services/storage/audit-logs-fields.service';
import {ServiceLogsFieldsService, serviceLogsFields} from '@app/services/storage/service-logs-fields.service';
-import {ServiceLogsHistogramDataService, serviceLogsHistogramData} from '@app/services/storage/service-logs-histogram-data.service';
+import {
+ ServiceLogsHistogramDataService, serviceLogsHistogramData
+} from '@app/services/storage/service-logs-histogram-data.service';
import {AppSettingsService, appSettings} from '@app/services/storage/app-settings.service';
import {AppStateService, appState} from '@app/services/storage/app-state.service';
import {ClustersService, clusters} from '@app/services/storage/clusters.service';
http://git-wip-us.apache.org/repos/asf/ambari/blob/aa5b0fe7/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 d719893..78bcdb1 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
@@ -27,7 +27,6 @@ import 'rxjs/add/operator/first';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/takeUntil';
import * as moment from 'moment-timezone';
-import {TranslateService} from '@ngx-translate/core';
import {HttpClientService} from '@app/services/http-client.service';
import {AuditLogsService} from '@app/services/storage/audit-logs.service';
import {AuditLogsFieldsService} from '@app/services/storage/audit-logs-fields.service';
@@ -46,6 +45,7 @@ import {
FilterCondition, TimeUnitListItem, SortingListItem, SearchBoxParameter, SearchBoxParameterTriggered
} from '@app/classes/filtering';
import {ListItem} from '@app/classes/list-item';
+import {HomogeneousObject} from '@app/classes/object';
import {LogsType, ScrollType, SortingType} from '@app/classes/string';
import {Tab} from '@app/classes/models/tab';
import {LogField} from '@app/classes/models/log-field';
@@ -61,15 +61,15 @@ import {CommonEntry} from '@app/classes/models/common-entry';
export class LogsContainerService {
constructor(
- private translate: TranslateService, private httpClient: HttpClientService,
- private auditLogsStorage: AuditLogsService, private auditLogsFieldsStorage: AuditLogsFieldsService,
- private serviceLogsStorage: ServiceLogsService, private serviceLogsFieldsStorage: ServiceLogsFieldsService,
- private serviceLogsHistogramStorage: ServiceLogsHistogramDataService,
- private serviceLogsTruncatedStorage: ServiceLogsTruncatedService, private appState: AppStateService,
- private appSettings: AppSettingsService, private tabsStorage: TabsService, private clustersStorage: ClustersService,
- private componentsStorage: ComponentsService, private hostsStorage: HostsService
+ private httpClient: HttpClientService, private appState: AppStateService,
+ private appSettings: AppSettingsService, private auditLogsStorage: AuditLogsService,
+ private auditLogsFieldsStorage: AuditLogsFieldsService, private serviceLogsStorage: ServiceLogsService,
+ private serviceLogsFieldsStorage: ServiceLogsFieldsService, private tabsStorage: TabsService,
+ private serviceLogsHistogramStorage: ServiceLogsHistogramDataService, private clustersStorage: ClustersService,
+ private componentsStorage: ComponentsService, private hostsStorage: HostsService,
+ private serviceLogsTruncatedStorage: ServiceLogsTruncatedService
) {
- const formItems = Object.keys(this.filters).reduce((currentObject: any, key: string): {[key: string]: FormControl} => {
+ const formItems = Object.keys(this.filters).reduce((currentObject: any, key: string): HomogeneousObject<FormControl> => {
let formControl = new FormControl(),
item = {
[key]: formControl
@@ -88,7 +88,7 @@ export class LogsContainerService {
tabsStorage.mapCollection((tab: Tab): Tab => {
let currentAppState = tab.appState || {};
const appState = Object.assign({}, currentAppState, {
- activeFilters: this.getFiltersData(tab.type)
+ activeFilters: this.getFiltersData(tab.appState.activeLogsType)
});
return Object.assign({}, tab, {
appState
@@ -120,7 +120,7 @@ export class LogsContainerService {
private readonly paginationOptions: string[] = ['10', '25', '50', '100'];
- filters: {[key: string]: FilterCondition} = {
+ filters: HomogeneousObject<FilterCondition> = {
clusters: {
label: 'filter.clusters',
options: [],
@@ -507,18 +507,25 @@ export class LogsContainerService {
query: ['includeQuery', 'excludeQuery']
};
+ readonly topResourcesCount: string = '10';
+
+ readonly topUsersCount: string = '6';
+
readonly logsTypeMap = {
auditLogs: {
logsModel: this.auditLogsStorage,
fieldsModel: this.auditLogsFieldsStorage,
// TODO add all the required fields
listFilters: ['clusters', 'timeRange', 'auditLogsSorting', 'pageSize', 'page', 'query'],
+ topResourcesFilters: ['clusters', 'timeRange', 'query'],
histogramFilters: ['clusters', 'timeRange', 'query']
},
serviceLogs: {
logsModel: this.serviceLogsStorage,
fieldsModel: this.serviceLogsFieldsStorage,
- listFilters: ['clusters', 'timeRange', 'components', 'levels', 'hosts', 'serviceLogsSorting', 'pageSize', 'page', 'query'],
+ listFilters: [
+ 'clusters', 'timeRange', 'components', 'levels', 'hosts', 'serviceLogsSorting', 'pageSize', 'page', 'query'
+ ],
histogramFilters: ['clusters', 'timeRange', 'components', 'levels', 'hosts', 'query']
}
};
@@ -620,6 +627,10 @@ export class LogsContainerService {
private stopCaptureTime: number;
+ topUsersGraphData: HomogeneousObject<HomogeneousObject<number>> = {};
+
+ topResourcesGraphData: HomogeneousObject<HomogeneousObject<number>> = {};
+
loadLogs = (logsType: LogsType = this.activeLogsType): void => {
this.httpClient.get(logsType, this.getParams('listFilters')).subscribe((response: Response): void => {
const jsonResponse = response.json(),
@@ -647,6 +658,34 @@ export class LogsContainerService {
}
});
}
+ if (logsType === 'auditLogs') {
+ this.httpClient.get('topAuditLogsResources', this.getParams('topResourcesFilters', {
+ field: 'resource'
+ }), {
+ number: this.topResourcesCount
+ }).subscribe((response: Response): void => {
+ const jsonResponse = response.json();
+ if (jsonResponse) {
+ const data = jsonResponse.graphData;
+ if (data) {
+ this.topResourcesGraphData = this.parseAuditLogsTopData(data);
+ }
+ }
+ });
+ this.httpClient.get('topAuditLogsResources', this.getParams('topResourcesFilters', {
+ field: 'reqUser'
+ }), {
+ number: this.topUsersCount
+ }).subscribe((response: Response): void => {
+ const jsonResponse = response.json();
+ if (jsonResponse) {
+ const data = jsonResponse.graphData;
+ if (data) {
+ this.topUsersGraphData = this.parseAuditLogsTopData(data);
+ }
+ }
+ });
+ }
};
loadLogContext(id: string, hostName: string, componentName: string, scrollType: ScrollType = ''): void {
@@ -680,7 +719,19 @@ export class LogsContainerService {
});
}
- private getParams(filtersMapName: string, logsType: LogsType = this.activeLogsType): {[key: string]: string} {
+ private parseAuditLogsTopData(data: BarGraph[]): HomogeneousObject<HomogeneousObject<number>> {
+ return data.reduce((currentObject: HomogeneousObject<HomogeneousObject<number>>, currentItem: BarGraph): HomogeneousObject<HomogeneousObject<number>> => Object.assign(currentObject, {
+ [currentItem.name]: currentItem.dataCount.reduce((currentDataObject: HomogeneousObject<number>, currentDataItem: CommonEntry): HomogeneousObject<number> => {
+ return Object.assign(currentDataObject, {
+ [currentDataItem.name]: currentDataItem.value
+ });
+ }, {})
+ }), {});
+ }
+
+ private getParams(
+ filtersMapName: string, additionalParams: HomogeneousObject<string> = {}, logsType: LogsType = this.activeLogsType
+ ): HomogeneousObject<string> {
let params = {};
this.logsTypeMap[logsType][filtersMapName].forEach((key: string): void => {
const inputValue = this.filtersForm.getRawValue()[key],
@@ -698,10 +749,10 @@ export class LogsContainerService {
}
});
}, this);
- return params;
+ return Object.assign({}, params, additionalParams);
}
- getHistogramData(data: BarGraph[]): {[key: string]: number} {
+ getHistogramData(data: BarGraph[]): HomogeneousObject<HomogeneousObject<number>> {
let histogramData = {};
data.forEach(type => {
const name = type.name;
@@ -800,7 +851,9 @@ export class LogsContainerService {
return (value: SearchBoxParameter[]): string => {
let parameters;
if (value && value.length) {
- parameters = value.filter((item: SearchBoxParameter): boolean => item.isExclude === isExclude).map((parameter: SearchBoxParameter): {[key: string]: string} => {
+ parameters = value.filter((item: SearchBoxParameter): boolean => {
+ return item.isExclude === isExclude;
+ }).map((parameter: SearchBoxParameter): HomogeneousObject<string> => {
return {
[parameter.name]: parameter.value.replace(/\s/g, '+')
};
[43/50] [abbrv] ambari git commit: AMBARI-22635: Addendum fix Ambari
should create a dummy core-site.xml for Ranger plugins when namenode is not
installed.
Posted by rl...@apache.org.
AMBARI-22635: Addendum fix Ambari should create a dummy core-site.xml for Ranger plugins when namenode is not installed.
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/35247b1f
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/35247b1f
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/35247b1f
Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 35247b1f4cbcf7bbe06b419494e82c8ad15e8fbf
Parents: 67b0642
Author: Vishal Suvagia <vi...@apache.org>
Authored: Fri Dec 15 11:20:31 2017 +0530
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Fri Jan 5 17:54:16 2018 -0500
----------------------------------------------------------------------
.../KAFKA/0.8.1/package/scripts/setup_ranger_kafka.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/35247b1f/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 e2cfbcf..16eff94 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
@@ -90,7 +90,7 @@ def setup_ranger_kafka():
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' },
+ create_core_site_path = params.conf_dir, configurations = { 'hadoop.security.authentication' : 'kerberos' if params.kerberos_security_enabled else 'simple' },
configuration_attributes = {})
else: