[ambari] branch branch-2.7 updated: [AMBARI-24610] [Log Search UI] Show user friendly component name in query input (#2278)

2018-09-10 Thread tobiasistvan
This is an automated email from the ASF dual-hosted git repository.

tobiasistvan pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
 new 48c616a  [AMBARI-24610] [Log Search UI] Show user friendly component 
name in query input (#2278)
48c616a is described below

commit 48c616ae1d9de05124167a2f413ec8e8e520f6bc
Author: Istvan Tobias 
AuthorDate: Tue Sep 11 00:08:52 2018 +0200

[AMBARI-24610] [Log Search UI] Show user friendly component name in query 
input (#2278)

(cherry picked from commit 7f4d05bf5ee89dd771637dbca5164ace95383ac7)
---
 .../app/components/search-box/search-box.component.html |  2 +-
 .../components/search-box/search-box.component.spec.ts  | 17 +++--
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git 
a/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.html
 
b/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.html
index 5af0eae..5fd87ab 100644
--- 
a/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.html
+++ 
b/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.html
@@ -21,7 +21,7 @@
 
 
   {{parameter.label | translate}}:
-  {{parameter.value}}
+  {{(parameter.name === 'type' ? 
(parameter.value | componentLabel | async) : parameter.value)}}
   
   
diff --git 
a/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.spec.ts
 
b/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.spec.ts
index 8d42c84..32348a3 100644
--- 
a/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.spec.ts
+++ 
b/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.spec.ts
@@ -18,10 +18,14 @@
 
 import {NO_ERRORS_SCHEMA} from '@angular/core';
 import {async, ComponentFixture, TestBed} from '@angular/core/testing';
+import {StoreModule} from '@ngrx/store';
+
 import {TranslationModules} from '@app/test-config.spec';
 import {UtilsService} from '@app/services/utils.service';
 
 import {SearchBoxComponent} from './search-box.component';
+import {ComponentsService, components} from 
'@app/services/storage/components.service';
+import {ComponentLabelPipe} from '@app/pipes/component-label';
 
 describe('SearchBoxComponent', () => {
   let component: SearchBoxComponent;
@@ -29,9 +33,18 @@ describe('SearchBoxComponent', () => {
 
   beforeEach(async(() => {
 TestBed.configureTestingModule({
-  declarations: [SearchBoxComponent],
-  imports: TranslationModules,
+  declarations: [
+ComponentLabelPipe,
+SearchBoxComponent
+  ],
+  imports: [
+...TranslationModules,
+StoreModule.provideStore({
+  components
+})
+  ],
   providers: [
+ComponentsService,
 UtilsService
   ],
   schemas: [NO_ERRORS_SCHEMA]



[ambari] branch trunk updated: [AMBARI-24610] [Log Search UI] Show user friendly component name in query input (#2277)

2018-09-10 Thread tobiasistvan
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/trunk by this push:
 new c17762b  [AMBARI-24610] [Log Search UI] Show user friendly component 
name in query input (#2277)
c17762b is described below

commit c17762bdd91fddc0cca87d3aa24e4121c7b5e675
Author: Istvan Tobias 
AuthorDate: Tue Sep 11 00:08:28 2018 +0200

[AMBARI-24610] [Log Search UI] Show user friendly component name in query 
input (#2277)
---
 .../app/components/search-box/search-box.component.html |  2 +-
 .../components/search-box/search-box.component.spec.ts  | 17 +++--
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git 
a/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.html
 
b/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.html
index 5af0eae..5fd87ab 100644
--- 
a/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.html
+++ 
b/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.html
@@ -21,7 +21,7 @@
 
 
   {{parameter.label | translate}}:
-  {{parameter.value}}
+  {{(parameter.name === 'type' ? 
(parameter.value | componentLabel | async) : parameter.value)}}
   
   
diff --git 
a/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.spec.ts
 
b/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.spec.ts
index 8d42c84..32348a3 100644
--- 
a/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.spec.ts
+++ 
b/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.spec.ts
@@ -18,10 +18,14 @@
 
 import {NO_ERRORS_SCHEMA} from '@angular/core';
 import {async, ComponentFixture, TestBed} from '@angular/core/testing';
+import {StoreModule} from '@ngrx/store';
+
 import {TranslationModules} from '@app/test-config.spec';
 import {UtilsService} from '@app/services/utils.service';
 
 import {SearchBoxComponent} from './search-box.component';
+import {ComponentsService, components} from 
'@app/services/storage/components.service';
+import {ComponentLabelPipe} from '@app/pipes/component-label';
 
 describe('SearchBoxComponent', () => {
   let component: SearchBoxComponent;
@@ -29,9 +33,18 @@ describe('SearchBoxComponent', () => {
 
   beforeEach(async(() => {
 TestBed.configureTestingModule({
-  declarations: [SearchBoxComponent],
-  imports: TranslationModules,
+  declarations: [
+ComponentLabelPipe,
+SearchBoxComponent
+  ],
+  imports: [
+...TranslationModules,
+StoreModule.provideStore({
+  components
+})
+  ],
   providers: [
+ComponentsService,
 UtilsService
   ],
   schemas: [NO_ERRORS_SCHEMA]



[ambari] branch trunk updated: AMBARI-24609. Ability to install common ambari python libraries to maven repository (local / remote). (#2273)

2018-09-10 Thread oleewere
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/trunk by this push:
 new 68d0b64  AMBARI-24609. Ability to install common ambari python 
libraries to maven repository (local / remote). (#2273)
68d0b64 is described below

commit 68d0b6430c5c2fbb72e7e4b52f1b60bccb07e773
Author: Olivér Szabó 
AuthorDate: Mon Sep 10 16:13:26 2018 +0200

AMBARI-24609. Ability to install common ambari python libraries to maven 
repository (local / remote). (#2273)

* AMBARI-24609. Ability to install common ambari python libraries to maven 
repository (local / remote).

* AMBARI-24609. Review changes.
---
 install-ambari-python.sh | 182 +++
 setup.py |  36 --
 2 files changed, 211 insertions(+), 7 deletions(-)

diff --git a/install-ambari-python.sh b/install-ambari-python.sh
new file mode 100755
index 000..eb7e853
--- /dev/null
+++ b/install-ambari-python.sh
@@ -0,0 +1,182 @@
+#!/usr/bin/env 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.
+
+# requires: pip setuptools wheel
+
+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
+
+function print_help() {
+  cat << EOF
+   Usage: ./install-ambari-python.sh [additional options]
+
+   -c, --clean  clean generated python distribution directories
+   -d, --deploy deploy ambari-python artifact to maven remote 
repository
+   -v, --version   override ambari-python artifact versison
+   -i, --repository-id  repository id in settings.xml for remote 
repository
+   -r, --repository-urlrepository url of remote repository
+   -h, --help   print help
+EOF
+}
+
+function get_python_artifact_file() {
+  local artifact_file=$(ls $SCRIPT_DIR/dist/ | head -n 1)
+  echo $artifact_file
+}
+
+function get_version() {
+  local artifact_file=$(get_python_artifact_file)
+  local artifact_version=$(echo $artifact_file | perl -lne 
'/ambari-python-(.*?)\.tar\.gz/ && print $1')
+  echo $artifact_version
+}
+
+function clean() {
+  if [[ -d "$SCRIPT_DIR/dist" ]]; then
+echo "Removing '$SCRIPT_DIR/dist' directoy ..."
+rm -r "$SCRIPT_DIR/dist"
+echo "Directory '$SCRIPT_DIR/dist' successfully deleted."
+  fi
+  if [[ -d "$SCRIPT_DIR/ambari_python.egg-info" ]]; then
+echo "Removing '$SCRIPT_DIR/ambari_python.egg-info' directoy ..."
+rm -r "$SCRIPT_DIR/ambari_python.egg-info"
+echo "Directory '$SCRIPT_DIR/ambari_python.egg-info' successfully deleted."
+  fi
+  if [[ -d "$SCRIPT_DIR/target/ambari-python-dist" ]]; then
+echo "Removing '$SCRIPT_DIR/target/ambari-python' directoy ..."
+rm -r "$SCRIPT_DIR/target/ambari-python-dist"
+echo "Directory '$SCRIPT_DIR/target/ambari-python' successfully deleted."
+  fi
+}
+
+function generate_site_packages() {
+  local version="$1"
+  pip install $SCRIPT_DIR/dist/ambari-python-$version.tar.gz -I 
--install-option="--prefix=$SCRIPT_DIR/target/ambari-python-dist"
+}
+
+function archive_python_dist() {
+  local artifact="$1"
+  local site_packages_dir=$(find $SCRIPT_DIR/target/ambari-python-dist -name 
"site-packages")
+  local base_dir="`dirname $site_packages_dir`" # use this to make it work 
with different python versions
+  if [[ -f "$SCRIPT_DIR/target/$artifact" ]]; then
+echo "Removing '$SCRIPT_DIR/target/$artifact' file ..."
+echo "File '$SCRIPT_DIR/target/$artifact' successfully deleted."
+  fi
+  tar -zcf $SCRIPT_DIR/target/$artifact -C $base_dir site-packages
+}
+
+function install() {
+  local artifact_file="$1"
+  local version="$2"
+  mvn install:install-file -Dfile=$artifact_file -DgeneratePom=true 
-Dversion=$version -DartifactId=ambari-python -DgroupId=org.apache.ambari 
-Dpackaging=tar.gz
+}
+
+function deploy() {
+  local artifact_file="$1"
+  local version="$2"
+  local repo_id="$3"
+  local repo_url="$4"
+  mvn deploy:deploy-file -Dfile=$artifact_file 

[ambari] branch branch-2.7 updated: AMBARI-24614. deploy-gce-perf-cluster.py script does not work (aonishuk)

2018-09-10 Thread aonishuk
This is an automated email from the ASF dual-hosted git repository.

aonishuk pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
 new a75ae27  AMBARI-24614. deploy-gce-perf-cluster.py script does not work 
(aonishuk)
a75ae27 is described below

commit a75ae27740a42b7ec08215024a35def87bccedb0
Author: Andrew Onishuk 
AuthorDate: Mon Sep 10 15:41:05 2018 +0300

AMBARI-24614. deploy-gce-perf-cluster.py script does not work (aonishuk)
---
 contrib/utils/perf/deploy-gce-perf-cluster.py | 16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/contrib/utils/perf/deploy-gce-perf-cluster.py 
b/contrib/utils/perf/deploy-gce-perf-cluster.py
index 6084ce9..beab106 100644
--- a/contrib/utils/perf/deploy-gce-perf-cluster.py
+++ b/contrib/utils/perf/deploy-gce-perf-cluster.py
@@ -28,7 +28,7 @@ import re
 import socket
 
 cluster_prefix = "perf"
-ambari_repo_file_url = 
"http://s3.amazonaws.com/dev.hortonworks.com/ambari/centos6/2.x/updates/2.5.0.0/ambaribn.repo;
+ambari_repo_file_url = 
"http://s3.amazonaws.com/dev.hortonworks.com/ambari/centos7/2.x/updates/2.6.2.0/ambaribn.repo;
 
 public_hostname_script = "foo"
 hostname_script = "foo"
@@ -279,14 +279,14 @@ def create_vms(args, number_of_nodes):
   :param args: Command line args
   :param number_of_nodes: Number of VMs to request.
   """
-  print "Creating server VM {0}-server-{1} with xxlarge nodes on 
centos6...".format(cluster_prefix, args.cluster_suffix)
-  execute_command(args, args.controller, "/usr/sbin/gce up {0}-server-{1} 1 
--centos6 --xxlarge --ex --disk-xxlarge --ssd".format(cluster_prefix, 
args.cluster_suffix),
+  print "Creating server VM {0}-server-{1} with xxlarge nodes on 
centos7...".format(cluster_prefix, args.cluster_suffix)
+  execute_command(args, args.controller, "/opt/gce-utils/gce up {0}-server-{1} 
1 --centos7 --xlarge --ex --disk-xxlarge --ssd".format(cluster_prefix, 
args.cluster_suffix),
   "Failed to create server, probably not enough resources!", 
"-tt")
   time.sleep(10)
 
   # trying to create cluster with needed params
-  print "Creating agent VMs {0}-agent-{1} with {2} xlarge nodes on 
centos6...".format(cluster_prefix, args.cluster_suffix, str(number_of_nodes))
-  execute_command(args, args.controller, "/usr/sbin/gce up {0}-agent-{1} {2} 
--centos6 --xlarge --ex --disk-xlarge".format(cluster_prefix, 
args.cluster_suffix, str(number_of_nodes)),
+  print "Creating agent VMs {0}-agent-{1} with {2} xlarge nodes on 
centos7...".format(cluster_prefix, args.cluster_suffix, str(number_of_nodes))
+  execute_command(args, args.controller, "/opt/gce-utils/gce up {0}-agent-{1} 
{2} --centos7 --xlarge --ex --disk-xlarge".format(cluster_prefix, 
args.cluster_suffix, str(number_of_nodes)),
   "Failed to create cluster VMs, probably not enough 
resources!", "-tt")
 
   # VMs are not accessible immediately
@@ -329,6 +329,7 @@ def create_server_script(server_host_name):
   # echo "arg=value" >> .../ambari.properties
 
   contents = "#!/bin/bash\n" + \
+  "yum install wget -y\n" + \
   "wget -O /etc/yum.repos.d/ambari.repo {0}\n".format(ambari_repo_file_url) + \
   "yum clean all; yum install git ambari-server -y\n" + \
   "mkdir /home ; cd /home ; git clone https://github.com/apache/ambari.git ; 
cd ambari ; git checkout branch-2.5\n" + \
@@ -399,6 +400,7 @@ def create_agent_script(server_host_name):
 
   # TODO, instead of cloning Ambari repo on each VM, do it on the server once 
and distribute to all of the agents.
   contents = "#!/bin/bash\n" + \
+  "yum install wget -y\n" + \
   "wget -O /etc/yum.repos.d/ambari.repo {0}\n".format(ambari_repo_file_url) + \
   "yum clean all; yum install krb5-workstation git ambari-agent -y\n" + \
   "mkdir /home ; cd /home; git clone https://github.com/apache/ambari.git ; cd 
ambari ; git checkout branch-2.5\n" + \
@@ -476,7 +478,7 @@ def __get_vms_list_from_name(args, cluster_name):
   :param args: Command line args
   :return: Mapping of VM host name to ip.
   """
-  gce_fqdb_cmd = '/usr/sbin/gce fqdn {0}'.format(cluster_name)
+  gce_fqdb_cmd = '/opt/gce-utils/gce fqdn {0}'.format(cluster_name)
   out = execute_command(args, args.controller, gce_fqdb_cmd, "Failed to get 
VMs list!", "-tt")
   lines = out.split('\n')
   #print "LINES=" + str(lines)
@@ -485,7 +487,7 @@ def __get_vms_list_from_name(args, cluster_name):
 for s in lines[2:]:  # Ignore non-meaningful lines
   if not s:
 continue
-  match = re.match(r'^([\d\.]*)\s+([\w\.-]*)\s+([\w\.-]*)\s$', s, re.M)
+  match = re.match(r'^([\d\.]*)\s+([\w\.-]*)\s+([\w\.-]*)\s+$', s, re.M)
   if match:
 result[match.group(2)] = match.group(1)
   else:



[ambari] branch trunk updated: AMBARI-24614. deploy-gce-perf-cluster.py script does not work (aonishuk)

2018-09-10 Thread aonishuk
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/trunk by this push:
 new 7cc5c9d  AMBARI-24614. deploy-gce-perf-cluster.py script does not work 
(aonishuk)
7cc5c9d is described below

commit 7cc5c9d3c49740fabdece358429dd5b7fad4f007
Author: Andrew Onishuk 
AuthorDate: Mon Sep 10 15:41:13 2018 +0300

AMBARI-24614. deploy-gce-perf-cluster.py script does not work (aonishuk)
---
 contrib/utils/perf/deploy-gce-perf-cluster.py | 16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/contrib/utils/perf/deploy-gce-perf-cluster.py 
b/contrib/utils/perf/deploy-gce-perf-cluster.py
index 6084ce9..beab106 100644
--- a/contrib/utils/perf/deploy-gce-perf-cluster.py
+++ b/contrib/utils/perf/deploy-gce-perf-cluster.py
@@ -28,7 +28,7 @@ import re
 import socket
 
 cluster_prefix = "perf"
-ambari_repo_file_url = 
"http://s3.amazonaws.com/dev.hortonworks.com/ambari/centos6/2.x/updates/2.5.0.0/ambaribn.repo;
+ambari_repo_file_url = 
"http://s3.amazonaws.com/dev.hortonworks.com/ambari/centos7/2.x/updates/2.6.2.0/ambaribn.repo;
 
 public_hostname_script = "foo"
 hostname_script = "foo"
@@ -279,14 +279,14 @@ def create_vms(args, number_of_nodes):
   :param args: Command line args
   :param number_of_nodes: Number of VMs to request.
   """
-  print "Creating server VM {0}-server-{1} with xxlarge nodes on 
centos6...".format(cluster_prefix, args.cluster_suffix)
-  execute_command(args, args.controller, "/usr/sbin/gce up {0}-server-{1} 1 
--centos6 --xxlarge --ex --disk-xxlarge --ssd".format(cluster_prefix, 
args.cluster_suffix),
+  print "Creating server VM {0}-server-{1} with xxlarge nodes on 
centos7...".format(cluster_prefix, args.cluster_suffix)
+  execute_command(args, args.controller, "/opt/gce-utils/gce up {0}-server-{1} 
1 --centos7 --xlarge --ex --disk-xxlarge --ssd".format(cluster_prefix, 
args.cluster_suffix),
   "Failed to create server, probably not enough resources!", 
"-tt")
   time.sleep(10)
 
   # trying to create cluster with needed params
-  print "Creating agent VMs {0}-agent-{1} with {2} xlarge nodes on 
centos6...".format(cluster_prefix, args.cluster_suffix, str(number_of_nodes))
-  execute_command(args, args.controller, "/usr/sbin/gce up {0}-agent-{1} {2} 
--centos6 --xlarge --ex --disk-xlarge".format(cluster_prefix, 
args.cluster_suffix, str(number_of_nodes)),
+  print "Creating agent VMs {0}-agent-{1} with {2} xlarge nodes on 
centos7...".format(cluster_prefix, args.cluster_suffix, str(number_of_nodes))
+  execute_command(args, args.controller, "/opt/gce-utils/gce up {0}-agent-{1} 
{2} --centos7 --xlarge --ex --disk-xlarge".format(cluster_prefix, 
args.cluster_suffix, str(number_of_nodes)),
   "Failed to create cluster VMs, probably not enough 
resources!", "-tt")
 
   # VMs are not accessible immediately
@@ -329,6 +329,7 @@ def create_server_script(server_host_name):
   # echo "arg=value" >> .../ambari.properties
 
   contents = "#!/bin/bash\n" + \
+  "yum install wget -y\n" + \
   "wget -O /etc/yum.repos.d/ambari.repo {0}\n".format(ambari_repo_file_url) + \
   "yum clean all; yum install git ambari-server -y\n" + \
   "mkdir /home ; cd /home ; git clone https://github.com/apache/ambari.git ; 
cd ambari ; git checkout branch-2.5\n" + \
@@ -399,6 +400,7 @@ def create_agent_script(server_host_name):
 
   # TODO, instead of cloning Ambari repo on each VM, do it on the server once 
and distribute to all of the agents.
   contents = "#!/bin/bash\n" + \
+  "yum install wget -y\n" + \
   "wget -O /etc/yum.repos.d/ambari.repo {0}\n".format(ambari_repo_file_url) + \
   "yum clean all; yum install krb5-workstation git ambari-agent -y\n" + \
   "mkdir /home ; cd /home; git clone https://github.com/apache/ambari.git ; cd 
ambari ; git checkout branch-2.5\n" + \
@@ -476,7 +478,7 @@ def __get_vms_list_from_name(args, cluster_name):
   :param args: Command line args
   :return: Mapping of VM host name to ip.
   """
-  gce_fqdb_cmd = '/usr/sbin/gce fqdn {0}'.format(cluster_name)
+  gce_fqdb_cmd = '/opt/gce-utils/gce fqdn {0}'.format(cluster_name)
   out = execute_command(args, args.controller, gce_fqdb_cmd, "Failed to get 
VMs list!", "-tt")
   lines = out.split('\n')
   #print "LINES=" + str(lines)
@@ -485,7 +487,7 @@ def __get_vms_list_from_name(args, cluster_name):
 for s in lines[2:]:  # Ignore non-meaningful lines
   if not s:
 continue
-  match = re.match(r'^([\d\.]*)\s+([\w\.-]*)\s+([\w\.-]*)\s$', s, re.M)
+  match = re.match(r'^([\d\.]*)\s+([\w\.-]*)\s+([\w\.-]*)\s+$', s, re.M)
   if match:
 result[match.group(2)] = match.group(1)
   else:



[ambari] branch branch-2.7 updated: AMBARI-24612 Host Level Maintenance mode is not working through Ambari UI

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

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


The following commit(s) were added to refs/heads/branch-2.7 by this push:
 new fde00bb  AMBARI-24612 Host Level Maintenance mode is not working 
through Ambari UI
fde00bb is described below

commit fde00bb409fcdd908e13b33d5852fd45f871daa5
Author: Andrii Tkach 
AuthorDate: Mon Sep 10 14:25:42 2018 +0300

AMBARI-24612 Host Level Maintenance mode is not working through Ambari UI
---
 ambari-web/app/views/main/host/details.js | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/ambari-web/app/views/main/host/details.js 
b/ambari-web/app/views/main/host/details.js
index 3d9e8ed..524142c 100644
--- a/ambari-web/app/views/main/host/details.js
+++ b/ambari-web/app/views/main/host/details.js
@@ -39,7 +39,6 @@ App.MainHostDetailsView = Em.View.extend({
   hasManyClientsWithConfigs: Em.computed.gt('clientsWithConfigs.length', 1),
 
   maintenance: function () {
-var onOff = this.get('controller.content.isActive') ? "On" : "Off";
 var result = [];
 if (App.isAuthorized("SERVICE.START_STOP")) {
   result = result.concat([
@@ -74,8 +73,8 @@ App.MainHostDetailsView = Em.View.extend({
 action: 'onOffPassiveModeForHost',
 liClass: '',
 cssClass: 'icon-medkit',
-active: this.get('isActive'),
-label: this.t('passiveState.turn' + onOff)
+active: this.get('controller.content.isActive'),
+label: this.t('passiveState.turn' + 
(this.get('controller.content.isActive') ? "On" : "Off"))
   });
 }
 if (App.get('isKerberosEnabled') && 
App.get('supports.regenerateKeytabsOnSingleHost')){



[ambari] branch trunk updated: AMBARI-24612 Host Level Maintenance mode is not working through Ambari UI

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

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


The following commit(s) were added to refs/heads/trunk by this push:
 new 70b0579  AMBARI-24612 Host Level Maintenance mode is not working 
through Ambari UI
70b0579 is described below

commit 70b0579d1a66adc9299e3cd9aa44c920406a0da9
Author: Andrii Tkach 
AuthorDate: Mon Sep 10 14:20:40 2018 +0300

AMBARI-24612 Host Level Maintenance mode is not working through Ambari UI
---
 ambari-web/app/views/main/host/details.js | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/ambari-web/app/views/main/host/details.js 
b/ambari-web/app/views/main/host/details.js
index 3d9e8ed..524142c 100644
--- a/ambari-web/app/views/main/host/details.js
+++ b/ambari-web/app/views/main/host/details.js
@@ -39,7 +39,6 @@ App.MainHostDetailsView = Em.View.extend({
   hasManyClientsWithConfigs: Em.computed.gt('clientsWithConfigs.length', 1),
 
   maintenance: function () {
-var onOff = this.get('controller.content.isActive') ? "On" : "Off";
 var result = [];
 if (App.isAuthorized("SERVICE.START_STOP")) {
   result = result.concat([
@@ -74,8 +73,8 @@ App.MainHostDetailsView = Em.View.extend({
 action: 'onOffPassiveModeForHost',
 liClass: '',
 cssClass: 'icon-medkit',
-active: this.get('isActive'),
-label: this.t('passiveState.turn' + onOff)
+active: this.get('controller.content.isActive'),
+label: this.t('passiveState.turn' + 
(this.get('controller.content.isActive') ? "On" : "Off"))
   });
 }
 if (App.get('isKerberosEnabled') && 
App.get('supports.regenerateKeytabsOnSingleHost')){



[ambari] branch branch-2.7 updated: AMBARI-24605. Using the new RBAC framework to allow cluster operators/administrators and Ambari administrators to manage widgets (#2275)

2018-09-10 Thread smolnar
This is an automated email from the ASF dual-hosted git repository.

smolnar pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
 new d96bfd3  AMBARI-24605. Using the new RBAC framework to allow cluster 
operators/administrators and Ambari administrators to manage widgets (#2275)
d96bfd3 is described below

commit d96bfd326d186955dee564e03e27488ab1da8df2
Author: Sandor Molnar 
AuthorDate: Mon Sep 10 14:21:55 2018 +0200

AMBARI-24605. Using the new RBAC framework to allow cluster 
operators/administrators and Ambari administrators to manage widgets (#2275)
---
 .../internal/WidgetResourceProvider.java   | 37 ++
 .../security/authorization/RoleAuthorization.java  |  1 +
 .../ambari/server/upgrade/UpgradeCatalog272.java   |  4 +++
 .../src/main/resources/Ambari-DDL-Derby-CREATE.sql |  4 +++
 .../src/main/resources/Ambari-DDL-MySQL-CREATE.sql |  4 +++
 .../main/resources/Ambari-DDL-Oracle-CREATE.sql|  4 +++
 .../main/resources/Ambari-DDL-Postgres-CREATE.sql  |  4 +++
 .../resources/Ambari-DDL-SQLAnywhere-CREATE.sql|  4 +++
 .../main/resources/Ambari-DDL-SQLServer-CREATE.sql |  4 +++
 .../internal/WidgetResourceProviderTest.java   |  2 +-
 10 files changed, 40 insertions(+), 28 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetResourceProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetResourceProvider.java
index 5f5d028..93042e4 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetResourceProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetResourceProvider.java
@@ -17,7 +17,10 @@
  */
 package org.apache.ambari.server.controller.internal;
 
+import static 
org.apache.ambari.server.security.authorization.RoleAuthorization.CLUSTER_MANAGE_WIDGETS;
+
 import java.util.ArrayList;
+import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -40,17 +43,13 @@ import 
org.apache.ambari.server.controller.spi.SystemException;
 import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
 import org.apache.ambari.server.orm.dao.WidgetDAO;
-import org.apache.ambari.server.orm.entities.PermissionEntity;
 import org.apache.ambari.server.orm.entities.WidgetEntity;
 import org.apache.ambari.server.orm.entities.WidgetLayoutUserWidgetEntity;
-import org.apache.ambari.server.security.authorization.AmbariGrantedAuthority;
 import org.apache.ambari.server.security.authorization.AuthorizationHelper;
+import org.apache.ambari.server.security.authorization.ResourceType;
 import org.apache.commons.lang.ObjectUtils;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.security.access.AccessDeniedException;
-import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.context.SecurityContext;
-import org.springframework.security.core.context.SecurityContextHolder;
 
 import com.google.gson.Gson;
 import com.google.inject.Inject;
@@ -157,7 +156,7 @@ public class WidgetResourceProvider extends 
AbstractControllerResourceProvider {
   String clusterName = 
properties.get(WIDGET_CLUSTER_NAME_PROPERTY_ID).toString();
   String scope = properties.get(WIDGET_SCOPE_PROPERTY_ID).toString();
 
-  if (!isScopeAllowedForUser(scope)) {
+  if (!isScopeAllowedForUser(scope, clusterName)) {
 throw new AccessDeniedException("Only cluster operator can create 
widgets with cluster scope");
   }
 
@@ -310,7 +309,8 @@ public class WidgetResourceProvider extends 
AbstractControllerResourceProvider {
 
   if 
(StringUtils.isNotBlank(ObjectUtils.toString(propertyMap.get(WIDGET_SCOPE_PROPERTY_ID
 {
 String scope = 
propertyMap.get(WIDGET_SCOPE_PROPERTY_ID).toString();
-if (!isScopeAllowedForUser(scope)) {
+String clusterName = 
propertyMap.get(WIDGET_CLUSTER_NAME_PROPERTY_ID).toString();
+if (!isScopeAllowedForUser(scope, clusterName)) {
   throw new AmbariException("Only cluster operator can create 
widgets with cluster scope");
 }
 entity.setScope(scope);
@@ -383,28 +383,11 @@ public class WidgetResourceProvider extends 
AbstractControllerResourceProvider {
 return pkPropertyIds;
   }
 
-  private boolean isScopeAllowedForUser(String scope) {
-if (scope.equals(WidgetEntity.USER_SCOPE)) {
-  return true;
-}
-
-// Only cluster operators are allowed to create widgets with cluster scope
-SecurityContext securityContext = SecurityContextHolder.getContext();
-securityContext.getAuthentication().getAuthorities();
-boolean 

[ambari] branch trunk updated: AMBARI-24605. Using the new RBAC framework to allow cluster operators/administrators and Ambari administrators to manage widgets (#2274)

2018-09-10 Thread smolnar
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/trunk by this push:
 new d9ab7ba  AMBARI-24605. Using the new RBAC framework to allow cluster 
operators/administrators and Ambari administrators to manage widgets (#2274)
d9ab7ba is described below

commit d9ab7ba8cc9f8b3ee4a7d888945d474c187ddb38
Author: Sandor Molnar 
AuthorDate: Mon Sep 10 14:21:40 2018 +0200

AMBARI-24605. Using the new RBAC framework to allow cluster 
operators/administrators and Ambari administrators to manage widgets (#2274)
---
 .../internal/WidgetResourceProvider.java   | 37 ++
 .../security/authorization/RoleAuthorization.java  |  1 +
 .../ambari/server/upgrade/UpgradeCatalog272.java   |  4 +++
 .../src/main/resources/Ambari-DDL-Derby-CREATE.sql |  4 +++
 .../src/main/resources/Ambari-DDL-MySQL-CREATE.sql |  4 +++
 .../main/resources/Ambari-DDL-Oracle-CREATE.sql|  4 +++
 .../main/resources/Ambari-DDL-Postgres-CREATE.sql  |  4 +++
 .../resources/Ambari-DDL-SQLAnywhere-CREATE.sql|  4 +++
 .../main/resources/Ambari-DDL-SQLServer-CREATE.sql |  4 +++
 .../internal/WidgetResourceProviderTest.java   |  2 +-
 10 files changed, 40 insertions(+), 28 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetResourceProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetResourceProvider.java
index 5f5d028..93042e4 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetResourceProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetResourceProvider.java
@@ -17,7 +17,10 @@
  */
 package org.apache.ambari.server.controller.internal;
 
+import static 
org.apache.ambari.server.security.authorization.RoleAuthorization.CLUSTER_MANAGE_WIDGETS;
+
 import java.util.ArrayList;
+import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -40,17 +43,13 @@ import 
org.apache.ambari.server.controller.spi.SystemException;
 import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
 import org.apache.ambari.server.orm.dao.WidgetDAO;
-import org.apache.ambari.server.orm.entities.PermissionEntity;
 import org.apache.ambari.server.orm.entities.WidgetEntity;
 import org.apache.ambari.server.orm.entities.WidgetLayoutUserWidgetEntity;
-import org.apache.ambari.server.security.authorization.AmbariGrantedAuthority;
 import org.apache.ambari.server.security.authorization.AuthorizationHelper;
+import org.apache.ambari.server.security.authorization.ResourceType;
 import org.apache.commons.lang.ObjectUtils;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.security.access.AccessDeniedException;
-import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.context.SecurityContext;
-import org.springframework.security.core.context.SecurityContextHolder;
 
 import com.google.gson.Gson;
 import com.google.inject.Inject;
@@ -157,7 +156,7 @@ public class WidgetResourceProvider extends 
AbstractControllerResourceProvider {
   String clusterName = 
properties.get(WIDGET_CLUSTER_NAME_PROPERTY_ID).toString();
   String scope = properties.get(WIDGET_SCOPE_PROPERTY_ID).toString();
 
-  if (!isScopeAllowedForUser(scope)) {
+  if (!isScopeAllowedForUser(scope, clusterName)) {
 throw new AccessDeniedException("Only cluster operator can create 
widgets with cluster scope");
   }
 
@@ -310,7 +309,8 @@ public class WidgetResourceProvider extends 
AbstractControllerResourceProvider {
 
   if 
(StringUtils.isNotBlank(ObjectUtils.toString(propertyMap.get(WIDGET_SCOPE_PROPERTY_ID
 {
 String scope = 
propertyMap.get(WIDGET_SCOPE_PROPERTY_ID).toString();
-if (!isScopeAllowedForUser(scope)) {
+String clusterName = 
propertyMap.get(WIDGET_CLUSTER_NAME_PROPERTY_ID).toString();
+if (!isScopeAllowedForUser(scope, clusterName)) {
   throw new AmbariException("Only cluster operator can create 
widgets with cluster scope");
 }
 entity.setScope(scope);
@@ -383,28 +383,11 @@ public class WidgetResourceProvider extends 
AbstractControllerResourceProvider {
 return pkPropertyIds;
   }
 
-  private boolean isScopeAllowedForUser(String scope) {
-if (scope.equals(WidgetEntity.USER_SCOPE)) {
-  return true;
-}
-
-// Only cluster operators are allowed to create widgets with cluster scope
-SecurityContext securityContext = SecurityContextHolder.getContext();
-securityContext.getAuthentication().getAuthorities();
-boolean hasPermissionForClusterScope = 

[ambari] branch branch-2.7 updated: [AMBARI-24604] Stack advisor error popup with "500 status code" thrown during customize service page of install wizard (dsen) (#2269)

2018-09-10 Thread dsen
This is an automated email from the ASF dual-hosted git repository.

dsen pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
 new 2a084df  [AMBARI-24604] Stack advisor error popup with "500 status 
code" thrown during customize service page of install wizard (dsen) (#2269)
2a084df is described below

commit 2a084df031d640c3427932eadf3c30b66cb60339
Author: Dmitry Sen 
AuthorDate: Mon Sep 10 13:46:34 2018 +0300

[AMBARI-24604] Stack advisor error popup with "500 status code" thrown 
during customize service page of install wizard (dsen) (#2269)
---
 ambari-server/src/main/resources/stacks/stack_advisor.py | 4 
 1 file changed, 4 insertions(+)

diff --git a/ambari-server/src/main/resources/stacks/stack_advisor.py 
b/ambari-server/src/main/resources/stacks/stack_advisor.py
index 551c2bd..eaac73a 100644
--- a/ambari-server/src/main/resources/stacks/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/stack_advisor.py
@@ -2987,6 +2987,10 @@ class DefaultStackAdvisor(StackAdvisor):
   return None
 
 dir = re.sub("^file://", "", dir, count=1)
+
+if not dir:
+  return self.getErrorItem("Value has wrong format")
+
 mountPoints = {}
 for mountPoint in hostInfo["disk_info"]:
   mountPoints[mountPoint["mountpoint"]] = 
self.to_number(mountPoint["available"])



[ambari] branch trunk updated: [AMBARI-24604] Stack advisor error popup with "500 status code" thrown during customize service page of install wizard (dsen) (#2270)

2018-09-10 Thread dsen
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/trunk by this push:
 new ab3a244  [AMBARI-24604] Stack advisor error popup with "500 status 
code" thrown during customize service page of install wizard (dsen) (#2270)
ab3a244 is described below

commit ab3a2449432a23cb9c050d0876717e9f581dd767
Author: Dmitry Sen 
AuthorDate: Mon Sep 10 13:46:17 2018 +0300

[AMBARI-24604] Stack advisor error popup with "500 status code" thrown 
during customize service page of install wizard (dsen) (#2270)
---
 ambari-server/src/main/resources/stacks/stack_advisor.py | 4 
 1 file changed, 4 insertions(+)

diff --git a/ambari-server/src/main/resources/stacks/stack_advisor.py 
b/ambari-server/src/main/resources/stacks/stack_advisor.py
index 551c2bd..eaac73a 100644
--- a/ambari-server/src/main/resources/stacks/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/stack_advisor.py
@@ -2987,6 +2987,10 @@ class DefaultStackAdvisor(StackAdvisor):
   return None
 
 dir = re.sub("^file://", "", dir, count=1)
+
+if not dir:
+  return self.getErrorItem("Value has wrong format")
+
 mountPoints = {}
 for mountPoint in hostInfo["disk_info"]:
   mountPoints[mountPoint["mountpoint"]] = 
self.to_number(mountPoint["available"])



[ambari] branch trunk updated: AMBARI-24597. Popup shown when Ambari started on a different port other than 8080 (akovalenko)

2018-09-10 Thread akovalenko
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/trunk by this push:
 new 4b60f5c  AMBARI-24597. Popup shown when Ambari started on a different 
port other than 8080 (akovalenko)
4b60f5c is described below

commit 4b60f5ce03a44f320a252dbb8ab88c078d54a345
Author: Aleksandr Kovalenko 
AuthorDate: Thu Sep 6 13:07:24 2018 +0300

AMBARI-24597. Popup shown when Ambari started on a different port other 
than 8080 (akovalenko)
---
 ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js 
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js
index 98b0383..f68a1cf 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js
@@ -28,7 +28,7 @@ angular.module('ambariAdminConsole', [
 .constant('Settings', {
   siteRoot: '{proxy_root}/'.replace(/\{.+\}/g, ''),
baseUrl: '{proxy_root}/api/v1'.replace(/\{.+\}/g, ''),
-  testMode: (window.location.port == 8000),
+  testMode: false,
   mockDataPrefix: 'assets/data/',
   isLDAPConfigurationSupported: false,
   isLoginActivitiesSupported: false,