[07/22] Revert "AMBARI-7138. Ambari RPM deals with jinja2 dependency incorrectly (aonishuk)"
http://git-wip-us.apache.org/repos/asf/ambari/blob/570de228/ambari-common/src/main/python/jinja2/jinja2/_stringdefs.py -- diff --git a/ambari-common/src/main/python/jinja2/jinja2/_stringdefs.py b/ambari-common/src/main/python/jinja2/jinja2/_stringdefs.py new file mode 100644 index 000..1161b7f --- /dev/null +++ b/ambari-common/src/main/python/jinja2/jinja2/_stringdefs.py @@ -0,0 +1,130 @@ +# -*- coding: utf-8 -*- +""" +jinja2._stringdefs +~~ + +Strings of all Unicode characters of a certain category. +Used for matching in Unicode-aware languages. Run to regenerate. + +Inspired by chartypes_create.py from the MoinMoin project, original +implementation from Pygments. + +:copyright: Copyright 2006-2009 by the Jinja team, see AUTHORS. +:license: BSD, see LICENSE for details. +""" + +Cc = u'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f' + +Cf = u'\xad\u0600\u0601\u0602\u0603\u06dd\u070f\u17b4\u17b5\u200b\u200c\u200d\u200e\u200f\u202a\u202b\u202c\u202d\u202e\u2060\u2061\u2062\u2063\u206a\u206b\u206c\u206d\u206e\u206f\ufeff\ufff9\ufffa\ufffb' + +Cn = u'\u0242\u0243\u0244\u0245\u0246\u0247\u0248\u0249\u024a\u024b\u024c\u024d\u024e\u024f\u0370\u0371\u0372\u0373\u0376\u0377\u0378\u0379\u037b\u037c\u037d\u037f\u0380\u0381\u0382\u0383\u038b\u038d\u03a2\u03cf\u0487\u04cf\u04fa\u04fb\u04fc\u04fd\u04fe\u04ff\u0510\u0511\u0512\u0513\u0514\u0515\u0516\u0517\u0518\u0519\u051a\u051b\u051c\u051d\u051e\u051f\u0520\u0521\u0522\u0523\u0524\u0525\u0526\u0527\u0528\u0529\u052a\u052b\u052c\u052d\u052e\u052f\u0530\u0557\u0558\u0560\u0588\u058b\u058c\u058d\u058e\u058f\u0590\u05ba\u05c8\u05c9\u05ca\u05cb\u05cc\u05cd\u05ce\u05cf\u05eb\u05ec\u05ed\u05ee\u05ef\u05f5\u05f6\u05f7\u05f8\u05f9\u05fa\u05fb\u05fc\u05fd\u05fe\u05ff\u0604\u0605\u0606\u0607\u0608\u0609\u060a\u0616\u0617\u0618\u0619\u061a\u061c\u061d\u0620\u063b\u063c\u063d\u063e\u063f\u065f\u070e\u074b\u074c\u076e\u076f\u0770\u0771\u0772\u0773\u0774\u0775\u0776\u0777\u0778\u0779\u077a\u077b\u077c\u077d\u077e\u077f\u07b2\u07b3\u07b4\u07b5\u07b6\u07b7\u07b8\u07b9\u07ba\u07bb\u07bc\u07bd\u07be \u07bf\u07c0\u07c1\u07c2\u07c3\u07c4\u07c5\u07c6\u07c7\u07c8\u07c9\u07ca\u07cb\u07cc\u07cd\u07ce\u07cf\u07d0\u07d1\u07d2\u07d3\u07d4\u07d5\u07d6\u07d7\u07d8\u07d9\u07da\u07db\u07dc\u07dd\u07de\u07df\u07e0\u07e1\u07e2\u07e3\u07e4\u07e5\u07e6\u07e7\u07e8\u07e9\u07ea\u07eb\u07ec\u07ed\u07ee\u07ef\u07f0\u07f1\u07f2\u07f3\u07f4\u07f5\u07f6\u07f7\u07f8\u07f9\u07fa\u07fb\u07fc\u07fd\u07fe\u07ff\u0800\u0801\u0802\u0803\u0804\u0805\u0806\u0807\u0808\u0809\u080a\u080b\u080c\u080d\u080e\u080f\u0810\u0811\u0812\u0813\u0814\u0815\u0816\u0817\u0818\u0819\u081a\u081b\u081c\u081d\u081e\u081f\u0820\u0821\u0822\u0823\u0824\u0825\u0826\u0827\u0828\u0829\u082a\u082b\u082c\u082d\u082e\u082f\u0830\u0831\u0832\u0833\u0834\u0835\u0836\u0837\u0838\u0839\u083a\u083b\u083c\u083d\u083e\u083f\u0840\u0841\u0842\u0843\u0844\u0845\u0846\u0847\u0848\u0849\u084a\u084b\u084c\u084d\u084e\u084f\u0850\u0851\u0852\u0853\u0854\u0855\u0856\u0857\u0858\u0859\u085a\u085b\u085c\u085d\u085e\u085f\u0860\u0861\u0862\u0863\u0864\ u0865\u0866\u0867\u0868\u0869\u086a\u086b\u086c\u086d\u086e\u086f\u0870\u0871\u0872\u0873\u0874\u0875\u0876\u0877\u0878\u0879\u087a\u087b\u087c\u087d\u087e\u087f\u0880\u0881\u0882\u0883\u0884\u0885\u0886\u0887\u0888\u0889\u088a\u088b\u088c\u088d\u088e\u088f\u0890\u0891\u0892\u0893\u0894\u0895\u0896\u0897\u0898\u0899\u089a\u089b\u089c\u089d\u089e\u089f\u08a0\u08a1\u08a2\u08a3\u08a4\u08a5\u08a6\u08a7\u08a8\u08a9\u08aa\u08ab\u08ac\u08ad\u08ae\u08af\u08b0\u08b1\u08b2\u08b3\u08b4\u08b5\u08b6\u08b7\u08b8\u08b9\u08ba\u08bb\u08bc\u08bd\u08be\u08bf\u08c0\u08c1\u08c2\u08c3\u08c4\u08c5\u08c6\u08c7\u08c8\u08c9\u08ca\u08cb\u08cc\u08cd\u08ce\u08cf\u08d0\u08d1\u08d2\u08d3\u08d4\u08d5\u08d6\u08d7\u08d8\u08d9\u08da\u08db\u08dc\u08dd\u08de\u08df\u08e0\u08e1\u08e2\u08e3\u08e4\u08e5\u08e6\u08e7\u08e8\u08e9\u08ea\u08eb\u08ec\u08ed\u08ee\u08ef\u08f0\u08f1\u08f2\u08f3\u08f4\u08f5\u08f6\u08f7\u08f8\u08f9\u08fa\u08fb\u08fc\u08fd\u08fe\u08ff\u0900\u093a\u093b\u094e\u094f\u0955\u0956\u0957\u0971\u0972\u0973\u 0974\u0975\u0976\u0977\u0978\u0979\u097a\u097b\u097c\u097e\u097f\u0980\u0984\u098d\u098e\u0991\u0992\u09a9\u09b1\u09b3\u09b4\u09b5\u09ba\u09bb\u09c5\u09c6\u09c9\u09ca\u09cf\u09d0\u09d1\u09d2\u09d3\u09d4\u09d5\u09d6\u09d8\u09d9\u09da\u09db\u09de\u09e4\u09e5\u09fb\u09fc\u09fd\u09fe\u09ff\u0a00\u0a04\u0a0b\u0a0c\u0a0d\u0a0e\u0a11\u0a12\u0a29\u0a31\u0a34\u0a37\u0a3a\u0a3b\u0a3d\u0a43\u0a44\u0a45\u0a46\u0a49\u0a4a\u0a4e\u0a4f\u0a50\u0a51\u0a52\u0a53\u0a54\u0a55\u0a56\u0a57\u0a58\u0a5d\u0a5f\u0a60\u0a61\u0a62\u0a63\u0a64\u0a65\u0a75\u0a76\u0a77\u0a78\u0a79\u0a7a\u0a7b\u0a7c\u0a7d\u0a7e\u0a7f\u0a80\u0a84\u0a8e\
[12/22] Revert "AMBARI-7138. Ambari RPM deals with jinja2 dependency incorrectly (aonishuk)"
http://git-wip-us.apache.org/repos/asf/ambari/blob/570de228/ambari-common/src/main/python/ambari_jinja2/examples/bench.py -- diff --git a/ambari-common/src/main/python/ambari_jinja2/examples/bench.py b/ambari-common/src/main/python/ambari_jinja2/examples/bench.py deleted file mode 100644 index 0f4f982..000 --- a/ambari-common/src/main/python/ambari_jinja2/examples/bench.py +++ /dev/null @@ -1,433 +0,0 @@ -"""\ -This benchmark compares some python templating engines with Jinja 2 so -that we get a picture of how fast Jinja 2 is for a semi real world -template. If a template engine is not installed the test is skipped.\ -""" -import sys -import cgi -from timeit import Timer -from ambari_jinja2 import Environment as JinjaEnvironment - -context = { -'page_title': 'mitsuhiko\'s benchmark', -'table': [dict(a=1,b=2,c=3,d=4,e=5,f=6,g=7,h=8,i=9,j=10) for x in range(1000)] -} - -jinja_template = JinjaEnvironment( -line_statement_prefix='%', -variable_start_string="${", -variable_end_string="}" -).from_string("""\ - - - -${page_title|e} - - - - ${page_title|e} - - -% for href, caption in [ -('index.html', 'Index'), -('downloads.html', 'Downloads'), -('products.html', 'Products') - ] - ${caption|e} -% endfor - - - - % for row in table - -% for cell in row - ${cell} -% endfor - - % endfor - - - -\ -""") - -def test_jinja(): -jinja_template.render(context) - -try: -from tornado.template import Template -except ImportError: -test_tornado = None -else: -tornado_template = Template("""\ - - - -{{ page_title }} - - - - {{ page_title }} - - -{% for href, caption in [ \ -('index.html', 'Index'), \ -('downloads.html', 'Downloads'), \ -('products.html', 'Products') \ - ] %} - {{ caption }} -{% end %} - - - - {% for row in table %} - -{% for cell in row %} - {{ cell }} -{% end %} - - {% end %} - - - -\ -""") - -def test_tornado(): -tornado_template.generate(**context) - -try: -from django.conf import settings -settings.configure() -from django.template import Template as DjangoTemplate, Context as DjangoContext -except ImportError: -test_django = None -else: -django_template = DjangoTemplate("""\ - - - -{{ page_title }} - - - - {{ page_title }} - - -{% for href, caption in navigation %} - {{ caption }} -{% endfor %} - - - - {% for row in table %} - -{% for cell in row %} - {{ cell }} -{% endfor %} - - {% endfor %} - - - -\ -""") - -def test_django(): -c = DjangoContext(context) -c['navigation'] = [('index.html', 'Index'), ('downloads.html', 'Downloads'), - ('products.html', 'Products')] -django_template.render(c) - -try: -from mako.template import Template as MakoTemplate -except ImportError: -test_mako = None -else: -mako_template = MakoTemplate("""\ - - - -${page_title|h} - - - - ${page_title|h} - - -% for href, caption in [('index.html', 'Index'), ('downloads.html', 'Downloads'), ('products.html', 'Products')]: - ${caption|h} -% endfor - - - - % for row in table: - -% for cell in row: - ${cell} -% endfor - - % endfor - - - -\ -""") - -def test_mako(): -mako_template.render(**context) - -try: -from genshi.template import MarkupTemplate as GenshiTemplate -except ImportError: -test_genshi = None -else: -genshi_template = GenshiTemplate("""\ -http://www.w3.org/1999/xhtml"; xmlns:py="http://genshi.edgewall.org/";> - -${page_title} - - - - ${page_title} - - - ${caption} - - - - - ${cell} - - - - -\ -""") - -def test_genshi(): -genshi_template.generate(**context).render('html', strip_whitespace=False) - -try: -from Cheetah.Template import Template as CheetahTemplate -except ImportError: -test_cheetah = None -else: -cheetah_template = CheetahTemplate("""\ -#import cgi - - - -$cgi.escape($page_title) - - - - $cgi.escape($page_title) - - -#for $href, $caption in [('index.html', 'Index'), ('downloads.html', 'Downloads'), ('products.html', 'Products')]: - $cgi.escape($caption) -#end for - - - - #for $row in $table: - -#for $cell in $row: - $cell -#end for - - #end for - - - -\ -""", searchList=[dict(context)]) - -def test_cheetah(): -unicode(che
[17/22] Revert "AMBARI-7138. Ambari RPM deals with jinja2 dependency incorrectly (aonishuk)"
http://git-wip-us.apache.org/repos/asf/ambari/blob/570de228/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/nodes.py -- diff --git a/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/nodes.py b/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/nodes.py deleted file mode 100644 index 804070c..000 --- a/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/nodes.py +++ /dev/null @@ -1,901 +0,0 @@ -# -*- coding: utf-8 -*- -""" -ambari_jinja2.nodes - - -This module implements additional nodes derived from the ast base node. - -It also provides some node tree helper functions like `in_lineno` and -`get_nodes` used by the parser and translator in order to normalize -python and jinja nodes. - -:copyright: (c) 2010 by the Jinja Team. -:license: BSD, see LICENSE for more details. -""" -import operator -from itertools import chain, izip -from collections import deque -from ambari_jinja2.utils import Markup, MethodType, FunctionType - - -#: the types we support for context functions -_context_function_types = (FunctionType, MethodType) - - -_binop_to_func = { -'*':operator.mul, -'/':operator.truediv, -'//': operator.floordiv, -'**': operator.pow, -'%':operator.mod, -'+':operator.add, -'-':operator.sub -} - -_uaop_to_func = { -'not': operator.not_, -'+':operator.pos, -'-':operator.neg -} - -_cmpop_to_func = { -'eq': operator.eq, -'ne': operator.ne, -'gt': operator.gt, -'gteq': operator.ge, -'lt': operator.lt, -'lteq': operator.le, -'in': lambda a, b: a in b, -'notin':lambda a, b: a not in b -} - - -class Impossible(Exception): -"""Raised if the node could not perform a requested action.""" - - -class NodeType(type): -"""A metaclass for nodes that handles the field and attribute -inheritance. fields and attributes from the parent class are -automatically forwarded to the child.""" - -def __new__(cls, name, bases, d): -for attr in 'fields', 'attributes': -storage = [] -storage.extend(getattr(bases[0], attr, ())) -storage.extend(d.get(attr, ())) -assert len(bases) == 1, 'multiple inheritance not allowed' -assert len(storage) == len(set(storage)), 'layout conflict' -d[attr] = tuple(storage) -d.setdefault('abstract', False) -return type.__new__(cls, name, bases, d) - - -class EvalContext(object): -"""Holds evaluation time information. Custom attributes can be attached -to it in extensions. -""" - -def __init__(self, environment, template_name=None): -if callable(environment.autoescape): -self.autoescape = environment.autoescape(template_name) -else: -self.autoescape = environment.autoescape -self.volatile = False - -def save(self): -return self.__dict__.copy() - -def revert(self, old): -self.__dict__.clear() -self.__dict__.update(old) - - -def get_eval_context(node, ctx): -if ctx is None: -if node.environment is None: -raise RuntimeError('if no eval context is passed, the ' - 'node must have an attached ' - 'environment.') -return EvalContext(node.environment) -return ctx - - -class Node(object): -"""Baseclass for all Jinja2 nodes. There are a number of nodes available -of different types. There are three major types: - -- :class:`Stmt`: statements -- :class:`Expr`: expressions -- :class:`Helper`: helper nodes -- :class:`Template`: the outermost wrapper node - -All nodes have fields and attributes. Fields may be other nodes, lists, -or arbitrary values. Fields are passed to the constructor as regular -positional arguments, attributes as keyword arguments. Each node has -two attributes: `lineno` (the line number of the node) and `environment`. -The `environment` attribute is set at the end of the parsing process for -all nodes automatically. -""" -__metaclass__ = NodeType -fields = () -attributes = ('lineno', 'environment') -abstract = True - -def __init__(self, *fields, **attributes): -if self.abstract: -raise TypeError('abstract nodes are not instanciable') -if fields: -if len(fields) != len(self.fields): -if not self.fields: -raise TypeError('%r takes 0 arguments' % -self.__class__.__name__) -raise TypeError('%r takes 0 or %d argument%s' % ( -self.__class__.__name__, -len(self.fields), -len(self.fields) != 1 and 's' or ''
[04/22] Revert "AMBARI-7138. Ambari RPM deals with jinja2 dependency incorrectly (aonishuk)"
http://git-wip-us.apache.org/repos/asf/ambari/blob/570de228/ambari-common/src/main/python/jinja2/jinja2/filters.py -- diff --git a/ambari-common/src/main/python/jinja2/jinja2/filters.py b/ambari-common/src/main/python/jinja2/jinja2/filters.py new file mode 100644 index 000..d1848e4 --- /dev/null +++ b/ambari-common/src/main/python/jinja2/jinja2/filters.py @@ -0,0 +1,719 @@ +# -*- coding: utf-8 -*- +""" +jinja2.filters +~~ + +Bundled jinja filters. + +:copyright: (c) 2010 by the Jinja Team. +:license: BSD, see LICENSE for more details. +""" +import re +import math +from random import choice +from operator import itemgetter +from itertools import imap, groupby +from jinja2.utils import Markup, escape, pformat, urlize, soft_unicode +from jinja2.runtime import Undefined +from jinja2.exceptions import FilterArgumentError, SecurityError + + +_word_re = re.compile(r'\w+(?u)') + + +def contextfilter(f): +"""Decorator for marking context dependent filters. The current +:class:`Context` will be passed as first argument. +""" +f.contextfilter = True +return f + + +def evalcontextfilter(f): +"""Decorator for marking eval-context dependent filters. An eval +context object is passed as first argument. For more information +about the eval context, see :ref:`eval-context`. + +.. versionadded:: 2.4 +""" +f.evalcontextfilter = True +return f + + +def environmentfilter(f): +"""Decorator for marking evironment dependent filters. The current +:class:`Environment` is passed to the filter as first argument. +""" +f.environmentfilter = True +return f + + +def do_forceescape(value): +"""Enforce HTML escaping. This will probably double escape variables.""" +if hasattr(value, '__html__'): +value = value.__html__() +return escape(unicode(value)) + + +@evalcontextfilter +def do_replace(eval_ctx, s, old, new, count=None): +"""Return a copy of the value with all occurrences of a substring +replaced with a new one. The first argument is the substring +that should be replaced, the second is the replacement string. +If the optional third argument ``count`` is given, only the first +``count`` occurrences are replaced: + +.. sourcecode:: jinja + +{{ "Hello World"|replace("Hello", "Goodbye") }} +-> Goodbye World + +{{ "argh"|replace("a", "d'oh, ", 2) }} +-> d'oh, d'oh, aaargh +""" +if count is None: +count = -1 +if not eval_ctx.autoescape: +return unicode(s).replace(unicode(old), unicode(new), count) +if hasattr(old, '__html__') or hasattr(new, '__html__') and \ + not hasattr(s, '__html__'): +s = escape(s) +else: +s = soft_unicode(s) +return s.replace(soft_unicode(old), soft_unicode(new), count) + + +def do_upper(s): +"""Convert a value to uppercase.""" +return soft_unicode(s).upper() + + +def do_lower(s): +"""Convert a value to lowercase.""" +return soft_unicode(s).lower() + + +@evalcontextfilter +def do_xmlattr(_eval_ctx, d, autospace=True): +"""Create an SGML/XML attribute string based on the items in a dict. +All values that are neither `none` nor `undefined` are automatically +escaped: + +.. sourcecode:: html+jinja + + +... + + +Results in something like this: + +.. sourcecode:: html + + +... + + +As you can see it automatically prepends a space in front of the item +if the filter returned something unless the second parameter is false. +""" +rv = u' '.join( +u'%s="%s"' % (escape(key), escape(value)) +for key, value in d.iteritems() +if value is not None and not isinstance(value, Undefined) +) +if autospace and rv: +rv = u' ' + rv +if _eval_ctx.autoescape: +rv = Markup(rv) +return rv + + +def do_capitalize(s): +"""Capitalize a value. The first character will be uppercase, all others +lowercase. +""" +return soft_unicode(s).capitalize() + + +def do_title(s): +"""Return a titlecased version of the value. I.e. words will start with +uppercase letters, all remaining characters are lowercase. +""" +return soft_unicode(s).title() + + +def do_dictsort(value, case_sensitive=False, by='key'): +"""Sort a dict and yield (key, value) pairs. Because python dicts are +unsorted you may want to use this function to order them by either +key or value: + +.. sourcecode:: jinja + +{% for item in mydict|dictsort %} +sort the dict by key, case insensitive + +{% for item in mydict|dicsort(true) %} +sort the dict by key, case sensitive + +{% for item in mydict|dictsort(false, 'value') %} +sort the dict by key, case insensitive, sorted +normally and ordered by value
[11/22] Revert "AMBARI-7138. Ambari RPM deals with jinja2 dependency incorrectly (aonishuk)"
http://git-wip-us.apache.org/repos/asf/ambari/blob/570de228/ambari-common/src/main/python/ambari_jinja2/ext/jinja.el -- diff --git a/ambari-common/src/main/python/ambari_jinja2/ext/jinja.el b/ambari-common/src/main/python/ambari_jinja2/ext/jinja.el deleted file mode 100644 index da4800a..000 --- a/ambari-common/src/main/python/ambari_jinja2/ext/jinja.el +++ /dev/null @@ -1,213 +0,0 @@ -;;; jinja.el --- Jinja mode highlighting -;; -;; Author: Georg Brandl -;; Copyright: (c) 2009 by the Jinja Team -;; Last modified: 2008-05-22 23:04 by gbr -;; -;; -;; -;;; Commentary: -;; -;; Mostly ripped off django-mode by Lennart Borgman. -;; -;; -;; -;; This program is free software; you can redistribute it and/or -;; modify it under the terms of the GNU General Public License as -;; published by the Free Software Foundation; either version 2, or -;; (at your option) any later version. -;; -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this program; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth -;; Floor, Boston, MA 02110-1301, USA. -;; -;; -;; -;;; Code: - -(defconst jinja-font-lock-keywords - (list -; (cons (rx "{% comment %}" (submatch (0+ anything)) -; "{% endcomment %}") (list 1 font-lock-comment-face)) - '("{# ?\\(.*?\\) ?#}" . (1 font-lock-comment-face)) - '("{%-?\\|-?%}\\|{{\\|}}" . font-lock-preprocessor-face) - '("{#\\|#}" . font-lock-comment-delimiter-face) - ;; first word in a block is a command - '("{%-?[ \t\n]*\\([a-zA-Z_]+\\)" . (1 font-lock-keyword-face)) - ;; variables - '("\\({{ ?\\)\\([^|]*?\\)\\(|.*?\\)? ?}}" . (1 font-lock-variable-name-face)) - ;; keywords and builtins - (cons (rx word-start - (or "in" "as" "recursive" "not" "and" "or" "if" "else" - "import" "with" "without" "context") - word-end) - font-lock-keyword-face) - (cons (rx word-start - (or "true" "false" "none" "loop" "self" "super") - word-end) - font-lock-builtin-face) - ;; tests - '("\\(is\\)[ \t]*\\(not\\)[ \t]*\\([a-zA-Z_]+\\)" - (1 font-lock-keyword-face) (2 font-lock-keyword-face) - (3 font-lock-function-name-face)) - ;; builtin filters - (cons (rx - "|" (* space) - (submatch - (or "abs" "batch" "capitalize" "capture" "center" "count" "default" - "dformat" "dictsort" "e" "escape" "filesizeformat" "first" - "float" "format" "getattribute" "getitem" "groupby" "indent" - "int" "join" "jsonencode" "last" "length" "lower" "markdown" - "pprint" "random" "replace" "reverse" "round" "rst" "slice" - "sort" "string" "striptags" "sum" "textile" "title" "trim" - "truncate" "upper" "urlencode" "urlize" "wordcount" "wordwrap" - "xmlattr"))) - (list 1 font-lock-builtin-face)) - ) - "Minimal highlighting expressions for Jinja mode") - -(define-derived-mode jinja-mode nil "Jinja" - "Simple Jinja mode for use with `mumamo-mode'. -This mode only provides syntax highlighting." - ;;(set (make-local-variable 'comment-start) "{#") - ;;(set (make-local-variable 'comment-end) "#}") - (setq font-lock-defaults '(jinja-font-lock-keywords))) - -;; mumamo stuff - -(when (require 'mumamo nil t) - - (defun mumamo-chunk-jinja3(pos min max) -"Find {# ... #}. Return range and `jinja-mode'. -See `mumamo-find-possible-chunk' for POS, MIN and MAX." -(mumamo-find-possible-chunk pos min max -'mumamo-search-bw-exc-start-jinja3 -'mumamo-search-bw-exc-end-jinja3 -'mumamo-search-fw-exc-start-jinja3 -'mumamo-search-fw-exc-end-jinja3)) - - (defun mumamo-chunk-ambari_jinja2(pos min max) -"Find {{ ... }}. Return range and `jinja-mode'. -See `mumamo-find-possible-chunk' for POS, MIN and MAX." -(mumamo-find-possible-chunk pos min max -'mumamo-search-bw-exc-start-ambari_jinja2 -'mumamo-search-bw-exc-end-ambari_jinja2 -'mumamo-search-fw-exc-start-ambari_jinja2 -'mumamo-search-fw-exc-end-ambari_jinja2)) - - (defun mumamo-chunk-jinja (pos min max) -"Find {% ... %}. Return range and `jinja-mode'. -See `mumamo-find-possib
[02/22] Revert "AMBARI-7138. Ambari RPM deals with jinja2 dependency incorrectly (aonishuk)"
http://git-wip-us.apache.org/repos/asf/ambari/blob/570de228/ambari-common/src/main/python/jinja2/jinja2/sandbox.py -- diff --git a/ambari-common/src/main/python/jinja2/jinja2/sandbox.py b/ambari-common/src/main/python/jinja2/jinja2/sandbox.py new file mode 100644 index 000..7497195 --- /dev/null +++ b/ambari-common/src/main/python/jinja2/jinja2/sandbox.py @@ -0,0 +1,271 @@ +# -*- coding: utf-8 -*- +""" +jinja2.sandbox +~~ + +Adds a sandbox layer to Jinja as it was the default behavior in the old +Jinja 1 releases. This sandbox is slightly different from Jinja 1 as the +default behavior is easier to use. + +The behavior can be changed by subclassing the environment. + +:copyright: (c) 2010 by the Jinja Team. +:license: BSD. +""" +import operator +from jinja2.runtime import Undefined +from jinja2.environment import Environment +from jinja2.exceptions import SecurityError +from jinja2.utils import FunctionType, MethodType, TracebackType, CodeType, \ + FrameType, GeneratorType + + +#: maximum number of items a range may produce +MAX_RANGE = 10 + +#: attributes of function objects that are considered unsafe. +UNSAFE_FUNCTION_ATTRIBUTES = set(['func_closure', 'func_code', 'func_dict', + 'func_defaults', 'func_globals']) + +#: unsafe method attributes. function attributes are unsafe for methods too +UNSAFE_METHOD_ATTRIBUTES = set(['im_class', 'im_func', 'im_self']) + + +import warnings + +# make sure we don't warn in python 2.6 about stuff we don't care about +warnings.filterwarnings('ignore', 'the sets module', DeprecationWarning, +module='jinja2.sandbox') + +from collections import deque + +_mutable_set_types = (set,) +_mutable_mapping_types = (dict,) +_mutable_sequence_types = (list,) + + +# on python 2.x we can register the user collection types +try: +from UserDict import UserDict, DictMixin +from UserList import UserList +_mutable_mapping_types += (UserDict, DictMixin) +_mutable_set_types += (UserList,) +except ImportError: +pass + +# if sets is still available, register the mutable set from there as well +try: +from sets import Set +_mutable_set_types += (Set,) +except ImportError: +pass + +#: register Python 2.6 abstract base classes +try: +from collections import MutableSet, MutableMapping, MutableSequence +_mutable_set_types += (MutableSet,) +_mutable_mapping_types += (MutableMapping,) +_mutable_sequence_types += (MutableSequence,) +except ImportError: +pass + +_mutable_spec = ( +(_mutable_set_types, frozenset([ +'add', 'clear', 'difference_update', 'discard', 'pop', 'remove', +'symmetric_difference_update', 'update' +])), +(_mutable_mapping_types, frozenset([ +'clear', 'pop', 'popitem', 'setdefault', 'update' +])), +(_mutable_sequence_types, frozenset([ +'append', 'reverse', 'insert', 'sort', 'extend', 'remove' +])), +(deque, frozenset([ +'append', 'appendleft', 'clear', 'extend', 'extendleft', 'pop', +'popleft', 'remove', 'rotate' +])) +) + + +def safe_range(*args): +"""A range that can't generate ranges with a length of more than +MAX_RANGE items. +""" +rng = xrange(*args) +if len(rng) > MAX_RANGE: +raise OverflowError('range too big, maximum size for range is %d' % +MAX_RANGE) +return rng + + +def unsafe(f): +""" +Mark a function or method as unsafe:: + +@unsafe +def delete(self): +pass +""" +f.unsafe_callable = True +return f + + +def is_internal_attribute(obj, attr): +"""Test if the attribute given is an internal python attribute. For +example this function returns `True` for the `func_code` attribute of +python objects. This is useful if the environment method +:meth:`~SandboxedEnvironment.is_safe_attribute` is overriden. + +>>> from jinja2.sandbox import is_internal_attribute +>>> is_internal_attribute(lambda: None, "func_code") +True +>>> is_internal_attribute((lambda x:x).func_code, 'co_code') +True +>>> is_internal_attribute(str, "upper") +False +""" +if isinstance(obj, FunctionType): +if attr in UNSAFE_FUNCTION_ATTRIBUTES: +return True +elif isinstance(obj, MethodType): +if attr in UNSAFE_FUNCTION_ATTRIBUTES or \ + attr in UNSAFE_METHOD_ATTRIBUTES: +return True +elif isinstance(obj, type): +if attr == 'mro': +return True +elif isinstance(obj, (CodeType, TracebackType, FrameType)): +return True +elif isinstance(obj, GeneratorType): +if attr == 'gi_frame': +return True +return attr.startswith('__') + + +def modifies_known_mutable(obj, attr): +"""This function checks if an attribute on a builtin mutable ob
[14/22] Revert "AMBARI-7138. Ambari RPM deals with jinja2 dependency incorrectly (aonishuk)"
http://git-wip-us.apache.org/repos/asf/ambari/blob/570de228/ambari-common/src/main/python/ambari_jinja2/custom_fixers/fix_broken_reraising.py -- diff --git a/ambari-common/src/main/python/ambari_jinja2/custom_fixers/fix_broken_reraising.py b/ambari-common/src/main/python/ambari_jinja2/custom_fixers/fix_broken_reraising.py deleted file mode 100644 index fd0ea68..000 --- a/ambari-common/src/main/python/ambari_jinja2/custom_fixers/fix_broken_reraising.py +++ /dev/null @@ -1,21 +0,0 @@ -from lib2to3 import fixer_base, pytree -from lib2to3.fixer_util import Name, BlankLine, Name, Attr, ArgList - - -class FixBrokenReraising(fixer_base.BaseFix): -PATTERN = """ -raise_stmt< 'raise' any ',' val=any ',' tb=any > -""" - -# run before the broken 2to3 checker with the same goal -# tries to rewrite it with a rule that does not work out for jinja -run_order = 1 - -def transform(self, node, results): -tb = results['tb'].clone() -tb.prefix = '' -with_tb = Attr(results['val'].clone(), Name('with_traceback')) + \ - [ArgList([tb])] -new = pytree.Node(self.syms.simple_stmt, [Name("raise")] + with_tb) -new.prefix = node.prefix -return new http://git-wip-us.apache.org/repos/asf/ambari/blob/570de228/ambari-common/src/main/python/ambari_jinja2/custom_fixers/fix_xrange2.py -- diff --git a/ambari-common/src/main/python/ambari_jinja2/custom_fixers/fix_xrange2.py b/ambari-common/src/main/python/ambari_jinja2/custom_fixers/fix_xrange2.py deleted file mode 100644 index 5d35e50..000 --- a/ambari-common/src/main/python/ambari_jinja2/custom_fixers/fix_xrange2.py +++ /dev/null @@ -1,11 +0,0 @@ -from lib2to3 import fixer_base -from lib2to3.fixer_util import Name, BlankLine - - -# whyever this is necessary.. - -class FixXrange2(fixer_base.BaseFix): -PATTERN = "'xrange'" - -def transform(self, node, results): -node.replace(Name('range', prefix=node.prefix)) http://git-wip-us.apache.org/repos/asf/ambari/blob/570de228/ambari-common/src/main/python/ambari_jinja2/docs/Makefile -- diff --git a/ambari-common/src/main/python/ambari_jinja2/docs/Makefile b/ambari-common/src/main/python/ambari_jinja2/docs/Makefile deleted file mode 100644 index 5e24ec1..000 --- a/ambari-common/src/main/python/ambari_jinja2/docs/Makefile +++ /dev/null @@ -1,75 +0,0 @@ -# Makefile for Sphinx documentation -# - -# You can set these variables from the command line. -SPHINXOPTS= -SPHINXBUILD = sphinx-build -PAPER = - -# Internal variables. -PAPEROPT_a4 = -D latex_paper_size=a4 -PAPEROPT_letter = -D latex_paper_size=letter -ALLSPHINXOPTS = -d _build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . - -.PHONY: help clean html web pickle htmlhelp latex changes linkcheck - -help: - @echo "Please use \`make ' where is one of" - @echo " html to make standalone HTML files" - @echo " pickleto make pickle files" - @echo " json to make JSON files" - @echo " htmlhelp to make HTML files and a HTML help project" - @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" - @echo " changes to make an overview over all changed/added/deprecated items" - @echo " linkcheck to check all external links for integrity" - -clean: - -rm -rf _build/* - -html: - mkdir -p _build/html _build/doctrees - $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) _build/html - @echo - @echo "Build finished. The HTML pages are in _build/html." - -pickle: - mkdir -p _build/pickle _build/doctrees - $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) _build/pickle - @echo - @echo "Build finished; now you can process the pickle files" - -json: - mkdir -p _build/json _build/doctrees - $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) _build/json - @echo - @echo "Build finished; now you can process the json files" - -web: pickle - -htmlhelp: - mkdir -p _build/htmlhelp _build/doctrees - $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) _build/htmlhelp - @echo - @echo "Build finished; now you can run HTML Help Workshop with the" \ - ".hhp project file in _build/htmlhelp." - -latex: - mkdir -p _build/latex _build/doctrees - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) _build/latex - @echo - @echo "Build finished; the LaTeX files are in _build/latex." - @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ - "run these through (pdf)latex." - -changes: - mkdir -p _build/changes _build/doctrees - $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) _build/changes - @echo - @echo "The overview file is in _build/changes." - -linkcheck: - mkdir -
[18/22] Revert "AMBARI-7138. Ambari RPM deals with jinja2 dependency incorrectly (aonishuk)"
http://git-wip-us.apache.org/repos/asf/ambari/blob/570de228/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/filters.py -- diff --git a/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/filters.py b/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/filters.py deleted file mode 100644 index bdb545e..000 --- a/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/filters.py +++ /dev/null @@ -1,719 +0,0 @@ -# -*- coding: utf-8 -*- -""" -ambari_jinja2.filters -~~ - -Bundled jinja filters. - -:copyright: (c) 2010 by the Jinja Team. -:license: BSD, see LICENSE for more details. -""" -import re -import math -from random import choice -from operator import itemgetter -from itertools import imap, groupby -from ambari_jinja2.utils import Markup, escape, pformat, urlize, soft_unicode -from ambari_jinja2.runtime import Undefined -from ambari_jinja2.exceptions import FilterArgumentError, SecurityError - - -_word_re = re.compile(r'\w+(?u)') - - -def contextfilter(f): -"""Decorator for marking context dependent filters. The current -:class:`Context` will be passed as first argument. -""" -f.contextfilter = True -return f - - -def evalcontextfilter(f): -"""Decorator for marking eval-context dependent filters. An eval -context object is passed as first argument. For more information -about the eval context, see :ref:`eval-context`. - -.. versionadded:: 2.4 -""" -f.evalcontextfilter = True -return f - - -def environmentfilter(f): -"""Decorator for marking evironment dependent filters. The current -:class:`Environment` is passed to the filter as first argument. -""" -f.environmentfilter = True -return f - - -def do_forceescape(value): -"""Enforce HTML escaping. This will probably double escape variables.""" -if hasattr(value, '__html__'): -value = value.__html__() -return escape(unicode(value)) - - -@evalcontextfilter -def do_replace(eval_ctx, s, old, new, count=None): -"""Return a copy of the value with all occurrences of a substring -replaced with a new one. The first argument is the substring -that should be replaced, the second is the replacement string. -If the optional third argument ``count`` is given, only the first -``count`` occurrences are replaced: - -.. sourcecode:: jinja - -{{ "Hello World"|replace("Hello", "Goodbye") }} --> Goodbye World - -{{ "argh"|replace("a", "d'oh, ", 2) }} --> d'oh, d'oh, aaargh -""" -if count is None: -count = -1 -if not eval_ctx.autoescape: -return unicode(s).replace(unicode(old), unicode(new), count) -if hasattr(old, '__html__') or hasattr(new, '__html__') and \ - not hasattr(s, '__html__'): -s = escape(s) -else: -s = soft_unicode(s) -return s.replace(soft_unicode(old), soft_unicode(new), count) - - -def do_upper(s): -"""Convert a value to uppercase.""" -return soft_unicode(s).upper() - - -def do_lower(s): -"""Convert a value to lowercase.""" -return soft_unicode(s).lower() - - -@evalcontextfilter -def do_xmlattr(_eval_ctx, d, autospace=True): -"""Create an SGML/XML attribute string based on the items in a dict. -All values that are neither `none` nor `undefined` are automatically -escaped: - -.. sourcecode:: html+jinja - - -... - - -Results in something like this: - -.. sourcecode:: html - - -... - - -As you can see it automatically prepends a space in front of the item -if the filter returned something unless the second parameter is false. -""" -rv = u' '.join( -u'%s="%s"' % (escape(key), escape(value)) -for key, value in d.iteritems() -if value is not None and not isinstance(value, Undefined) -) -if autospace and rv: -rv = u' ' + rv -if _eval_ctx.autoescape: -rv = Markup(rv) -return rv - - -def do_capitalize(s): -"""Capitalize a value. The first character will be uppercase, all others -lowercase. -""" -return soft_unicode(s).capitalize() - - -def do_title(s): -"""Return a titlecased version of the value. I.e. words will start with -uppercase letters, all remaining characters are lowercase. -""" -return soft_unicode(s).title() - - -def do_dictsort(value, case_sensitive=False, by='key'): -"""Sort a dict and yield (key, value) pairs. Because python dicts are -unsorted you may want to use this function to order them by either -key or value: - -.. sourcecode:: jinja - -{% for item in mydict|dictsort %} -sort the dict by key, case insensitive - -{% for item in mydict|dicsort(true) %} -sort the dict by key, case sensitive - -{% for item in mydict|dictsort(false, 'value') %} -
[09/22] Revert "AMBARI-7138. Ambari RPM deals with jinja2 dependency incorrectly (aonishuk)"
http://git-wip-us.apache.org/repos/asf/ambari/blob/570de228/ambari-common/src/main/python/jinja2/docs/templates.rst -- diff --git a/ambari-common/src/main/python/jinja2/docs/templates.rst b/ambari-common/src/main/python/jinja2/docs/templates.rst new file mode 100644 index 000..4a1f6ff --- /dev/null +++ b/ambari-common/src/main/python/jinja2/docs/templates.rst @@ -0,0 +1,1365 @@ +Template Designer Documentation +=== + +.. highlight:: html+jinja + +This document describes the syntax and semantics of the template engine and +will be most useful as reference to those creating Jinja templates. As the +template engine is very flexible the configuration from the application might +be slightly different from here in terms of delimiters and behavior of +undefined values. + + +Synopsis + + +A template is simply a text file. It can generate any text-based format +(HTML, XML, CSV, LaTeX, etc.). It doesn't have a specific extension, +``.html`` or ``.xml`` are just fine. + +A template contains **variables** or **expressions**, which get replaced with +values when the template is evaluated, and tags, which control the logic of +the template. The template syntax is heavily inspired by Django and Python. + +Below is a minimal template that illustrates a few basics. We will cover +the details later in that document:: + + + + +My Webpage + + + +{% for item in navigation %} +{{ item.caption }} +{% endfor %} + + +My Webpage +{{ a_variable }} + + + +This covers the default settings. The application developer might have +changed the syntax from ``{% foo %}`` to ``<% foo %>`` or something similar. + +There are two kinds of delimiers. ``{% ... %}`` and ``{{ ... }}``. The first +one is used to execute statements such as for-loops or assign values, the +latter prints the result of the expression to the template. + +.. _variables: + +Variables +- + +The application passes variables to the templates you can mess around in the +template. Variables may have attributes or elements on them you can access +too. How a variable looks like, heavily depends on the application providing +those. + +You can use a dot (``.``) to access attributes of a variable, alternative the +so-called "subscript" syntax (``[]``) can be used. The following lines do +the same:: + +{{ foo.bar }} +{{ foo['bar'] }} + +It's important to know that the curly braces are *not* part of the variable +but the print statement. If you access variables inside tags don't put the +braces around. + +If a variable or attribute does not exist you will get back an undefined +value. What you can do with that kind of value depends on the application +configuration, the default behavior is that it evaluates to an empty string +if printed and that you can iterate over it, but every other operation fails. + +.. _notes-on-subscriptions: + +.. admonition:: Implementation + +For convenience sake ``foo.bar`` in Jinja2 does the following things on +the Python layer: + +- check if there is an attribute called `bar` on `foo`. +- if there is not, check if there is an item ``'bar'`` in `foo`. +- if there is not, return an undefined object. + +``foo['bar']`` on the other hand works mostly the same with the a small +difference in the order: + +- check if there is an item ``'bar'`` in `foo`. +- if there is not, check if there is an attribute called `bar` on `foo`. +- if there is not, return an undefined object. + +This is important if an object has an item or attribute with the same +name. Additionally there is the :func:`attr` filter that just looks up +attributes. + +.. _filters: + +Filters +--- + +Variables can by modified by **filters**. Filters are separated from the +variable by a pipe symbol (``|``) and may have optional arguments in +parentheses. Multiple filters can be chained. The output of one filter is +applied to the next. + +``{{ name|striptags|title }}`` for example will remove all HTML Tags from the +`name` and title-cases it. Filters that accept arguments have parentheses +around the arguments, like a function call. This example will join a list +by commas: ``{{ list|join(', ') }}``. + +The :ref:`builtin-filters` below describes all the builtin filters. + +.. _tests: + +Tests +- + +Beside filters there are also so called "tests" available. Tests can be used +to test a variable against a common expression. To test a variable or +expression you add `is` plus the name of the test after the variable. For +example to find out if a variable is defined you can do ``name is defined`` +which will then return true or false depending on if `name` is defined. + +Tests can accept arguments too. If the test only takes one argument you can +leave out the parentheses to group them. For e
[08/22] Revert "AMBARI-7138. Ambari RPM deals with jinja2 dependency incorrectly (aonishuk)"
http://git-wip-us.apache.org/repos/asf/ambari/blob/570de228/ambari-common/src/main/python/jinja2/examples/rwbench/mako/index.html -- diff --git a/ambari-common/src/main/python/jinja2/examples/rwbench/mako/index.html b/ambari-common/src/main/python/jinja2/examples/rwbench/mako/index.html new file mode 100644 index 000..c4c6303 --- /dev/null +++ b/ambari-common/src/main/python/jinja2/examples/rwbench/mako/index.html @@ -0,0 +1,31 @@ +<%! + from rwbench import dateformat +%> +<%inherit file="layout.html" /> +<%namespace file="helpers.html" import="input_field, textarea, form" /> +<%def name="page_title()">Index Page +% for article in articles: + <% if not article.published: continue %> + + ${article.title|h} + written by ${article.user.username|h} on ${dateformat(article.pub_date)} + ${article.body} + +% endfor +<%call expr="form()"> + +Name +${input_field('name')} +E-Mail +${input_field('email')} +URL +${input_field('url')} +Comment +${textarea('comment')} +Captcha +${input_field('captcha')} + + ${input_field(type='submit', value='Submit')} + ${input_field(name='cancel', type='submit', value='Cancel')} + http://git-wip-us.apache.org/repos/asf/ambari/blob/570de228/ambari-common/src/main/python/jinja2/examples/rwbench/mako/layout.html -- diff --git a/ambari-common/src/main/python/jinja2/examples/rwbench/mako/layout.html b/ambari-common/src/main/python/jinja2/examples/rwbench/mako/layout.html new file mode 100644 index 000..a9c353e --- /dev/null +++ b/ambari-common/src/main/python/jinja2/examples/rwbench/mako/layout.html @@ -0,0 +1,30 @@ +http://www.w3.org/TR/html4/strict.dtd";> + + + ${self.page_title()} | RealWorld Benchmark + + + + + + RealWorld Benchmark + +A less stupid benchmark for Mako and Jinja2 to get an impression how +code changes affect runtime performance. + + + +% for href, caption in page_navigation: + ${caption} +% endfor + + + ${self.body()} + + + © Copyright 2008 by I don't know who. + + + + +<%def name="page_title()"> http://git-wip-us.apache.org/repos/asf/ambari/blob/570de228/ambari-common/src/main/python/jinja2/examples/rwbench/rwbench.py -- diff --git a/ambari-common/src/main/python/jinja2/examples/rwbench/rwbench.py b/ambari-common/src/main/python/jinja2/examples/rwbench/rwbench.py new file mode 100644 index 000..813dd56 --- /dev/null +++ b/ambari-common/src/main/python/jinja2/examples/rwbench/rwbench.py @@ -0,0 +1,112 @@ +# -*- coding: utf-8 -*- +""" +RealWorldish Benchmark +~~ + +A more real-world benchmark of Jinja2. Like the other benchmark in the +Jinja2 repository this has no real-world usefulnes (despite the name). +Just go away and ignore it. NOW! + +:copyright: (c) 2009 by the Jinja Team. +:license: BSD. +""" +import sys +from os.path import join, dirname, abspath +try: +from cProfile import Profile +except ImportError: +from profile import Profile +from pstats import Stats +ROOT = abspath(dirname(__file__)) + +from random import choice, randrange +from datetime import datetime +from timeit import Timer +from jinja2 import Environment, FileSystemLoader +from jinja2.utils import generate_lorem_ipsum +from mako.lookup import TemplateLookup +from genshi.template import TemplateLoader as GenshiTemplateLoader + + +def dateformat(x): +return x.strftime('%Y-%m-%d') + + +jinja_env = Environment(loader=FileSystemLoader(join(ROOT, 'jinja'))) +jinja_env.filters['dateformat'] = dateformat +mako_lookup = TemplateLookup(directories=[join(ROOT, 'mako')]) +genshi_loader = GenshiTemplateLoader([join(ROOT, 'genshi')]) + +class Article(object): + +def __init__(self, id): +self.id = id +self.href = '/article/%d' % self.id +self.title = generate_lorem_ipsum(1, False, 5, 10) +self.user = choice(users) +self.body = generate_lorem_ipsum() +self.pub_date = datetime.utcfromtimestamp(randrange(10 ** 9, 2 * 10 ** 9)) +self.published = True + + +class User(object): + +def __init__(self, username): +self.href = '/user/%s' % username +self.username = username + + +users = map(User, [u'John Doe', u'Jane Doe', u'Peter Somewhat']) +articles = map(Article, range(20)) +navigation = [ +('index', 'Index'), +('about', 'About'), +('foo?bar=1', 'Foo with Bar'), +('foo?bar=2&s=x', 'Foo with X'), +('blah','Blub Blah'), +('hehe','Haha'), +] * 5 + +context = dict(users=users, articles=articles, page_navigation=navigation) + + +jinja_template = jinja_env.get_template('index.html') +mako_template = mako_lookup.get_template('index.html') +genshi_tem
[16/22] Revert "AMBARI-7138. Ambari RPM deals with jinja2 dependency incorrectly (aonishuk)"
http://git-wip-us.apache.org/repos/asf/ambari/blob/570de228/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/sandbox.py -- diff --git a/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/sandbox.py b/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/sandbox.py deleted file mode 100644 index 020c82a..000 --- a/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/sandbox.py +++ /dev/null @@ -1,271 +0,0 @@ -# -*- coding: utf-8 -*- -""" -ambari_jinja2.sandbox -~~ - -Adds a sandbox layer to Jinja as it was the default behavior in the old -Jinja 1 releases. This sandbox is slightly different from Jinja 1 as the -default behavior is easier to use. - -The behavior can be changed by subclassing the environment. - -:copyright: (c) 2010 by the Jinja Team. -:license: BSD. -""" -import operator -from ambari_jinja2.runtime import Undefined -from ambari_jinja2.environment import Environment -from ambari_jinja2.exceptions import SecurityError -from ambari_jinja2.utils import FunctionType, MethodType, TracebackType, CodeType, \ - FrameType, GeneratorType - - -#: maximum number of items a range may produce -MAX_RANGE = 10 - -#: attributes of function objects that are considered unsafe. -UNSAFE_FUNCTION_ATTRIBUTES = set(['func_closure', 'func_code', 'func_dict', - 'func_defaults', 'func_globals']) - -#: unsafe method attributes. function attributes are unsafe for methods too -UNSAFE_METHOD_ATTRIBUTES = set(['im_class', 'im_func', 'im_self']) - - -import warnings - -# make sure we don't warn in python 2.6 about stuff we don't care about -warnings.filterwarnings('ignore', 'the sets module', DeprecationWarning, -module='ambari_jinja2.sandbox') - -from collections import deque - -_mutable_set_types = (set,) -_mutable_mapping_types = (dict,) -_mutable_sequence_types = (list,) - - -# on python 2.x we can register the user collection types -try: -from UserDict import UserDict, DictMixin -from UserList import UserList -_mutable_mapping_types += (UserDict, DictMixin) -_mutable_set_types += (UserList,) -except ImportError: -pass - -# if sets is still available, register the mutable set from there as well -try: -from sets import Set -_mutable_set_types += (Set,) -except ImportError: -pass - -#: register Python 2.6 abstract base classes -try: -from collections import MutableSet, MutableMapping, MutableSequence -_mutable_set_types += (MutableSet,) -_mutable_mapping_types += (MutableMapping,) -_mutable_sequence_types += (MutableSequence,) -except ImportError: -pass - -_mutable_spec = ( -(_mutable_set_types, frozenset([ -'add', 'clear', 'difference_update', 'discard', 'pop', 'remove', -'symmetric_difference_update', 'update' -])), -(_mutable_mapping_types, frozenset([ -'clear', 'pop', 'popitem', 'setdefault', 'update' -])), -(_mutable_sequence_types, frozenset([ -'append', 'reverse', 'insert', 'sort', 'extend', 'remove' -])), -(deque, frozenset([ -'append', 'appendleft', 'clear', 'extend', 'extendleft', 'pop', -'popleft', 'remove', 'rotate' -])) -) - - -def safe_range(*args): -"""A range that can't generate ranges with a length of more than -MAX_RANGE items. -""" -rng = xrange(*args) -if len(rng) > MAX_RANGE: -raise OverflowError('range too big, maximum size for range is %d' % -MAX_RANGE) -return rng - - -def unsafe(f): -""" -Mark a function or method as unsafe:: - -@unsafe -def delete(self): -pass -""" -f.unsafe_callable = True -return f - - -def is_internal_attribute(obj, attr): -"""Test if the attribute given is an internal python attribute. For -example this function returns `True` for the `func_code` attribute of -python objects. This is useful if the environment method -:meth:`~SandboxedEnvironment.is_safe_attribute` is overriden. - ->>> from ambari_jinja2.sandbox import is_internal_attribute ->>> is_internal_attribute(lambda: None, "func_code") -True ->>> is_internal_attribute((lambda x:x).func_code, 'co_code') -True ->>> is_internal_attribute(str, "upper") -False -""" -if isinstance(obj, FunctionType): -if attr in UNSAFE_FUNCTION_ATTRIBUTES: -return True -elif isinstance(obj, MethodType): -if attr in UNSAFE_FUNCTION_ATTRIBUTES or \ - attr in UNSAFE_METHOD_ATTRIBUTES: -return True -elif isinstance(obj, type): -if attr == 'mro': -return True -elif isinstance(obj, (CodeType, TracebackType, FrameType)): -return True -elif isinstance(obj, GeneratorType): -if attr == 'gi_frame': -return True -return attr.startswith('__') -
[20/22] Revert "AMBARI-7138. Ambari RPM deals with jinja2 dependency incorrectly (aonishuk)"
http://git-wip-us.apache.org/repos/asf/ambari/blob/570de228/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/bccache.py -- diff --git a/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/bccache.py b/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/bccache.py deleted file mode 100644 index e728209..000 --- a/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/bccache.py +++ /dev/null @@ -1,280 +0,0 @@ -# -*- coding: utf-8 -*- -""" -ambari_jinja2.bccache -~~ - -This module implements the bytecode cache system Jinja is optionally -using. This is useful if you have very complex template situations and -the compiliation of all those templates slow down your application too -much. - -Situations where this is useful are often forking web applications that -are initialized on the first request. - -:copyright: (c) 2010 by the Jinja Team. -:license: BSD. -""" -from os import path, listdir -import marshal -import tempfile -import cPickle as pickle -import fnmatch -from cStringIO import StringIO -try: -from hashlib import sha1 -except ImportError: -from sha import new as sha1 -from ambari_jinja2.utils import open_if_exists - - -bc_version = 1 -bc_magic = 'j2'.encode('ascii') + pickle.dumps(bc_version, 2) - - -class Bucket(object): -"""Buckets are used to store the bytecode for one template. It's created -and initialized by the bytecode cache and passed to the loading functions. - -The buckets get an internal checksum from the cache assigned and use this -to automatically reject outdated cache material. Individual bytecode -cache subclasses don't have to care about cache invalidation. -""" - -def __init__(self, environment, key, checksum): -self.environment = environment -self.key = key -self.checksum = checksum -self.reset() - -def reset(self): -"""Resets the bucket (unloads the bytecode).""" -self.code = None - -def load_bytecode(self, f): -"""Loads bytecode from a file or file like object.""" -# make sure the magic header is correct -magic = f.read(len(bc_magic)) -if magic != bc_magic: -self.reset() -return -# the source code of the file changed, we need to reload -checksum = pickle.load(f) -if self.checksum != checksum: -self.reset() -return -# now load the code. Because marshal is not able to load -# from arbitrary streams we have to work around that -if isinstance(f, file): -self.code = marshal.load(f) -else: -self.code = marshal.loads(f.read()) - -def write_bytecode(self, f): -"""Dump the bytecode into the file or file like object passed.""" -if self.code is None: -raise TypeError('can\'t write empty bucket') -f.write(bc_magic) -pickle.dump(self.checksum, f, 2) -if isinstance(f, file): -marshal.dump(self.code, f) -else: -f.write(marshal.dumps(self.code)) - -def bytecode_from_string(self, string): -"""Load bytecode from a string.""" -self.load_bytecode(StringIO(string)) - -def bytecode_to_string(self): -"""Return the bytecode as string.""" -out = StringIO() -self.write_bytecode(out) -return out.getvalue() - - -class BytecodeCache(object): -"""To implement your own bytecode cache you have to subclass this class -and override :meth:`load_bytecode` and :meth:`dump_bytecode`. Both of -these methods are passed a :class:`~ambari_jinja2.bccache.Bucket`. - -A very basic bytecode cache that saves the bytecode on the file system:: - -from os import path - -class MyCache(BytecodeCache): - -def __init__(self, directory): -self.directory = directory - -def load_bytecode(self, bucket): -filename = path.join(self.directory, bucket.key) -if path.exists(filename): -with open(filename, 'rb') as f: -bucket.load_bytecode(f) - -def dump_bytecode(self, bucket): -filename = path.join(self.directory, bucket.key) -with open(filename, 'wb') as f: -bucket.write_bytecode(f) - -A more advanced version of a filesystem based bytecode cache is part of -Jinja2. -""" - -def load_bytecode(self, bucket): -"""Subclasses have to override this method to load bytecode into a -bucket. If they are not able to find code in the cache for the -bucket, it must not do anything. -""" -raise NotImplementedError() - -def dump_bytecode(self, bucket): -"""Subclasses have to override this method to write the bytecode -from a bucket b
[06/22] Revert "AMBARI-7138. Ambari RPM deals with jinja2 dependency incorrectly (aonishuk)"
http://git-wip-us.apache.org/repos/asf/ambari/blob/570de228/ambari-common/src/main/python/jinja2/jinja2/bccache.py -- diff --git a/ambari-common/src/main/python/jinja2/jinja2/bccache.py b/ambari-common/src/main/python/jinja2/jinja2/bccache.py new file mode 100644 index 000..1e2236c --- /dev/null +++ b/ambari-common/src/main/python/jinja2/jinja2/bccache.py @@ -0,0 +1,280 @@ +# -*- coding: utf-8 -*- +""" +jinja2.bccache +~~ + +This module implements the bytecode cache system Jinja is optionally +using. This is useful if you have very complex template situations and +the compiliation of all those templates slow down your application too +much. + +Situations where this is useful are often forking web applications that +are initialized on the first request. + +:copyright: (c) 2010 by the Jinja Team. +:license: BSD. +""" +from os import path, listdir +import marshal +import tempfile +import cPickle as pickle +import fnmatch +from cStringIO import StringIO +try: +from hashlib import sha1 +except ImportError: +from sha import new as sha1 +from jinja2.utils import open_if_exists + + +bc_version = 1 +bc_magic = 'j2'.encode('ascii') + pickle.dumps(bc_version, 2) + + +class Bucket(object): +"""Buckets are used to store the bytecode for one template. It's created +and initialized by the bytecode cache and passed to the loading functions. + +The buckets get an internal checksum from the cache assigned and use this +to automatically reject outdated cache material. Individual bytecode +cache subclasses don't have to care about cache invalidation. +""" + +def __init__(self, environment, key, checksum): +self.environment = environment +self.key = key +self.checksum = checksum +self.reset() + +def reset(self): +"""Resets the bucket (unloads the bytecode).""" +self.code = None + +def load_bytecode(self, f): +"""Loads bytecode from a file or file like object.""" +# make sure the magic header is correct +magic = f.read(len(bc_magic)) +if magic != bc_magic: +self.reset() +return +# the source code of the file changed, we need to reload +checksum = pickle.load(f) +if self.checksum != checksum: +self.reset() +return +# now load the code. Because marshal is not able to load +# from arbitrary streams we have to work around that +if isinstance(f, file): +self.code = marshal.load(f) +else: +self.code = marshal.loads(f.read()) + +def write_bytecode(self, f): +"""Dump the bytecode into the file or file like object passed.""" +if self.code is None: +raise TypeError('can\'t write empty bucket') +f.write(bc_magic) +pickle.dump(self.checksum, f, 2) +if isinstance(f, file): +marshal.dump(self.code, f) +else: +f.write(marshal.dumps(self.code)) + +def bytecode_from_string(self, string): +"""Load bytecode from a string.""" +self.load_bytecode(StringIO(string)) + +def bytecode_to_string(self): +"""Return the bytecode as string.""" +out = StringIO() +self.write_bytecode(out) +return out.getvalue() + + +class BytecodeCache(object): +"""To implement your own bytecode cache you have to subclass this class +and override :meth:`load_bytecode` and :meth:`dump_bytecode`. Both of +these methods are passed a :class:`~jinja2.bccache.Bucket`. + +A very basic bytecode cache that saves the bytecode on the file system:: + +from os import path + +class MyCache(BytecodeCache): + +def __init__(self, directory): +self.directory = directory + +def load_bytecode(self, bucket): +filename = path.join(self.directory, bucket.key) +if path.exists(filename): +with open(filename, 'rb') as f: +bucket.load_bytecode(f) + +def dump_bytecode(self, bucket): +filename = path.join(self.directory, bucket.key) +with open(filename, 'wb') as f: +bucket.write_bytecode(f) + +A more advanced version of a filesystem based bytecode cache is part of +Jinja2. +""" + +def load_bytecode(self, bucket): +"""Subclasses have to override this method to load bytecode into a +bucket. If they are not able to find code in the cache for the +bucket, it must not do anything. +""" +raise NotImplementedError() + +def dump_bytecode(self, bucket): +"""Subclasses have to override this method to write the bytecode +from a bucket back to the cache. If it unable to do so it must not +fail silently but ra
[10/22] Revert "AMBARI-7138. Ambari RPM deals with jinja2 dependency incorrectly (aonishuk)"
http://git-wip-us.apache.org/repos/asf/ambari/blob/570de228/ambari-common/src/main/python/jinja2/docs/api.rst -- diff --git a/ambari-common/src/main/python/jinja2/docs/api.rst b/ambari-common/src/main/python/jinja2/docs/api.rst new file mode 100644 index 000..3bf8a94 --- /dev/null +++ b/ambari-common/src/main/python/jinja2/docs/api.rst @@ -0,0 +1,787 @@ +API +=== + +.. module:: jinja2 +:synopsis: public Jinja2 API + +This document describes the API to Jinja2 and not the template language. It +will be most useful as reference to those implementing the template interface +to the application and not those who are creating Jinja2 templates. + +Basics +-- + +Jinja2 uses a central object called the template :class:`Environment`. +Instances of this class are used to store the configuration, global objects +and are used to load templates from the file system or other locations. +Even if you are creating templates from strings by using the constructor of +:class:`Template` class, an environment is created automatically for you, +albeit a shared one. + +Most applications will create one :class:`Environment` object on application +initialization and use that to load templates. In some cases it's however +useful to have multiple environments side by side, if different configurations +are in use. + +The simplest way to configure Jinja2 to load templates for your application +looks roughly like this:: + +from jinja2 import Environment, PackageLoader +env = Environment(loader=PackageLoader('yourapplication', 'templates')) + +This will create a template environment with the default settings and a +loader that looks up the templates in the `templates` folder inside the +`yourapplication` python package. Different loaders are available +and you can also write your own if you want to load templates from a +database or other resources. + +To load a template from this environment you just have to call the +:meth:`get_template` method which then returns the loaded :class:`Template`:: + +template = env.get_template('mytemplate.html') + +To render it with some variables, just call the :meth:`render` method:: + +print template.render(the='variables', go='here') + +Using a template loader rather then passing strings to :class:`Template` +or :meth:`Environment.from_string` has multiple advantages. Besides being +a lot easier to use it also enables template inheritance. + + +Unicode +--- + +Jinja2 is using Unicode internally which means that you have to pass Unicode +objects to the render function or bytestrings that only consist of ASCII +characters. Additionally newlines are normalized to one end of line +sequence which is per default UNIX style (``\n``). + +Python 2.x supports two ways of representing string objects. One is the +`str` type and the other is the `unicode` type, both of which extend a type +called `basestring`. Unfortunately the default is `str` which should not +be used to store text based information unless only ASCII characters are +used. With Python 2.6 it is possible to make `unicode` the default on a per +module level and with Python 3 it will be the default. + +To explicitly use a Unicode string you have to prefix the string literal +with a `u`: ``u'Hänsel und Gretel sagen Hallo'``. That way Python will +store the string as Unicode by decoding the string with the character +encoding from the current Python module. If no encoding is specified this +defaults to 'ASCII' which means that you can't use any non ASCII identifier. + +To set a better module encoding add the following comment to the first or +second line of the Python module using the Unicode literal:: + +# -*- coding: utf-8 -*- + +We recommend utf-8 as Encoding for Python modules and templates as it's +possible to represent every Unicode character in utf-8 and because it's +backwards compatible to ASCII. For Jinja2 the default encoding of templates +is assumed to be utf-8. + +It is not possible to use Jinja2 to process non-Unicode data. The reason +for this is that Jinja2 uses Unicode already on the language level. For +example Jinja2 treats the non-breaking space as valid whitespace inside +expressions which requires knowledge of the encoding or operating on an +Unicode string. + +For more details about Unicode in Python have a look at the excellent +`Unicode documentation`_. + +Another important thing is how Jinja2 is handling string literals in +templates. A naive implementation would be using Unicode strings for +all string literals but it turned out in the past that this is problematic +as some libraries are typechecking against `str` explicitly. For example +`datetime.strftime` does not accept Unicode arguments. To not break it +completely Jinja2 is returning `str` for strings that fit into ASCII and +for everything else `unicode`: + +>>> m = Template(u"{% set a, b = 'foo', 'föö' %}").module +>>> m.a +'foo' +>>> m.b +u'f\xf6
[13/22] Revert "AMBARI-7138. Ambari RPM deals with jinja2 dependency incorrectly (aonishuk)"
http://git-wip-us.apache.org/repos/asf/ambari/blob/570de228/ambari-common/src/main/python/ambari_jinja2/docs/intro.rst -- diff --git a/ambari-common/src/main/python/ambari_jinja2/docs/intro.rst b/ambari-common/src/main/python/ambari_jinja2/docs/intro.rst deleted file mode 100644 index 912bd39..000 --- a/ambari-common/src/main/python/ambari_jinja2/docs/intro.rst +++ /dev/null @@ -1,168 +0,0 @@ -Introduction - - -This is the documentation for the Jinja2 general purpose templating language. -Jinja2 is a library for Python 2.4 and onwards that is designed to be flexible, -fast and secure. - -If you have any exposure to other text-based template languages, such as Smarty or -Django, you should feel right at home with Jinja2. It's both designer and -developer friendly by sticking to Python's principles and adding functionality -useful for templating environments. - -The key-features are... - -- ... **configurable syntax**. If you are generating LaTeX or other formats -with Jinja2 you can change the delimiters to something that integrates better -into the LaTeX markup. - -- ... **fast**. While performance is not the primarily target of Jinja2 it's -surprisingly fast. The overhead compared to regular Python code was reduced -to the very minimum. - -- ... **easy to debug**. Jinja2 integrates directly into the python traceback -system which allows you to debug Jinja2 templates with regular python -debugging helpers. - -- ... **secure**. It's possible to evaluate untrusted template code if the -optional sandbox is enabled. This allows Jinja2 to be used as templating -language for applications where users may modify the template design. - - -Prerequisites -- - -Jinja2 needs at least **Python 2.4** to run. Additionally a working C-compiler -that can create python extensions should be installed for the debugger if you -are using Python 2.4. - -If you don't have a working C-compiler and you are trying to install the source -release with the debugsupport you will get a compiler error. - -.. _ctypes: http://python.net/crew/theller/ctypes/ - - -Installation - - -You have multiple ways to install Jinja2. If you are unsure what to do, go -with the Python egg or tarball. - -As a Python egg (via easy_install) -~~ - -You can install the most recent Jinja2 version using `easy_install`_ or `pip`_:: - -easy_install Jinja2 -pip install Jinja2 - -This will install a Jinja2 egg in your Python installation's site-packages -directory. - -(If you are installing from the windows command line omit the `sudo` and make -sure to run the command as user with administrator rights) - -From the tarball release -~ - -1. Download the most recent tarball from the `download page`_ -2. Unpack the tarball -3. ``sudo python setup.py install`` - -Note that you either have to have setuptools or `distribute`_ installed, -the latter is preferred. - -This will install Jinja2 into your Python installation's site-packages directory. - -.. _distribute: http://pypi.python.org/pypi/distribute - -Installing the development version -~~ - -1. Install `git`_ -2. ``git clone git://github.com/mitsuhiko/ambari_jinja2.git`` -3. ``cd ambari_jinja2`` -4. ``ln -s ambari_jinja2 /usr/lib/python2.X/site-packages`` - -As an alternative to steps 4 you can also do ``python setup.py develop`` -which will install the package via distribute in development mode. This also -has the advantage that the C extensions are compiled. - -.. _download page: http://pypi.python.org/pypi/Jinja2 -.. _setuptools: http://peak.telecommunity.com/DevCenter/setuptools -.. _easy_install: http://peak.telecommunity.com/DevCenter/EasyInstall -.. _pip: http://pypi.python.org/pypi/pip -.. _git: http://git-scm.org/ - - -More Speed with MarkupSafe -~~ - -As of version 2.5.1 Jinja2 will check for an installed `MarkupSafe`_ -module. If it can find it, it will use the Markup class of that module -instead of the one that comes with Jinja2. `MarkupSafe` replaces the -older speedups module that came with Jinja2 and has the advantage that is -has a better setup script and will automatically attempt to install the C -version and nicely fall back to a pure Python implementation if that is -not possible. - -The C implementation of MarkupSafe is much faster and recommended when -using Jinja2 with autoescaping. - -.. _MarkupSafe: http://pypi.python.org/pypi/MarkupSafe - - -Enable the debug support Module -~~~ - -By default Jinja2 will not compile the debug support module. Enabling this -will fail if you don't have the Python headers or a working compiler. This -is often the case if you are installing Jinja2 from a windows machine. - -Because the debug support is only necessary for Python 2.4 you will not
[15/22] Revert "AMBARI-7138. Ambari RPM deals with jinja2 dependency incorrectly (aonishuk)"
http://git-wip-us.apache.org/repos/asf/ambari/blob/570de228/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/testsuite/lexnparse.py -- diff --git a/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/testsuite/lexnparse.py b/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/testsuite/lexnparse.py deleted file mode 100644 index 69ff4bc..000 --- a/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/testsuite/lexnparse.py +++ /dev/null @@ -1,390 +0,0 @@ -# -*- coding: utf-8 -*- -""" -ambari_jinja2.testsuite.lexnparse -~~ - -All the unittests regarding lexing, parsing and syntax. - -:copyright: (c) 2010 by the Jinja Team. -:license: BSD, see LICENSE for more details. -""" -import os -import sys -import time -import tempfile -import unittest - -from ambari_jinja2.testsuite import JinjaTestCase - -from ambari_jinja2 import Environment, Template, TemplateSyntaxError, \ - UndefinedError, nodes - -env = Environment() - - -# how does a string look like in jinja syntax? -if sys.version_info < (3, 0): -def jinja_string_repr(string): -return repr(string)[1:] -else: -jinja_string_repr = repr - - -class LexerTestCase(JinjaTestCase): - -def test_raw1(self): -tmpl = env.from_string('{% raw %}foo{% endraw %}|' - '{%raw%}{{ bar }}|{% baz %}{% endraw %}') -assert tmpl.render() == 'foo|{{ bar }}|{% baz %}' - -def test_raw2(self): -tmpl = env.from_string('1 {%- raw -%} 2 {%- endraw -%} 3') -assert tmpl.render() == '123' - -def test_balancing(self): -env = Environment('{%', '%}', '${', '}') -tmpl = env.from_string('''{% for item in seq -%}${{'foo': item}|upper}{% endfor %}''') -assert tmpl.render(seq=range(3)) == "{'FOO': 0}{'FOO': 1}{'FOO': 2}" - -def test_comments(self): -env = Environment('', '{', '}') -tmpl = env.from_string('''\ - - - {item} - -''') -assert tmpl.render(seq=range(3)) == ("\n 0\n " - "1\n 2\n") - -def test_string_escapes(self): -for char in u'\0', u'\u2668', u'\xe4', u'\t', u'\r', u'\n': -tmpl = env.from_string('{{ %s }}' % jinja_string_repr(char)) -assert tmpl.render() == char -assert env.from_string('{{ "\N{HOT SPRINGS}" }}').render() == u'\u2668' - -def test_bytefallback(self): -from pprint import pformat -tmpl = env.from_string(u'''{{ 'foo'|pprint }}|{{ 'bär'|pprint }}''') -assert tmpl.render() == pformat('foo') + '|' + pformat(u'bär') - -def test_operators(self): -from ambari_jinja2.lexer import operators -for test, expect in operators.iteritems(): -if test in '([{}])': -continue -stream = env.lexer.tokenize('{{ %s }}' % test) -stream.next() -assert stream.current.type == expect - -def test_normalizing(self): -for seq in '\r', '\r\n', '\n': -env = Environment(newline_sequence=seq) -tmpl = env.from_string('1\n2\r\n3\n4\n') -result = tmpl.render() -assert result.replace(seq, 'X') == '1X2X3X4' - - -class ParserTestCase(JinjaTestCase): - -def test_php_syntax(self): -env = Environment('', '', '') -tmpl = env.from_string('''\ -\ - - -''') -assert tmpl.render(seq=range(5)) == '01234' - -def test_erb_syntax(self): -env = Environment('<%', '%>', '<%=', '%>', '<%#', '%>') -tmpl = env.from_string('''\ -<%# I'm a comment, I'm not interesting %>\ -<% for item in seq -%> -<%= item %> -<%- endfor %>''') -assert tmpl.render(seq=range(5)) == '01234' - -def test_comment_syntax(self): -env = Environment('', '${', '}', '') -tmpl = env.from_string('''\ -\ - -${item} -''') -assert tmpl.render(seq=range(5)) == '01234' - -def test_balancing(self): -tmpl = env.from_string('''{{{'foo':'bar'}.foo}}''') -assert tmpl.render() == 'bar' - -def test_start_comment(self): -tmpl = env.from_string('''{# foo comment -and bar comment #} -{% macro blub() %}foo{% endmacro %} -{{ blub() }}''') -assert tmpl.render().strip() == 'foo' - -def test_line_syntax(self): -env = Environment('<%', '%>', '${', '}', '<%#', '%>', '%') -tmpl = env.from_string('''\ -<%# regular comment %> -% for item in seq: -${item} -% endfor''') -assert [int(x.strip()) for x in tmpl.render(seq=range(5)).split()] == \ - range(5) - -env = Environment('<%', '%>', '${', '}', '<%#', '%>', '%', '##') -tmpl = env.from_string('''\ -<%# regular comment %> -% for item in seq: -${item} ## the rest of the stuff -% endfor''') -assert [int(x.strip()) for x in tmpl.render(seq=range(5)).split()] == \ -
[05/22] Revert "AMBARI-7138. Ambari RPM deals with jinja2 dependency incorrectly (aonishuk)"
http://git-wip-us.apache.org/repos/asf/ambari/blob/570de228/ambari-common/src/main/python/jinja2/jinja2/environment.py -- diff --git a/ambari-common/src/main/python/jinja2/jinja2/environment.py b/ambari-common/src/main/python/jinja2/jinja2/environment.py new file mode 100644 index 000..ac74a5c --- /dev/null +++ b/ambari-common/src/main/python/jinja2/jinja2/environment.py @@ -0,0 +1,1118 @@ +# -*- coding: utf-8 -*- +""" +jinja2.environment +~~ + +Provides a class that holds runtime and parsing time options. + +:copyright: (c) 2010 by the Jinja Team. +:license: BSD, see LICENSE for more details. +""" +import os +import sys +from jinja2 import nodes +from jinja2.defaults import * +from jinja2.lexer import get_lexer, TokenStream +from jinja2.parser import Parser +from jinja2.optimizer import optimize +from jinja2.compiler import generate +from jinja2.runtime import Undefined, new_context +from jinja2.exceptions import TemplateSyntaxError, TemplateNotFound, \ + TemplatesNotFound +from jinja2.utils import import_string, LRUCache, Markup, missing, \ + concat, consume, internalcode, _encode_filename + + +# for direct template usage we have up to ten living environments +_spontaneous_environments = LRUCache(10) + +# the function to create jinja traceback objects. This is dynamically +# imported on the first exception in the exception handler. +_make_traceback = None + + +def get_spontaneous_environment(*args): +"""Return a new spontaneous environment. A spontaneous environment is an +unnamed and unaccessible (in theory) environment that is used for +templates generated from a string and not from the file system. +""" +try: +env = _spontaneous_environments.get(args) +except TypeError: +return Environment(*args) +if env is not None: +return env +_spontaneous_environments[args] = env = Environment(*args) +env.shared = True +return env + + +def create_cache(size): +"""Return the cache class for the given size.""" +if size == 0: +return None +if size < 0: +return {} +return LRUCache(size) + + +def copy_cache(cache): +"""Create an empty copy of the given cache.""" +if cache is None: +return None +elif type(cache) is dict: +return {} +return LRUCache(cache.capacity) + + +def load_extensions(environment, extensions): +"""Load the extensions from the list and bind it to the environment. +Returns a dict of instanciated environments. +""" +result = {} +for extension in extensions: +if isinstance(extension, basestring): +extension = import_string(extension) +result[extension.identifier] = extension(environment) +return result + + +def _environment_sanity_check(environment): +"""Perform a sanity check on the environment.""" +assert issubclass(environment.undefined, Undefined), 'undefined must ' \ + 'be a subclass of undefined because filters depend on it.' +assert environment.block_start_string != \ + environment.variable_start_string != \ + environment.comment_start_string, 'block, variable and comment ' \ + 'start strings must be different' +assert environment.newline_sequence in ('\r', '\r\n', '\n'), \ + 'newline_sequence set to unknown line ending string.' +return environment + + +class Environment(object): +r"""The core component of Jinja is the `Environment`. It contains +important shared variables like configuration, filters, tests, +globals and others. Instances of this class may be modified if +they are not shared and if no template was loaded so far. +Modifications on environments after the first template was loaded +will lead to surprising effects and undefined behavior. + +Here the possible initialization parameters: + +`block_start_string` +The string marking the begin of a block. Defaults to ``'{%'``. + +`block_end_string` +The string marking the end of a block. Defaults to ``'%}'``. + +`variable_start_string` +The string marking the begin of a print statement. +Defaults to ``'{{'``. + +`variable_end_string` +The string marking the end of a print statement. Defaults to +``'}}'``. + +`comment_start_string` +The string marking the begin of a comment. Defaults to ``'{#'``. + +`comment_end_string` +The string marking the end of a comment. Defaults to ``'#}'``. + +`line_statement_prefix` +If given and a string, this will be used as prefix for line based +statements. See also :ref:`line-statements`. + +`line_comment_prefix` +If given and a string, this will be used as prefix for line based +based comments. See also :r
[19/22] Revert "AMBARI-7138. Ambari RPM deals with jinja2 dependency incorrectly (aonishuk)"
http://git-wip-us.apache.org/repos/asf/ambari/blob/570de228/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/environment.py -- diff --git a/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/environment.py b/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/environment.py deleted file mode 100644 index b3d6bc7..000 --- a/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/environment.py +++ /dev/null @@ -1,1118 +0,0 @@ -# -*- coding: utf-8 -*- -""" -ambari_jinja2.environment -~~ - -Provides a class that holds runtime and parsing time options. - -:copyright: (c) 2010 by the Jinja Team. -:license: BSD, see LICENSE for more details. -""" -import os -import sys -from ambari_jinja2 import nodes -from ambari_jinja2.defaults import * -from ambari_jinja2.lexer import get_lexer, TokenStream -from ambari_jinja2.parser import Parser -from ambari_jinja2.optimizer import optimize -from ambari_jinja2.compiler import generate -from ambari_jinja2.runtime import Undefined, new_context -from ambari_jinja2.exceptions import TemplateSyntaxError, TemplateNotFound, \ - TemplatesNotFound -from ambari_jinja2.utils import import_string, LRUCache, Markup, missing, \ - concat, consume, internalcode, _encode_filename - - -# for direct template usage we have up to ten living environments -_spontaneous_environments = LRUCache(10) - -# the function to create jinja traceback objects. This is dynamically -# imported on the first exception in the exception handler. -_make_traceback = None - - -def get_spontaneous_environment(*args): -"""Return a new spontaneous environment. A spontaneous environment is an -unnamed and unaccessible (in theory) environment that is used for -templates generated from a string and not from the file system. -""" -try: -env = _spontaneous_environments.get(args) -except TypeError: -return Environment(*args) -if env is not None: -return env -_spontaneous_environments[args] = env = Environment(*args) -env.shared = True -return env - - -def create_cache(size): -"""Return the cache class for the given size.""" -if size == 0: -return None -if size < 0: -return {} -return LRUCache(size) - - -def copy_cache(cache): -"""Create an empty copy of the given cache.""" -if cache is None: -return None -elif type(cache) is dict: -return {} -return LRUCache(cache.capacity) - - -def load_extensions(environment, extensions): -"""Load the extensions from the list and bind it to the environment. -Returns a dict of instanciated environments. -""" -result = {} -for extension in extensions: -if isinstance(extension, basestring): -extension = import_string(extension) -result[extension.identifier] = extension(environment) -return result - - -def _environment_sanity_check(environment): -"""Perform a sanity check on the environment.""" -assert issubclass(environment.undefined, Undefined), 'undefined must ' \ - 'be a subclass of undefined because filters depend on it.' -assert environment.block_start_string != \ - environment.variable_start_string != \ - environment.comment_start_string, 'block, variable and comment ' \ - 'start strings must be different' -assert environment.newline_sequence in ('\r', '\r\n', '\n'), \ - 'newline_sequence set to unknown line ending string.' -return environment - - -class Environment(object): -r"""The core component of Jinja is the `Environment`. It contains -important shared variables like configuration, filters, tests, -globals and others. Instances of this class may be modified if -they are not shared and if no template was loaded so far. -Modifications on environments after the first template was loaded -will lead to surprising effects and undefined behavior. - -Here the possible initialization parameters: - -`block_start_string` -The string marking the begin of a block. Defaults to ``'{%'``. - -`block_end_string` -The string marking the end of a block. Defaults to ``'%}'``. - -`variable_start_string` -The string marking the begin of a print statement. -Defaults to ``'{{'``. - -`variable_end_string` -The string marking the end of a print statement. Defaults to -``'}}'``. - -`comment_start_string` -The string marking the begin of a comment. Defaults to ``'{#'``. - -`comment_end_string` -The string marking the end of a comment. Defaults to ``'#}'``. - -`line_statement_prefix` -If given and a string, this will be used as prefix for line based -statements. See also :ref:`line-statements`. - -`line_comme
[22/22] git commit: Revert "AMBARI-7138. Ambari RPM deals with jinja2 dependency incorrectly (aonishuk)"
Revert "AMBARI-7138. Ambari RPM deals with jinja2 dependency incorrectly (aonishuk)" This reverts commit 7c3ea59fc05db44f9f8a3aebc3e370918fa53e60. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/570de228 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/570de228 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/570de228 Branch: refs/heads/trunk Commit: 570de22829e9cbdf481215a4ba9207486cd81dc4 Parents: 5c0ef4f Author: Mahadev Konar Authored: Wed Sep 3 12:34:31 2014 -0700 Committer: Mahadev Konar Committed: Wed Sep 3 12:34:31 2014 -0700 -- ambari-agent/pom.xml| 12 +- .../resource_management/TestContentSources.py |2 +- .../src/main/python/ambari_jinja2/AUTHORS | 31 - .../src/main/python/ambari_jinja2/CHANGES | 235 --- .../src/main/python/ambari_jinja2/LICENSE | 31 - .../src/main/python/ambari_jinja2/MANIFEST.in | 12 - .../src/main/python/ambari_jinja2/Makefile |4 - .../ambari_jinja2/ambari_jinja2/__init__.py | 73 - .../ambari_jinja2/ambari_jinja2/_debugsupport.c | 78 - .../ambari_jinja2/_markupsafe/__init__.py | 225 --- .../ambari_jinja2/_markupsafe/_bundle.py| 49 - .../ambari_jinja2/_markupsafe/_constants.py | 267 --- .../ambari_jinja2/_markupsafe/_native.py| 45 - .../ambari_jinja2/_markupsafe/tests.py | 80 - .../ambari_jinja2/ambari_jinja2/_stringdefs.py | 130 -- .../ambari_jinja2/ambari_jinja2/bccache.py | 280 --- .../ambari_jinja2/ambari_jinja2/compiler.py | 1640 -- .../ambari_jinja2/ambari_jinja2/constants.py| 32 - .../python/ambari_jinja2/ambari_jinja2/debug.py | 308 .../ambari_jinja2/ambari_jinja2/defaults.py | 40 - .../ambari_jinja2/ambari_jinja2/environment.py | 1118 .../ambari_jinja2/ambari_jinja2/exceptions.py | 143 -- .../python/ambari_jinja2/ambari_jinja2/ext.py | 610 --- .../ambari_jinja2/ambari_jinja2/filters.py | 719 .../python/ambari_jinja2/ambari_jinja2/lexer.py | 681 .../ambari_jinja2/ambari_jinja2/loaders.py | 449 - .../python/ambari_jinja2/ambari_jinja2/meta.py | 102 -- .../python/ambari_jinja2/ambari_jinja2/nodes.py | 901 -- .../ambari_jinja2/ambari_jinja2/optimizer.py| 68 - .../ambari_jinja2/ambari_jinja2/parser.py | 896 -- .../ambari_jinja2/ambari_jinja2/runtime.py | 544 -- .../ambari_jinja2/ambari_jinja2/sandbox.py | 271 --- .../python/ambari_jinja2/ambari_jinja2/tests.py | 146 -- .../ambari_jinja2/testsuite/__init__.py | 95 - .../ambari_jinja2/testsuite/api.py | 240 --- .../ambari_jinja2/testsuite/core_tags.py| 286 --- .../ambari_jinja2/testsuite/debug.py| 60 - .../ambari_jinja2/testsuite/doctests.py | 29 - .../ambari_jinja2/testsuite/ext.py | 455 - .../ambari_jinja2/testsuite/filters.py | 291 .../ambari_jinja2/testsuite/imports.py | 144 -- .../ambari_jinja2/testsuite/inheritance.py | 208 --- .../ambari_jinja2/testsuite/lexnparse.py| 390 - .../ambari_jinja2/testsuite/loader.py | 191 -- .../ambari_jinja2/testsuite/regression.py | 258 --- .../testsuite/res/templates/broken.html |3 - .../testsuite/res/templates/foo/test.html |1 - .../testsuite/res/templates/syntaxerror.html|4 - .../testsuite/res/templates/test.html |1 - .../ambari_jinja2/testsuite/security.py | 134 -- .../ambari_jinja2/testsuite/tests.py| 87 - .../ambari_jinja2/testsuite/utils.py| 85 - .../python/ambari_jinja2/ambari_jinja2/utils.py | 601 --- .../ambari_jinja2/ambari_jinja2/visitor.py | 87 - .../python/ambari_jinja2/artwork/jinjalogo.svg | 132 -- .../custom_fixers/fix_alt_unicode.py| 13 - .../custom_fixers/fix_broken_reraising.py | 21 - .../ambari_jinja2/custom_fixers/fix_xrange2.py | 11 - .../src/main/python/ambari_jinja2/docs/Makefile | 75 - .../python/ambari_jinja2/docs/_static/jinja.js | 26 - .../python/ambari_jinja2/docs/_static/print.css |5 - .../python/ambari_jinja2/docs/_static/style.css | 390 - .../ambari_jinja2/docs/_templates/genindex.html | 36 - .../ambari_jinja2/docs/_templates/layout.html | 77 - .../docs/_templates/opensearch.xml |9 - .../ambari_jinja2/docs/_templates/page.html |4 - .../ambari_jinja2/docs/_templates/search.html | 35 - .../src/main/python/ambari_jinja2/docs/api.rst | 787 - .../ambari_jinja2/docs/cache_extension.py | 56 - .../python/ambari_jinja2/docs/changelog.rst |3 - .../src/main/python/ambari_jinja2/docs/conf.py | 141 -- .../python/ambari_j
[21/22] Revert "AMBARI-7138. Ambari RPM deals with jinja2 dependency incorrectly (aonishuk)"
http://git-wip-us.apache.org/repos/asf/ambari/blob/570de228/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/_stringdefs.py -- diff --git a/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/_stringdefs.py b/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/_stringdefs.py deleted file mode 100644 index 83d1528..000 --- a/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/_stringdefs.py +++ /dev/null @@ -1,130 +0,0 @@ -# -*- coding: utf-8 -*- -""" -ambari_jinja2._stringdefs -~~ - -Strings of all Unicode characters of a certain category. -Used for matching in Unicode-aware languages. Run to regenerate. - -Inspired by chartypes_create.py from the MoinMoin project, original -implementation from Pygments. - -:copyright: Copyright 2006-2009 by the Jinja team, see AUTHORS. -:license: BSD, see LICENSE for details. -""" - -Cc = u'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f' - -Cf = u'\xad\u0600\u0601\u0602\u0603\u06dd\u070f\u17b4\u17b5\u200b\u200c\u200d\u200e\u200f\u202a\u202b\u202c\u202d\u202e\u2060\u2061\u2062\u2063\u206a\u206b\u206c\u206d\u206e\u206f\ufeff\ufff9\ufffa\ufffb' - -Cn = u'\u0242\u0243\u0244\u0245\u0246\u0247\u0248\u0249\u024a\u024b\u024c\u024d\u024e\u024f\u0370\u0371\u0372\u0373\u0376\u0377\u0378\u0379\u037b\u037c\u037d\u037f\u0380\u0381\u0382\u0383\u038b\u038d\u03a2\u03cf\u0487\u04cf\u04fa\u04fb\u04fc\u04fd\u04fe\u04ff\u0510\u0511\u0512\u0513\u0514\u0515\u0516\u0517\u0518\u0519\u051a\u051b\u051c\u051d\u051e\u051f\u0520\u0521\u0522\u0523\u0524\u0525\u0526\u0527\u0528\u0529\u052a\u052b\u052c\u052d\u052e\u052f\u0530\u0557\u0558\u0560\u0588\u058b\u058c\u058d\u058e\u058f\u0590\u05ba\u05c8\u05c9\u05ca\u05cb\u05cc\u05cd\u05ce\u05cf\u05eb\u05ec\u05ed\u05ee\u05ef\u05f5\u05f6\u05f7\u05f8\u05f9\u05fa\u05fb\u05fc\u05fd\u05fe\u05ff\u0604\u0605\u0606\u0607\u0608\u0609\u060a\u0616\u0617\u0618\u0619\u061a\u061c\u061d\u0620\u063b\u063c\u063d\u063e\u063f\u065f\u070e\u074b\u074c\u076e\u076f\u0770\u0771\u0772\u0773\u0774\u0775\u0776\u0777\u0778\u0779\u077a\u077b\u077c\u077d\u077e\u077f\u07b2\u07b3\u07b4\u07b5\u07b6\u07b7\u07b8\u07b9\u07ba\u07bb\u07bc\u07bd\u07be \u07bf\u07c0\u07c1\u07c2\u07c3\u07c4\u07c5\u07c6\u07c7\u07c8\u07c9\u07ca\u07cb\u07cc\u07cd\u07ce\u07cf\u07d0\u07d1\u07d2\u07d3\u07d4\u07d5\u07d6\u07d7\u07d8\u07d9\u07da\u07db\u07dc\u07dd\u07de\u07df\u07e0\u07e1\u07e2\u07e3\u07e4\u07e5\u07e6\u07e7\u07e8\u07e9\u07ea\u07eb\u07ec\u07ed\u07ee\u07ef\u07f0\u07f1\u07f2\u07f3\u07f4\u07f5\u07f6\u07f7\u07f8\u07f9\u07fa\u07fb\u07fc\u07fd\u07fe\u07ff\u0800\u0801\u0802\u0803\u0804\u0805\u0806\u0807\u0808\u0809\u080a\u080b\u080c\u080d\u080e\u080f\u0810\u0811\u0812\u0813\u0814\u0815\u0816\u0817\u0818\u0819\u081a\u081b\u081c\u081d\u081e\u081f\u0820\u0821\u0822\u0823\u0824\u0825\u0826\u0827\u0828\u0829\u082a\u082b\u082c\u082d\u082e\u082f\u0830\u0831\u0832\u0833\u0834\u0835\u0836\u0837\u0838\u0839\u083a\u083b\u083c\u083d\u083e\u083f\u0840\u0841\u0842\u0843\u0844\u0845\u0846\u0847\u0848\u0849\u084a\u084b\u084c\u084d\u084e\u084f\u0850\u0851\u0852\u0853\u0854\u0855\u0856\u0857\u0858\u0859\u085a\u085b\u085c\u085d\u085e\u085f\u0860\u0861\u0862\u0863\u0864\ u0865\u0866\u0867\u0868\u0869\u086a\u086b\u086c\u086d\u086e\u086f\u0870\u0871\u0872\u0873\u0874\u0875\u0876\u0877\u0878\u0879\u087a\u087b\u087c\u087d\u087e\u087f\u0880\u0881\u0882\u0883\u0884\u0885\u0886\u0887\u0888\u0889\u088a\u088b\u088c\u088d\u088e\u088f\u0890\u0891\u0892\u0893\u0894\u0895\u0896\u0897\u0898\u0899\u089a\u089b\u089c\u089d\u089e\u089f\u08a0\u08a1\u08a2\u08a3\u08a4\u08a5\u08a6\u08a7\u08a8\u08a9\u08aa\u08ab\u08ac\u08ad\u08ae\u08af\u08b0\u08b1\u08b2\u08b3\u08b4\u08b5\u08b6\u08b7\u08b8\u08b9\u08ba\u08bb\u08bc\u08bd\u08be\u08bf\u08c0\u08c1\u08c2\u08c3\u08c4\u08c5\u08c6\u08c7\u08c8\u08c9\u08ca\u08cb\u08cc\u08cd\u08ce\u08cf\u08d0\u08d1\u08d2\u08d3\u08d4\u08d5\u08d6\u08d7\u08d8\u08d9\u08da\u08db\u08dc\u08dd\u08de\u08df\u08e0\u08e1\u08e2\u08e3\u08e4\u08e5\u08e6\u08e7\u08e8\u08e9\u08ea\u08eb\u08ec\u08ed\u08ee\u08ef\u08f0\u08f1\u08f2\u08f3\u08f4\u08f5\u08f6\u08f7\u08f8\u08f9\u08fa\u08fb\u08fc\u08fd\u08fe\u08ff\u0900\u093a\u093b\u094e\u094f\u0955\u0956\u0957\u0971\u0972\u0973\u 0974\u0975\u0976\u0977\u0978\u0979\u097a\u097b\u097c\u097e\u097f\u0980\u0984\u098d\u098e\u0991\u0992\u09a9\u09b1\u09b3\u09b4\u09b5\u09ba\u09bb\u09c5\u09c6\u09c9\u09ca\u09cf\u09d0\u09d1\u09d2\u09d3\u09d4\u09d5\u09d6\u09d8\u09d9\u09da\u09db\u09de\u09e4\u09e5\u09fb\u09fc\u09fd\u09fe\u09ff\u0a00\u0a04\u0a0b\u0a0c\u0a0d\u0a0e\u0a11\u0a12\u0a29\u0a31\u0a34\u0a37\u0a3a\u0a3b\u0a3d\u0a43\u0a44\u0a45\u0a46\u0a49\u0a4a\u0a4e\u0a4f\u0a50\u0a51\u0a52\u0a53\u0a54\u0a55\u0a56\u0a57\u0a58\u0a5d\u0a5f\u0a60\u0a61\u0a62\u0a63\u0a64\u0a65\u0a75\u0a76\u0a7
[01/22] Revert "AMBARI-7138. Ambari RPM deals with jinja2 dependency incorrectly (aonishuk)"
Repository: ambari Updated Branches: refs/heads/trunk 5c0ef4f62 -> 570de2282 http://git-wip-us.apache.org/repos/asf/ambari/blob/570de228/ambari-common/src/main/python/jinja2/jinja2/testsuite/lexnparse.py -- diff --git a/ambari-common/src/main/python/jinja2/jinja2/testsuite/lexnparse.py b/ambari-common/src/main/python/jinja2/jinja2/testsuite/lexnparse.py new file mode 100644 index 000..008a0a9 --- /dev/null +++ b/ambari-common/src/main/python/jinja2/jinja2/testsuite/lexnparse.py @@ -0,0 +1,390 @@ +# -*- coding: utf-8 -*- +""" +jinja2.testsuite.lexnparse +~~ + +All the unittests regarding lexing, parsing and syntax. + +:copyright: (c) 2010 by the Jinja Team. +:license: BSD, see LICENSE for more details. +""" +import os +import sys +import time +import tempfile +import unittest + +from jinja2.testsuite import JinjaTestCase + +from jinja2 import Environment, Template, TemplateSyntaxError, \ + UndefinedError, nodes + +env = Environment() + + +# how does a string look like in jinja syntax? +if sys.version_info < (3, 0): +def jinja_string_repr(string): +return repr(string)[1:] +else: +jinja_string_repr = repr + + +class LexerTestCase(JinjaTestCase): + +def test_raw1(self): +tmpl = env.from_string('{% raw %}foo{% endraw %}|' + '{%raw%}{{ bar }}|{% baz %}{% endraw %}') +assert tmpl.render() == 'foo|{{ bar }}|{% baz %}' + +def test_raw2(self): +tmpl = env.from_string('1 {%- raw -%} 2 {%- endraw -%} 3') +assert tmpl.render() == '123' + +def test_balancing(self): +env = Environment('{%', '%}', '${', '}') +tmpl = env.from_string('''{% for item in seq +%}${{'foo': item}|upper}{% endfor %}''') +assert tmpl.render(seq=range(3)) == "{'FOO': 0}{'FOO': 1}{'FOO': 2}" + +def test_comments(self): +env = Environment('', '{', '}') +tmpl = env.from_string('''\ + + + {item} + +''') +assert tmpl.render(seq=range(3)) == ("\n 0\n " + "1\n 2\n") + +def test_string_escapes(self): +for char in u'\0', u'\u2668', u'\xe4', u'\t', u'\r', u'\n': +tmpl = env.from_string('{{ %s }}' % jinja_string_repr(char)) +assert tmpl.render() == char +assert env.from_string('{{ "\N{HOT SPRINGS}" }}').render() == u'\u2668' + +def test_bytefallback(self): +from pprint import pformat +tmpl = env.from_string(u'''{{ 'foo'|pprint }}|{{ 'bär'|pprint }}''') +assert tmpl.render() == pformat('foo') + '|' + pformat(u'bär') + +def test_operators(self): +from jinja2.lexer import operators +for test, expect in operators.iteritems(): +if test in '([{}])': +continue +stream = env.lexer.tokenize('{{ %s }}' % test) +stream.next() +assert stream.current.type == expect + +def test_normalizing(self): +for seq in '\r', '\r\n', '\n': +env = Environment(newline_sequence=seq) +tmpl = env.from_string('1\n2\r\n3\n4\n') +result = tmpl.render() +assert result.replace(seq, 'X') == '1X2X3X4' + + +class ParserTestCase(JinjaTestCase): + +def test_php_syntax(self): +env = Environment('', '', '') +tmpl = env.from_string('''\ +\ + + +''') +assert tmpl.render(seq=range(5)) == '01234' + +def test_erb_syntax(self): +env = Environment('<%', '%>', '<%=', '%>', '<%#', '%>') +tmpl = env.from_string('''\ +<%# I'm a comment, I'm not interesting %>\ +<% for item in seq -%> +<%= item %> +<%- endfor %>''') +assert tmpl.render(seq=range(5)) == '01234' + +def test_comment_syntax(self): +env = Environment('', '${', '}', '') +tmpl = env.from_string('''\ +\ + +${item} +''') +assert tmpl.render(seq=range(5)) == '01234' + +def test_balancing(self): +tmpl = env.from_string('''{{{'foo':'bar'}.foo}}''') +assert tmpl.render() == 'bar' + +def test_start_comment(self): +tmpl = env.from_string('''{# foo comment +and bar comment #} +{% macro blub() %}foo{% endmacro %} +{{ blub() }}''') +assert tmpl.render().strip() == 'foo' + +def test_line_syntax(self): +env = Environment('<%', '%>', '${', '}', '<%#', '%>', '%') +tmpl = env.from_string('''\ +<%# regular comment %> +% for item in seq: +${item} +% endfor''') +assert [int(x.strip()) for x in tmpl.render(seq=range(5)).split()] == \ + range(5) + +env = Environment('<%', '%>', '${', '}', '<%#', '%>', '%', '##') +tmpl = env.from_string('''\ +<%# regular comment %> +% for item in seq: +${item} ## the rest of the stuff +% endfor''') +assert [int(x.strip()) for x in tmpl.render(seq=range(5)).split()] == \ +
[03/22] Revert "AMBARI-7138. Ambari RPM deals with jinja2 dependency incorrectly (aonishuk)"
http://git-wip-us.apache.org/repos/asf/ambari/blob/570de228/ambari-common/src/main/python/jinja2/jinja2/nodes.py -- diff --git a/ambari-common/src/main/python/jinja2/jinja2/nodes.py b/ambari-common/src/main/python/jinja2/jinja2/nodes.py new file mode 100644 index 000..6446c70 --- /dev/null +++ b/ambari-common/src/main/python/jinja2/jinja2/nodes.py @@ -0,0 +1,901 @@ +# -*- coding: utf-8 -*- +""" +jinja2.nodes + + +This module implements additional nodes derived from the ast base node. + +It also provides some node tree helper functions like `in_lineno` and +`get_nodes` used by the parser and translator in order to normalize +python and jinja nodes. + +:copyright: (c) 2010 by the Jinja Team. +:license: BSD, see LICENSE for more details. +""" +import operator +from itertools import chain, izip +from collections import deque +from jinja2.utils import Markup, MethodType, FunctionType + + +#: the types we support for context functions +_context_function_types = (FunctionType, MethodType) + + +_binop_to_func = { +'*':operator.mul, +'/':operator.truediv, +'//': operator.floordiv, +'**': operator.pow, +'%':operator.mod, +'+':operator.add, +'-':operator.sub +} + +_uaop_to_func = { +'not': operator.not_, +'+':operator.pos, +'-':operator.neg +} + +_cmpop_to_func = { +'eq': operator.eq, +'ne': operator.ne, +'gt': operator.gt, +'gteq': operator.ge, +'lt': operator.lt, +'lteq': operator.le, +'in': lambda a, b: a in b, +'notin':lambda a, b: a not in b +} + + +class Impossible(Exception): +"""Raised if the node could not perform a requested action.""" + + +class NodeType(type): +"""A metaclass for nodes that handles the field and attribute +inheritance. fields and attributes from the parent class are +automatically forwarded to the child.""" + +def __new__(cls, name, bases, d): +for attr in 'fields', 'attributes': +storage = [] +storage.extend(getattr(bases[0], attr, ())) +storage.extend(d.get(attr, ())) +assert len(bases) == 1, 'multiple inheritance not allowed' +assert len(storage) == len(set(storage)), 'layout conflict' +d[attr] = tuple(storage) +d.setdefault('abstract', False) +return type.__new__(cls, name, bases, d) + + +class EvalContext(object): +"""Holds evaluation time information. Custom attributes can be attached +to it in extensions. +""" + +def __init__(self, environment, template_name=None): +if callable(environment.autoescape): +self.autoescape = environment.autoescape(template_name) +else: +self.autoescape = environment.autoescape +self.volatile = False + +def save(self): +return self.__dict__.copy() + +def revert(self, old): +self.__dict__.clear() +self.__dict__.update(old) + + +def get_eval_context(node, ctx): +if ctx is None: +if node.environment is None: +raise RuntimeError('if no eval context is passed, the ' + 'node must have an attached ' + 'environment.') +return EvalContext(node.environment) +return ctx + + +class Node(object): +"""Baseclass for all Jinja2 nodes. There are a number of nodes available +of different types. There are three major types: + +- :class:`Stmt`: statements +- :class:`Expr`: expressions +- :class:`Helper`: helper nodes +- :class:`Template`: the outermost wrapper node + +All nodes have fields and attributes. Fields may be other nodes, lists, +or arbitrary values. Fields are passed to the constructor as regular +positional arguments, attributes as keyword arguments. Each node has +two attributes: `lineno` (the line number of the node) and `environment`. +The `environment` attribute is set at the end of the parsing process for +all nodes automatically. +""" +__metaclass__ = NodeType +fields = () +attributes = ('lineno', 'environment') +abstract = True + +def __init__(self, *fields, **attributes): +if self.abstract: +raise TypeError('abstract nodes are not instanciable') +if fields: +if len(fields) != len(self.fields): +if not self.fields: +raise TypeError('%r takes 0 arguments' % +self.__class__.__name__) +raise TypeError('%r takes 0 or %d argument%s' % ( +self.__class__.__name__, +len(self.fields), +len(self.fields) != 1 and 's' or '' +)) +for name, arg in izip(self.fields, field
git commit: AMBARI-7011. ambari trunk commit build fails due to NagiosPropertyProviderTest. (Jun Aoki via mahadev)
Repository: ambari Updated Branches: refs/heads/trunk ad983dee1 -> 1c09523b2 AMBARI-7011. ambari trunk commit build fails due to NagiosPropertyProviderTest. (Jun Aoki via mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1c09523b Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1c09523b Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1c09523b Branch: refs/heads/trunk Commit: 1c09523b2f40f38bd60e69a855b5f7e5d4bcbcac Parents: ad983de Author: Mahadev Konar Authored: Thu Sep 4 15:52:54 2014 -0700 Committer: Mahadev Konar Committed: Thu Sep 4 15:52:58 2014 -0700 -- .../server/controller/nagios/NagiosPropertyProvider.java | 8 ++-- .../server/controller/nagios/NagiosPropertyProviderTest.java | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/1c09523b/ambari-server/src/main/java/org/apache/ambari/server/controller/nagios/NagiosPropertyProvider.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/nagios/NagiosPropertyProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/nagios/NagiosPropertyProvider.java index 64d5e58..d2e425f 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/nagios/NagiosPropertyProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/nagios/NagiosPropertyProvider.java @@ -79,10 +79,12 @@ public class NagiosPropertyProvider extends BaseProvider implements PropertyProv private static final String ALERT_SUMMARY_PASSIVE_PROPERTY_ID = "alerts/summary/PASSIVE"; private static final String PASSIVE_TOKEN = "AMBARIPASSIVE="; - private static final List IGNORABLE_FOR_SERVICES = new ArrayList( + private static final List DEFAULT_IGNORABLE_FOR_SERVICES = Collections.unmodifiableList(new ArrayList( Arrays.asList("NodeManager health", "NodeManager process", "TaskTracker process", "RegionServer process", "DataNode process", "DataNode space", - "ZooKeeper Server process", "Supervisors process")); + "ZooKeeper Server process", "Supervisors process"))); + + private static List IGNORABLE_FOR_SERVICES; private static final List IGNORABLE_FOR_HOSTS = new ArrayList( Collections.singletonList("percent")); @@ -99,6 +101,7 @@ public class NagiosPropertyProvider extends BaseProvider implements PropertyProv static { NAGIOS_PROPERTY_IDS.add("alerts/summary"); NAGIOS_PROPERTY_IDS.add("alerts/detail"); +IGNORABLE_FOR_SERVICES = new ArrayList(DEFAULT_IGNORABLE_FOR_SERVICES); scheduler = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() { @Override @@ -121,6 +124,7 @@ public class NagiosPropertyProvider extends BaseProvider implements PropertyProv clusters = injector.getInstance(Clusters.class); Configuration config = injector.getInstance(Configuration.class); +IGNORABLE_FOR_SERVICES = new ArrayList(DEFAULT_IGNORABLE_FOR_SERVICES); String ignores = config.getProperty(Configuration.NAGIOS_IGNORE_FOR_SERVICES_KEY); if (null != ignores) { Collections.addAll(IGNORABLE_FOR_SERVICES, COMMA_PATTERN.split(ignores)); http://git-wip-us.apache.org/repos/asf/ambari/blob/1c09523b/ambari-server/src/test/java/org/apache/ambari/server/controller/nagios/NagiosPropertyProviderTest.java -- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/nagios/NagiosPropertyProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/nagios/NagiosPropertyProviderTest.java index 0a0821a..4316dc9 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/nagios/NagiosPropertyProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/nagios/NagiosPropertyProviderTest.java @@ -235,6 +235,7 @@ public class NagiosPropertyProviderTest { @Test public void testNagiosServiceAlerts() throws Exception { +module.properties.remove(Configuration.NAGIOS_IGNORE_FOR_SERVICES_KEY); // make sure NAGIOS_IGNORE_FOR_SERVICES_KEY is not set, which could be set by testNagiosServiceAlertsAddIgnore TestStreamProvider streamProvider = new TestStreamProvider("nagios_alerts.txt"); @@ -243,6 +244,7 @@ public class NagiosPropertyProviderTest { "ServiceInfo/cluster_name", "ServiceInfo/service_name"); npp.forceReset(); +NagiosPropertyProvider.init(injector); Resource resource = new ResourceImpl(Resource.Type.Service); resource.setProperty("ServiceInfo/cluster_name", "c1");
git commit: AMBARI-7163. Inactive user should not be able to login. (mahadev)
Repository: ambari Updated Branches: refs/heads/trunk f76e5c9f3 -> 981adc667 AMBARI-7163. Inactive user should not be able to login. (mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/981adc66 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/981adc66 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/981adc66 Branch: refs/heads/trunk Commit: 981adc667c3c6a5bfeca34736bba602f2a423d9b Parents: f76e5c9 Author: Mahadev Konar Authored: Fri Sep 5 10:22:04 2014 -0700 Committer: Mahadev Konar Committed: Fri Sep 5 10:22:04 2014 -0700 -- .../AmbariLdapAuthoritiesPopulator.java | 18 ++-- .../AmbariLocalUserDetailsService.java | 4 +- ...ariAuthorizationProviderDisableUserTest.java | 97 .../TestAmbariLdapAuthoritiesPopulator.java | 2 + ambari-web/app/controllers/login_controller.js | 10 +- ambari-web/app/messages.js | 1 + ambari-web/app/router.js| 8 +- 7 files changed, 127 insertions(+), 13 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/981adc66/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthoritiesPopulator.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthoritiesPopulator.java b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthoritiesPopulator.java index 487e703..fc7f73a 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthoritiesPopulator.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthoritiesPopulator.java @@ -17,7 +17,11 @@ */ package org.apache.ambari.server.security.authorization; -import com.google.inject.Inject; +import java.util.Collection; +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; + import org.apache.ambari.server.orm.dao.MemberDAO; import org.apache.ambari.server.orm.dao.PrivilegeDAO; import org.apache.ambari.server.orm.dao.UserDAO; @@ -28,13 +32,11 @@ import org.apache.ambari.server.orm.entities.UserEntity; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.ldap.core.DirContextOperations; +import org.springframework.security.authentication.DisabledException; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.ldap.userdetails.LdapAuthoritiesPopulator; -import java.util.Collection; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; +import com.google.inject.Inject; /** * Provides authorities population for LDAP user from LDAP catalog @@ -63,12 +65,14 @@ public class AmbariLdapAuthoritiesPopulator implements LdapAuthoritiesPopulator UserEntity user; user = userDAO.findLdapUserByName(username); - + if (user == null) { log.error("Can't get authorities for user " + username + ", he is not present in local DB"); return Collections.emptyList(); } - +if(!user.getActive()){ + throw new DisabledException("User is disabled"); +} // get all of the privileges for the user List principalEntities = new LinkedList(); http://git-wip-us.apache.org/repos/asf/ambari/blob/981adc66/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLocalUserDetailsService.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLocalUserDetailsService.java b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLocalUserDetailsService.java index 55707f8..2aae8a0 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLocalUserDetailsService.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLocalUserDetailsService.java @@ -91,7 +91,7 @@ public class AmbariLocalUserDetailsService implements UserDetailsService { List privilegeEntities = privilegeDAO.findAllByPrincipal(principalEntities); -return new User(user.getUserName(), user.getUserPassword(), -authorizationHelper.convertPrivilegesToAuthorities(privilegeEntities)); +return new User(user.getUserName(), user.getUserPassword(), user.getActive(), +true, true, true, authorizationHelper.convertPrivilegesToAuthorities(privilegeEntities)); } } http://git-wip-us.apache.org/repos/asf/ambari/blob/981adc66/ambari-server/src/test/java/org/apach
git commit: AMBARI-4671. Support changing the cluster name of an existing hadoop cluster. (mahadev)
Repository: ambari Updated Branches: refs/heads/trunk a6e5c8b3c -> bc54512cf AMBARI-4671. Support changing the cluster name of an existing hadoop cluster. (mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/bc54512c Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/bc54512c Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/bc54512c Branch: refs/heads/trunk Commit: bc54512cf289dafabfde4a7dbe769447f3eee7e6 Parents: a6e5c8b Author: Mahadev Konar Authored: Fri Sep 5 16:17:10 2014 -0700 Committer: Mahadev Konar Committed: Fri Sep 5 16:17:14 2014 -0700 -- .../AmbariManagementControllerImpl.java | 24 -- .../AmbariManagementControllerImplTest.java | 86 2 files changed, 105 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/bc54512c/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java index e53433d..99552e5 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java @@ -1144,17 +1144,23 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle private synchronized RequestStatusResponse updateCluster(ClusterRequest request) throws AmbariException { -if (request.getClusterName() == null -|| request.getClusterName().isEmpty()) { - throw new IllegalArgumentException("Invalid arguments, cluster name" - + " should not be null"); +if (request.getClusterId() == null +&& (request.getClusterName() == null +|| request.getClusterName().isEmpty())) { + throw new IllegalArgumentException("Invalid arguments, cluster id or cluster name should not be null"); } LOG.info("Received a updateCluster request" ++ ", clusterId=" + request.getClusterId() + ", clusterName=" + request.getClusterName() + ", request=" + request); -final Cluster cluster = clusters.getCluster(request.getClusterName()); +final Cluster cluster; +if (request.getClusterId() == null) { + cluster = clusters.getCluster(request.getClusterName()); +} else { + cluster = clusters.getClusterById(request.getClusterId()); +} //save data to return configurations created List configurationResponses = new LinkedList(); @@ -1166,6 +1172,14 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle throw new IllegalArgumentException(msg); } +// set the new name of the cluster if change is requested +if (!cluster.getClusterName().equals(request.getClusterName())) { + if (LOG.isDebugEnabled()) { +LOG.debug("Received cluster name change request from " + cluster.getClusterName() + " to " + request.getClusterName()); + } + cluster.setClusterName(request.getClusterName()); +} + // set or create configuration mapping (and optionally create the map of properties) if (null != request.getDesiredConfig()) { Set configs = new HashSet(); http://git-wip-us.apache.org/repos/asf/ambari/blob/bc54512c/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java -- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java index 1d7bc7f..ecc2c0d 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java @@ -26,6 +26,7 @@ import static org.easymock.EasyMock.createStrictMock; import static org.easymock.EasyMock.expect; import static org.easymock.EasyMock.replay; import static org.easymock.EasyMock.verify; +import static org.easymock.EasyMock.expectLastCall; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; @@ -65,6 +66,7 @@ import org.apache.ambari.server.state.ServiceComponentHost; import org.
git commit: AMBARI-6639. License of Font Awesome is wrong in NOTICE.txt. (Jun Aoki via mahadev)
Repository: ambari Updated Branches: refs/heads/trunk 221c5a13f -> 2ef3506a9 AMBARI-6639. License of Font Awesome is wrong in NOTICE.txt. (Jun Aoki via mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2ef3506a Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2ef3506a Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2ef3506a Branch: refs/heads/trunk Commit: 2ef3506a9dc4aab0e6eb3799cf0eed0c141b3008 Parents: 221c5a1 Author: Mahadev Konar Authored: Mon Sep 8 21:40:43 2014 -0700 Committer: Mahadev Konar Committed: Mon Sep 8 21:40:43 2014 -0700 -- ambari-web/app/assets/licenses/NOTICE.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/2ef3506a/ambari-web/app/assets/licenses/NOTICE.txt -- diff --git a/ambari-web/app/assets/licenses/NOTICE.txt b/ambari-web/app/assets/licenses/NOTICE.txt index d317866..82231f0 100644 --- a/ambari-web/app/assets/licenses/NOTICE.txt +++ b/ambari-web/app/assets/licenses/NOTICE.txt @@ -30,7 +30,7 @@ Copyright (c) 2012, Michael Bostock. This product includes bootstrap-datepicker.js (http://www.eyecon.ro/bootstrap-datepicker - Apache License, Version 2.0) Copyright (c) 2012 Stefan Petre -This product includes Font Awesome 3.2.1 (http://fortawesome.github.com/Font-Awesome - Creative Commons 3.0) +This product includes Font Awesome 3.2.1 (http://fortawesome.github.com/Font-Awesome - SIL OFL 1.1) Copyright (c) 2013 Dave Gandy This product includes Rickshaw 1.1.2 (http://code.shutterstock.com/rickshaw/ - MIT License) @@ -44,4 +44,4 @@ Copyright (c) 2011 Felix Gnass [fgnass at neteye dot de] This product includes Moment.js (https://github.com/moment/moment/ - MIT license) -This product includes iframeAutoHeight.js (http://github.com/house9/jquery-iframe-auto-height - MIT license) \ No newline at end of file +This product includes iframeAutoHeight.js (http://github.com/house9/jquery-iframe-auto-height - MIT license)
[1/2] AMBARI-7230. LDAP Sync Scale issues for thousands of users/100's of groups. (mahadev)
Repository: ambari Updated Branches: refs/heads/trunk fbe8b876a -> 17b48bf40 http://git-wip-us.apache.org/repos/asf/ambari/blob/17b48bf4/ambari-server/src/main/java/org/apache/ambari/server/security/ldap/LdapUserGroupMemberDto.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/ldap/LdapUserGroupMemberDto.java b/ambari-server/src/main/java/org/apache/ambari/server/security/ldap/LdapUserGroupMemberDto.java new file mode 100644 index 000..319b831 --- /dev/null +++ b/ambari-server/src/main/java/org/apache/ambari/server/security/ldap/LdapUserGroupMemberDto.java @@ -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. + */ +package org.apache.ambari.server.security.ldap; + +/** + * Pojo with information about LDAP membership. + */ +public class LdapUserGroupMemberDto { + /** + * Name of the group. + */ + private final String groupName; + + /** + * Name of the user. + */ + private final String userName; + + /** + * Constructor. + * + * @param groupName group name + * @param userName user name + */ + public LdapUserGroupMemberDto(String groupName, String userName) { +this.groupName = groupName; +this.userName = userName; + } + + /** + * Get the group name. + * + * @return the group name + */ + public String getGroupName() { +return groupName; + } + + /** + * Get the user name. + * + * @return the user name + */ + public String getUserName() { +return userName; + } + + @Override + public boolean equals(Object o) { +if (this == o) return true; +if (o == null || getClass() != o.getClass()) return false; + +LdapUserGroupMemberDto that = (LdapUserGroupMemberDto) o; + +if (userName != null ? !userName.equals(that.userName) : that.userName != null) return false; +if (groupName != null ? !groupName.equals(that.groupName) : that.groupName != null) return false; + +return true; + } + + @Override + public int hashCode() { +int result = userName != null ? userName.hashCode() : 0; +result = 31 * result + (groupName != null ? groupName.hashCode() : 0); +return result; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/17b48bf4/ambari-server/src/main/python/ambari-server.py -- diff --git a/ambari-server/src/main/python/ambari-server.py b/ambari-server/src/main/python/ambari-server.py index 81b79d1..35ba17b 100755 --- a/ambari-server/src/main/python/ambari-server.py +++ b/ambari-server/src/main/python/ambari-server.py @@ -2940,11 +2940,11 @@ def setup_ldap(): LDAP_PRIMARY_URL_DEFAULT = get_value_from_properties(properties, ldap_property_list_reqd[0]) LDAP_SECONDARY_URL_DEFAULT = get_value_from_properties(properties, ldap_property_list_reqd[1]) LDAP_USE_SSL_DEFAULT = get_value_from_properties(properties, ldap_property_list_reqd[2], "false") - LDAP_USER_CLASS_DEFAULT = get_value_from_properties(properties, ldap_property_list_reqd[3], "person") + LDAP_USER_CLASS_DEFAULT = get_value_from_properties(properties, ldap_property_list_reqd[3], "posixAccount") LDAP_USER_ATT_DEFAULT = get_value_from_properties(properties, ldap_property_list_reqd[4], "uid") - LDAP_GROUP_CLASS_DEFAULT = get_value_from_properties(properties, ldap_property_list_reqd[5], "groupOfUniqueNames") + LDAP_GROUP_CLASS_DEFAULT = get_value_from_properties(properties, ldap_property_list_reqd[5], "posixGroup") LDAP_GROUP_ATT_DEFAULT = get_value_from_properties(properties, ldap_property_list_reqd[6], "cn") - LDAP_GROUP_MEMBER_DEFAULT = get_value_from_properties(properties, ldap_property_list_reqd[7], "uniqueMember") + LDAP_GROUP_MEMBER_DEFAULT = get_value_from_properties(properties, ldap_property_list_reqd[7], "memberUid") LDAP_BASE_DN_DEFAULT = get_value_from_properties(properties, ldap_property_list_reqd[8]) LDAP_BIND_DEFAULT = get_value_from_properties(properties, ldap_property_list_reqd[9], "false") LDAP_MGR_DN_DEFAULT = get_value_from_properties(properties, ldap_property_list_opt[0]) http://git-wip-us.apache.org/repos/asf/ambari/blob/17b48bf4/ambari-server/src/main/resour
[2/2] git commit: AMBARI-7230. LDAP Sync Scale issues for thousands of users/100's of groups. (mahadev)
AMBARI-7230. LDAP Sync Scale issues for thousands of users/100's of groups. (mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/17b48bf4 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/17b48bf4 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/17b48bf4 Branch: refs/heads/trunk Commit: 17b48bf40ff58a1bf429d1fbc14b3049ef79391d Parents: fbe8b87 Author: Mahadev Konar Authored: Tue Sep 9 15:09:00 2014 -0700 Committer: Mahadev Konar Committed: Tue Sep 9 15:09:08 2014 -0700 -- .../server/configuration/Configuration.java | 14 + .../controller/AmbariManagementController.java | 16 +- .../AmbariManagementControllerImpl.java | 34 +- .../ambari/server/controller/AmbariServer.java | 6 +- .../internal/ControllerResourceProvider.java| 22 +- .../apache/ambari/server/orm/dao/GroupDAO.java | 30 +- .../apache/ambari/server/orm/dao/MemberDAO.java | 34 +- .../ambari/server/orm/dao/PrincipalDAO.java | 27 +- .../ambari/server/orm/dao/PrincipalTypeDAO.java | 29 +- .../apache/ambari/server/orm/dao/UserDAO.java | 49 ++- .../server/orm/entities/MemberEntity.java | 7 +- .../server/orm/entities/PrincipalEntity.java| 2 +- .../ambari/server/orm/entities/UserEntity.java | 5 +- .../authorization/AmbariLdapDataPopulator.java | 409 -- .../server/security/authorization/User.java | 2 +- .../server/security/authorization/Users.java| 158 ++- .../security/ldap/AmbariLdapDataPopulator.java | 430 +++ .../server/security/ldap/LdapBatchDto.java | 67 +++ .../server/security/ldap/LdapGroupDto.java | 113 + .../server/security/ldap/LdapSyncDto.java | 72 .../server/security/ldap/LdapUserDto.java | 133 ++ .../security/ldap/LdapUserGroupMemberDto.java | 82 ambari-server/src/main/python/ambari-server.py | 6 +- .../src/main/resources/META-INF/persistence.xml | 4 + .../AmbariLdapDataPopulatorTest.java| 261 --- .../ldap/AmbariLdapDataPopulatorTest.java | 202 + .../security/ldap/LdapPerformanceTest.java | 94 27 files changed, 1561 insertions(+), 747 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/17b48bf4/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 ae20d43..a21f98c 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 @@ -576,6 +576,20 @@ public class Configuration { properties.setProperty(CLIENT_SECURITY_KEY, type.toString()); } + public void setLdap(String host, String userClass, String userNameAttr, String groupClass, String groupName, String groupMember, + String baseDN, boolean anon, String managerDN, String managerPass) { +properties.setProperty(LDAP_PRIMARY_URL_KEY, host); +properties.setProperty(LDAP_USER_OBJECT_CLASS_KEY, userClass); +properties.setProperty(LDAP_USERNAME_ATTRIBUTE_KEY, userNameAttr); +properties.setProperty(LDAP_GROUP_OBJECT_CLASS_KEY, groupClass); +properties.setProperty(LDAP_GROUP_NAMING_ATTR_KEY, groupName); +properties.setProperty(LDAP_GROUP_MEMEBERSHIP_ATTR_KEY, groupMember); +properties.setProperty(LDAP_BASE_DN_KEY, baseDN); +properties.setProperty(LDAP_BIND_ANONYMOUSLY_KEY, String.valueOf(anon)); +properties.setProperty(LDAP_MANAGER_DN_KEY, managerDN); +properties.setProperty(LDAP_MANAGER_PASSWORD_KEY, managerPass); + } + public String getWebAppDir() { LOG.info("Web App DIR test " + properties.getProperty(WEBAPP_DIR)); return properties.getProperty(WEBAPP_DIR, "web"); http://git-wip-us.apache.org/repos/asf/ambari/blob/17b48bf4/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java index 1a5d933..13efd32 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java @@ -24,6 +24,7 @@ import org.apache.ambari.server.api.service
[2/2] ambari git commit: Revert "AMBARI-8852 - RU: Cannot Retry on failure (tbeerbower)"
Revert "AMBARI-8852 - RU: Cannot Retry on failure (tbeerbower)" This reverts commit 85ff51496d555bdac09198523a9860b20be31c35. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/600f1afc Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/600f1afc Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/600f1afc Branch: refs/heads/trunk Commit: 600f1afcd9f2f4f70c20e005a0f6b748214e15c8 Parents: 1ea1577 Author: Mahadev Konar Authored: Tue Dec 23 16:09:24 2014 -0800 Committer: Mahadev Konar Committed: Tue Dec 23 16:09:24 2014 -0800 -- .../server/actionmanager/ActionScheduler.java | 82 - .../server/actionmanager/HostRoleCommand.java | 19 +--- .../ambari/server/actionmanager/Stage.java | 73 +++ .../controller/AmbariActionExecutionHelper.java | 13 +-- .../AmbariCustomCommandExecutionHelper.java | 97 +--- .../AmbariManagementControllerImpl.java | 8 +- .../server/controller/KerberosHelper.java | 4 +- .../ClusterStackVersionResourceProvider.java| 2 +- .../HostStackVersionResourceProvider.java | 2 +- .../internal/RequestResourceProvider.java | 5 +- .../internal/StageResourceProvider.java | 16 +--- .../internal/UpgradeGroupResourceProvider.java | 2 +- .../internal/UpgradeResourceProvider.java | 28 ++ .../ambari/server/orm/entities/StageEntity.java | 23 - .../server/upgrade/UpgradeCatalog200.java | 3 - .../apache/ambari/server/utils/StageUtils.java | 2 +- .../main/resources/Ambari-DDL-MySQL-CREATE.sql | 1 - .../main/resources/Ambari-DDL-Oracle-CREATE.sql | 1 - .../resources/Ambari-DDL-Postgres-CREATE.sql| 1 - .../Ambari-DDL-Postgres-EMBEDDED-CREATE.sql | 1 - .../resources/Ambari-DDL-SQLServer-CREATE.sql | 2 +- .../ExecutionCommandWrapperTest.java| 2 +- .../actionmanager/TestActionDBAccessorImpl.java | 18 ++-- .../server/actionmanager/TestActionManager.java | 2 +- .../actionmanager/TestActionScheduler.java | 16 ++-- .../ambari/server/actionmanager/TestStage.java | 4 +- .../server/agent/TestHeartbeatHandler.java | 8 +- .../AmbariManagementControllerTest.java | 10 +- .../internal/StageResourceProviderTest.java | 44 - .../serveraction/ServerActionExecutorTest.java | 4 +- .../server/stageplanner/TestStagePlanner.java | 26 +++--- .../server/upgrade/UpgradeCatalog200Test.java | 13 --- 32 files changed, 176 insertions(+), 356 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/600f1afc/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java index 6511369..ccecad9 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java @@ -232,11 +232,11 @@ class ActionScheduler implements Runnable { boolean exclusiveRequestIsGoing = false; // This loop greatly depends on the fact that order of stages in // a list does not change between invocations - for (Stage stage : stages) { + for (Stage s : stages) { // Check if we can process this stage in parallel with another stages i_stage ++; -long requestId = stage.getRequestId(); -LOG.debug("==> STAGE_i = " + i_stage + "(requestId=" + requestId + ",StageId=" + stage.getStageId() + ")"); +long requestId = s.getRequestId(); +LOG.debug("==> STAGE_i = " + i_stage + "(requestId=" + requestId + ",StageId=" + s.getStageId() + ")"); Request request = db.getRequest(requestId); if (request.isExclusive()) { @@ -262,7 +262,7 @@ class ActionScheduler implements Runnable { // Commands that will be scheduled in current scheduler wakeup List commandsToSchedule = new ArrayList(); -Map roleStats = processInProgressStage(stage, commandsToSchedule); +Map roleStats = processInProgressStage(s, commandsToSchedule); // Check if stage is failed boolean failed = false; for (Map.Entryentry : roleStats.entrySet()) { @@ -281,14 +281,14 @@ class ActionScheduler implements Runnable { if(!failed) { // Prior stage may have failed and it may need to fail the whole request - failed = hasPreviousStageFailed(stage); + failed = hasPreviousStag
[1/2] ambari git commit: Revert "AMBARI-8852 - RU: Cannot Retry on failure (tbeerbower)"
Repository: ambari Updated Branches: refs/heads/trunk 1ea1577c9 -> 600f1afcd http://git-wip-us.apache.org/repos/asf/ambari/blob/600f1afc/ambari-server/src/test/java/org/apache/ambari/server/stageplanner/TestStagePlanner.java -- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/stageplanner/TestStagePlanner.java b/ambari-server/src/test/java/org/apache/ambari/server/stageplanner/TestStagePlanner.java index 0a381f9..dd2a519 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/stageplanner/TestStagePlanner.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/stageplanner/TestStagePlanner.java @@ -89,10 +89,10 @@ public class TestStagePlanner { Stage stage = StageUtils.getATestStage(1, 1, "host1", "", ""); stage.addHostRoleExecutionCommand("host2", Role.HBASE_MASTER, RoleCommand.START, new ServiceComponentHostStartEvent("HBASE_MASTER", -"host2", now), "cluster1", "HBASE", false); +"host2", now), "cluster1", "HBASE"); stage.addHostRoleExecutionCommand("host3", Role.ZOOKEEPER_SERVER, RoleCommand.START, new ServiceComponentHostStartEvent("ZOOKEEPER_SERVER", -"host3", now), "cluster1", "ZOOKEEPER", false); +"host3", now), "cluster1", "ZOOKEEPER"); System.out.println(stage.toString()); rg.build(stage); @@ -115,37 +115,37 @@ public class TestStagePlanner { Stage stage = StageUtils.getATestStage(1, 1, "host1", "", ""); stage.addHostRoleExecutionCommand("host11", Role.SECONDARY_NAMENODE, RoleCommand.START, new ServiceComponentHostStartEvent("SECONDARY_NAMENODE", -"host11", now), "cluster1", "HDFS", false); +"host11", now), "cluster1", "HDFS"); stage.addHostRoleExecutionCommand("host2", Role.HBASE_MASTER, RoleCommand.START, new ServiceComponentHostStartEvent("HBASE_MASTER", -"host2", now), "cluster1", "HBASE", false); +"host2", now), "cluster1", "HBASE"); stage.addHostRoleExecutionCommand("host3", Role.ZOOKEEPER_SERVER, RoleCommand.START, new ServiceComponentHostStartEvent("ZOOKEEPER_SERVER", -"host3", now), "cluster1", "ZOOKEEPER", false); +"host3", now), "cluster1", "ZOOKEEPER"); stage.addHostRoleExecutionCommand("host4", Role.DATANODE, RoleCommand.START, new ServiceComponentHostStartEvent("DATANODE", -"host4", now), "cluster1", "HDFS", false); +"host4", now), "cluster1", "HDFS"); stage.addHostRoleExecutionCommand("host4", Role.HBASE_REGIONSERVER, RoleCommand.START, new ServiceComponentHostStartEvent("HBASE_REGIONSERVER", -"host4", now), "cluster1", "HBASE", false); +"host4", now), "cluster1", "HBASE"); stage.addHostRoleExecutionCommand("host4", Role.TASKTRACKER, RoleCommand.START, new ServiceComponentHostStartEvent("TASKTRACKER", -"host4", now), "cluster1", "MAPREDUCE", false); +"host4", now), "cluster1", "MAPREDUCE"); stage.addHostRoleExecutionCommand("host5", Role.JOBTRACKER, RoleCommand.START, new ServiceComponentHostStartEvent("JOBTRACKER", -"host5", now), "cluster1", "MAPREDUCE", false); +"host5", now), "cluster1", "MAPREDUCE"); stage.addHostRoleExecutionCommand("host6", Role.OOZIE_SERVER, RoleCommand.START, new ServiceComponentHostStartEvent("OOZIE_SERVER", -"host6", now), "cluster1", "OOZIE", false); +"host6", now), "cluster1", "OOZIE"); stage.addHostRoleExecutionCommand("host7", Role.WEBHCAT_SERVER, RoleCommand.START, new ServiceComponentHostStartEvent("WEBHCAT_SERVER", -"host7", now), "cluster1", "WEBHCAT", false); +"host7", now), "cluster1", "WEBHCAT"); stage.addHostRoleExecutionCommand("host4", Role.GANGLIA_MONITOR, RoleCommand.START, new ServiceComponentHostStartEvent("GANGLIA_MONITOR", -"host4", now), "cluster1", "GANGLIA", false); +"host4", now), "cluster1", "GANGLIA"); stage.addHostRoleExecutionCommand("host9", Role.GANGLIA_SERVER, RoleCommand.START, new ServiceComponentHostStartEvent("GANGLIA_SERVER", -"host9", now), "cluster1", "GANGLIA", false); +"host9", now), "cluster1", "GANGLIA"); System.out.println(stage.toString()); rg.build(stage); System.out.println(rg.stringifyGraph()); http://git-wip-us.apache.org/repos/asf/ambari/blob/600f1afc/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog200Test.java -- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog200Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog200Test.java index cd68dc1..f8d061a 100644 --- a/ambari-server/src/test/java/org/apach
[1/2] ambari git commit: AMBARI-8984. Ambari user+group sync does not work with Active Directory. (Yurii Shylov via mahadev)
Repository: ambari Updated Branches: refs/heads/trunk 07a3078cc -> 6b1eef55e AMBARI-8984. Ambari user+group sync does not work with Active Directory. (Yurii Shylov via mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d7a293bf Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d7a293bf Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d7a293bf Branch: refs/heads/trunk Commit: d7a293bfe384989ab1a6b3556a459752f7d46efa Parents: 07a3078 Author: Mahadev Konar Authored: Wed Jan 7 14:14:40 2015 -0800 Committer: Mahadev Konar Committed: Wed Jan 7 15:48:54 2015 -0800 -- .../server/configuration/Configuration.java | 4 + .../authorization/LdapServerProperties.java | 12 ++ .../security/ldap/AmbariLdapDataPopulator.java | 113 +++ ambari-server/src/main/python/ambari-server.py | 29 ++--- .../ldap/AmbariLdapDataPopulatorTest.java | 63 +++ .../src/test/python/TestAmbariServer.py | 8 +- 6 files changed, 168 insertions(+), 61 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/d7a293bf/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 4bbe255..e5b4cc4 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 @@ -142,6 +142,8 @@ public class Configuration { "authentication.ldap.managerDn"; public static final String LDAP_MANAGER_PASSWORD_KEY = "authentication.ldap.managerPassword"; + public static final String LDAP_DN_ATTRIBUTE_KEY = + "authentication.ldap.dnAttribute"; public static final String LDAP_USERNAME_ATTRIBUTE_KEY = "authentication.ldap.usernameAttribute"; public static final String LDAP_USER_BASE_KEY = @@ -295,6 +297,7 @@ public class Configuration { private static final String LDAP_PRIMARY_URL_DEFAULT = "localhost:33389"; private static final String LDAP_BASE_DN_DEFAULT = "dc=ambari,dc=apache,dc=org"; private static final String LDAP_USERNAME_ATTRIBUTE_DEFAULT = "uid"; + private static final String LDAP_DN_ATTRIBUTE_DEFAULT = "dn"; private static final String LDAP_USER_BASE_DEFAULT = "ou=people,dc=ambari,dc=apache,dc=org"; private static final String LDAP_USER_OBJECT_CLASS_DEFAULT = "person"; @@ -910,6 +913,7 @@ public class Configuration { ldapServerProperties.setUserBase(properties.getProperty(LDAP_USER_BASE_KEY, LDAP_USER_BASE_DEFAULT)); ldapServerProperties.setUserObjectClass(properties.getProperty(LDAP_USER_OBJECT_CLASS_KEY, LDAP_USER_OBJECT_CLASS_DEFAULT)); + ldapServerProperties.setDnAttribute(properties.getProperty(LDAP_DN_ATTRIBUTE_KEY, LDAP_DN_ATTRIBUTE_DEFAULT)); ldapServerProperties.setGroupBase(properties. getProperty(LDAP_GROUP_BASE_KEY, LDAP_GROUP_BASE_DEFAULT)); http://git-wip-us.apache.org/repos/asf/ambari/blob/d7a293bf/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/LdapServerProperties.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/LdapServerProperties.java b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/LdapServerProperties.java index 758523b..ddb3670 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/LdapServerProperties.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/LdapServerProperties.java @@ -35,6 +35,7 @@ public class LdapServerProperties { private String managerDn; private String managerPassword; private String baseDN; + private String dnAttribute; //LDAP group properties private String groupBase; @@ -216,6 +217,14 @@ public class LdapServerProperties { return userObjectClass; } + public String getDnAttribute() { +return dnAttribute; + } + + public void setDnAttribute(String dnAttribute) { +this.dnAttribute = dnAttribute; + } + @Override public boolean equals(Object obj) { if (this == obj) return true; @@ -249,6 +258,8 @@ public class LdapServerProperties { that.adminGroupMappingRules) : that.adminGroupMappingRules != null) return false; if (groupSearchFilter != null ? !groupSearchFilter.equals( that.groupSearchFil
[2/2] ambari git commit: AMBARI-9012. Add Nagios-SNMP contrib to Ambari. (Cabir Zounaidou via mahadev)
AMBARI-9012. Add Nagios-SNMP contrib to Ambari. (Cabir Zounaidou via mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6b1eef55 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6b1eef55 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6b1eef55 Branch: refs/heads/trunk Commit: 6b1eef55ec692db337233c8f676b8725eae10652 Parents: d7a293b Author: Mahadev Konar Authored: Wed Jan 7 15:55:52 2015 -0800 Committer: Mahadev Konar Committed: Wed Jan 7 15:55:52 2015 -0800 -- contrib/nagios-snmp/README.md | 99 .../src/nagios/objects/snmp-commands.cfg| 33 +++ .../src/nagios/objects/snmp-contacts.cfg| 31 ++ contrib/nagios-snmp/src/scripts/send-host-trap | 29 ++ .../nagios-snmp/src/scripts/send-service-trap | 30 ++ 5 files changed, 222 insertions(+) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/6b1eef55/contrib/nagios-snmp/README.md -- diff --git a/contrib/nagios-snmp/README.md b/contrib/nagios-snmp/README.md new file mode 100644 index 000..dd76f46 --- /dev/null +++ b/contrib/nagios-snmp/README.md @@ -0,0 +1,99 @@ + + +Ambari Server integration with SNMP traps += +Ambari uses nagios to manage alerts in the cluster. When a node goes down or a service state changes in the cluster, nagios +will handle those events and is monitored using Ambari-web. This document describes how to integrate alerts with remote +SNMP management station by sending SNMP traps. By enabling SNMP traps, Ambari & Hadoop cluster alerts can be monitored +using remote management station (like OpenNMS, HP OpenView, etc.,). + +This will work with Ambari Server 1.7.0 and below. In Ambari 2.0.0, this feature will be +replaced by alert framework. + +Prerequisites: +-- +1. Nagios server should be running in one of the hadoop cluster node. (Need not to be same node as Ambari server). +2. SNMP should be installed in the node where nagios server is running. Run the following command to install net-snmp +and net-snmp-utils. +> yum install net-snmp net-snmp-utils net-snmp-devel +3. There should be connectivity between the hadoop node running nagios server and the management station. The snmptrap +command will use 162/udp to send trap to the management station. + +Instructions: +- +1. Copy the file src/nagios/objects/snmp-commands.cfg to {nagios\_home\_dir}/objects/snmp-commands.cfg in the node where nagios is running. +This file defines the command to send traps for service and host failures. + +The default home directory (nagios_home_dir) for nagios is /etc/nagios + +2. Copy the file src/nagios/objects/snmp-contacts.cfg to {nagios\_home\_dir}/objects/snmp-contacts.cfg in the node where nagios is running. +This file defines the **snmp-management-station** contact. + +3. In the node where ambari-server is running, edit file /var/lib/ambari-server/resources/stacks/HDP/2.0.6/services/NAGIOS/package/templates/nagios.cfg.j2 +and add below lines just before the {{nagios\_host\_cfg}} + + #Definitions for SNMP traps + cfg_file=/etc/nagios/objects/snmp-commands.cfg + cfg_file=/etc/nagios/objects/snmp-contacts.cfg + +Note: If the home directory is different than /etc/nagios, use the updated home directory. The updated configuration will be automatically +pushed to the nagios server when ambari-server restarted. + +4. To enable SNMP trap, edit file /var/lib/ambari-server/resources/stacks/HDP/2.0.6/services/NAGIOS/package/templates/contacts.cfg.j2 +in the ambari-server and add **snmp-management-station** to the contract group **admins** + + > members {{nagios\_web\_login}},sys_logger,**snmp-management-station** + +5. Copy the file src/scripts/send-service-trap to /usr/local/bin/send-service-trap in the node where nagios is running. +Also, run the following command + + > chmod +x /usr/local/bin/send-service-trap + + > chown nagios:nagios /usr/local/bin/send-service-trap + +6. Copy the file src/scripts/send-host-trap to /usr/local/bin/send-host-trap in the node where nagios is running. +Also, run the following command + + > chmod +x /usr/local/bin/send-service-trap + + > chown nagios:nagios /usr/local/bin/send-service-trap + +7. Download nagios MIBS from *http://ftp.cc.uoc.gr/mirrors/monitoring-plugins/mib/nagiosmib-1.0.0.tar.gz* and +extract the files to /usr/share/snmp/mibs/ directory. + +8. Restart ambari-server + > ambari-server restart + +9. Launch ambari-web (or GUI) in the browser and login. Select Nagios server and restart the service. + +10. Configure management station by editing file /et
[2/2] ambari git commit: Revert "AMBARI-8949. Support Ranger installation via Ambari. (gautam borad via jaimin)"
Revert "AMBARI-8949. Support Ranger installation via Ambari. (gautam borad via jaimin)" This reverts commit ed44a11f4f7e9dcee0901b68c912205619bc7eed. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/01b3af1b Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/01b3af1b Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/01b3af1b Branch: refs/heads/trunk Commit: 01b3af1b7d191019aafc0d8d670941548a7d4b14 Parents: 7f361ad Author: Mahadev Konar Authored: Sun Jan 11 20:33:12 2015 -0800 Committer: Mahadev Konar Committed: Sun Jan 11 20:33:12 2015 -0800 -- .../libraries/functions/ranger_admin.py | 119 .../HBASE/0.96.0.2.0/metainfo.xml | 1 - .../0.96.0.2.0/package/scripts/hbase_master.py | 7 +- .../HBASE/0.96.0.2.0/package/scripts/params.py | 13 -- .../package/scripts/setup_ranger_hbase.py | 184 -- .../common-services/HDFS/2.1.0.2.0/metainfo.xml | 1 - .../HDFS/2.1.0.2.0/package/scripts/namenode.py | 4 +- .../HDFS/2.1.0.2.0/package/scripts/params.py| 14 -- .../package/scripts/setup_ranger_hdfs.py| 186 --- .../HIVE/0.12.0.2.0/metainfo.xml| 1 - .../0.12.0.2.0/package/scripts/hive_server.py | 5 +- .../HIVE/0.12.0.2.0/package/scripts/params.py | 12 -- .../package/scripts/setup_ranger_hive.py| 182 -- .../ranger-knox-plugin-properties.xml | 157 .../common-services/KNOX/0.5.0.2.2/metainfo.xml | 1 - .../0.5.0.2.2/package/scripts/knox_gateway.py | 3 - .../KNOX/0.5.0.2.2/package/scripts/params.py| 11 -- .../package/scripts/setup_ranger_knox.py| 184 -- .../0.4.0/configuration/admin-properties.xml| 180 -- .../RANGER/0.4.0/configuration/ranger-env.xml | 49 - .../0.4.0/configuration/usersync-properties.xml | 103 -- .../common-services/RANGER/0.4.0/metainfo.xml | 78 .../RANGER/0.4.0/package/scripts/params.py | 44 - .../0.4.0/package/scripts/ranger_admin.py | 49 - .../0.4.0/package/scripts/ranger_usersync.py| 47 - .../0.4.0/package/scripts/setup_ranger.py | 132 - .../stacks/HDP/2.2/role_command_order.json | 13 -- .../ranger-hbase-plugin-properties.xml | 150 --- .../ranger-hdfs-plugin-properties.xml | 144 -- .../ranger-hive-plugin-properties.xml | 150 --- .../stacks/HDP/2.2/services/RANGER/metainfo.xml | 29 --- .../stacks/2.0.6/configs/client-upgrade.json| 13 +- .../python/stacks/2.0.6/configs/default.json| 8 +- .../stacks/2.0.6/configs/default_client.json| 5 +- .../python/stacks/2.0.6/configs/ha_default.json | 5 +- .../python/stacks/2.0.6/configs/hbase-2.2.json | 5 +- .../stacks/2.0.6/configs/hbase-check-2.2.json | 5 +- .../stacks/2.0.6/configs/hbase-preupgrade.json | 5 +- .../stacks/2.0.6/configs/hbase-rs-2.2.json | 5 +- .../python/stacks/2.0.6/configs/secured.json| 8 +- .../stacks/2.0.6/configs/secured_client.json| 5 +- .../test/python/stacks/2.2/configs/default.json | 9 +- .../python/stacks/2.2/configs/hive-upgrade.json | 5 - ambari-web/app/config.js| 1 - 44 files changed, 20 insertions(+), 2312 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/01b3af1b/ambari-common/src/main/python/resource_management/libraries/functions/ranger_admin.py -- diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/ranger_admin.py b/ambari-common/src/main/python/resource_management/libraries/functions/ranger_admin.py deleted file mode 100644 index 98509d8..000 --- a/ambari-common/src/main/python/resource_management/libraries/functions/ranger_admin.py +++ /dev/null @@ -1,119 +0,0 @@ -#!/usr/bin/env python -""" -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -&quo
[1/2] ambari git commit: Revert "AMBARI-8949. Support Ranger installation via Ambari. (gautam borad via jaimin)"
Repository: ambari Updated Branches: refs/heads/trunk 7f361ad96 -> 01b3af1b7 http://git-wip-us.apache.org/repos/asf/ambari/blob/01b3af1b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py -- diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py deleted file mode 100644 index bb7d94c..000 --- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env python -""" -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -""" - -from resource_management.libraries.functions.version import format_hdp_stack_version, compare_versions -from resource_management import * - -config = Script.get_config() -tmp_dir = Script.get_tmp_dir() - -hdp_stack_version = str(config['hostLevelParams']['stack_version']) -hdp_stack_version = format_hdp_stack_version(hdp_stack_version) -stack_is_hdp22_or_further = hdp_stack_version != "" and compare_versions(hdp_stack_version, '2.2') >= 0 - -if stack_is_hdp22_or_further: - ranger_home= '/usr/hdp/current/ranger-admin' - ranger_stop= '/usr/bin/ranger-admin-stop' - ranger_start = '/usr/bin/ranger-admin-start' - usersync_home = '/usr/hdp/current/ranger-usersync' - usersync_start = '/usr/bin/ranger-usersync-start' - usersync_stop = '/usr/bin/ranger-usersync-stop' -else: - pass - -java_home = config['hostLevelParams']['java_home'] -unix_user = default("/configurations/ranger-env/unix_user", "ranger") -unix_group = default("/configurations/ranger-env/unix_group", "ranger") - http://git-wip-us.apache.org/repos/asf/ambari/blob/01b3af1b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_admin.py -- diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_admin.py b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_admin.py deleted file mode 100644 index c916162..000 --- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_admin.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python -""" -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -""" - -import sys -from resource_management import * -from setup_ranger import setup_ranger - -class RangerAdmin(Script): -def install(self, env): -self.install_packages(env) -setup_ranger(env) - -def stop(self, env): -import params -env.set_params(params) -Execute(format('{params.ranger_stop}')) - -def start(self, env): -import params -setup_ranger(env) -Execute(format('{params.ranger_start}')) - -def status(self, env): -pass - -def configure(self, env): -import params -env.set_params(params) - - -if __name__ == "__main__": - RangerAdmin().execute() http://git-wip-us.apache.org/repos/asf/ambari/blob/01b3af1b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_usersync.py -- diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_usersync.py b/ambari-server/src/main/resources/com
[1/2] ambari git commit: Revert "Revert "AMBARI-8949. Support Ranger installation via Ambari. (gautam borad via jaimin)""
Repository: ambari Updated Branches: refs/heads/trunk 01b3af1b7 -> 31cdf9fab http://git-wip-us.apache.org/repos/asf/ambari/blob/31cdf9fa/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py -- diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py new file mode 100644 index 000..bb7d94c --- /dev/null +++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python +""" +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +""" + +from resource_management.libraries.functions.version import format_hdp_stack_version, compare_versions +from resource_management import * + +config = Script.get_config() +tmp_dir = Script.get_tmp_dir() + +hdp_stack_version = str(config['hostLevelParams']['stack_version']) +hdp_stack_version = format_hdp_stack_version(hdp_stack_version) +stack_is_hdp22_or_further = hdp_stack_version != "" and compare_versions(hdp_stack_version, '2.2') >= 0 + +if stack_is_hdp22_or_further: + ranger_home= '/usr/hdp/current/ranger-admin' + ranger_stop= '/usr/bin/ranger-admin-stop' + ranger_start = '/usr/bin/ranger-admin-start' + usersync_home = '/usr/hdp/current/ranger-usersync' + usersync_start = '/usr/bin/ranger-usersync-start' + usersync_stop = '/usr/bin/ranger-usersync-stop' +else: + pass + +java_home = config['hostLevelParams']['java_home'] +unix_user = default("/configurations/ranger-env/unix_user", "ranger") +unix_group = default("/configurations/ranger-env/unix_group", "ranger") + http://git-wip-us.apache.org/repos/asf/ambari/blob/31cdf9fa/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_admin.py -- diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_admin.py b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_admin.py new file mode 100644 index 000..c916162 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_admin.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python +""" +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +""" + +import sys +from resource_management import * +from setup_ranger import setup_ranger + +class RangerAdmin(Script): +def install(self, env): +self.install_packages(env) +setup_ranger(env) + +def stop(self, env): +import params +env.set_params(params) +Execute(format('{params.ranger_stop}')) + +def start(self, env): +import params +setup_ranger(env) +Execute(format('{params.ranger_start}')) + +def status(self, env): +pass + +def configure(self, env): +import params +env.set_params(params) + + +if __name__ == "__main__": + RangerAdmin().execute() http://git-wip-us.apache.org/repos/asf/ambari/blob/31cdf9fa/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_usersync.py -- diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_usersync.py b/ambari-server/src/main/resources/common-serv
[2/2] ambari git commit: Revert "Revert "AMBARI-8949. Support Ranger installation via Ambari. (gautam borad via jaimin)""
Revert "Revert "AMBARI-8949. Support Ranger installation via Ambari. (gautam borad via jaimin)"" This reverts commit 01b3af1b7d191019aafc0d8d670941548a7d4b14. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/31cdf9fa Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/31cdf9fa Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/31cdf9fa Branch: refs/heads/trunk Commit: 31cdf9fab34c07f8a1f1f5f6b97de432ea55fc44 Parents: 01b3af1 Author: Mahadev Konar Authored: Sun Jan 11 20:37:05 2015 -0800 Committer: Mahadev Konar Committed: Sun Jan 11 20:37:05 2015 -0800 -- .../libraries/functions/ranger_admin.py | 119 .../HBASE/0.96.0.2.0/metainfo.xml | 1 + .../0.96.0.2.0/package/scripts/hbase_master.py | 7 +- .../HBASE/0.96.0.2.0/package/scripts/params.py | 13 ++ .../package/scripts/setup_ranger_hbase.py | 184 ++ .../common-services/HDFS/2.1.0.2.0/metainfo.xml | 1 + .../HDFS/2.1.0.2.0/package/scripts/namenode.py | 4 +- .../HDFS/2.1.0.2.0/package/scripts/params.py| 14 ++ .../package/scripts/setup_ranger_hdfs.py| 186 +++ .../HIVE/0.12.0.2.0/metainfo.xml| 1 + .../0.12.0.2.0/package/scripts/hive_server.py | 5 +- .../HIVE/0.12.0.2.0/package/scripts/params.py | 12 ++ .../package/scripts/setup_ranger_hive.py| 182 ++ .../ranger-knox-plugin-properties.xml | 157 .../common-services/KNOX/0.5.0.2.2/metainfo.xml | 1 + .../0.5.0.2.2/package/scripts/knox_gateway.py | 3 + .../KNOX/0.5.0.2.2/package/scripts/params.py| 11 ++ .../package/scripts/setup_ranger_knox.py| 184 ++ .../0.4.0/configuration/admin-properties.xml| 180 ++ .../RANGER/0.4.0/configuration/ranger-env.xml | 49 + .../0.4.0/configuration/usersync-properties.xml | 103 ++ .../common-services/RANGER/0.4.0/metainfo.xml | 78 .../RANGER/0.4.0/package/scripts/params.py | 44 + .../0.4.0/package/scripts/ranger_admin.py | 49 + .../0.4.0/package/scripts/ranger_usersync.py| 47 + .../0.4.0/package/scripts/setup_ranger.py | 132 + .../stacks/HDP/2.2/role_command_order.json | 13 ++ .../ranger-hbase-plugin-properties.xml | 150 +++ .../ranger-hdfs-plugin-properties.xml | 144 ++ .../ranger-hive-plugin-properties.xml | 150 +++ .../stacks/HDP/2.2/services/RANGER/metainfo.xml | 29 +++ .../stacks/2.0.6/configs/client-upgrade.json| 13 +- .../python/stacks/2.0.6/configs/default.json| 8 +- .../stacks/2.0.6/configs/default_client.json| 5 +- .../python/stacks/2.0.6/configs/ha_default.json | 5 +- .../python/stacks/2.0.6/configs/hbase-2.2.json | 5 +- .../stacks/2.0.6/configs/hbase-check-2.2.json | 5 +- .../stacks/2.0.6/configs/hbase-preupgrade.json | 5 +- .../stacks/2.0.6/configs/hbase-rs-2.2.json | 5 +- .../python/stacks/2.0.6/configs/secured.json| 8 +- .../stacks/2.0.6/configs/secured_client.json| 5 +- .../test/python/stacks/2.2/configs/default.json | 9 +- .../python/stacks/2.2/configs/hive-upgrade.json | 5 + ambari-web/app/config.js| 1 + 44 files changed, 2312 insertions(+), 20 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/31cdf9fa/ambari-common/src/main/python/resource_management/libraries/functions/ranger_admin.py -- diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/ranger_admin.py b/ambari-common/src/main/python/resource_management/libraries/functions/ranger_admin.py new file mode 100644 index 000..98509d8 --- /dev/null +++ b/ambari-common/src/main/python/resource_management/libraries/functions/ranger_admin.py @@ -0,0 +1,119 @@ +#!/usr/bin/env python +""" +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the
ambari git commit: AMBARI-9300. Tests fail with python 2.6. (Yurii Shylov via mahadev)
Repository: ambari Updated Branches: refs/heads/trunk 731fe2661 -> eb7e11c63 AMBARI-9300. Tests fail with python 2.6. (Yurii Shylov via mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/eb7e11c6 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/eb7e11c6 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/eb7e11c6 Branch: refs/heads/trunk Commit: eb7e11c639be80d89531232b202d44f25e1c2636 Parents: 731fe26 Author: Mahadev Konar Authored: Fri Jan 23 10:31:07 2015 -0800 Committer: Mahadev Konar Committed: Fri Jan 23 10:31:07 2015 -0800 -- .../resource_management/TestSecurityCommons.py | 33 1 file changed, 13 insertions(+), 20 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/eb7e11c6/ambari-agent/src/test/python/resource_management/TestSecurityCommons.py -- diff --git a/ambari-agent/src/test/python/resource_management/TestSecurityCommons.py b/ambari-agent/src/test/python/resource_management/TestSecurityCommons.py index 602b88b..918aed1 100644 --- a/ambari-agent/src/test/python/resource_management/TestSecurityCommons.py +++ b/ambari-agent/src/test/python/resource_management/TestSecurityCommons.py @@ -142,27 +142,20 @@ class TestSecurityCommons(TestCase): } result = get_params_from_filesystem(conf_dir, config_file) +expected = { + 'test_jaas': { +'Client': { + 'keyTab': '/etc/security/keytabs/hbase.service.keytab', + 'useTicketCache': 'false', + 'storeKey': 'true', + 'com.sun.security.auth.module.Krb5LoginModule': 'required', + 'useKeyTab': 'true', + 'principal': 'hbase/vp-ambari-ranger-med-0120-2.cs1cloud.inter...@example.com' +} + } +} -self.assertIn('test_jaas', result) -self.assertIn('Client', result['test_jaas']) - -self.assertIn('com.sun.security.auth.module.Krb5LoginModule', result['test_jaas']['Client']) -self.assertEquals('required', result['test_jaas']['Client']['com.sun.security.auth.module.Krb5LoginModule']) - -self.assertIn('useKeyTab', result['test_jaas']['Client']) -self.assertEquals('true', result['test_jaas']['Client']['useKeyTab']) - -self.assertIn('storeKey', result['test_jaas']['Client']) -self.assertEquals('true', result['test_jaas']['Client']['storeKey']) - -self.assertIn('useTicketCache', result['test_jaas']['Client']) -self.assertEquals('false', result['test_jaas']['Client']['useTicketCache']) - -self.assertIn('keyTab', result['test_jaas']['Client']) -self.assertEquals('/etc/security/keytabs/hbase.service.keytab', result['test_jaas']['Client']['keyTab']) - -self.assertIn('principal', result['test_jaas']['Client']) - self.assertEquals('hbase/vp-ambari-ranger-med-0120-2.cs1cloud.inter...@example.com', result['test_jaas']['Client']['principal']) +self.assertEquals(expected, result) os.unlink(jaas_file_path)
ambari git commit: AMBARI-9196. Part of Validation string-type configs in MR2 does not work at Installation. (Yurii Shylov via mahadev)
Repository: ambari Updated Branches: refs/heads/trunk ec99d7510 -> e803670a8 AMBARI-9196. Part of Validation string-type configs in MR2 does not work at Installation. (Yurii Shylov via mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e803670a Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e803670a Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e803670a Branch: refs/heads/trunk Commit: e803670a89a91b60d2f3d963a4105ec4da599021 Parents: ec99d75 Author: Mahadev Konar Authored: Mon Jan 26 10:58:01 2015 -0800 Committer: Mahadev Konar Committed: Mon Jan 26 10:58:01 2015 -0800 -- .../stacks/HDP/2.2/services/stack_advisor.py| 3 +- .../stacks/2.2/common/test_stack_advisor.py | 35 2 files changed, 37 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/e803670a/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py index 1608e04..3d0ace2 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py @@ -253,7 +253,8 @@ class HDP22StackAdvisor(HDP21StackAdvisor): {"config-name": 'mapreduce.task.io.sort.mb', "item": self.validatorLessThenDefaultValue(properties, recommendedDefaults, 'mapreduce.task.io.sort.mb')}, {"config-name": 'mapreduce.map.memory.mb', "item": self.validatorLessThenDefaultValue(properties, recommendedDefaults, 'mapreduce.map.memory.mb')}, {"config-name": 'mapreduce.reduce.memory.mb', "item": self.validatorLessThenDefaultValue(properties, recommendedDefaults, 'mapreduce.reduce.memory.mb')}, -{"config-name": 'yarn.app.mapreduce.am.resource.mb', "item": self.validatorLessThenDefaultValue(properties, recommendedDefaults, 'yarn.app.mapreduce.am.resource.mb')}] +{"config-name": 'yarn.app.mapreduce.am.resource.mb', "item": self.validatorLessThenDefaultValue(properties, recommendedDefaults, 'yarn.app.mapreduce.am.resource.mb')}, +{"config-name": 'yarn.app.mapreduce.am.command-opts', "item": self.validateXmxValue(properties, recommendedDefaults, 'yarn.app.mapreduce.am.command-opts')}] return self.toConfigurationValidationProblems(validationItems, "mapred-site") def validateHDFSConfigurationsEnv(self, properties, recommendedDefaults, configurations, services, hosts): http://git-wip-us.apache.org/repos/asf/ambari/blob/e803670a/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py -- diff --git a/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py index f387bd1..ba6cd8c 100644 --- a/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py +++ b/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py @@ -795,4 +795,39 @@ class TestHDP22StackAdvisor(TestCase): 'type': 'configuration'}] res = self.stackAdvisor.validateHDFSConfigurationsEnv(properties, recommendedDefaults, configurations, '', '') +self.assertEquals(res, res_expected) + + def test_validateMR2XmxOptsEnv(self): + +recommendedDefaults = {'mapreduce.map.java.opts': '-Xmx500m', + 'mapreduce.reduce.java.opts': '-Xmx600m', + 'mapreduce.task.io.sort.mb': '100', + 'mapreduce.map.memory.mb': '200', + 'mapreduce.reduce.memory.mb': '300', + 'yarn.app.mapreduce.am.resource.mb': '400', + 'yarn.app.mapreduce.am.command-opts': '-Xmx546m -Dhdp.version=${hdp.version}'} +properties = {'mapreduce.map.java.opts': '-Xmxm', + 'mapreduce.reduce.java.opts': '-Xmx0m', + 'mapreduce.task.io.sort.mb': '110', + 'm
ambari git commit: AMBARI-9108. Error on Assign Slaves + Clients page when adding new hosts. (Antonenko Alexander via mahadev)
Repository: ambari Updated Branches: refs/heads/trunk e803670a8 -> 694ca91fd AMBARI-9108. Error on Assign Slaves + Clients page when adding new hosts. (Antonenko Alexander via mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/694ca91f Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/694ca91f Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/694ca91f Branch: refs/heads/trunk Commit: 694ca91fd57665c8f2a60d1fc675165bea5481fe Parents: e803670 Author: Mahadev Konar Authored: Mon Jan 26 11:59:07 2015 -0800 Committer: Mahadev Konar Committed: Mon Jan 26 11:59:07 2015 -0800 -- .../src/main/resources/stacks/stack_advisor.py | 22 +--- .../stacks/2.0.6/common/test_stack_advisor.py | 2 +- 2 files changed, 15 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/694ca91f/ambari-server/src/main/resources/stacks/stack_advisor.py -- diff --git a/ambari-server/src/main/resources/stacks/stack_advisor.py b/ambari-server/src/main/resources/stacks/stack_advisor.py index 81d2288..3d22d92 100644 --- a/ambari-server/src/main/resources/stacks/stack_advisor.py +++ b/ambari-server/src/main/resources/stacks/stack_advisor.py @@ -386,17 +386,23 @@ class DefaultStackAdvisor(StackAdvisor): for component in slaveClientComponents: componentName = component["StackServiceComponents"]["component_name"] -if self.isComponentHostsPopulated(component): - hostsForComponent = component["StackServiceComponents"]["hostnames"] -elif component["StackServiceComponents"]["cardinality"] == "ALL": +if component["StackServiceComponents"]["cardinality"] == "ALL": hostsForComponent = hostsList else: - if len(freeHosts) == 0: + componentIsPopulated = self.isComponentHostsPopulated(component) + if componentIsPopulated: +hostsForComponent = component["StackServiceComponents"]["hostnames"] + else: +hostsForComponent = [] + + if self.isSlaveComponent(component): +hostsForComponent.extend(freeHosts) +hostsForComponent = list(set(hostsForComponent)) # removing duplicates + elif self.isClientComponent(component) and not componentIsPopulated: +hostsForComponent = freeHosts[0:1] + + if not hostsForComponent: # hostsForComponent is empty hostsForComponent = hostsList[-1:] - else: # len(freeHosts) >= 1 -hostsForComponent = freeHosts -if self.isClientComponent(component): - hostsForComponent = freeHosts[0:1] #extend 'hostsComponentsMap' with 'hostsForComponent' for hostName in hostsForComponent: http://git-wip-us.apache.org/repos/asf/ambari/blob/694ca91f/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py -- diff --git a/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py index 3a8d79b..bae5ef8 100644 --- a/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py +++ b/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py @@ -91,7 +91,7 @@ class TestHDP206StackAdvisor(TestCase): result = self.stackAdvisor.recommendComponentLayout(services, hosts) expectedComponentsHostsMap = { - "GANGLIA_MONITOR": ["host1"] + "GANGLIA_MONITOR": ["host1", "host2"] } self.assertHostLayout(expectedComponentsHostsMap, result)
ambari git commit: AMBARI-9303. Alerts: Incorrect alert name on Alerts page. (Yurii Shylov via mahadev)
Repository: ambari Updated Branches: refs/heads/trunk 694ca91fd -> bb36d2a3b AMBARI-9303. Alerts: Incorrect alert name on Alerts page. (Yurii Shylov via mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/bb36d2a3 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/bb36d2a3 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/bb36d2a3 Branch: refs/heads/trunk Commit: bb36d2a3b345063339752eb6ff8493ba90294477 Parents: 694ca91 Author: Mahadev Konar Authored: Mon Jan 26 12:03:43 2015 -0800 Committer: Mahadev Konar Committed: Mon Jan 26 12:03:43 2015 -0800 -- .../src/main/resources/common-services/KNOX/0.5.0.2.2/alerts.json | 2 +- .../resources/stacks/HDP/2.2.GlusterFS/services/KNOX/alerts.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/bb36d2a3/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/alerts.json -- diff --git a/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/alerts.json b/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/alerts.json index e063da7..4986e04 100644 --- a/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/alerts.json +++ b/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/alerts.json @@ -4,7 +4,7 @@ "KNOX_GATEWAY": [ { "name": "knox_gateway_process", -"label": "Know Gateway Process", +"label": "Knox Gateway Process", "description": "This host-level alert is triggered if the Knox Gateway cannot be determined to be up.", "interval": 1, "scope": "HOST", http://git-wip-us.apache.org/repos/asf/ambari/blob/bb36d2a3/ambari-server/src/main/resources/stacks/HDP/2.2.GlusterFS/services/KNOX/alerts.json -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2.GlusterFS/services/KNOX/alerts.json b/ambari-server/src/main/resources/stacks/HDP/2.2.GlusterFS/services/KNOX/alerts.json index 85bf144..9599a48 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.2.GlusterFS/services/KNOX/alerts.json +++ b/ambari-server/src/main/resources/stacks/HDP/2.2.GlusterFS/services/KNOX/alerts.json @@ -4,7 +4,7 @@ "KNOX_GATEWAY": [ { "name": "knox_gateway_process", -"label": "Know Gateway Process", +"label": "Knox Gateway Process", "interval": 1, "scope": "HOST", "source": {
ambari git commit: AMBARI-9610. Update Ambari Preupload to make optimizations for tarball upload. (Ivan Kozlov via mahadev)
Repository: ambari Updated Branches: refs/heads/trunk 94205c744 -> 2952039a8 AMBARI-9610. Update Ambari Preupload to make optimizations for tarball upload. (Ivan Kozlov via mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2952039a Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2952039a Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2952039a Branch: refs/heads/trunk Commit: 2952039a844435f195458281b353bce033dfe75c Parents: 94205c7 Author: Mahadev Konar Authored: Thu Feb 12 15:51:36 2015 -0800 Committer: Mahadev Konar Committed: Thu Feb 12 15:51:36 2015 -0800 -- .../main/resources/scripts/Ambaripreupload.py | 58 ++-- 1 file changed, 41 insertions(+), 17 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/2952039a/ambari-server/src/main/resources/scripts/Ambaripreupload.py -- diff --git a/ambari-server/src/main/resources/scripts/Ambaripreupload.py b/ambari-server/src/main/resources/scripts/Ambaripreupload.py index 89e0742..42a7faa 100644 --- a/ambari-server/src/main/resources/scripts/Ambaripreupload.py +++ b/ambari-server/src/main/resources/scripts/Ambaripreupload.py @@ -176,8 +176,7 @@ def copy_tarballs_to_hdfs(source, dest, hdp_select_component_name, component_use destination_file = os.path.join(component_tar_destination_folder, file_name) destination_file = destination_file.replace("{{ hdp_stack_version }}", hdp_version) - does_hdfs_file_exist_cmd = "fs -ls %s" % destination_file - + kinit_if_needed = "" if params.security_enabled: kinit_if_needed = format("{kinit_path_local} -kt {hdfs_user_keytab} {hdfs_principal_name};") @@ -187,7 +186,22 @@ def copy_tarballs_to_hdfs(source, dest, hdp_select_component_name, component_use user=component_user, path='/bin' ) - + + #Check if destination folder already exists + does_hdfs_dir_exist = False + does_hdfs_file_exist_cmd = "fs -ls %s" % os.path.dirname(destination_file) + try: +ExecuteHadoop(does_hdfs_file_exist_cmd, + user=component_user, + logoutput=True, + conf_dir=params.hadoop_conf_dir, + bin_dir=params.hadoop_bin_dir +) +does_hdfs_dir_exist = True + except Fail: +pass + + does_hdfs_file_exist_cmd = "fs -ls %s" % destination_file does_hdfs_file_exist = False try: ExecuteHadoop(does_hdfs_file_exist_cmd, @@ -200,7 +214,7 @@ def copy_tarballs_to_hdfs(source, dest, hdp_select_component_name, component_use except Fail: pass - if not does_hdfs_file_exist: + if not does_hdfs_file_exist and not does_hdfs_dir_exist: source_and_dest_pairs = [(component_tar_source_file, destination_file), ] return _copy_files(source_and_dest_pairs, file_owner, group_owner, kinit_if_needed) return 1 @@ -243,12 +257,11 @@ with Environment() as env: not_if = no_op_test, sudo = True, ) - - oozie_setup_sh="" - + + oozie_root = 'oozie-server' + oozie_setup_sh = format("/usr/hdp/current/{oozie_root}/bin/oozie-setup.sh") oozie_shared_lib = format("/usr/hdp/current/{oozie_root}/share") - oozie_shared_lib = "/usr/lib/oozie/share" oozie_user = 'oozie' oozie_hdfs_user_dir = format("/user/{oozie_user}") kinit_if_needed = '' @@ -257,16 +270,27 @@ with Environment() as env: oozie_cmd = format("{put_shared_lib_to_hdfs_cmd} ; hadoop --config {hadoop_conf_dir} dfs -chmod -R 755 {oozie_hdfs_user_dir}/share") not_if_command = format("{kinit_if_needed} hadoop --config {hadoop_conf_dir} dfs -ls /user/oozie/share | awk 'BEGIN {{count=0;}} /share/ {{count++}} END {{if (count > 0) {{exit 0}} else {{exit 1'") - HdfsDirectory(format("{oozie_hdfs_user_dir}/share"), -action="create", -owner=oozie_user, -mode=0555, -conf_dir=params.hadoop_conf_dir, -hdfs_user=params.hdfs_user, -) - Execute( oozie_cmd, user = params.oozie_user, not_if = not_if_command, - path = params.execute_path ) + #Check if destination folder already exists + does_hdfs_file_exist_cmd = "fs -ls %s" % format("{oozie_hdfs_user_dir}/share") + try: +ExecuteHadoop(does_hdfs_file_exist_cmd, + user=oozie_user, + logoutput=True, + conf_dir=params.hadoop_conf_dir, + bin_dir=params.hadoop_bin_dir +) + except Fail: +#If dir does no
ambari git commit: AMBARI-9607. Storm : DRPC Server does not start on secure cluster. (Eugene C via mahadev)
Repository: ambari Updated Branches: refs/heads/trunk 5a2b89464 -> 7f752bed2 AMBARI-9607. Storm : DRPC Server does not start on secure cluster. (Eugene C via mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7f752bed Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7f752bed Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7f752bed Branch: refs/heads/trunk Commit: 7f752bed246b38c252b82c1105b66ca7551bfd68 Parents: 5a2b894 Author: Mahadev Konar Authored: Fri Feb 13 13:04:05 2015 -0800 Committer: Mahadev Konar Committed: Fri Feb 13 13:04:12 2015 -0800 -- .../common-services/STORM/0.9.1.2.1/package/scripts/params.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/7f752bed/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/params.py -- diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/params.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/params.py index 5164550..887132d 100644 --- a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/params.py +++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/params.py @@ -89,7 +89,7 @@ if security_enabled: _nimbus_principal_name = config['configurations']['storm-env']['nimbus_principal_name'] -nimbus_jaas_principal = _nimbus_principal_name.replace('_HOST',nimbus_host.lower()) +nimbus_jaas_principal = _nimbus_principal_name.replace('_HOST', _hostname_lowercase) nimbus_bare_jaas_principal = _nimbus_principal_name.replace('/_HOST','').replace('@'+kerberos_domain,'') nimbus_keytab_path = config['configurations']['storm-env']['nimbus_keytab']
ambari git commit: AMBARI-9802. Phoenix is failing on ambari-installed secure clusters. (Rob Levas via mahadev)
Repository: ambari Updated Branches: refs/heads/trunk 5e64d87f6 -> acbe6f108 AMBARI-9802. Phoenix is failing on ambari-installed secure clusters. (Rob Levas via mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/acbe6f10 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/acbe6f10 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/acbe6f10 Branch: refs/heads/trunk Commit: acbe6f10832af0f3fcc95c524c968a17b9efc3e5 Parents: 5e64d87 Author: Mahadev Konar Authored: Thu Feb 26 10:44:14 2015 -0800 Committer: Mahadev Konar Committed: Thu Feb 26 10:44:14 2015 -0800 -- .../HBASE/0.96.0.2.0/package/scripts/hbase.py | 8 +++ .../stacks/2.0.6/HBASE/test_hbase_client.py | 14 + .../stacks/2.0.6/HBASE/test_hbase_master.py | 21 ++- .../2.0.6/HBASE/test_hbase_regionserver.py | 22 +++- 4 files changed, 63 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/acbe6f10/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 6f18ddf..06e0481 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 @@ -65,6 +65,14 @@ def hbase(name=None # 'master' or 'regionserver' or 'client' group = params.user_group ) + XmlConfig( "core-site.xml", + conf_dir = params.hbase_conf_dir, + configurations = params.config['configurations']['core-site'], + configuration_attributes=params.config['configuration_attributes']['core-site'], + owner = params.hbase_user, + group = params.user_group + ) + if 'hdfs-site' in params.config['configurations']: XmlConfig( "hdfs-site.xml", conf_dir = params.hbase_conf_dir, http://git-wip-us.apache.org/repos/asf/ambari/blob/acbe6f10/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_client.py -- diff --git a/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_client.py b/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_client.py index aee496f..370aca0 100644 --- a/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_client.py +++ b/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_client.py @@ -67,6 +67,13 @@ class TestHBaseClient(RMFTestCase): configurations = self.getConfig()['configurations']['hbase-site'], configuration_attributes = self.getConfig()['configuration_attributes']['hbase-site'] ) +self.assertResourceCalled('XmlConfig', 'core-site.xml', + owner = 'hbase', + group = 'hadoop', + conf_dir = '/etc/hbase/conf', + configurations = self.getConfig()['configurations']['core-site'], + configuration_attributes = self.getConfig()['configuration_attributes']['core-site'] +) self.assertResourceCalled('XmlConfig', 'hdfs-site.xml', owner = 'hbase', group = 'hadoop', @@ -151,6 +158,13 @@ class TestHBaseClient(RMFTestCase): configurations = self.getConfig()['configurations']['hbase-site'], configuration_attributes = self.getConfig()['configuration_attributes']['hbase-site'] ) +self.assertResourceCalled('XmlConfig', 'core-site.xml', + owner = 'hbase', + group = 'hadoop', + conf_dir = '/etc/hbase/conf', + configurations = self.getConfig()['configurations']['core-site'], + configuration_attributes = self.getConfig()['configuration_attributes']['core-site'] +) self.assertResourceCalled('XmlConfig', 'hdfs-site.xml', owner = 'hbase', group = 'hadoop', http://git-wip-us.apache.org/repos/asf/ambari/blob/acbe6f10/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_master.py -- diff --git a/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_master.py b/ambari-
ambari git commit: AMBARI-9802. Phoenix is failing on ambari-installed secure clusters. (Rob Levas via mahadev)
Repository: ambari Updated Branches: refs/heads/branch-2.0.0 fb0f4f5a9 -> a48918291 AMBARI-9802. Phoenix is failing on ambari-installed secure clusters. (Rob Levas via mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a4891829 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a4891829 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a4891829 Branch: refs/heads/branch-2.0.0 Commit: a489182913a13a5e43f53658b3cfebbc37fa07fa Parents: fb0f4f5 Author: Mahadev Konar Authored: Thu Feb 26 10:44:14 2015 -0800 Committer: Mahadev Konar Committed: Thu Feb 26 10:45:08 2015 -0800 -- .../HBASE/0.96.0.2.0/package/scripts/hbase.py | 8 +++ .../stacks/2.0.6/HBASE/test_hbase_client.py | 14 + .../stacks/2.0.6/HBASE/test_hbase_master.py | 21 ++- .../2.0.6/HBASE/test_hbase_regionserver.py | 22 +++- 4 files changed, 63 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/a4891829/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 6f18ddf..06e0481 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 @@ -65,6 +65,14 @@ def hbase(name=None # 'master' or 'regionserver' or 'client' group = params.user_group ) + XmlConfig( "core-site.xml", + conf_dir = params.hbase_conf_dir, + configurations = params.config['configurations']['core-site'], + configuration_attributes=params.config['configuration_attributes']['core-site'], + owner = params.hbase_user, + group = params.user_group + ) + if 'hdfs-site' in params.config['configurations']: XmlConfig( "hdfs-site.xml", conf_dir = params.hbase_conf_dir, http://git-wip-us.apache.org/repos/asf/ambari/blob/a4891829/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_client.py -- diff --git a/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_client.py b/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_client.py index aee496f..370aca0 100644 --- a/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_client.py +++ b/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_client.py @@ -67,6 +67,13 @@ class TestHBaseClient(RMFTestCase): configurations = self.getConfig()['configurations']['hbase-site'], configuration_attributes = self.getConfig()['configuration_attributes']['hbase-site'] ) +self.assertResourceCalled('XmlConfig', 'core-site.xml', + owner = 'hbase', + group = 'hadoop', + conf_dir = '/etc/hbase/conf', + configurations = self.getConfig()['configurations']['core-site'], + configuration_attributes = self.getConfig()['configuration_attributes']['core-site'] +) self.assertResourceCalled('XmlConfig', 'hdfs-site.xml', owner = 'hbase', group = 'hadoop', @@ -151,6 +158,13 @@ class TestHBaseClient(RMFTestCase): configurations = self.getConfig()['configurations']['hbase-site'], configuration_attributes = self.getConfig()['configuration_attributes']['hbase-site'] ) +self.assertResourceCalled('XmlConfig', 'core-site.xml', + owner = 'hbase', + group = 'hadoop', + conf_dir = '/etc/hbase/conf', + configurations = self.getConfig()['configurations']['core-site'], + configuration_attributes = self.getConfig()['configuration_attributes']['core-site'] +) self.assertResourceCalled('XmlConfig', 'hdfs-site.xml', owner = 'hbase', group = 'hadoop', http://git-wip-us.apache.org/repos/asf/ambari/blob/a4891829/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_master.py -- diff --git a/ambari-server/src/test/python/stacks/2.0.6/HBASE/tes
ambari git commit: Revert "AMBARI-10036. Add HDP 2.3 stack to Ambari (aonishuk)"
Repository: ambari Updated Branches: refs/heads/branch-2.0.0 c7e8cbaa7 -> 9c9c3041a Revert "AMBARI-10036. Add HDP 2.3 stack to Ambari (aonishuk)" This reverts commit 7d74689046ce92870faeb64707d0dd80d20fdcff. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9c9c3041 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9c9c3041 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9c9c3041 Branch: refs/heads/branch-2.0.0 Commit: 9c9c3041af09b46f73eed94f4aca73bf12f50709 Parents: c7e8cba Author: Mahadev Konar Authored: Wed Mar 11 18:20:39 2015 -0700 Committer: Mahadev Konar Committed: Wed Mar 11 18:20:39 2015 -0700 -- .../main/resources/stacks/HDP/2.3/metainfo.xml | 23 - .../resources/stacks/HDP/2.3/repos/repoinfo.xml | 68 -- .../HDP/2.3/services/ACCUMULO/metainfo.xml | 45 -- .../stacks/HDP/2.3/services/FALCON/metainfo.xml | 44 - .../stacks/HDP/2.3/services/FLUME/metainfo.xml | 46 -- .../stacks/HDP/2.3/services/HBASE/metainfo.xml | 52 --- .../stacks/HDP/2.3/services/HDFS/metainfo.xml | 95 .../stacks/HDP/2.3/services/HIVE/metainfo.xml | 85 -- .../stacks/HDP/2.3/services/KAFKA/metainfo.xml | 44 - .../HDP/2.3/services/KERBEROS/metainfo.xml | 25 -- .../stacks/HDP/2.3/services/KNOX/metainfo.xml | 44 - .../stacks/HDP/2.3/services/OOZIE/metainfo.xml | 70 --- .../stacks/HDP/2.3/services/PIG/metainfo.xml| 44 - .../stacks/HDP/2.3/services/RANGER/metainfo.xml | 54 --- .../stacks/HDP/2.3/services/SLIDER/metainfo.xml | 50 --- .../stacks/HDP/2.3/services/SPARK/metainfo.xml | 53 --- .../stacks/HDP/2.3/services/SQOOP/metainfo.xml | 52 --- .../stacks/HDP/2.3/services/STORM/metainfo.xml | 45 -- .../stacks/HDP/2.3/services/TEZ/metainfo.xml| 46 -- .../stacks/HDP/2.3/services/YARN/metainfo.xml | 79 .../HDP/2.3/services/ZOOKEEPER/metainfo.xml | 45 -- .../stacks/HDP/2.3/services/stack_advisor.py| 21 - 22 files changed, 1130 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/9c9c3041/ambari-server/src/main/resources/stacks/HDP/2.3/metainfo.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/metainfo.xml deleted file mode 100644 index d04b44b..000 --- a/ambari-server/src/main/resources/stacks/HDP/2.3/metainfo.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - true - -2.2 - http://git-wip-us.apache.org/repos/asf/ambari/blob/9c9c3041/ambari-server/src/main/resources/stacks/HDP/2.3/repos/repoinfo.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/repos/repoinfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/repos/repoinfo.xml deleted file mode 100644 index 5b25a04..000 --- a/ambari-server/src/main/resources/stacks/HDP/2.3/repos/repoinfo.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - http://public-repo-1.hortonworks.com/HDP/hdp_urlinfo.json - - - http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos6/2.x/updates/2.3.0.0 - HDP-2.3 - HDP - - - http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6 - HDP-UTILS-1.1.0.20 - HDP-UTILS - - - - - http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos5/2.x/updates/2.3.0.0 - HDP-2.3 - HDP - - - http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos5 - HDP-UTILS-1.1.0.20 - HDP-UTILS - - - - - http://s3.amazonaws.com/dev.hortonworks.com/HDP/suse11sp3/2.x/updates/2.3.0.0 - HDP-2.3 - HDP - - - http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/suse11sp3 - HDP-UTILS-1.1.0.20 - HDP-UTILS - - - - - http://s3.amazonaws.com/dev.hortonworks.com/HDP/ubuntu12/2.x/updates/2.3.0.0 - HDP-2.3 - HDP - - - http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/ubuntu12 - HDP-UTILS-1.1.0.20 - HDP-UTILS - - - http://git-wip-us.apache.org/repos/asf/ambari/blob/9c9c3041/ambari-server/src/main/resources/stacks/HDP/2.3/services/ACCUMULO/metainfo.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/ACCUMULO/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/services/ACCUMULO/metainfo.xml deleted file mode 100644 index 5d7bfa0..000 --- a/ambari-server/src/main/resources/stacks/HDP/2.3/serv
ambari git commit: Fix intendation in pom file for metrics (mahadev)
Repository: ambari Updated Branches: refs/heads/trunk a7be81f59 -> ff8a0f04b Fix intendation in pom file for metrics (mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ff8a0f04 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ff8a0f04 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ff8a0f04 Branch: refs/heads/trunk Commit: ff8a0f04b09d868889b52e18f96c4140785f1da9 Parents: a7be81f Author: Mahadev Konar Authored: Thu Mar 12 22:44:09 2015 -0700 Committer: Mahadev Konar Committed: Thu Mar 12 22:44:09 2015 -0700 -- ambari-metrics/pom.xml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/ff8a0f04/ambari-metrics/pom.xml -- diff --git a/ambari-metrics/pom.xml b/ambari-metrics/pom.xml index 6fc0155..efd176c 100644 --- a/ambari-metrics/pom.xml +++ b/ambari-metrics/pom.xml @@ -36,9 +36,7 @@ python >= 2.6 python (>= 2.6) - - http://public-repo-1.hortonworks.com/HDP/centos6/2.x/GA/2.2.0.0/tars/hbase-0.98.4.2.2.0.0-2041-hadoop2.tar.gz - + http://public-repo-1.hortonworks.com/HDP/centos6/2.x/GA/2.2.0.0/tars/hbase-0.98.4.2.2.0.0-2041-hadoop2.tar.gz hbase-0.98.4.2.2.0.0-2041-hadoop2 http://public-repo-1.hortonworks.com/HDP/centos6/2.x/GA/2.2.0.0/tars/hadoop-2.6.0.2.2.0.0-2041.tar.gz
ambari git commit: Fix intendation in pom file for metrics (mahadev)
Repository: ambari Updated Branches: refs/heads/branch-2.0.0 8d130de75 -> 6b8b07f82 Fix intendation in pom file for metrics (mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6b8b07f8 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6b8b07f8 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6b8b07f8 Branch: refs/heads/branch-2.0.0 Commit: 6b8b07f828592b33a744652663571436e4fe95a8 Parents: 8d130de Author: Mahadev Konar Authored: Thu Mar 12 22:44:09 2015 -0700 Committer: Mahadev Konar Committed: Thu Mar 12 22:44:47 2015 -0700 -- ambari-metrics/pom.xml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/6b8b07f8/ambari-metrics/pom.xml -- diff --git a/ambari-metrics/pom.xml b/ambari-metrics/pom.xml index 6fc0155..efd176c 100644 --- a/ambari-metrics/pom.xml +++ b/ambari-metrics/pom.xml @@ -36,9 +36,7 @@ python >= 2.6 python (>= 2.6) - - http://public-repo-1.hortonworks.com/HDP/centos6/2.x/GA/2.2.0.0/tars/hbase-0.98.4.2.2.0.0-2041-hadoop2.tar.gz - + http://public-repo-1.hortonworks.com/HDP/centos6/2.x/GA/2.2.0.0/tars/hbase-0.98.4.2.2.0.0-2041-hadoop2.tar.gz hbase-0.98.4.2.2.0.0-2041-hadoop2 http://public-repo-1.hortonworks.com/HDP/centos6/2.x/GA/2.2.0.0/tars/hadoop-2.6.0.2.2.0.0-2041.tar.gz
ambari git commit: AMBARI-10248. Add support for templeton.hive.extra.files property in webhcat-site.xml. (mahadev)
Repository: ambari Updated Branches: refs/heads/trunk 36ac57824 -> aae47bd59 AMBARI-10248. Add support for templeton.hive.extra.files property in webhcat-site.xml. (mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/aae47bd5 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/aae47bd5 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/aae47bd5 Branch: refs/heads/trunk Commit: aae47bd59249a4d98b6ea6692e602ea29d66e916 Parents: 36ac578 Author: Mahadev Konar Authored: Fri Mar 27 10:41:10 2015 -0700 Committer: Mahadev Konar Committed: Fri Mar 27 10:41:10 2015 -0700 -- .../2.2/services/HIVE/configuration/webhcat-site.xml| 12 1 file changed, 12 insertions(+) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/aae47bd5/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/webhcat-site.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/webhcat-site.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/webhcat-site.xml index 0454c1c..d95be55 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/webhcat-site.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/webhcat-site.xml @@ -109,4 +109,16 @@ limitations under the License. The hdfs path to the Hadoop streaming jar file. + +templeton.hive.extra.files + /etc/tez/conf/tez-site.xml,/usr/hdp/current/tez-client,/usr/hdp/current/tez-client/lib +The resources in this list will be localized to the node running LaunchMapper and added to HADOOP_CLASSPTH + before launching 'hive' command. If the path /foo/bar is a directory, the contents of the the entire dir will be localized + and ./foo/* will be added to HADOOP_CLASSPATH. Note that since classpath path processing does not recurse into subdirectories, + the paths in this property may be overlapping. In the example above, "./tez-site.xml:./tez-client/*:./lib/*" will be added to + HADOOP_CLASSPATH. + This can be used to specify config files, Tez artifacts, etc. This will be sent -files option of hadoop jar command thus + each path is interpreted by Generic Option Parser. It can be local or hdfs path. + +
git commit: AMBARI-7291. Create different Maven profiles to build Bigtop, HDP and PHD stacks. (Alex Newton via mahadev)
Repository: ambari Updated Branches: refs/heads/trunk 62a50a695 -> dcedac206 AMBARI-7291. Create different Maven profiles to build Bigtop, HDP and PHD stacks. (Alex Newton via mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/dcedac20 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/dcedac20 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/dcedac20 Branch: refs/heads/trunk Commit: dcedac20674ba278b764cacd569e40c0c12d7278 Parents: 62a50a6 Author: Mahadev Konar Authored: Fri Sep 26 15:31:05 2014 -0700 Committer: Mahadev Konar Committed: Fri Sep 26 15:31:05 2014 -0700 -- ambari-agent/pom.xml | 3 ++- ambari-server/pom.xml| 8 ambari-server/src/main/assemblies/server.xml | 3 ++- pom.xml | 1 + 4 files changed, 9 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/dcedac20/ambari-agent/pom.xml -- diff --git a/ambari-agent/pom.xml b/ambari-agent/pom.xml index f226748..3761649 100644 --- a/ambari-agent/pom.xml +++ b/ambari-agent/pom.xml @@ -583,7 +583,8 @@ ${ambari.server.module}/src/main/resources -stacks/**/* +stacks/stack_advisor.py +stacks/${stack.distribution}/**/* custom_actions/**/* false http://git-wip-us.apache.org/repos/asf/ambari/blob/dcedac20/ambari-server/pom.xml -- diff --git a/ambari-server/pom.xml b/ambari-server/pom.xml index 6287cdb..0fc41aa 100644 --- a/ambari-server/pom.xml +++ b/ambari-server/pom.xml @@ -480,10 +480,10 @@ - /var/lib/ambari-server/resources/stacks/HDP + /var/lib/ambari-server/resources/stacks/${stack.distribution} - target/classes/stacks/HDP + target/classes/stacks/${stack.distribution} @@ -843,11 +843,11 @@ -target/classes/stacks/HDP +target/classes/stacks/${stack.distribution} directory perm - /var/lib/ambari-server/resources/stacks/HDP + /var/lib/ambari-server/resources/stacks/${stack.distribution} http://git-wip-us.apache.org/repos/asf/ambari/blob/dcedac20/ambari-server/src/main/assemblies/server.xml -- diff --git a/ambari-server/src/main/assemblies/server.xml b/ambari-server/src/main/assemblies/server.xml index 83800e4..a5a1f79 100644 --- a/ambari-server/src/main/assemblies/server.xml +++ b/ambari-server/src/main/assemblies/server.xml @@ -93,7 +93,8 @@ src/main/resources /ambari-server-${project.version}/var/lib/ambari-server/resources/ -stacks/** +stacks/stack_advisor.py +stacks/${stack.distribution}/** http://git-wip-us.apache.org/repos/asf/ambari/blob/dcedac20/pom.xml -- diff --git a/pom.xml b/pom.xml index cb47889..3db2d00 100644 --- a/pom.xml +++ b/pom.xml @@ -31,6 +31,7 @@ universe/admin i386 amd64 extra +BIGTOP
svn commit: r1614050 - in /ambari/site: index.html install-0.9.html install.html irc.html issue-tracking.html license.html mail-lists.html privacy-policy.html project-info.html team-list.html whats-ne
Author: mahadev Date: Mon Jul 28 15:17:20 2014 New Revision: 1614050 URL: http://svn.apache.org/r1614050 Log: Adding contributors Modified: ambari/site/index.html ambari/site/install-0.9.html ambari/site/install.html ambari/site/irc.html ambari/site/issue-tracking.html ambari/site/license.html ambari/site/mail-lists.html ambari/site/privacy-policy.html ambari/site/project-info.html ambari/site/team-list.html ambari/site/whats-new.html Modified: ambari/site/index.html URL: http://svn.apache.org/viewvc/ambari/site/index.html?rev=1614050&r1=1614049&r2=1614050&view=diff == --- ambari/site/index.html (original) +++ ambari/site/index.html Mon Jul 28 15:17:20 2014 @@ -1,13 +1,13 @@ http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en"> - + @@ -251,7 +251,7 @@ - Last Published: 2014-07-19 | + Last Published: 2014-07-28 | Version: 1.6.1 Modified: ambari/site/install-0.9.html URL: http://svn.apache.org/viewvc/ambari/site/install-0.9.html?rev=1614050&r1=1614049&r2=1614050&view=diff == --- ambari/site/install-0.9.html (original) +++ ambari/site/install-0.9.html Mon Jul 28 15:17:20 2014 @@ -1,13 +1,13 @@ http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en"> - + @@ -251,7 +251,7 @@ - Last Published: 2014-07-19 | + Last Published: 2014-07-28 | Version: 1.6.1 Modified: ambari/site/install.html URL: http://svn.apache.org/viewvc/ambari/site/install.html?rev=1614050&r1=1614049&r2=1614050&view=diff == --- ambari/site/install.html (original) +++ ambari/site/install.html Mon Jul 28 15:17:20 2014 @@ -1,13 +1,13 @@ http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en"> - + @@ -251,7 +251,7 @@ - Last Published: 2014-07-19 | + Last Published: 2014-07-28 | Version: 1.6.1 Modified: ambari/site/irc.html URL: http://svn.apache.org/viewvc/ambari/site/irc.html?rev=1614050&r1=1614049&r2=1614050&view=diff == --- ambari/site/irc.html (original) +++ ambari/site/irc.html Mon Jul 28 15:17:20 2014 @@ -1,13 +1,13 @@ http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en"> - + @@ -251,7 +251,7 @@ - Last Published: 2014-07-19 | + Last Published: 2014-07-28 | Version: 1.6.1 Modified: ambari/site/issue-tracking.html URL: http://svn.apache.org/viewvc/ambari/site/issue-tracking.html?rev=1614050&r1=1614049&r2=1614050&view=diff == --- ambari/site/issue-tracking.html (original) +++ ambari/site/issue-tracking.html Mon Jul 28 15:17:20 2014 @@ -1,13 +1,13 @@ http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en"> - + Issue Tracking @@ -251,7 +251,7 @@ - Last Published: 2014-07-19 | + Last Published: 2014-07-28 | Version: 1.6.1 Modified: ambari/site/license.html URL: http://svn.apache.org/viewvc/ambari/site/license.html?rev=1614050&r1=1614049&r2=1614050&view=diff == --- ambari/site/license.html (original) +++ ambari/site/license.html Mon Jul 28 15:17:20 2014 @@ -1,13 +1,13 @@ http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en"> - + Project License @@ -251,7 +251,7 @@ - Last Published: 2014-07-19 | + Last Published: 2014-07-28 | Version: 1.6.1 Modified: ambari/site/mail-lists.html URL: http://svn.apache.org/viewvc/ambari/site/mail-lists.html?rev=1614050&r1=1614049&r2=
git commit: Adding known contributors that are current
Repository: ambari Updated Branches: refs/heads/trunk a6873d64c -> 2f2eeeb36 Adding known contributors that are current Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2f2eeeb3 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2f2eeeb3 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2f2eeeb3 Branch: refs/heads/trunk Commit: 2f2eeeb3622479551617e557b87f060280b25265 Parents: a6873d6 Author: Mahadev Konar Authored: Mon Jul 28 08:28:02 2014 -0700 Committer: Mahadev Konar Committed: Mon Jul 28 08:28:07 2014 -0700 -- docs/pom.xml | 27 +++ 1 file changed, 27 insertions(+) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/2f2eeeb3/docs/pom.xml -- diff --git a/docs/pom.xml b/docs/pom.xml index 0a42577..9212c2c 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -575,6 +575,33 @@ + + + Scott Creeley + RedHat + + + Michael Harp + TeraData + + + Janos Matyas + SequenceIQ + + + Greg Hill + OpenStack + + + Steve Ratay + TeraData + + + + + + + Apache Software Foundation http://www.apache.org/
git commit: Fix: Adding known contributors that are current
Repository: ambari Updated Branches: refs/heads/trunk 2f2eeeb36 -> 79ff7cbdb Fix: Adding known contributors that are current Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/79ff7cbd Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/79ff7cbd Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/79ff7cbd Branch: refs/heads/trunk Commit: 79ff7cbdbfd0f3fcf95aeb808f5a873c593063be Parents: 2f2eeeb Author: Mahadev Konar Authored: Mon Jul 28 08:28:59 2014 -0700 Committer: Mahadev Konar Committed: Mon Jul 28 08:28:59 2014 -0700 -- docs/pom.xml | 2 -- 1 file changed, 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/79ff7cbd/docs/pom.xml -- diff --git a/docs/pom.xml b/docs/pom.xml index 9212c2c..5b3b27e 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -596,8 +596,6 @@ Steve Ratay TeraData - -
svn commit: r1614056 - /ambari/site/team-list.html
Author: mahadev Date: Mon Jul 28 15:29:36 2014 New Revision: 1614056 URL: http://svn.apache.org/r1614056 Log: Fix: Adding contributors Modified: ambari/site/team-list.html Modified: ambari/site/team-list.html URL: http://svn.apache.org/viewvc/ambari/site/team-list.html?rev=1614056&r1=1614055&r2=1614056&view=diff == --- ambari/site/team-list.html (original) +++ ambari/site/team-list.html Mon Jul 28 15:29:36 2014 @@ -565,7 +565,7 @@ -The TeamA successful project requires many people to play many roles. Some members write code or documentation, while others are valuable as testers, submitting patches and suggestions.The team is comprised of Members and Contributors. Members have direct access to the source of a project and actively evolve the code-base. Contributors improve the project through submission of patches and suggestions to the Members. The number of Contributors to the project is unbounded. Get involved today. All contributions to the project are greatly appreciated.MembersThe following is a list of developers with commit privileges that have directly contributed to the project in one way or another.IdNameEmailOrganizationRo lesTime ZoneActual Time (GMT)ababiichukAndrii Babiichukmailto:ababiic...@apache.org";>ababiic...@apache.orgHortonworksPMC+2+2abaranchukArtem Baranchukmailto:abaranc...@apache.org";>abaranc...@apache.orgHortonworksCommitter+2+2aonishukAndrew Onischukmailto:aonis...@apache.org";>aonis...@apache.orgHortonworksCommitter+2+2atkachAndrii Tkachmailto:atk...@apache.org";>atkach@ap ache.orgHortonworksPMC+2+2akovalenkoAleksandr Kovalenkomailto:akovale...@apache.org";>akovale...@apache.orgHortonworksPMC+2+2alexantonenkoAlex Antonenkomailto:alexantone...@apache.org";>alexantone...@apache.orgHortonworksPMC+2+2berndfBernd Fondermannmailto:ber...@apache.org";>ber...@apache.org-PMC+1+1billieBillie Rinaldimailto:bil...@apache.org";>bil...@apache.orgHortonworksPMC-8-8crobertsChad Robertsmailto:crobe...@apache.org";>crobe...@apache.orgRed HatPMC--ddasDevaraj Dasmailto:d...@hortonworks.com";>d...@hortonworks.comHortonworksPMC-8-8dmitriusanDmitry Lysnichenkomailto:dmitriu...@apache.org";>dmitriu...@apache.orgHortonworksPMC+2+2dsenDmitry Senmailto:d...@apache.org";>d...@apache.orgHortonworksPMC+2+2eyangEric Yangmailto:ey...@apache.org";>ey...@apache.orgIBMPMC-8-8eboydErin A. Boydmailto:eb...@apache.org";>eb...@apache.orgRedhatCommitter-8-8hiteshHitesh Shahmailto:hit...@apache.org";>hit...@apache.orgHortonworksPMC-8-8jaganeJagane Sundarmailto:jag...@apache.or g">jag...@apache.orgWANdiscoPMC-8-8jaiminJaimin Jetlymailto:jai...@apache.org";>jai...@apache.orgHortonworksPMC-8-8jitendraJitendra Pandeymailto:jiten...@apache.org";>jiten...@apache.orgHortonworksPMC-8-8jspeidelJohn Speidelmailto:jspei...@apache.org";>jspei...@apache.orgHortonworksPMC-8-8kzhangKan Zhangmailto:kanzhangmail @yahoo.com">kanzhangm...@yahoo.comIBMPMC-8-8mahadevMahadev Konarmailto:maha...@apache.org";>maha...@apache.orgHortonworksPMC-8-8mpapirkovskyyMyroslav Papyrkovskyymailto:mpapirkovs...@apache.org";>mpapirkovs...@apache.orgHortonworksPMC+2+2ncoleNate Colemailto:nc...@apache.org";>nc...@apache.orgHortonworksPMC-8-8odiachenkoOleksandr Diachenkomailto:odiache...@apache.org";>odiache...@apache.orgHortonworksPMC+2+2omalleyOwen O'Malleymailto:omal...@apache.org";>omal...@apache.orgHortonworksPMC-8-8onechiporenkoOleg Nechiporenkomailto:onechipore...@apache.org";>onechipore...@apache.orgHortonworksPMC+2+2ramyaRamya Sunilmailto:ra...@apache.org";>ra...@apache.orgHortonworksPMC-8-8reznorVarun Kapoorhref="mailto:rez...@apache.org";>rez...@apache.org-PMC-8 id="developer-27">-8name="smohanty">smohantySumit Mohantyclass="externalLink" >href="mailto:smoha...@apache.org";>smoha...@apache.orgHortonworksPMC-8 id="developer-28">-8name="sposetti">sposettiJeff Sposetticlass="externalLink" >href="mailto:spose...@apache.org";>spose...@apache.orgHortonworksCommitter-8 id="developer-29">-8name="swagle">swagleSiddharth Wagleclass="externalLink" >href="mailto:swa...@apache.org";>swa...@apache.orgHortonworksPMC-8 id="developer-30">-8name="srimanth"> srimanthSrimanth Gunturimailto:srima...@apache.org";>srima...@apache.orgHortonworksPMC-8-8subinSubin Modeelmailto:su...@apache.org";>su...@apache.orgRedhatPMC-8-8tbeerbowerThomas Beerbowermailto:tbeerbo...@apache.org";>tbeerbo...@apache.orgHortonworksPMC-8-8vbrodetsky
svn commit: r1614057 - /ambari/site/team-list.html
Author: mahadev Date: Mon Jul 28 15:32:37 2014 New Revision: 1614057 URL: http://svn.apache.org/r1614057 Log: Fix: Adding contributors Modified: ambari/site/team-list.html Modified: ambari/site/team-list.html URL: http://svn.apache.org/viewvc/ambari/site/team-list.html?rev=1614057&r1=1614056&r2=1614057&view=diff == --- ambari/site/team-list.html (original) +++ ambari/site/team-list.html Mon Jul 28 15:32:37 2014 @@ -565,7 +565,7 @@ -The TeamA successful project requires many people to play many roles. Some members write code or documentation, while others are valuable as testers, submitting patches and suggestions.The team is comprised of Members and Contributors. Members have direct access to the source of a project and actively evolve the code-base. Contributors improve the project through submission of patches and suggestions to the Members. The number of Contributors to the project is unbounded. Get involved today. All contributions to the project are greatly appreciated.MembersThe following is a list of developers with commit privileges that have directly contributed to the project in one way or another.IdNameEmailOrganizationRo lesTime ZoneActual Time (GMT)ababiichukAndrii Babiichukmailto:ababiic...@apache.org";>ababiic...@apache.orgHortonworksPMC+2+2abaranchukArtem Baranchukmailto:abaranc...@apache.org";>abaranc...@apache.orgHortonworksCommitter+2+2aonishukAndrew Onischukmailto:aonis...@apache.org";>aonis...@apache.orgHortonworksCommitter+2+2atkachAndrii Tkachmailto:atk...@apache.org";>atkach@ap ache.orgHortonworksPMC+2+2akovalenkoAleksandr Kovalenkomailto:akovale...@apache.org";>akovale...@apache.orgHortonworksPMC+2+2alexantonenkoAlex Antonenkomailto:alexantone...@apache.org";>alexantone...@apache.orgHortonworksPMC+2+2berndfBernd Fondermannmailto:ber...@apache.org";>ber...@apache.org-PMC+1+1billieBillie Rinaldimailto:bil...@apache.org";>bil...@apache.orgHortonworksPMC-8-8crobertsChad Robertsmailto:crobe...@apache.org";>crobe...@apache.orgRed HatPMC--ddasDevaraj Dasmailto:d...@hortonworks.com";>d...@hortonworks.comHortonworksPMC-8-8dmitriusanDmitry Lysnichenkomailto:dmitriu...@apache.org";>dmitriu...@apache.orgHortonworksPMC+2+2dsenDmitry Senmailto:d...@apache.org";>d...@apache.orgHortonworksPMC+2+2eyangEric Yangmailto:ey...@apache.org";>ey...@apache.orgIBMPMC-8-8eboydErin A. Boydmailto:eb...@apache.org";>eb...@apache.orgRedhatCommitter-8-8hiteshHitesh Shahmailto:hit...@apache.org";>hit...@apache.orgHortonworksPMC-8-8jaganeJagane Sundarmailto:jag...@apache.or g">jag...@apache.orgWANdiscoPMC-8-8jaiminJaimin Jetlymailto:jai...@apache.org";>jai...@apache.orgHortonworksPMC-8-8jitendraJitendra Pandeymailto:jiten...@apache.org";>jiten...@apache.orgHortonworksPMC-8-8jspeidelJohn Speidelmailto:jspei...@apache.org";>jspei...@apache.orgHortonworksPMC-8-8kzhangKan Zhangmailto:kanzhangmail @yahoo.com">kanzhangm...@yahoo.comIBMPMC-8-8mahadevMahadev Konarmailto:maha...@apache.org";>maha...@apache.orgHortonworksPMC-8-8mpapirkovskyyMyroslav Papyrkovskyymailto:mpapirkovs...@apache.org";>mpapirkovs...@apache.orgHortonworksPMC+2+2ncoleNate Colemailto:nc...@apache.org";>nc...@apache.orgHortonworksPMC-8-8odiachenkoOleksandr Diachenkomailto:odiache...@apache.org";>odiache...@apache.orgHortonworksPMC+2+2omalleyOwen O'Malleymailto:omal...@apache.org";>omal...@apache.orgHortonworksPMC-8-8onechiporenkoOleg Nechiporenkomailto:onechipore...@apache.org";>onechipore...@apache.orgHortonworksPMC+2+2ramyaRamya Sunilmailto:ra...@apache.org";>ra...@apache.orgHortonworksPMC-8-8reznorVarun Kapoorhref="mailto:rez...@apache.org";>rez...@apache.org-PMC-8 id="developer-27">-8name="smohanty">smohantySumit Mohantyclass="externalLink" >href="mailto:smoha...@apache.org";>smoha...@apache.orgHortonworksPMC-8 id="developer-28">-8name="sposetti">sposettiJeff Sposetticlass="externalLink" >href="mailto:spose...@apache.org";>spose...@apache.orgHortonworksCommitter-8 id="developer-29">-8name="swagle">swagleSiddharth Wagleclass="externalLink" >href="mailto:swa...@apache.org";>swa...@apache.orgHortonworksPMC-8 id="developer-30">-8name="srimanth"> srimanthSrimanth Gunturimailto:srima...@apache.org";>srima...@apache.orgHortonworksPMC-8-8subinSubin Modeelmailto:su...@apache.org";>su...@apache.orgRedhatPMC-8-8tbeerbowerThomas Beerbowermailto:tbeerbo...@apache.org";>tbeerbo...@apache.orgHortonworksPMC-8-8vbrodetsky
[1/2] git commit: Fix: Adding known contributors that are current
Repository: ambari Updated Branches: refs/heads/trunk a1e8f545c -> 0f79b23bc Fix: Adding known contributors that are current Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/488e4d3c Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/488e4d3c Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/488e4d3c Branch: refs/heads/trunk Commit: 488e4d3cc755df0f8f6c0c716f082431139aba7e Parents: a1e8f54 Author: Mahadev Konar Authored: Mon Jul 28 08:32:03 2014 -0700 Committer: Mahadev Konar Committed: Tue Jul 29 11:56:59 2014 -0700 -- docs/pom.xml | 8 1 file changed, 4 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/488e4d3c/docs/pom.xml -- diff --git a/docs/pom.xml b/docs/pom.xml index 5b3b27e..3ffc6da 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -578,11 +578,11 @@ Scott Creeley - RedHat + Redhat Michael Harp - TeraData + Teradata Janos Matyas @@ -590,11 +590,11 @@ Greg Hill - OpenStack + Rackspace Steve Ratay - TeraData + Teradata
[2/2] git commit: AMBARI-5941. Ambari should generate config files in sorted order.
AMBARI-5941. Ambari should generate config files in sorted order. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0f79b23b Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0f79b23b Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0f79b23b Branch: refs/heads/trunk Commit: 0f79b23bc64e5020f4c71c4fa6f6cdf8091e5831 Parents: 488e4d3 Author: Mahadev Konar Authored: Tue Jul 29 12:45:10 2014 -0700 Committer: Mahadev Konar Committed: Tue Jul 29 12:45:10 2014 -0700 -- .../libraries/providers/xml_config.py | 2 +- .../TestXmlConfigResource.py| 39 +++- 2 files changed, 39 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/0f79b23b/ambari-agent/src/main/python/resource_management/libraries/providers/xml_config.py -- diff --git a/ambari-agent/src/main/python/resource_management/libraries/providers/xml_config.py b/ambari-agent/src/main/python/resource_management/libraries/providers/xml_config.py index b2c6acb..c962847 100644 --- a/ambari-agent/src/main/python/resource_management/libraries/providers/xml_config.py +++ b/ambari-agent/src/main/python/resource_management/libraries/providers/xml_config.py @@ -31,7 +31,7 @@ class XmlConfigProvider(Provider): # |e - for html-like escaping of <,>,'," config_content = InlineTemplate(''' -{% for key, value in configurations_dict.items() %} +{% for key, value in configurations_dict|dictsort %} {{ key|e }} {{ value|e }} http://git-wip-us.apache.org/repos/asf/ambari/blob/0f79b23b/ambari-agent/src/test/python/resource_management/TestXmlConfigResource.py -- diff --git a/ambari-agent/src/test/python/resource_management/TestXmlConfigResource.py b/ambari-agent/src/test/python/resource_management/TestXmlConfigResource.py index a1ecbe5..2ecfc4d 100644 --- a/ambari-agent/src/test/python/resource_management/TestXmlConfigResource.py +++ b/ambari-agent/src/test/python/resource_management/TestXmlConfigResource.py @@ -156,4 +156,41 @@ class TestXmlConfigResource(TestCase): }) open_mock.assert_called_with('/dir/conf/file.xml', 'wb') -result_file.__enter__().write.assert_called_with(u'\n \n\n\n \n \n\n\n\n prop.empty\n \n \n\n\n\n prop.3\n %d{ISO8601} %5p %c{1}:%L - %m%n\n value3\n\n\n\n prop.2\n INFO, openjpa\n\n \n\n prop.1\n '.'-MM-dd-HH\n x\n \n\n\n prop.4\n ${oozie.log.dir}/oozie.log\n \n value4\n \n\n \n') +result_file.__enter__().write.assert_called_with(u'\n \n\n\n \n \n\n\n\n prop.1\n '.'-MM-dd-HH\n x\n\n\n\n prop.2\n INFO, openjpa\n\n \n\n prop.3\n %d{ISO8601} %5p %c{1}:%L - %m%n\n value3\n\n\n \n prop.4\n ${oozie.log.dir}/oozie.log\n \n value4\n \n\n\n prop.empty\n \n \n\n \n \n') + + @patch("resource_management.core.providers.system._ensure_metadata") + @patch("__builtin__.open") + @patch.object(os.path, "exists") + @patch.object(os.path, "isdir") + @patch.object(time, "asctime") + def test_action_create_xml_config_sorted_by_key(self, + time_asctime_mock, + os_path_isdir_mock, + os_path_exists_mock, + open_mock, + ensure_mock): +""" +Tests if 'create' action - creates new non existent xml file and writes proper data +where configurations={"Key":"Value"} are stored in sorted by key order +""" +os_path_isdir_mock.side_effect = [False, True] +os_path_exists_mock.return_value = False +time_asctime_mock.return_value = 'Wed 2014-02' + +result_file = MagicMock() +open_mock.return_value = result_file + +with Environment('/') as env: + XmlConfig('file.xml', +conf_dir='/dir/conf', +configurations={"": "", +"third": "should be third", +"first"
git commit: AMBARI-6644. Ambari Server start fails with Postgres Embedded DB. (Jayush via mahadev)
Repository: ambari Updated Branches: refs/heads/trunk 2885f1912 -> 5d264f886 AMBARI-6644. Ambari Server start fails with Postgres Embedded DB. (Jayush via mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5d264f88 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5d264f88 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5d264f88 Branch: refs/heads/trunk Commit: 5d264f886b385a3b9eda4fc8c7ee382d8e2abf8f Parents: 2885f19 Author: Mahadev Konar Authored: Wed Jul 30 13:19:52 2014 -0700 Committer: Mahadev Konar Committed: Wed Jul 30 13:19:52 2014 -0700 -- .../Ambari-DDL-Postgres-EMBEDDED-CREATE.sql | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/5d264f88/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql -- diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql index b5fcd94..45b83c5 100644 --- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql +++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql @@ -212,17 +212,17 @@ ALTER TABLE ambari.viewinstance ADD CONSTRAINT FK_viewinst_view_name FOREIGN KEY ALTER TABLE ambari.viewinstanceproperty ADD CONSTRAINT FK_viewinstprop_view_name FOREIGN KEY (view_name, view_instance_name) REFERENCES ambari.viewinstance(view_name, name); ALTER TABLE ambari.viewinstancedata ADD CONSTRAINT FK_viewinstdata_view_name FOREIGN KEY (view_instance_id, view_name, view_instance_name) REFERENCES ambari.viewinstance(view_instance_id, view_name, name); ALTER TABLE ambari.viewentity ADD CONSTRAINT FK_viewentity_view_name FOREIGN KEY (view_name, view_instance_name) REFERENCES ambari.viewinstance(view_name, name); -ALTER TABLE ambari.adminresource ADD CONSTRAINT FK_resource_resource_type_id FOREIGN KEY (resource_type_id) REFERENCES adminresourcetype(resource_type_id); -ALTER TABLE ambari.adminprincipal ADD CONSTRAINT FK_principal_principal_type_id FOREIGN KEY (principal_type_id) REFERENCES adminprincipaltype(principal_type_id); -ALTER TABLE ambari.adminpermission ADD CONSTRAINT FK_permission_resource_type_id FOREIGN KEY (resource_type_id) REFERENCES adminresourcetype(resource_type_id); +ALTER TABLE ambari.adminresource ADD CONSTRAINT FK_resource_resource_type_id FOREIGN KEY (resource_type_id) REFERENCES ambari.adminresourcetype(resource_type_id); +ALTER TABLE ambari.adminprincipal ADD CONSTRAINT FK_principal_principal_type_id FOREIGN KEY (principal_type_id) REFERENCES ambari.adminprincipaltype(principal_type_id); +ALTER TABLE ambari.adminpermission ADD CONSTRAINT FK_permission_resource_type_id FOREIGN KEY (resource_type_id) REFERENCES ambari.adminresourcetype(resource_type_id); ALTER TABLE ambari.adminpermission ADD CONSTRAINT UQ_permission_name_resource_type_id UNIQUE (permission_name, resource_type_id); -ALTER TABLE ambari.adminprivilege ADD CONSTRAINT FK_privilege_permission_id FOREIGN KEY (permission_id) REFERENCES adminpermission(permission_id); -ALTER TABLE ambari.adminprivilege ADD CONSTRAINT FK_privilege_resource_id FOREIGN KEY (resource_id) REFERENCES adminresource(resource_id); -ALTER TABLE viewmain ADD CONSTRAINT FK_view_resource_type_id FOREIGN KEY (resource_type_id) REFERENCES adminresourcetype(resource_type_id); -ALTER TABLE ambari.viewinstance ADD CONSTRAINT FK_viewinstance_resource_id FOREIGN KEY (resource_id) REFERENCES adminresource(resource_id); -ALTER TABLE ambari.adminprivilege ADD CONSTRAINT FK_privilege_principal_id FOREIGN KEY (principal_id) REFERENCES adminprincipal(principal_id); -ALTER TABLE ambari.users ADD CONSTRAINT FK_users_principal_id FOREIGN KEY (principal_id) REFERENCES adminprincipal(principal_id); -ALTER TABLE ambari.groups ADD CONSTRAINT FK_groups_principal_id FOREIGN KEY (principal_id) REFERENCES adminprincipal(principal_id); +ALTER TABLE ambari.adminprivilege ADD CONSTRAINT FK_privilege_permission_id FOREIGN KEY (permission_id) REFERENCES ambari.adminpermission(permission_id); +ALTER TABLE ambari.adminprivilege ADD CONSTRAINT FK_privilege_resource_id FOREIGN KEY (resource_id) REFERENCES ambari.adminresource(resource_id); +ALTER TABLE ambari.viewmain ADD CONSTRAINT FK_view_resource_type_id FOREIGN KEY (resource_type_id) REFERENCES ambari.adminresourcetype(resource_type_id); +ALTER TABLE ambari.viewinstance ADD CONSTRAINT FK_viewinstance_resource_id FOREIGN KEY (resource_id) REFERENCES ambari.adminresource(resource_id); +ALTER TABLE ambari.adminprivilege ADD CONSTRAINT FK_privilege_principal_id FOREIGN KEY (principal_id) REFERENCES ambari.adminprinci
git commit: AMBARI-6689. Views : Admin - LDAP Support. (swagle via mahadev)
Repository: ambari Updated Branches: refs/heads/trunk 191c2eab6 -> 2e5d0d1fb AMBARI-6689. Views : Admin - LDAP Support. (swagle via mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2e5d0d1f Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2e5d0d1f Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2e5d0d1f Branch: refs/heads/trunk Commit: 2e5d0d1fbe4d0366361836f8c01847a995cf71cf Parents: 191c2ea Author: Mahadev Konar Authored: Fri Aug 1 10:08:08 2014 -0700 Committer: Mahadev Konar Committed: Fri Aug 1 10:08:44 2014 -0700 -- .../resources/ControllerResourceDefinition.java | 60 +++ .../resources/ResourceInstanceFactoryImpl.java | 7 +- .../server/api/services/ControllerService.java | 98 + .../server/configuration/Configuration.java | 52 ++- .../controller/AmbariManagementController.java | 33 +- .../AmbariManagementControllerImpl.java | 107 +++-- .../ambari/server/controller/AmbariServer.java | 3 + .../server/controller/ControllerRequest.java| 41 ++ .../server/controller/ControllerResponse.java | 33 ++ .../AbstractControllerResourceProvider.java | 2 + .../internal/ControllerResourceProvider.java| 243 +++ .../controller/internal/ControllerType.java | 65 +++ .../ambari/server/controller/spi/Resource.java | 4 +- .../apache/ambari/server/orm/dao/GroupDAO.java | 1 - .../authorization/AmbariLdapDataPopulator.java | 419 +++ .../authorization/LdapServerProperties.java | 31 +- .../server/security/authorization/Member.java | 53 --- .../server/security/authorization/User.java | 15 +- .../server/security/authorization/Users.java| 32 ++ .../src/main/resources/key_properties.json | 3 + .../src/main/resources/properties.json | 9 + 21 files changed, 1188 insertions(+), 123 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/2e5d0d1f/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ControllerResourceDefinition.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ControllerResourceDefinition.java b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ControllerResourceDefinition.java new file mode 100644 index 000..55e6502 --- /dev/null +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ControllerResourceDefinition.java @@ -0,0 +1,60 @@ +/** + * 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.resources; + +import java.util.HashSet; +import java.util.Set; + +import org.apache.ambari.server.controller.internal.ControllerType; +import org.apache.ambari.server.controller.spi.Resource; + +/** + * Controller Resource Definition + */ +public class ControllerResourceDefinition extends BaseResourceDefinition { + + private final ControllerType type; + + public ControllerResourceDefinition(ControllerType type) { +super(Resource.Type.Controller); +this.type = type; + } + + @Override + public String getPluralName() { +return "controllers"; + } + + @Override + public String getSingularName() { +return "controller"; + } + + @Override + public Set getSubResourceDefinitions() { +final Set subResourceDefinitions = new HashSet(); +if (type != null) { + switch (type) { + case LDAP: +break; + } +} +return subResourceDefinitions; + } + +} http://git-wip-us.apache.org/repos/asf/ambari/blob/2e5d0d1f/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ResourceInstanceFactoryImpl.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ResourceInstanceFactoryImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ResourceInstanceFactoryImpl.java index c376bcde..8
git commit: Revert "AMBARI-6709 After Namenode is moved via Ambari the hive metastore namenode hostname is not updated with the new namenode hostname (Dmytro Shkvyra via dsen)"
Repository: ambari Updated Branches: refs/heads/trunk 5a0b5810f -> b240fa307 Revert "AMBARI-6709 After Namenode is moved via Ambari the hive metastore namenode hostname is not updated with the new namenode hostname (Dmytro Shkvyra via dsen)" This reverts commit 26d2c9f6e0bb0fdbb1138a3cf3bcdc73b27f1ef8. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b240fa30 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b240fa30 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b240fa30 Branch: refs/heads/trunk Commit: b240fa30767ce95638c3996c6826493d36229cd0 Parents: 5a0b581 Author: Mahadev Konar Authored: Tue Aug 5 16:31:31 2014 -0700 Committer: Mahadev Konar Committed: Tue Aug 5 16:31:40 2014 -0700 -- .../services/HIVE/package/scripts/hive_service.py | 13 - .../2.0.6/services/HIVE/package/scripts/params.py | 1 - .../python/stacks/2.0.6/HIVE/test_hive_server.py | 17 ++--- 3 files changed, 6 insertions(+), 25 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/b240fa30/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/hive_service.py -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/hive_service.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/hive_service.py index cd3149e..8a57b01 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/hive_service.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/hive_service.py @@ -22,7 +22,6 @@ from resource_management import * import socket import sys import time -from resource_management.core.shell import checked_call def hive_service( name, @@ -42,9 +41,6 @@ def hive_service( process_id_exists = format("ls {pid_file} >/dev/null 2>&1 && ps `cat {pid_file}` >/dev/null 2>&1") if action == 'start': -if name == 'hiveserver2': - check_fs_root() - demon_cmd = format("{cmd}") Execute(demon_cmd, @@ -99,12 +95,3 @@ def hive_service( Execute(demon_cmd, not_if = format("! ({process_id_exists})") ) - -def check_fs_root(): - import params - fs_root_url = format("{fs_root}{hive_apps_whs_dir}") - cmd = "/usr/lib/hive/bin/metatool -listFSRoot 2>/dev/null | grep hdfs://" - code, out = checked_call(cmd, user=params.hive_user) - if fs_root_url.strip() != out.strip(): -cmd = format("/usr/lib/hive/bin/metatool -updateLocation {fs_root}{hive_apps_whs_dir} {out}") -Execute(cmd, user=params.hive_user) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/b240fa30/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/params.py -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/params.py index c492f04..5b6ac59 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/params.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/params.py @@ -66,7 +66,6 @@ smoke_test_path = format("{tmp_dir}/hiveserver2Smoke.sh") smoke_user_keytab = config['configurations']['hadoop-env']['smokeuser_keytab'] _authentication = config['configurations']['core-site']['hadoop.security.authentication'] -fs_root = config['configurations']['core-site']['fs.defaultFS'] security_enabled = ( not is_empty(_authentication) and _authentication == 'kerberos') kinit_path_local = functions.get_kinit_path(["/usr/bin", "/usr/kerberos/bin", "/usr/sbin"]) http://git-wip-us.apache.org/repos/asf/ambari/blob/b240fa30/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_server.py -- diff --git a/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_server.py b/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_server.py index 8eb6bd2..4e7df9d 100644 --- a/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_server.py +++ b/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_server.py @@ -46,10 +46,9 @@ class TestHiveServer(RMFTestCase): content='log4jproperties\nline2' ) self.asser
[1/2] AMBARI-6739. Java side for BE work for download client configurations.
Repository: ambari Updated Branches: refs/heads/trunk 92a52d4da -> 989a4b979 http://git-wip-us.apache.org/repos/asf/ambari/blob/989a4b97/ambari-server/src/test/resources/stacks/HDP/2.0.7/services/HIVE/metainfo.xml -- diff --git a/ambari-server/src/test/resources/stacks/HDP/2.0.7/services/HIVE/metainfo.xml b/ambari-server/src/test/resources/stacks/HDP/2.0.7/services/HIVE/metainfo.xml index 685f46e..d6fe959 100644 --- a/ambari-server/src/test/resources/stacks/HDP/2.0.7/services/HIVE/metainfo.xml +++ b/ambari-server/src/test/resources/stacks/HDP/2.0.7/services/HIVE/metainfo.xml @@ -97,9 +97,21 @@ CLIENT 0+ -scripts/hive_client.py +scripts/hive_client222.py PYTHON + + + xml + hive-site.xml + hive-site + + + env + hive-env.sh + hive-env + +
[2/2] git commit: AMBARI-6739. Java side for BE work for download client configurations.
AMBARI-6739. Java side for BE work for download client configurations. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/989a4b97 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/989a4b97 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/989a4b97 Branch: refs/heads/trunk Commit: 989a4b97915e0b4564c7f4404815fa83e11151f0 Parents: 92a52d4 Author: Mahadev Konar Authored: Wed Aug 6 11:08:16 2014 -0700 Committer: Mahadev Konar Committed: Wed Aug 6 11:14:09 2014 -0700 -- .../libraries/script/script.py | 9 +- .../ClientConfigResourceDefinition.java | 68 +++ .../resources/ResourceInstanceFactoryImpl.java | 4 + .../server/api/services/ComponentService.java | 48 ++- .../api/services/HostComponentService.java | 52 ++- .../server/api/services/ServiceService.java | 4 + .../server/api/util/StackExtensionHelper.java | 14 + .../AbstractControllerResourceProvider.java | 2 + .../internal/ClientConfigResourceProvider.java | 423 +++ .../ambari/server/controller/spi/Resource.java | 4 +- .../state/ClientConfigFileDefinition.java | 86 .../ambari/server/state/ComponentInfo.java | 16 + .../src/main/resources/key_properties.json | 6 + .../src/main/resources/properties.json | 7 + .../HDP/1.3.2/services/HBASE/metainfo.xml | 12 + .../stacks/HDP/1.3.2/services/HDFS/metainfo.xml | 12 + .../stacks/HDP/1.3.2/services/HIVE/metainfo.xml | 12 + .../HDP/1.3.2/services/MAPREDUCE/metainfo.xml | 17 + .../HDP/1.3.2/services/OOZIE/metainfo.xml | 12 + .../stacks/HDP/1.3.2/services/PIG/metainfo.xml | 7 + .../HDP/1.3.2/services/SQOOP/metainfo.xml | 7 + .../HDP/1.3.2/services/ZOOKEEPER/metainfo.xml | 7 + .../HDP/2.0.6/services/HBASE/metainfo.xml | 12 + .../stacks/HDP/2.0.6/services/HDFS/metainfo.xml | 12 + .../stacks/HDP/2.0.6/services/HIVE/metainfo.xml | 15 + .../HDP/2.0.6/services/OOZIE/metainfo.xml | 12 + .../stacks/HDP/2.0.6/services/PIG/metainfo.xml | 8 + .../HDP/2.0.6/services/SQOOP/metainfo.xml | 7 + .../stacks/HDP/2.0.6/services/YARN/metainfo.xml | 34 ++ .../HDP/2.0.6/services/ZOOKEEPER/metainfo.xml | 7 + .../2.1.GlusterFS/services/HIVE/metainfo.xml| 13 + .../stacks/HDP/2.1/services/FALCON/metainfo.xml | 7 + .../stacks/HDP/2.1/services/TEZ/metainfo.xml| 12 + .../api/services/ComponentServiceTest.java | 4 +- .../api/services/HostComponentServiceTest.java | 4 +- .../ClientConfigResourceProviderTest.java | 146 +++ .../python/stacks/1.3.2/HDFS/test_datanode.py | 3 +- .../python/stacks/1.3.2/HDFS/test_namenode.py | 3 +- .../python/stacks/1.3.2/HDFS/test_snamenode.py | 3 +- .../python/stacks/2.0.6/HDFS/test_datanode.py | 3 +- .../stacks/2.0.6/HDFS/test_journalnode.py | 3 +- .../python/stacks/2.0.6/HDFS/test_namenode.py | 3 + .../python/stacks/2.0.6/HDFS/test_snamenode.py | 3 +- .../test/python/stacks/2.0.6/HDFS/test_zkfc.py | 3 +- .../python/stacks/2.0.6/configs/default.json| 5 +- .../stacks/HDP/2.0.5/services/HIVE/metainfo.xml | 12 + .../stacks/HDP/2.0.5/services/YARN/metainfo.xml | 3 + .../stacks/HDP/2.0.7/services/HIVE/metainfo.xml | 14 +- 48 files changed, 1152 insertions(+), 28 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/989a4b97/ambari-common/src/main/python/resource_management/libraries/script/script.py -- diff --git a/ambari-common/src/main/python/resource_management/libraries/script/script.py b/ambari-common/src/main/python/resource_management/libraries/script/script.py index bee2f36..7b7d931 100644 --- a/ambari-common/src/main/python/resource_management/libraries/script/script.py +++ b/ambari-common/src/main/python/resource_management/libraries/script/script.py @@ -243,11 +243,11 @@ class Script(object): based on xml_configs_list and env_configs_list from commandParams """ import params -config = self.get_config() -xml_configs_list = json.loads(config['commandParams']['xml_configs_list']) -env_configs_list = json.loads(config['commandParams']['env_configs_list']) +env.set_params(params) +xml_configs_list = params.config['commandParams']['xml_configs_list'] +env_configs_list = params.config['commandParams']['env_configs_list'] conf_tmp_dir = tempfile.mkdtemp() -output_filename = os.path.join(self.get_tmp_dir(),"client-configs.tar.gz") +output_filename = os.path.join(self.get_tmp_dir(),params.config['commandParams']['output_file'])
[4/4] git commit: AMBARI-5934. Provide ability to rebalance HDFS.
AMBARI-5934. Provide ability to rebalance HDFS. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/cb662f49 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/cb662f49 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/cb662f49 Branch: refs/heads/trunk Commit: cb662f494f27b0ffc2058151f550b0cb08572db1 Parents: 70588f5 Author: Mahadev Konar Authored: Fri Aug 8 10:10:17 2014 -0700 Committer: Mahadev Konar Committed: Fri Aug 8 10:10:21 2014 -0700 -- .gitignore |1 + .../src/main/python/ambari_agent/ActionQueue.py | 84 +- .../BackgroundCommandExecutionHandle.py | 44 + .../python/ambari_agent/CommandStatusDict.py| 23 +- .../ambari_agent/CustomServiceOrchestrator.py | 59 +- .../main/python/ambari_agent/PythonExecutor.py | 128 ++- .../test/python/ambari_agent/TestActionQueue.py | 215 +++- .../TestCustomServiceOrchestrator.py| 34 + ambari-server/pom.xml |2 + .../server/actionmanager/ActionScheduler.java | 66 +- .../ambari/server/agent/AgentCommand.java |1 + .../ambari/server/agent/HeartBeatHandler.java |1 + .../server/api/services/AmbariMetaInfo.java | 23 +- .../server/api/util/StackExtensionHelper.java | 14 +- .../AmbariCustomCommandExecutionHelper.java | 14 +- .../ambari/server/state/ComponentInfo.java |8 + .../ambari/server/state/ConfigHelper.java | 11 +- .../server/state/CustomCommandDefinition.java |7 +- .../apache/ambari/server/state/ServiceInfo.java | 14 +- .../system_action_definitions.xml | 20 +- .../custom_actions/ambari_hdfs_rebalancer.py| 59 - .../custom_actions/cancel_background_task.py| 41 + .../stacks/HDP/2.0.6/services/HDFS/metainfo.xml |8 + .../scripts/balancer-emulator/balancer-err.log | 1032 ++ .../scripts/balancer-emulator/balancer.log | 29 + .../scripts/balancer-emulator/hdfs-command.py | 45 + .../HDFS/package/scripts/hdfs_rebalance.py | 130 +++ .../services/HDFS/package/scripts/namenode.py | 52 + .../services/HDFS/package/scripts/params.py |1 + .../actionmanager/TestActionScheduler.java | 83 ++ .../server/api/services/AmbariMetaInfoTest.java | 11 +- .../AmbariManagementControllerTest.java |3 +- .../BackgroundCustomCommandExecutionTest.java | 275 + .../ActionDefinitionManagerTest.java| 18 +- .../python/stacks/2.0.6/HDFS/test_namenode.py |7 + .../2.0.6/configs/rebalancehdfs_default.json| 388 +++ .../cust_action_definitions1.xml| 10 - .../system_action_definitions.xml | 32 - .../stacks/HDP/2.0.5/services/HDFS/metainfo.xml |9 + .../global/background_operations_controller.js |6 + ambari-web/app/controllers/main/service/item.js | 75 +- ambari-web/app/messages.js |8 + .../templates/common/host_progress_popup.hbs| 19 +- .../app/templates/common/prompt_popup.hbs |5 +- ambari-web/app/utils/ajax/ajax.js | 50 + ambari-web/app/utils/helper.js |3 + ambari-web/app/utils/host_progress_popup.js | 37 +- ambari-web/app/views/common/modal_popup.js |2 + ambari-web/app/views/main/service/item.js | 11 +- 49 files changed, 2942 insertions(+), 276 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/cb662f49/.gitignore -- diff --git a/.gitignore b/.gitignore index 0430303..cff27da 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ derby.log pass.txt ambari-agent/src/test/python/ambari_agent/dummy_files/current-stack velocity.log* +*.pydevproject http://git-wip-us.apache.org/repos/asf/ambari/blob/cb662f49/ambari-agent/src/main/python/ambari_agent/ActionQueue.py -- diff --git a/ambari-agent/src/main/python/ambari_agent/ActionQueue.py b/ambari-agent/src/main/python/ambari_agent/ActionQueue.py index d3aad6e..6437036 100644 --- a/ambari-agent/src/main/python/ambari_agent/ActionQueue.py +++ b/ambari-agent/src/main/python/ambari_agent/ActionQueue.py @@ -26,11 +26,13 @@ import pprint import os import json +from AgentException import AgentException from LiveStatus import LiveStatus from shell import shellRunner from ActualConfigHandler import ActualConfigHandler from CommandStatusDict import CommandStatusDict from CustomServiceOrchestrator import CustomServiceOrchestrator +from ambari_agent.BackgroundCommandExecutionHandle import BackgroundCommandExecutionHandle logger = logging.getLogger() @@ -52,9 +54,12 @@ class ActionQueue
[2/4] AMBARI-5934. Provide ability to rebalance HDFS.
http://git-wip-us.apache.org/repos/asf/ambari/blob/cb662f49/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HDFS/package/scripts/balancer-emulator/balancer.log -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HDFS/package/scripts/balancer-emulator/balancer.log b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HDFS/package/scripts/balancer-emulator/balancer.log new file mode 100644 index 000..2010c02 --- /dev/null +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HDFS/package/scripts/balancer-emulator/balancer.log @@ -0,0 +1,29 @@ +Time Stamp Iteration# Bytes Already Moved Bytes Left To Move Bytes Being Moved +Jul 28, 2014 5:01:49 PM 0 0 B 5.74 GB 9.79 GB +Jul 28, 2014 5:03:00 PM 1 0 B 5.58 GB 9.79 GB +Jul 28, 2014 5:04:07 PM 2 0 B 5.40 GB 9.79 GB +Jul 28, 2014 5:05:14 PM 3 0 B 5.06 GB 9.79 GB +Jul 28, 2014 5:05:50 PM 4 0 B 5.06 GB 9.79 GB +Jul 28, 2014 5:06:56 PM 5 0 B 4.81 GB 9.79 GB +Jul 28, 2014 5:07:33 PM 6 0 B 4.80 GB 9.79 GB +Jul 28, 2014 5:09:11 PM 7 0 B 4.29 GB 9.79 GB +Jul 28, 2014 5:09:47 PM 8 0 B 4.29 GB 9.79 GB +Jul 28, 2014 5:11:24 PM 9 0 B 3.89 GB 9.79 GB +Jul 28, 2014 5:12:00 PM 10 0 B 3.86 GB 9.79 GB +Jul 28, 2014 5:13:37 PM 11 0 B 3.23 GB 9.79 GB +Jul 28, 2014 5:15:13 PM 12 0 B 2.53 GB 9.79 GB +Jul 28, 2014 5:15:49 PM 13 0 B 2.52 GB 9.79 GB +Jul 28, 2014 5:16:25 PM 14 0 B 2.51 GB 9.79 GB +Jul 28, 2014 5:17:01 PM 15 0 B 2.39 GB 9.79 GB +Jul 28, 2014 5:17:37 PM 16 0 B 2.38 GB 9.79 GB +Jul 28, 2014 5:18:14 PM 17 0 B 2.31 GB 9.79 GB +Jul 28, 2014 5:18:50 PM 18 0 B 2.30 GB 9.79 GB +Jul 28, 2014 5:19:26 PM 19 0 B 2.21 GB 9.79 GB +Jul 28, 2014 5:20:02 PM 20 0 B 2.10 GB 9.79 GB +Jul 28, 2014 5:20:38 PM 21 0 B 2.06 GB 9.79 GB +Jul 28, 2014 5:22:14 PM 22 0 B 1.68 GB 9.79 GB +Jul 28, 2014 5:23:20 PM 23 0 B 1.00 GB 9.79 GB +Jul 28, 2014 5:23:56 PM 24 0 B 1016.16 MB 9.79 GB +Jul 28, 2014 5:25:33 PM 25 0 B30.55 MB 9.79 GB +The cluster is balanced. Exiting... +Balancing took 24.8580335 minutes http://git-wip-us.apache.org/repos/asf/ambari/blob/cb662f49/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HDFS/package/scripts/balancer-emulator/hdfs-command.py -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HDFS/package/scripts/balancer-emulator/hdfs-command.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HDFS/package/scripts/balancer-emulator/hdfs-command.py new file mode 100644 index 000..df173fe --- /dev/null +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HDFS/package/scripts/balancer-emulator/hdfs-command.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python + +''' +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +''' +import time +import sys +from threading import Thread + + +def write_function(path, handle, interval):
[1/4] AMBARI-5934. Provide ability to rebalance HDFS.
Repository: ambari Updated Branches: refs/heads/trunk 70588f5e0 -> cb662f494 http://git-wip-us.apache.org/repos/asf/ambari/blob/cb662f49/ambari-web/app/messages.js -- diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js index 1d5395e..da90e6e 100644 --- a/ambari-web/app/messages.js +++ b/ambari-web/app/messages.js @@ -294,6 +294,7 @@ Em.I18n.translations = { 'host.spacesValidation': 'Can\'t contain whitespaces', 'host.trimspacesValidation': 'Can\'t contain leading or trailing whitespaces', + 'services.hdfs.rebalance.title' : 'HDFS Rebalance', 'services.nagios.description':'Nagios Monitoring and Alerting system', 'services.ganglia.description':'Ganglia Metrics Collection system', 'services.hdfs.description':'Apache Hadoop Distributed File System', @@ -1173,6 +1174,13 @@ Em.I18n.translations = { 'services.service.summary.clientCount': '{0} Client Hosts', 'services.service.summary.historyServer': 'History Server Web UI', 'services.service.actions.run.rebalancer':'Run Rebalancer', + 'services.service.actions.run.rebalanceHdfsNodes':'Run Rebalance HDFS nodes', + 'services.service.actions.run.rebalanceHdfsNodes.title':'HDFS Rebalance NameNode', + 'services.service.actions.run.rebalanceHdfsNodes.prompt':'Please enter Balancer treshold:', + 'services.service.actions.run.rebalanceHdfsNodes.promptTooltip':'Percentage of disk capacity. This overwrites the default threshold', + 'services.service.actions.run.rebalanceHdfsNodes.promptError':'Value should be integer between 0 and 100', + 'services.service.actions.run.rebalanceHdfsNodes.context':'Rebalance HDFS nodes', + 'services.service.actions.run.rebalanceHdfsNodes.error':'Error during remote command: ', 'services.service.actions.run.yarnRefreshQueues.menu':'Refresh YARN Capacity Scheduler', 'services.service.actions.run.yarnRefreshQueues.context':'Refresh YARN Capacity Scheduler', 'services.service.actions.run.yarnRefreshQueues.error':'Error during remote command: ', http://git-wip-us.apache.org/repos/asf/ambari/blob/cb662f49/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 26dcc6f..6b36344 100644 --- a/ambari-web/app/templates/common/host_progress_popup.hbs +++ b/ambari-web/app/templates/common/host_progress_popup.hbs @@ -193,7 +193,24 @@ - + +{{#if view.openedTask.isRebalanceHDFSTask }} + {{t services.hdfs.rebalance.title}} + + + + + + + + {{view.openedTask.dataMoved}} moved / + {{view.openedTask.dataLeft}} left / + {{view.openedTask.dataBeingMoved}} being processed + +{{t common.cancel}} + + +{{/if}} stderr: {{view.openedTask.errorLog}} {{view.openedTask.stderr}} stdout: {{view.openedTask.outputLog}} http://git-wip-us.apache.org/repos/asf/ambari/blob/cb662f49/ambari-web/app/templates/common/prompt_popup.hbs -- diff --git a/ambari-web/app/templates/common/prompt_popup.hbs b/ambari-web/app/templates/common/prompt_popup.hbs index 6ca40a9..078cc65 100644 --- a/ambari-web/app/templates/common/prompt_popup.hbs +++ b/ambari-web/app/templates/common/prompt_popup.hbs @@ -17,11 +17,14 @@ }} - + {{view.text}} {{view Em.TextField class="prompt-input" valueBinding="view.parentView.inputValue"}} + {{#if view.parentView.isInvalid}} +{{view.parentView.errorMessage}} + {{/if}} http://git-wip-us.apache.org/repos/asf/ambari/blob/cb662f49/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 17c74b0..c5f2252 100644 --- a/ambari-web/app/utils/ajax/ajax.js +++ b/ambari-web/app/utils/ajax/ajax.js @@ -302,6 +302,55 @@ var urls = { }; } }, + 'service.item.rebalanceHdfsNodes' : { +'real' : '/clusters/{clusterName}/requests', +'mock' : '', +'format' : function(data) { + return { +type : 'POST', +data : JSON.stringify({ + RequestInfo : { +'context' : Em.I18n.t('services.service.actions.run.rebalanceHdfsNodes.context'), +'command' : 'REBALANCEHDFS', +
[3/4] AMBARI-5934. Provide ability to rebalance HDFS.
http://git-wip-us.apache.org/repos/asf/ambari/blob/cb662f49/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HDFS/package/scripts/balancer-emulator/balancer-err.log -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HDFS/package/scripts/balancer-emulator/balancer-err.log b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HDFS/package/scripts/balancer-emulator/balancer-err.log new file mode 100644 index 000..d7c6704 --- /dev/null +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HDFS/package/scripts/balancer-emulator/balancer-err.log @@ -0,0 +1,1032 @@ +14/07/28 17:01:48 INFO balancer.Balancer: Using a threshold of 5.0 +14/07/28 17:01:48 INFO balancer.Balancer: namenodes = [hdfs://evhubudsd1aae.budapest.epam.com:8020] +14/07/28 17:01:48 INFO balancer.Balancer: p = Balancer.Parameters[BalancingPolicy.Node, threshold=5.0] +14/07/28 17:01:49 INFO balancer.Balancer: Block token params received from NN: keyUpdateInterval=600 min(s), tokenLifetime=600 min(s) +14/07/28 17:01:49 INFO block.BlockTokenSecretManager: Setting block keys +14/07/28 17:01:49 INFO balancer.Balancer: Balancer will update its block keys every 150 minute(s) +14/07/28 17:01:49 INFO block.BlockTokenSecretManager: Setting block keys +14/07/28 17:01:49 INFO net.NetworkTopology: Adding a new node: /default-rack/10.253.130.9:50010 +14/07/28 17:01:49 INFO net.NetworkTopology: Adding a new node: /default-rack/10.253.129.224:50010 +14/07/28 17:01:49 INFO net.NetworkTopology: Adding a new node: /default-rack/10.253.130.8:50010 +14/07/28 17:01:49 INFO net.NetworkTopology: Adding a new node: /default-rack/10.253.130.4:50010 +14/07/28 17:01:49 INFO net.NetworkTopology: Adding a new node: /default-rack/10.253.129.225:50010 +14/07/28 17:01:49 INFO net.NetworkTopology: Adding a new node: /default-rack/10.253.129.223:50010 +14/07/28 17:01:49 INFO net.NetworkTopology: Adding a new node: /default-rack/10.253.130.3:50010 +14/07/28 17:01:49 INFO net.NetworkTopology: Adding a new node: /default-rack/10.253.130.1:50010 +14/07/28 17:01:49 INFO net.NetworkTopology: Adding a new node: /default-rack/10.253.130.2:50010 +14/07/28 17:01:49 INFO net.NetworkTopology: Adding a new node: /default-rack/10.253.130.0:50010 +14/07/28 17:01:49 INFO net.NetworkTopology: Adding a new node: /default-rack/10.253.130.11:50010 +14/07/28 17:01:49 INFO net.NetworkTopology: Adding a new node: /default-rack/10.253.130.6:50010 +14/07/28 17:01:49 INFO net.NetworkTopology: Adding a new node: /default-rack/10.253.130.10:50010 +14/07/28 17:01:49 INFO net.NetworkTopology: Adding a new node: /default-rack/10.253.130.7:50010 +14/07/28 17:01:49 INFO net.NetworkTopology: Adding a new node: /default-rack/10.253.130.5:50010 +14/07/28 17:01:49 INFO balancer.Balancer: 1 over-utilized: [Source[10.253.130.9:50010, utilization=34.887235026238486]] +14/07/28 17:01:49 INFO balancer.Balancer: 1 underutilized: [BalancerDatanode[10.253.130.5:50010, utilization=21.178140109955496]] +14/07/28 17:01:49 INFO balancer.Balancer: Need to move 5.74 GB to make the cluster balanced. +14/07/28 17:01:49 INFO balancer.Balancer: Decided to move 9.79 GB bytes from 10.253.130.9:50010 to 10.253.130.5:50010 +14/07/28 17:01:49 INFO balancer.Balancer: Will move 9.79 GB in this iteration +14/07/28 17:01:57 INFO balancer.Balancer: Moving block 1073950748 from 10.253.130.9:50010 to 10.253.130.5:50010 through 10.253.130.9:50010 is succeeded. +14/07/28 17:01:58 INFO balancer.Balancer: Moving block 1073939272 from 10.253.130.9:50010 to 10.253.130.5:50010 through 10.253.130.9:50010 is succeeded. +14/07/28 17:02:06 INFO balancer.Balancer: Moving block 1073863504 from 10.253.130.9:50010 to 10.253.130.5:50010 through 10.253.130.9:50010 is succeeded. +14/07/28 17:02:13 INFO balancer.Balancer: Moving block 1073863516 from 10.253.130.9:50010 to 10.253.130.5:50010 through 10.253.130.9:50010 is succeeded. +14/07/28 17:02:31 INFO balancer.Balancer: Moving block 1073743089 from 10.253.130.9:50010 to 10.253.130.5:50010 through 10.253.130.2:50010 is succeeded. +14/07/28 17:03:00 INFO net.NetworkTopology: Adding a new node: /default-rack/10.253.130.3:50010 +14/07/28 17:03:00 INFO net.NetworkTopology: Adding a new node: /default-rack/10.253.130.5:50010 +14/07/28 17:03:00 INFO net.NetworkTopology: Adding a new node: /default-rack/10.253.129.225:50010 +14/07/28 17:03:00 INFO net.NetworkTopology: Adding a new node: /default-rack/10.253.129.223:50010 +14/07/28 17:03:00 INFO net.NetworkTopology: Adding a new node: /default-rack/10.253.130.1:50010 +14/07/28 17:03:00 INFO net.NetworkTopology: Adding a new node: /default-rack/10.253.130.4:50010 +14/07/28 17:03:00 INFO net.NetworkTopology: Adding a new node: /default-rack/10.253.130.7:50010 +14/07/28 17:03:00 INFO net.NetworkTopology: Adding a new node: /default-rack/10.253.130.8:50010 +14/07/28 17:03:00 INFO net.NetworkTopology:
git commit: AMBARI-6834. Provide undefined prarameters for view instance.
Repository: ambari Updated Branches: refs/heads/trunk 389b2505d -> 62e2f9f8e AMBARI-6834. Provide undefined prarameters for view instance. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/62e2f9f8 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/62e2f9f8 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/62e2f9f8 Branch: refs/heads/trunk Commit: 62e2f9f8efd2d5d934e9c87f0d36568124660248 Parents: 389b250 Author: Mahadev Konar Authored: Tue Aug 12 12:09:09 2014 -0700 Committer: Mahadev Konar Committed: Tue Aug 12 12:09:13 2014 -0700 -- .../internal/ViewInstanceResourceProvider.java | 8 +- .../ViewInstanceResourceProviderTest.java | 82 2 files changed, 89 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/62e2f9f8/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProvider.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProvider.java index 2ebd9f4..c1a3d79 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProvider.java @@ -33,6 +33,7 @@ import org.apache.ambari.server.orm.entities.ViewEntity; import org.apache.ambari.server.orm.entities.ViewInstanceDataEntity; import org.apache.ambari.server.orm.entities.ViewInstanceEntity; import org.apache.ambari.server.orm.entities.ViewInstancePropertyEntity; +import org.apache.ambari.server.orm.entities.ViewParameterEntity; import org.apache.ambari.server.view.ViewRegistry; import java.util.Collection; @@ -199,7 +200,7 @@ public class ViewInstanceResourceProvider extends AbstractResourceProvider { // - helper methods // Convert an instance entity to a resource - private Resource toResource(ViewInstanceEntity viewInstanceEntity, Set requestedIds) { + protected Resource toResource(ViewInstanceEntity viewInstanceEntity, Set requestedIds) { Resource resource = new ResourceImpl(Resource.Type.ViewInstance); ViewEntity viewEntity = viewInstanceEntity.getViewEntity(); @@ -218,6 +219,11 @@ public class ViewInstanceResourceProvider extends AbstractResourceProvider { for (ViewInstancePropertyEntity viewInstancePropertyEntity : viewInstanceEntity.getProperties()) { properties.put(viewInstancePropertyEntity.getName(), viewInstancePropertyEntity.getValue()); } +for (ViewParameterEntity viewParameterEntity : viewEntity.getParameters()) { + if (!properties.containsKey(viewParameterEntity.getName())) { +properties.put(viewParameterEntity.getName(), null); + } +} setResourceProperty(resource, PROPERTIES_PROPERTY_ID, properties, requestedIds); Map applicationData = new HashMap(); http://git-wip-us.apache.org/repos/asf/ambari/blob/62e2f9f8/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProviderTest.java -- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProviderTest.java new file mode 100644 index 000..52f0231 --- /dev/null +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProviderTest.java @@ -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. + */ + +package org.apache.ambari.server.controller.internal; + +import org.apache.ambari.server.controller
git commit: AMBARI-6836. View: Files property checking should log more explicit failure.
Repository: ambari Updated Branches: refs/heads/trunk 62e2f9f8e -> 221f0e511 AMBARI-6836. View: Files property checking should log more explicit failure. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/221f0e51 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/221f0e51 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/221f0e51 Branch: refs/heads/trunk Commit: 221f0e511c4232af2b4ad49b99965a34e4f59df6 Parents: 62e2f9f Author: Mahadev Konar Authored: Tue Aug 12 13:44:41 2014 -0700 Committer: Mahadev Konar Committed: Tue Aug 12 13:44:41 2014 -0700 -- .../view/filebrowser/DownloadService.java | 201 +++ .../view/filebrowser/FileOperationService.java | 169 +--- .../ambari/view/filebrowser/HdfsService.java| 18 +- .../ambari/view/filebrowser/HelpService.java| 54 ++--- .../ambari/view/filebrowser/UploadService.java | 65 +++--- .../MisconfigurationFormattedException.java | 43 .../utils/NotFoundFormattedException.java | 27 +++ .../utils/ServiceFormattedException.java| 57 ++ .../main/resources/ui/app/controllers/error.js | 50 + .../resources/ui/app/controllers/filesAlert.js | 20 ++ .../src/main/resources/ui/app/initialize.js | 2 + .../main/resources/ui/app/templates/error.hbs | 25 ++- .../ui/app/templates/util/errorRow.hbs | 19 +- .../files/src/main/resources/ui/config.coffee | 2 +- 14 files changed, 527 insertions(+), 225 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/221f0e51/contrib/views/files/src/main/java/org/apache/ambari/view/filebrowser/DownloadService.java -- diff --git a/contrib/views/files/src/main/java/org/apache/ambari/view/filebrowser/DownloadService.java b/contrib/views/files/src/main/java/org/apache/ambari/view/filebrowser/DownloadService.java index 2f4d1b9..72ba726 100644 --- a/contrib/views/files/src/main/java/org/apache/ambari/view/filebrowser/DownloadService.java +++ b/contrib/views/files/src/main/java/org/apache/ambari/view/filebrowser/DownloadService.java @@ -46,6 +46,8 @@ import javax.ws.rs.core.UriInfo; import javax.xml.bind.annotation.XmlElement; import com.google.gson.Gson; +import org.apache.ambari.view.filebrowser.utils.NotFoundFormattedException; +import org.apache.ambari.view.filebrowser.utils.ServiceFormattedException; import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.FileStatus; import org.apache.ambari.view.ViewContext; @@ -89,17 +91,16 @@ public class DownloadService extends HdfsService { "filename=\"" + status.getPath().getName() + "\"").type(mimeType); } return result.build(); +} catch (WebApplicationException ex) { + throw ex; } catch (FileNotFoundException ex) { - return Response.ok(Response.Status.NOT_FOUND.getStatusCode()) - .entity(ex.getMessage()).build(); + throw new NotFoundFormattedException(ex.getMessage(), ex); } catch (Exception ex) { - return Response.ok(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()) - .entity(ex.getMessage()).build(); + throw new ServiceFormattedException(ex.getMessage(), ex); } } - private void zipFile(ZipOutputStream zip, String path) - throws InterruptedException, Exception { + private void zipFile(ZipOutputStream zip, String path) throws InterruptedException, IOException { try { zip.putNextEntry(new ZipEntry(path.substring(1))); FSDataInputStream in = getApi(context).open(path); @@ -108,22 +109,25 @@ public class DownloadService extends HdfsService { zip.write(chunk); } } catch (IOException ex) { - logger.error("Error zipping file " + path.substring(1) + ": " - + ex.getMessage()); + String msg = "Error zipping file " + path.substring(1) + ": " + + ex.getMessage(); + logger.error(msg); zip.write(ex.getMessage().getBytes()); + throw new ServiceFormattedException(ex.getMessage(), ex); } finally { zip.closeEntry(); } - } private void zipDirectory(ZipOutputStream zip, String path) { try { zip.putNextEntry(new ZipEntry(path.substring(1) + "/")); zip.closeEntry(); -} catch (IOException e) { - logger.error("Error zipping directory " + path.substring(1) + "/" + ": " - + e.getMessage()); +} catch (IOException ex) { + String msg = "Error zipping directory " + path.substring(1) + "/" + ": " + + ex.getMessage(); + logger.error(msg); + throw new ServiceFormattedExc
git commit: AMBARI-6837. Cancel background tasks for Rebalancer should follow the usual cancel reqeust paradigm.
Repository: ambari Updated Branches: refs/heads/trunk 221f0e511 -> 2aee43d38 AMBARI-6837. Cancel background tasks for Rebalancer should follow the usual cancel reqeust paradigm. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2aee43d3 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2aee43d3 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2aee43d3 Branch: refs/heads/trunk Commit: 2aee43d386e36f8c4999409db02078eb36c08e04 Parents: 221f0e5 Author: Mahadev Konar Authored: Tue Aug 12 14:47:24 2014 -0700 Committer: Mahadev Konar Committed: Tue Aug 12 14:47:24 2014 -0700 -- .../src/main/python/ambari_agent/ActionQueue.py | 26 +++-- .../ambari_agent/CustomServiceOrchestrator.py | 76 ++--- .../main/python/ambari_agent/PythonExecutor.py | 2 +- .../test/python/ambari_agent/TestActionQueue.py | 73 +++-- .../TestCustomServiceOrchestrator.py| 69 .../ambari/server/actionmanager/Stage.java | 107 +-- .../system_action_definitions.xml | 10 -- .../custom_actions/cancel_background_task.py| 41 --- .../services/HDFS/package/scripts/namenode.py | 15 ++- .../BackgroundCustomCommandExecutionTest.java | 51 - ambari-web/app/controllers/main/service/item.js | 2 +- ambari-web/app/utils/ajax/ajax.js | 18 ++-- ambari-web/app/utils/host_progress_popup.js | 7 +- 13 files changed, 203 insertions(+), 294 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/2aee43d3/ambari-agent/src/main/python/ambari_agent/ActionQueue.py -- diff --git a/ambari-agent/src/main/python/ambari_agent/ActionQueue.py b/ambari-agent/src/main/python/ambari_agent/ActionQueue.py index 6437036..476955f 100644 --- a/ambari-agent/src/main/python/ambari_agent/ActionQueue.py +++ b/ambari-agent/src/main/python/ambari_agent/ActionQueue.py @@ -55,11 +55,9 @@ class ActionQueue(threading.Thread): STATUS_COMMAND = 'STATUS_COMMAND' EXECUTION_COMMAND = 'EXECUTION_COMMAND' BACKGROUND_EXECUTION_COMMAND = 'BACKGROUND_EXECUTION_COMMAND' - CANCEL_BACKGROUND_EXECUTION_COMMAND = 'CANCEL_BACKGROUND_EXECUTION_COMMAND' ROLE_COMMAND_INSTALL = 'INSTALL' ROLE_COMMAND_START = 'START' ROLE_COMMAND_STOP = 'STOP' - ROLE_COMMAND_CANCEL = 'CANCEL' ROLE_COMMAND_CUSTOM_COMMAND = 'CUSTOM_COMMAND' CUSTOM_COMMAND_RESTART = 'RESTART' @@ -80,7 +78,7 @@ class ActionQueue(threading.Thread): self.configTags = {} self._stop = threading.Event() self.tmpdir = config.get('agent', 'prefix') -self.customServiceOrchestrator = CustomServiceOrchestrator(config, controller, self.commandStatuses) +self.customServiceOrchestrator = CustomServiceOrchestrator(config, controller) def stop(self): @@ -172,7 +170,7 @@ class ActionQueue(threading.Thread): def createCommandHandle(self, command): if(command.has_key('__handle')): raise AgentException("Command already has __handle") -command['__handle'] = BackgroundCommandExecutionHandle(command, command['commandId'], self.on_background_command_started, self.on_background_command_complete_callback) +command['__handle'] = BackgroundCommandExecutionHandle(command, command['commandId'], None, self.on_background_command_complete_callback) return command def process_command(self, command): @@ -281,20 +279,26 @@ class ActionQueue(threading.Thread): self.commandStatuses.put_command_status(command, roleResult) - def on_background_command_started(self, handle): -#update command with given handle -self.commandStatuses.update_command_status(handle.command, {'pid' : handle.pid}) - - + def command_was_canceled(self): +self.customServiceOrchestrator def on_background_command_complete_callback(self, process_condenced_result, handle): logger.debug('Start callback: %s' % process_condenced_result) logger.debug('The handle is: %s' % handle) status = self.COMPLETED_STATUS if handle.exitCode == 0 else self.FAILED_STATUS + +aborted_postfix = self.customServiceOrchestrator.command_canceled_reason(handle.command['taskId']) +if aborted_postfix: + status = self.FAILED_STATUS + logger.debug('Set status to: %s , reason = %s' % (status, aborted_postfix)) +else: + aborted_postfix = '' + + roleResult = self.commandStatuses.generate_report_template(handle.command) roleResult.update({ - 'stdout
git commit: AMBARI-6854. Add resource name to privileges API. (mahadev)
Repository: ambari Updated Branches: refs/heads/trunk 1b72f6df7 -> 84cdfef24 AMBARI-6854. Add resource name to privileges API. (mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/84cdfef2 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/84cdfef2 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/84cdfef2 Branch: refs/heads/trunk Commit: 84cdfef24120d5c4e98582617135f901f86ab58d Parents: 1b72f6d Author: Mahadev Konar Authored: Wed Aug 13 13:21:49 2014 -0700 Committer: Mahadev Konar Committed: Wed Aug 13 13:22:01 2014 -0700 -- .../ambari/server/controller/AmbariServer.java | 2 + .../AmbariPrivilegeResourceProvider.java| 93 +- .../AmbariPrivilegeResourceProviderTest.java| 181 ++- 3 files changed, 268 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/84cdfef2/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 98556f9..f4439b8 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 @@ -46,6 +46,7 @@ import org.apache.ambari.server.configuration.ComponentSSLConfiguration; import org.apache.ambari.server.configuration.Configuration; import org.apache.ambari.server.controller.internal.AbstractControllerResourceProvider; import org.apache.ambari.server.controller.internal.AlertDefinitionResourceProvider; +import org.apache.ambari.server.controller.internal.AmbariPrivilegeResourceProvider; import org.apache.ambari.server.controller.internal.BlueprintResourceProvider; import org.apache.ambari.server.controller.internal.ClusterPrivilegeResourceProvider; import org.apache.ambari.server.controller.internal.ClusterResourceProvider; @@ -538,6 +539,7 @@ public class AmbariServer { injector.getInstance(GroupDAO.class), injector.getInstance(PrincipalDAO.class), injector.getInstance(PermissionDAO.class), injector.getInstance(ResourceDAO.class)); ClusterPrivilegeResourceProvider.init(injector.getInstance(ClusterDAO.class)); + AmbariPrivilegeResourceProvider.init(injector.getInstance(ClusterDAO.class)); ViewRegistry.init(injector.getInstance(ViewDAO.class), injector.getInstance(ViewInstanceDAO.class), injector.getInstance(UserDAO.class), injector.getInstance(MemberDAO.class), injector.getInstance(PrivilegeDAO.class), injector.getInstance(SecurityHelper.class), http://git-wip-us.apache.org/repos/asf/ambari/blob/84cdfef2/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariPrivilegeResourceProvider.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariPrivilegeResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariPrivilegeResourceProvider.java index b24f994..d7c6a8f 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariPrivilegeResourceProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariPrivilegeResourceProvider.java @@ -19,19 +19,40 @@ package org.apache.ambari.server.controller.internal; import org.apache.ambari.server.controller.spi.Predicate; import org.apache.ambari.server.controller.spi.Resource; +import org.apache.ambari.server.orm.dao.ClusterDAO; +import org.apache.ambari.server.orm.entities.ClusterEntity; +import org.apache.ambari.server.orm.entities.GroupEntity; +import org.apache.ambari.server.orm.entities.PrivilegeEntity; import org.apache.ambari.server.orm.entities.ResourceEntity; +import org.apache.ambari.server.orm.entities.ResourceTypeEntity; +import org.apache.ambari.server.orm.entities.UserEntity; +import org.apache.ambari.server.orm.entities.ViewEntity; +import org.apache.ambari.server.orm.entities.ViewInstanceEntity; +import org.apache.ambari.server.view.ViewRegistry; -import java.util.Collections; import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; import java.util.Set; +import static org.apache.ambari.server.controller.internal.ClusterPrivilegeResourceProvider.PRIVILEGE_CLUSTER_NAME_PROPERTY_ID; +import static org.apache.ambari.server.controller.internal.ViewPrivilegeResourceProvider.PRIVILEGE_INSTANCE_NAME_PROPERTY_ID; +import sta
git commit: AMBARI-6897. View Unit Test Failure. (mahadev)
Repository: ambari Updated Branches: refs/heads/trunk 32caa4359 -> 50e798395 AMBARI-6897. View Unit Test Failure. (mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/50e79839 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/50e79839 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/50e79839 Branch: refs/heads/trunk Commit: 50e798395a1ca97ce0d0f2eb4979bed657227ea4 Parents: 32caa43 Author: Mahadev Konar Authored: Mon Aug 18 10:49:53 2014 -0700 Committer: Mahadev Konar Committed: Mon Aug 18 10:49:57 2014 -0700 -- .../apache/ambari/server/view/ViewRegistry.java | 20 - .../ambari/server/view/ViewRegistryTest.java| 23 +++- 2 files changed, 22 insertions(+), 21 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/50e79839/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java index 82d84f6..65a48b4 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java @@ -1053,15 +1053,6 @@ public class ViewRegistry { throws Exception { String viewName = view.getName(); -// get or create an admin resource type to represent this view -ResourceTypeEntity resourceTypeEntity = resourceTypeDAO.findByName(viewName); -if (resourceTypeEntity == null) { - resourceTypeEntity = new ResourceTypeEntity(); - resourceTypeEntity.setName(view.getName()); - resourceTypeDAO.create(resourceTypeEntity); -} -view.setResourceType(resourceTypeEntity); - ViewEntity persistedView = viewDAO.findByName(viewName); // if the view is not yet persisted ... @@ -1070,11 +1061,18 @@ public class ViewRegistry { LOG.debug("Creating View " + viewName + "."); } + // get or create an admin resource type to represent this view + ResourceTypeEntity resourceTypeEntity = resourceTypeDAO.findByName(viewName); + if (resourceTypeEntity == null) { +resourceTypeEntity = view.getResourceType(); +resourceTypeDAO.create(resourceTypeEntity); + } + for( ViewInstanceEntity instance : view.getInstances()) { // create an admin resource to represent this view instance ResourceEntity resourceEntity = new ResourceEntity(); -resourceEntity.setResourceType(resourceTypeEntity); +resourceEntity.setResourceType(view.getResourceType()); resourceDAO.create(resourceEntity); instance.setResource(resourceEntity); @@ -1146,7 +1144,7 @@ public class ViewRegistry { for (ViewInstanceEntity instance : xmlInstanceEntityMap.values()) { // create an admin resource to represent this view instance ResourceEntity resourceEntity = new ResourceEntity(); - resourceEntity.setResourceType(resourceTypeEntity); + resourceEntity.setResourceType(view.getResourceType()); resourceDAO.create(resourceEntity); instance.setResource(resourceEntity); http://git-wip-us.apache.org/repos/asf/ambari/blob/50e79839/ambari-server/src/test/java/org/apache/ambari/server/view/ViewRegistryTest.java -- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/view/ViewRegistryTest.java b/ambari-server/src/test/java/org/apache/ambari/server/view/ViewRegistryTest.java index 77990a7..21a00ed 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/view/ViewRegistryTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/view/ViewRegistryTest.java @@ -173,12 +173,10 @@ public class ViewRegistryTest { ViewDAO vDAO = createMock(ViewDAO.class); ResourceDAO rDAO = createNiceMock(ResourceDAO.class); -ResourceTypeDAO rtDAO = createNiceMock(ResourceTypeDAO.class); ViewInstanceDAO viDAO = createNiceMock(ViewInstanceDAO.class); ViewRegistry.setViewDAO(vDAO); ViewRegistry.setResourceDAO(rDAO); -ViewRegistry.setResourceTypeDAO(rtDAO); ViewRegistry.setInstanceDAO(viDAO); ViewEntity viewDefinition = ViewEntityTest.getViewEntity(); @@ -261,15 +259,11 @@ public class ViewRegistryTest { expect(vDAO.findAll()).andReturn(Collections.emptyList()); -expect(rtDAO.findByName("MY_VIEW{1.0.0}")).andReturn(null); -rtDAO.create(EasyMock.anyObject(ResourceTypeEntity.class)); -EasyMock.expectLastCall().anyTimes(); - expect(viDAO.merge(EasyMock.anyObject(ViewInstanceEntity
git commit: AMBARI-6900. Upgrade DB Tests Fail. value column problem. (mahadev)
Repository: ambari Updated Branches: refs/heads/trunk 50e798395 -> 1a9abc4ed AMBARI-6900. Upgrade DB Tests Fail. value column problem. (mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1a9abc4e Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1a9abc4e Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1a9abc4e Branch: refs/heads/trunk Commit: 1a9abc4ede0618f512d51390d8fdb175a0c96911 Parents: 50e7983 Author: Mahadev Konar Authored: Mon Aug 18 13:00:52 2014 -0700 Committer: Mahadev Konar Committed: Mon Aug 18 13:00:52 2014 -0700 -- .../server/orm/entities/AlertCurrentEntity.java | 2 +- .../orm/entities/AlertDefinitionEntity.java | 2 +- .../server/orm/entities/AlertGroupEntity.java | 2 +- .../server/orm/entities/AlertHistoryEntity.java | 2 +- .../server/orm/entities/AlertNoticeEntity.java | 2 +- .../server/orm/entities/AlertTargetEntity.java | 2 +- .../orm/entities/ClusterConfigEntity.java | 2 +- .../server/orm/entities/ClusterEntity.java | 2 +- .../server/orm/entities/ConfigGroupEntity.java | 2 +- .../ambari/server/orm/entities/GroupEntity.java | 2 +- .../orm/entities/HostRoleCommandEntity.java | 2 +- .../server/orm/entities/MemberEntity.java | 2 +- .../server/orm/entities/PermissionEntity.java | 2 +- .../server/orm/entities/PrincipalEntity.java| 2 +- .../orm/entities/PrincipalTypeEntity.java | 2 +- .../server/orm/entities/PrivilegeEntity.java| 2 +- .../entities/RequestOperationLevelEntity.java | 2 +- .../entities/RequestResourceFilterEntity.java | 2 +- .../orm/entities/RequestScheduleEntity.java | 2 +- .../server/orm/entities/ResourceEntity.java | 2 +- .../server/orm/entities/ResourceTypeEntity.java | 2 +- .../orm/entities/ServiceConfigEntity.java | 2 +- .../ambari/server/orm/entities/UserEntity.java | 2 +- .../server/orm/entities/ViewEntityEntity.java | 2 +- .../server/orm/entities/ViewInstanceEntity.java | 2 +- .../server/upgrade/UpgradeCatalog170.java | 85 +--- .../main/resources/Ambari-DDL-MySQL-CREATE.sql | 52 ++-- .../main/resources/Ambari-DDL-Oracle-CREATE.sql | 52 ++-- .../resources/Ambari-DDL-Postgres-CREATE.sql| 4 +- .../Ambari-DDL-Postgres-EMBEDDED-CREATE.sql | 4 +- 30 files changed, 121 insertions(+), 126 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/1a9abc4e/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertCurrentEntity.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertCurrentEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertCurrentEntity.java index d00cbc7..cde61f2 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertCurrentEntity.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertCurrentEntity.java @@ -43,7 +43,7 @@ import org.apache.ambari.server.state.MaintenanceState; */ @Entity @Table(name = "alert_current") -@TableGenerator(name = "alert_current_id_generator", table = "ambari_sequences", pkColumnName = "sequence_name", valueColumnName = "value", pkColumnValue = "alert_current_id_seq", initialValue = 0, allocationSize = 1) +@TableGenerator(name = "alert_current_id_generator", table = "ambari_sequences", pkColumnName = "sequence_name", valueColumnName = "sequence_value", pkColumnValue = "alert_current_id_seq", initialValue = 0, allocationSize = 1) @NamedQueries({ @NamedQuery(name = "AlertCurrentEntity.findAll", query = "SELECT alert FROM AlertCurrentEntity alert"), @NamedQuery(name = "AlertCurrentEntity.findByService", query = "SELECT alert FROM AlertCurrentEntity alert JOIN alert.alertHistory history WHERE history.clusterId = :clusterId AND history.serviceName = :serviceName"), http://git-wip-us.apache.org/repos/asf/ambari/blob/1a9abc4e/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertDefinitionEntity.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertDefinitionEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertDefinitionEntity.java index de30921..23ad8f4 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertDefinitionEntity.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertDefinitionEntity.java @@ -48,7 +48,7 @@ import org.ap
git commit: AMBARI-6902. LDAP uses redundant properties from ambari configuration. (mahadev)
Repository: ambari Updated Branches: refs/heads/trunk e7d864ca0 -> bba2806f7 AMBARI-6902. LDAP uses redundant properties from ambari configuration. (mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/bba2806f Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/bba2806f Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/bba2806f Branch: refs/heads/trunk Commit: bba2806f76d98a139e83736fd08b72fae0ab27c1 Parents: e7d864c Author: Mahadev Konar Authored: Mon Aug 18 13:29:51 2014 -0700 Committer: Mahadev Konar Committed: Mon Aug 18 13:29:55 2014 -0700 -- .../authorization/AmbariLdapDataPopulator.java | 17 - 1 file changed, 4 insertions(+), 13 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/bba2806f/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapDataPopulator.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapDataPopulator.java b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapDataPopulator.java index 29b69a6..7932833 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapDataPopulator.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapDataPopulator.java @@ -91,7 +91,7 @@ public class AmbariLdapDataPopulator { public Object mapFromAttributes(Attributes attributes) throws NamingException { - return attributes.get("uid").get(); + return ""; } }); return true; @@ -269,10 +269,7 @@ public class AmbariLdapDataPopulator { final LdapTemplate ldapTemplate = loadLdapTemplate(); final EqualsFilter equalsFilter = new EqualsFilter("objectClass", ldapServerProperties.getGroupObjectClass()); -String baseDn = ldapServerProperties.getGroupBase(); -if (baseDn == null) { - baseDn = ldapServerProperties.getBaseDN(); -} +String baseDn = ldapServerProperties.getBaseDN(); ldapTemplate.search(baseDn, equalsFilter.encode(), new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) @@ -295,10 +292,7 @@ public class AmbariLdapDataPopulator { final LdapTemplate ldapTemplate = loadLdapTemplate(); final EqualsFilter equalsFilter = new EqualsFilter("objectClass", ldapServerProperties.getUserObjectClass()); -String baseDn = ldapServerProperties.getUserBase(); -if (baseDn == null) { - baseDn = ldapServerProperties.getBaseDN(); -} +String baseDn = ldapServerProperties.getBaseDN(); ldapTemplate.search(baseDn, equalsFilter.encode(), new AttributesMapper() { public Object mapFromAttributes(Attributes attributes) @@ -323,10 +317,7 @@ public class AmbariLdapDataPopulator { final AndFilter andFilter = new AndFilter(); andFilter.and(new EqualsFilter("objectClass", ldapServerProperties.getGroupObjectClass())); andFilter.and(new EqualsFilter(ldapServerProperties.getGroupNamingAttr(), groupName)); -String baseDn = ldapServerProperties.getGroupBase(); -if (baseDn == null) { - baseDn = ldapServerProperties.getBaseDN(); -} +String baseDn = ldapServerProperties.getBaseDN(); ldapTemplate.search(baseDn, andFilter.encode(), new ContextMapper() { public Object mapFromContext(Object ctx) {
git commit: AMBARI-6905. POST on /api/v1/persist fails for CLUSTER.OPERATE. (mahadev)
Repository: ambari Updated Branches: refs/heads/trunk c9fbc849f -> 0c46e95e6 AMBARI-6905. POST on /api/v1/persist fails for CLUSTER.OPERATE. (mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0c46e95e Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0c46e95e Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0c46e95e Branch: refs/heads/trunk Commit: 0c46e95e646da932d644719377d2584fc2b026c6 Parents: c9fbc84 Author: Mahadev Konar Authored: Mon Aug 18 21:01:39 2014 -0700 Committer: Mahadev Konar Committed: Tue Aug 19 10:56:11 2014 -0700 -- .../AmbariAuthorizationFilter.java | 15 ++- .../AmbariAuthorizationFilterTest.java | 124 +++ 2 files changed, 136 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/0c46e95e/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariAuthorizationFilter.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariAuthorizationFilter.java b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariAuthorizationFilter.java index 4ba8c7f..bc67cdb 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariAuthorizationFilter.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariAuthorizationFilter.java @@ -54,9 +54,10 @@ public class AmbariAuthorizationFilter implements Filter { HttpServletRequest httpRequest = (HttpServletRequest) request; HttpServletResponse httpResponse = (HttpServletResponse) response; -SecurityContext context = SecurityContextHolder.getContext(); +SecurityContext context = getSecurityContext(); -if (context.getAuthentication() == null || !context.getAuthentication().isAuthenticated()) { +Authentication authentication = context.getAuthentication(); +if (authentication == null || !authentication.isAuthenticated()) { String token = httpRequest.getHeader(INTERNAL_TOKEN_HEADER); if (token != null) { context.setAuthentication(new InternalAuthenticationToken(token)); @@ -64,7 +65,6 @@ public class AmbariAuthorizationFilter implements Filter { } else { boolean authorized = false; - Authentication authentication = context.getAuthentication(); for (GrantedAuthority grantedAuthority : authentication.getAuthorities()) { if (grantedAuthority instanceof AmbariGrantedAuthority) { @@ -93,6 +93,11 @@ public class AmbariAuthorizationFilter implements Filter { authorized = true; break; } + } else if (requestURI.matches("/api/v[0-9]+/persist.*")) { +if (permissionId.equals(PermissionEntity.CLUSTER_OPERATE_PERMISSION)) { + authorized = true; + break; +} } } } @@ -134,4 +139,8 @@ public class AmbariAuthorizationFilter implements Filter { } return value == null || value.length() == 0 ? defaultValue : value; } + + SecurityContext getSecurityContext() { +return SecurityContextHolder.getContext(); + } } http://git-wip-us.apache.org/repos/asf/ambari/blob/0c46e95e/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariAuthorizationFilterTest.java -- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariAuthorizationFilterTest.java b/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariAuthorizationFilterTest.java new file mode 100644 index 000..a950eb6 --- /dev/null +++ b/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariAuthorizationFilterTest.java @@ -0,0 +1,124 @@ +/* + * 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 u
git commit: AMBARI-6920. Admin Views: Sync LDAP does not sync the LDAP groups. (mahadev)
Repository: ambari Updated Branches: refs/heads/trunk 818dc161f -> 51bebd3da AMBARI-6920. Admin Views: Sync LDAP does not sync the LDAP groups. (mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/51bebd3d Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/51bebd3d Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/51bebd3d Branch: refs/heads/trunk Commit: 51bebd3daa97478946bbef65ffd77ee62af19ba2 Parents: 818dc16 Author: Mahadev Konar Authored: Tue Aug 19 12:15:57 2014 -0700 Committer: Mahadev Konar Committed: Tue Aug 19 12:16:02 2014 -0700 -- .../internal/PrivilegeResourceProvider.java | 3 + .../authorization/AmbariLdapDataPopulator.java | 32 +-- .../AmbariLdapDataPopulatorTest.java| 261 +++ 3 files changed, 277 insertions(+), 19 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/51bebd3d/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/PrivilegeResourceProvider.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/PrivilegeResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/PrivilegeResourceProvider.java index d8fce4d..f0bcaf8 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/PrivilegeResourceProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/PrivilegeResourceProvider.java @@ -342,6 +342,9 @@ public abstract class PrivilegeResourceProvider extends AbstractResourceProvi } } else if (PrincipalTypeEntity.USER_PRINCIPAL_TYPE_NAME.equalsIgnoreCase(principalType)) { UserEntity userEntity = userDAO.findLocalUserByName(principalName); + if (userEntity == null) { +userEntity = userDAO.findLdapUserByName(principalName); + } if (userEntity != null) { entity.setPrincipal(principalDAO.findById(userEntity.getPrincipal().getId())); } http://git-wip-us.apache.org/repos/asf/ambari/blob/51bebd3d/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapDataPopulator.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapDataPopulator.java b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapDataPopulator.java index 7932833..b5f9341 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapDataPopulator.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapDataPopulator.java @@ -65,7 +65,7 @@ public class AmbariLdapDataPopulator { /** * LDAP specific properties. */ - private LdapServerProperties ldapServerProperties; + protected LdapServerProperties ldapServerProperties; /** * LDAP template for making search queries. @@ -86,14 +86,7 @@ public class AmbariLdapDataPopulator { public boolean isLdapEnabled() { try { final LdapTemplate ldapTemplate = loadLdapTemplate(); - ldapTemplate.search(ldapServerProperties.getBaseDN(), - "(objectclass=person)", new AttributesMapper() { - -public Object mapFromAttributes(Attributes attributes) -throws NamingException { - return ""; -} - }); + ldapTemplate.list(ldapServerProperties.getBaseDN()); return true; } catch (Exception ex) { LOG.error("Could not connect to LDAP server", ex); @@ -217,7 +210,7 @@ public class AmbariLdapDataPopulator { * @param groupName group name * @throws AmbariException if group refresh failed */ - private void refreshGroupMembers(String groupName) throws AmbariException { + protected void refreshGroupMembers(String groupName) throws AmbariException { final Set externalMembers = getExternalLdapGroupMembers(groupName); final Map internalUsers = getInternalUsers(); final Map internalMembers = getInternalMembers(groupName); @@ -233,8 +226,9 @@ public class AmbariLdapDataPopulator { internalMembers.remove(externalMember); internalUsers.remove(externalMember); } else { -users.createUser(externalMember, "", true, false); +users.createUser(externalMember, ""); users.setUserLdap(externalMember); +users.addMemberToGroup(groupName, externalMember); } } for (Entry userToBeUnsynced: internalMembers.entrySet()) { @@ -248,7 +242,7 @@ public class AmbariLdapDataPopulator { * * @throws AmbariException */
git commit: AMBARI-6956. Rebalance HDFS should fail if NameNode is down. (mahadev)
Repository: ambari Updated Branches: refs/heads/trunk 4b91492d2 -> 22a6007e7 AMBARI-6956. Rebalance HDFS should fail if NameNode is down. (mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/22a6007e Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/22a6007e Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/22a6007e Branch: refs/heads/trunk Commit: 22a6007e7118a5b9b6cfc5bab22073e423941ece Parents: 4b91492 Author: Mahadev Konar Authored: Wed Aug 20 13:17:42 2014 -0700 Committer: Mahadev Konar Committed: Wed Aug 20 13:17:42 2014 -0700 -- .../test/python/ambari_agent/TestActionQueue.py | 9 +--- .../scripts/balancer-emulator/hdfs-command.py | 4 +- .../services/HDFS/package/scripts/namenode.py | 18 +--- .../python/stacks/2.0.6/HDFS/test_namenode.py | 47 +--- .../2.0.6/configs/rebalancehdfs_default.json| 2 +- 5 files changed, 58 insertions(+), 22 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/22a6007e/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py -- diff --git a/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py b/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py index f582a68..ff165b7 100644 --- a/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py +++ b/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py @@ -595,15 +595,10 @@ class TestActionQueue(TestCase): report = actionQueue.result() self.assertEqual(len(report['reports']),1) - - - @patch.object(StackVersionsFileHandler, "read_stack_version") @patch.object(CustomServiceOrchestrator, "resolve_script_path") - @patch.object(FileCache, "__init__") - def test_execute_python_executor(self, read_stack_version_mock, FileCache_mock, resolve_script_path_mock): -FileCache_mock.return_value = None - + @patch.object(StackVersionsFileHandler, "read_stack_version") + def test_execute_python_executor(self, read_stack_version_mock, resolve_script_path_mock): dummy_controller = MagicMock() cfg = AmbariConfig().getConfig() http://git-wip-us.apache.org/repos/asf/ambari/blob/22a6007e/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HDFS/package/scripts/balancer-emulator/hdfs-command.py -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HDFS/package/scripts/balancer-emulator/hdfs-command.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HDFS/package/scripts/balancer-emulator/hdfs-command.py index df173fe..0cce48c 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HDFS/package/scripts/balancer-emulator/hdfs-command.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HDFS/package/scripts/balancer-emulator/hdfs-command.py @@ -29,10 +29,10 @@ def write_function(path, handle, interval): handle.flush() time.sleep(interval) -thread = Thread(target = write_function, args = ('balancer.log', sys.stdout, 1)) +thread = Thread(target = write_function, args = ('balancer.log', sys.stdout, 1.5)) thread.start() -threaderr = Thread(target = write_function, args = ('balancer-err.log', sys.stderr, 0.3)) +threaderr = Thread(target = write_function, args = ('balancer-err.log', sys.stderr, 1.5 * 0.023)) threaderr.start() thread.join() http://git-wip-us.apache.org/repos/asf/ambari/blob/22a6007e/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HDFS/package/scripts/namenode.py -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HDFS/package/scripts/namenode.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HDFS/package/scripts/namenode.py index f401122..8dae3eb 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HDFS/package/scripts/namenode.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HDFS/package/scripts/namenode.py @@ -101,11 +101,13 @@ class NameNode(Script): _print("Executing command %s\n" % command) parser = hdfs_rebalance.HdfsParser() -proc = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, - shell=False, - close_fds=True, - cwd=basedir - ) +proc = subprocess.Popen( +command, +stdout=subprocess.PIPE, +
git commit: AMBARI-6961. service config versioning needs to handle host config groups. (myroslav via mahadev)
Repository: ambari Updated Branches: refs/heads/trunk 48b61d0cc -> 5ed94d53a AMBARI-6961. service config versioning needs to handle host config groups. (myroslav via mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5ed94d53 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5ed94d53 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5ed94d53 Branch: refs/heads/trunk Commit: 5ed94d53a3c7444ae1dc8143137f1bc528c6fd3d Parents: 48b61d0 Author: Mahadev Konar Authored: Wed Aug 20 15:29:18 2014 -0700 Committer: Mahadev Konar Committed: Wed Aug 20 15:29:22 2014 -0700 -- .../ServiceConfigVersionResponse.java | 30 .../internal/ConfigGroupResourceProvider.java | 15 ++ .../ServiceConfigVersionResourceProvider.java | 11 +- .../ambari/server/orm/dao/ClusterDAO.java | 14 ++ .../orm/entities/ServiceConfigEntity.java | 28 .../org/apache/ambari/server/state/Cluster.java | 5 + .../server/state/cluster/ClusterImpl.java | 157 +++ .../main/resources/Ambari-DDL-MySQL-CREATE.sql | 4 +- .../main/resources/Ambari-DDL-Oracle-CREATE.sql | 4 +- .../resources/Ambari-DDL-Postgres-CREATE.sql| 5 +- .../Ambari-DDL-Postgres-EMBEDDED-CREATE.sql | 10 +- .../src/main/resources/properties.json | 3 + 12 files changed, 251 insertions(+), 35 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/5ed94d53/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionResponse.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionResponse.java index f463a4b..49921bc 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionResponse.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionResponse.java @@ -30,9 +30,12 @@ public class ServiceConfigVersionResponse { private String serviceName; private Long version; private Long createTime; + private Long groupId; + private String groupName; private String userName; private String note; private List configurations; + private List hosts; @JsonProperty("service_name") public String getServiceName() { @@ -100,5 +103,32 @@ public class ServiceConfigVersionResponse { public void setNote(String note) { this.note = note; } + + public List getHosts() { +return hosts; + } + + @JsonProperty("hosts") + public void setHosts(List hosts) { +this.hosts = hosts; + } + + @JsonProperty("group_name") + public String getGroupName() { +return groupName; + } + + public void setGroupName(String groupName) { +this.groupName = groupName; + } + + @JsonProperty("group_id") + public Long getGroupId() { +return groupId; + } + + public void setGroupId(Long groupId) { +this.groupId = groupId; + } } http://git-wip-us.apache.org/repos/asf/ambari/blob/5ed94d53/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java index ab9646d..bb75832 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java @@ -456,6 +456,11 @@ public class ConfigGroupResourceProvider extends request.getTag(), request.getDescription(), request.getConfigs(), hosts); + String serviceName = null; + if (configGroup.getConfigurations() != null) { +serviceName = cluster.getServiceForConfigTypes(configGroup.getConfigurations().keySet()); + } + // Persist before add, since id is auto-generated configLogger.info("Persisting new Config group" + ", clusterName = " + cluster.getClusterName() @@ -465,6 +470,9 @@ public class ConfigGroupResourceProvider extends configGroup.persist(); cluster.addConfigGroup(configGroup); + if (serviceName != null) { +cluster.createServiceConfigVersion(serviceName, getManagementController().getAuthName(), null, configGroup); + } ConfigGroupResponse response = new ConfigGroupResponse(configGroup .getId(),
git commit: AMBARI-6933. Rolling restart not working. (swagle via mahadev)
Repository: ambari Updated Branches: refs/heads/trunk 0e7a2679b -> cc9ae3f6f AMBARI-6933. Rolling restart not working. (swagle via mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/cc9ae3f6 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/cc9ae3f6 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/cc9ae3f6 Branch: refs/heads/trunk Commit: cc9ae3f6f05ebf933162c28c8ce9b11be9a3a94b Parents: 0e7a267 Author: Mahadev Konar Authored: Fri Aug 22 14:43:02 2014 -0700 Committer: Mahadev Konar Committed: Fri Aug 22 14:43:06 2014 -0700 -- .../internal/InternalAuthenticationToken.java | 30 +++- 1 file changed, 23 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/cc9ae3f6/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/internal/InternalAuthenticationToken.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/internal/InternalAuthenticationToken.java b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/internal/InternalAuthenticationToken.java index 8752278..4494697 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/internal/InternalAuthenticationToken.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/internal/InternalAuthenticationToken.java @@ -18,19 +18,26 @@ package org.apache.ambari.server.security.authorization.internal; +import java.util.Collection; +import java.util.Collections; + import org.apache.ambari.server.orm.entities.PermissionEntity; import org.apache.ambari.server.orm.entities.PrivilegeEntity; +import org.apache.ambari.server.orm.entities.ResourceEntity; +import org.apache.ambari.server.orm.entities.ResourceTypeEntity; import org.apache.ambari.server.security.authorization.AmbariGrantedAuthority; import org.springframework.security.core.Authentication; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.User; -import java.util.Collection; -import java.util.Collections; public class InternalAuthenticationToken implements Authentication { - + private static final long serialVersionUID = 1L; + private static final String INTERNAL_NAME = "internal"; private static final PrivilegeEntity ADMIN_PRIV_ENTITY = new PrivilegeEntity(); + static{ +createAdminPrivilegeEntity(ADMIN_PRIV_ENTITY); + } // used in ClustersImpl, checkPermissions private static final Collection AUTHORITIES = @@ -40,12 +47,22 @@ public class InternalAuthenticationToken implements Authentication { private String token; private boolean authenticated = false; - static{ + + private static void createAdminPrivilegeEntity(PrivilegeEntity entity) { PermissionEntity pe = new PermissionEntity(); pe.setId(PermissionEntity.AMBARI_ADMIN_PERMISSION); pe.setPermissionName(PermissionEntity.AMBARI_ADMIN_PERMISSION_NAME); - -ADMIN_PRIV_ENTITY.setPermission(pe); + +entity.setPermission(pe); + +ResourceEntity resource = new ResourceEntity(); +resource.setId(1L); + +ResourceTypeEntity rte = new ResourceTypeEntity(); +rte.setId(ResourceTypeEntity.CLUSTER_RESOURCE_TYPE); +rte.setName(ResourceTypeEntity.CLUSTER_RESOURCE_TYPE_NAME); +resource.setResourceType(rte); +entity.setResource(resource); } public InternalAuthenticationToken(String tokenString) { @@ -81,7 +98,6 @@ public class InternalAuthenticationToken implements Authentication { public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException { this.authenticated = isAuthenticated; } - @Override public String getName() { return INTERNAL_NAME;
git commit: AMBARI-7001. Handle upgrade for Service Config versions for config groups. (myroslav via mahadev)
Repository: ambari Updated Branches: refs/heads/trunk a6febc087 -> ebf47965b AMBARI-7001. Handle upgrade for Service Config versions for config groups. (myroslav via mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ebf47965 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ebf47965 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ebf47965 Branch: refs/heads/trunk Commit: ebf47965b9312ace3c56adbf4416021e21f8cdcb Parents: a6febc0 Author: Mahadev Konar Authored: Sun Aug 24 10:21:13 2014 -0700 Committer: Mahadev Konar Committed: Sun Aug 24 10:21:19 2014 -0700 -- .../api/services/ConfigurationService.java | 2 +- .../internal/ConfigGroupResourceProvider.java | 26 .../ambari/server/orm/dao/ServiceConfigDAO.java | 9 ++- .../server/orm/entities/ConfigGroupEntity.java | 11 + .../server/state/cluster/ClusterImpl.java | 8 -- .../server/state/configgroup/ConfigGroup.java | 4 +++ .../state/configgroup/ConfigGroupImpl.java | 21 .../server/upgrade/UpgradeCatalog170.java | 11 + .../main/resources/Ambari-DDL-MySQL-CREATE.sql | 4 +-- .../main/resources/Ambari-DDL-Oracle-CREATE.sql | 4 +-- .../resources/Ambari-DDL-Postgres-CREATE.sql| 4 +-- .../Ambari-DDL-Postgres-EMBEDDED-CREATE.sql | 4 +-- 12 files changed, 91 insertions(+), 17 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/ebf47965/ambari-server/src/main/java/org/apache/ambari/server/api/services/ConfigurationService.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ConfigurationService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ConfigurationService.java index 18fa335..cfbfc7f 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ConfigurationService.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ConfigurationService.java @@ -51,7 +51,7 @@ public class ConfigurationService extends BaseService { m_clusterName = clusterName; } - @Path("serviceconfigversions") + @Path("service_config_versions") public ServiceConfigVersionService getServiceConfigVersionService() { return new ServiceConfigVersionService(m_clusterName); } http://git-wip-us.apache.org/repos/asf/ambari/blob/ebf47965/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java index bb75832..c803c5a 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java @@ -17,6 +17,8 @@ */ package org.apache.ambari.server.controller.internal; +import com.google.common.collect.MapDifference; +import com.google.common.collect.Maps; import org.apache.ambari.server.AmbariException; import org.apache.ambari.server.ClusterNotFoundException; import org.apache.ambari.server.ConfigGroupNotFoundException; @@ -44,6 +46,7 @@ import org.apache.ambari.server.state.ConfigImpl; import org.apache.ambari.server.state.Host; import org.apache.ambari.server.state.configgroup.ConfigGroup; import org.apache.ambari.server.state.configgroup.ConfigGroupFactory; +import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -457,9 +460,10 @@ public class ConfigGroupResourceProvider extends request.getConfigs(), hosts); String serviceName = null; - if (configGroup.getConfigurations() != null) { -serviceName = cluster.getServiceForConfigTypes(configGroup.getConfigurations().keySet()); + if (request.getConfigs() != null && !request.getConfigs().isEmpty()) { +serviceName = cluster.getServiceForConfigTypes(request.getConfigs().keySet()); } + configGroup.setServiceName(serviceName); // Persist before add, since id is auto-generated configLogger.info("Persisting new Config group" @@ -472,6 +476,9 @@ public class ConfigGroupResourceProvider extends cluster.addConfigGroup(configGroup); if (serviceName != null) { cluster.createServiceConfigVersion(serviceName, getManagementController().getAuthName(), null, configGroup); + } else { +LOG.warn("Cou
git commit: AMBARI-7027. Config History: need current version for each config group. (myroslav via mahadev)
Repository: ambari Updated Branches: refs/heads/trunk 0e9c744f2 -> a8e6736ac AMBARI-7027. Config History: need current version for each config group. (myroslav via mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a8e6736a Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a8e6736a Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a8e6736a Branch: refs/heads/trunk Commit: a8e6736ac536f08e86503d037446a4d793db1029 Parents: 0e9c744 Author: Mahadev Konar Authored: Tue Aug 26 17:30:30 2014 -0700 Committer: Mahadev Konar Committed: Tue Aug 26 17:30:30 2014 -0700 -- .../ServiceConfigVersionResourceDefinition.java | 10 +-- .../AmbariManagementControllerImpl.java | 16 - .../server/controller/ClusterRequest.java | 12 ++-- .../server/controller/ClusterResponse.java | 9 ++- .../server/controller/ConfigGroupRequest.java | 9 +++ .../controller/ServiceConfigVersionRequest.java | 23 +++ .../ServiceConfigVersionResponse.java | 13 +++- .../internal/ClusterResourceProvider.java | 40 +++- .../internal/ConfigGroupResourceProvider.java | 4 ++ .../ServiceConfigVersionResourceProvider.java | 12 ++-- .../ambari/server/orm/dao/ServiceConfigDAO.java | 41 +++- .../org/apache/ambari/server/state/Cluster.java | 6 +- .../server/state/cluster/ClusterImpl.java | 67 .../src/main/resources/properties.json | 5 +- .../server/state/cluster/ClusterTest.java | 13 ++-- 15 files changed, 214 insertions(+), 66 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/a8e6736a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ServiceConfigVersionResourceDefinition.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ServiceConfigVersionResourceDefinition.java b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ServiceConfigVersionResourceDefinition.java index f5d07f6..ef4108c 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ServiceConfigVersionResourceDefinition.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ServiceConfigVersionResourceDefinition.java @@ -43,12 +43,12 @@ public class ServiceConfigVersionResourceDefinition extends BaseResourceDefiniti @Override public String getPluralName() { -return "serviceconfigversions"; +return "service_config_versions"; } @Override public String getSingularName() { -return "serviceconfigversion"; +return "service_config_version"; } private class HrefProcessor extends BaseHrefPostProcessor { @@ -66,10 +66,10 @@ public class ServiceConfigVersionResourceDefinition extends BaseResourceDefiniti idx = href.indexOf("/", idx) + 1; String serviceName = (String) resultNode.getObject().getPropertyValue("service_name"); -Long version = (Long) resultNode.getObject().getPropertyValue("serviceconfigversion"); +Long version = (Long) resultNode.getObject().getPropertyValue("service_config_version"); href = href.substring(0, idx) -+ "configurations/serviceconfigversions?service_name=" -+ serviceName + "&serviceconfigversion=" + version; ++ "configurations/service_config_versions?service_name=" ++ serviceName + "&service_config_version=" + version; resultNode.setProperty("href", href); } else { http://git-wip-us.apache.org/repos/asf/ambari/blob/a8e6736a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java index 394f6ad..f7f2f2d 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java @@ -140,6 +140,7 @@ import org.slf4j.LoggerFactory; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; +import com.google.common.collect.Multimaps; import com.google.gson.Gson; import com.google.inject.Inject; import com.google.inject.Injector; @@ -1156,6 +1157,12 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
ambari git commit: AMBARI-8219. Ambari: HS2 query Alter index fails throwing java.lang.NumberFormatException: For input string: (mahadev)
Repository: ambari Updated Branches: refs/heads/trunk f812baf58 -> 26a9c7302 AMBARI-8219. Ambari: HS2 query Alter index fails throwing java.lang.NumberFormatException: For input string: (mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/26a9c730 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/26a9c730 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/26a9c730 Branch: refs/heads/trunk Commit: 26a9c73022d283d4bc90b2943dc58a0cd0d02e0f Parents: f812baf Author: Mahadev Konar Authored: Fri Nov 7 15:15:47 2014 -0800 Committer: Mahadev Konar Committed: Fri Nov 7 15:16:41 2014 -0800 -- .../stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/26a9c730/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml index 3909d98..12b4612 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml @@ -243,7 +243,7 @@ limitations under the License. hive.exec.max.created.files -10L +10 Maximum number of HDFS files created by all mappers/reducers in a MapReduce job.
ambari git commit: AMBARI-8219. Ambari: HS2 query Alter index fails throwing java.lang.NumberFormatException: For input string: (mahadev)
Repository: ambari Updated Branches: refs/heads/branch-1.7.0 38c1ab8b6 -> ae89c AMBARI-8219. Ambari: HS2 query Alter index fails throwing java.lang.NumberFormatException: For input string: (mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ae89 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ae89 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ae89 Branch: refs/heads/branch-1.7.0 Commit: ae89cc7a7f041a9abbfcff42719f871f1836 Parents: 38c1ab8 Author: Mahadev Konar Authored: Fri Nov 7 15:15:47 2014 -0800 Committer: Mahadev Konar Committed: Fri Nov 7 15:15:52 2014 -0800 -- .../stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/ae89/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml index 3909d98..12b4612 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml @@ -243,7 +243,7 @@ limitations under the License. hive.exec.max.created.files -10L +10 Maximum number of HDFS files created by all mappers/reducers in a MapReduce job.
ambari git commit: AMBARI-8217. HDP 2.1 Stack includes incorrect address defaults for App Timeline Service. (Bob Nettleton via mahadev)
Repository: ambari Updated Branches: refs/heads/trunk 26a9c7302 -> 700d1d99c AMBARI-8217. HDP 2.1 Stack includes incorrect address defaults for App Timeline Service. (Bob Nettleton via mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/700d1d99 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/700d1d99 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/700d1d99 Branch: refs/heads/trunk Commit: 700d1d99c55b70b28137de120e1d60c48fbe815b Parents: 26a9c73 Author: Mahadev Konar Authored: Fri Nov 7 15:39:48 2014 -0800 Committer: Mahadev Konar Committed: Fri Nov 7 15:39:48 2014 -0800 -- .../stacks/HDP/2.1/services/YARN/configuration/yarn-site.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/700d1d99/ambari-server/src/main/resources/stacks/HDP/2.1/services/YARN/configuration/yarn-site.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.1/services/YARN/configuration/yarn-site.xml b/ambari-server/src/main/resources/stacks/HDP/2.1/services/YARN/configuration/yarn-site.xml index dd67eb3..e9f5c3c 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.1/services/YARN/configuration/yarn-site.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.1/services/YARN/configuration/yarn-site.xml @@ -373,7 +373,7 @@ yarn.timeline-service.webapp.address -0.0.0.0:8188 +localhost:8188 The http address of the timeline service web application. @@ -381,7 +381,7 @@ yarn.timeline-service.webapp.https.address -0.0.0.0:8190 +localhost:8190 The http address of the timeline service web application. @@ -389,7 +389,7 @@ yarn.timeline-service.address -0.0.0.0:10200 +localhost:10200 This is default address for the timeline server to start the RPC server.
ambari git commit: AMBARI-8217. HDP 2.1 Stack includes incorrect address defaults for App Timeline Service. (Bob Nettleton via mahadev)
Repository: ambari Updated Branches: refs/heads/branch-1.7.0 ae89c -> f12efbef2 AMBARI-8217. HDP 2.1 Stack includes incorrect address defaults for App Timeline Service. (Bob Nettleton via mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f12efbef Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f12efbef Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f12efbef Branch: refs/heads/branch-1.7.0 Commit: f12efbef223f887c5adbc45de0b3d07c83b43ad0 Parents: ae8 Author: Mahadev Konar Authored: Fri Nov 7 15:39:48 2014 -0800 Committer: Mahadev Konar Committed: Fri Nov 7 15:43:23 2014 -0800 -- .../stacks/HDP/2.1/services/YARN/configuration/yarn-site.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/f12efbef/ambari-server/src/main/resources/stacks/HDP/2.1/services/YARN/configuration/yarn-site.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.1/services/YARN/configuration/yarn-site.xml b/ambari-server/src/main/resources/stacks/HDP/2.1/services/YARN/configuration/yarn-site.xml index dd67eb3..e9f5c3c 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.1/services/YARN/configuration/yarn-site.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.1/services/YARN/configuration/yarn-site.xml @@ -373,7 +373,7 @@ yarn.timeline-service.webapp.address -0.0.0.0:8188 +localhost:8188 The http address of the timeline service web application. @@ -381,7 +381,7 @@ yarn.timeline-service.webapp.https.address -0.0.0.0:8190 +localhost:8190 The http address of the timeline service web application. @@ -389,7 +389,7 @@ yarn.timeline-service.address -0.0.0.0:10200 +localhost:10200 This is default address for the timeline server to start the RPC server.
ambari git commit: Revert "AMBARI-8216. Change hive settings to configure transactions. With some yarn-site changes. (swagle)"
Repository: ambari Updated Branches: refs/heads/branch-1.7.0 31c96b840 -> aaf7bcbe3 Revert "AMBARI-8216. Change hive settings to configure transactions. With some yarn-site changes. (swagle)" This reverts commit 38c1ab8b6c6a56fc01d802095b0af142a1ff9dca. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/aaf7bcbe Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/aaf7bcbe Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/aaf7bcbe Branch: refs/heads/branch-1.7.0 Commit: aaf7bcbe352c2af52d0be8a18f1739e06b11e5c8 Parents: 31c96b8 Author: Mahadev Konar Authored: Fri Nov 7 17:41:53 2014 -0800 Committer: Mahadev Konar Committed: Fri Nov 7 17:42:40 2014 -0800 -- .../services/HIVE/configuration/hive-site.xml | 18 + .../services/YARN/configuration/yarn-site.xml | 76 ++-- 2 files changed, 23 insertions(+), 71 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/aaf7bcbe/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml index 12b4612..2e0e12f 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml @@ -221,11 +221,10 @@ limitations under the License. hive.exec.dynamic.partition.mode -nonstrict +strict In strict mode, the user must specify at least one static partition in case the user accidentally overwrites all partitions. - NonStrict allows all partitions of a table to be dynamic. @@ -661,21 +660,6 @@ limitations under the License. - -hive.support.concurrency -false - - Support concurrency and use locks, needed for Transactions. Requires Zookeeper. - - - - -hive.cli.print.header -false - - Whether to print the names of the columns in query output. - - hive.compactor.worker.timeout http://git-wip-us.apache.org/repos/asf/ambari/blob/aaf7bcbe/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration/yarn-site.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration/yarn-site.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration/yarn-site.xml index be96c64..b4f6558 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration/yarn-site.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration/yarn-site.xml @@ -42,16 +42,13 @@ yarn.nodemanager.recovery.enabled -true -Enable the node manager to recover after starting +1 + yarn.nodemanager.recovery.dir /hadoop/yarn/yarn-nm-recovery - - The local filesystem directory in which the node manager will store - state when recovery is enabled. - + yarn.client.nodemanager-connect.retry-interval-ms @@ -65,28 +62,18 @@ yarn.resourcemanager.recovery.enabled -true - - Enable RM to recover state after starting. - If true, then yarn.resourcemanager.store.class must be specified. - +1 + yarn.resourcemanager.work-preserving-recovery.enabled -true - - Enable RM work preserving recovery. This configuration is private to YARN for experimenting the feature. - +1 + yarn.resourcemanager.store.class org.apache.hadoop.yarn.server.resourcemanager.recovery.ZKRMStateStore - - The class to use as the persistent store. - If org.apache.hadoop.yarn.server.resourcemanager.recovery.ZKRMStateStore is used, - the store is implicitly fenced; meaning a single ResourceManager - is able to use the store at any point in time. - + yarn.resourcemanager.zk-address @@ -156,7 +143,7 @@ yarn.resourcemanager.ha.enabled -false +0 enable RM HA or not @@ -171,12 +158,12 @@ yarn.nodemanager.linux-container-executor.cgroups.mount -true +1 If true, YARN will automount the CGroup, however the directory needs to already exist; else, the cgroup should be mounted by the admin yarn.nodemanager.linux-container-executor.cgroups.strict-resource-usage -false +0 Strictly limit CPU resource usage to allocated usage even if spare CPU is available @@ -
ambari git commit: Revert "AMBARI-8216. Change hive settings to configure transactions. With some yarn-site changes. (swagle)"
Repository: ambari Updated Branches: refs/heads/trunk 9e9071356 -> f9532293b Revert "AMBARI-8216. Change hive settings to configure transactions. With some yarn-site changes. (swagle)" This reverts commit 7c648f7796bd6c73918302032f7feb98cc1f3790. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f9532293 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f9532293 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f9532293 Branch: refs/heads/trunk Commit: f9532293bafca45ebb665d6bee8d591c210cdf17 Parents: 9e90713 Author: Mahadev Konar Authored: Fri Nov 7 17:43:21 2014 -0800 Committer: Mahadev Konar Committed: Fri Nov 7 17:43:21 2014 -0800 -- .../services/HIVE/configuration/hive-site.xml | 18 + .../services/YARN/configuration/yarn-site.xml | 76 ++-- 2 files changed, 23 insertions(+), 71 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/f9532293/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml index 12b4612..2e0e12f 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml @@ -221,11 +221,10 @@ limitations under the License. hive.exec.dynamic.partition.mode -nonstrict +strict In strict mode, the user must specify at least one static partition in case the user accidentally overwrites all partitions. - NonStrict allows all partitions of a table to be dynamic. @@ -661,21 +660,6 @@ limitations under the License. - -hive.support.concurrency -false - - Support concurrency and use locks, needed for Transactions. Requires Zookeeper. - - - - -hive.cli.print.header -false - - Whether to print the names of the columns in query output. - - hive.compactor.worker.timeout http://git-wip-us.apache.org/repos/asf/ambari/blob/f9532293/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration/yarn-site.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration/yarn-site.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration/yarn-site.xml index be96c64..b4f6558 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration/yarn-site.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration/yarn-site.xml @@ -42,16 +42,13 @@ yarn.nodemanager.recovery.enabled -true -Enable the node manager to recover after starting +1 + yarn.nodemanager.recovery.dir /hadoop/yarn/yarn-nm-recovery - - The local filesystem directory in which the node manager will store - state when recovery is enabled. - + yarn.client.nodemanager-connect.retry-interval-ms @@ -65,28 +62,18 @@ yarn.resourcemanager.recovery.enabled -true - - Enable RM to recover state after starting. - If true, then yarn.resourcemanager.store.class must be specified. - +1 + yarn.resourcemanager.work-preserving-recovery.enabled -true - - Enable RM work preserving recovery. This configuration is private to YARN for experimenting the feature. - +1 + yarn.resourcemanager.store.class org.apache.hadoop.yarn.server.resourcemanager.recovery.ZKRMStateStore - - The class to use as the persistent store. - If org.apache.hadoop.yarn.server.resourcemanager.recovery.ZKRMStateStore is used, - the store is implicitly fenced; meaning a single ResourceManager - is able to use the store at any point in time. - + yarn.resourcemanager.zk-address @@ -156,7 +143,7 @@ yarn.resourcemanager.ha.enabled -false +0 enable RM HA or not @@ -171,12 +158,12 @@ yarn.nodemanager.linux-container-executor.cgroups.mount -true +1 If true, YARN will automount the CGroup, however the directory needs to already exist; else, the cgroup should be mounted by the admin yarn.nodemanager.linux-container-executor.cgroups.strict-resource-usage -false +0 Strictly limit CPU resource usage to allocated usage even if spare CPU is available @@ -
[1/2] ambari git commit: Fix Hive test
Repository: ambari Updated Branches: refs/heads/branch-1.7.0 bf671fef2 -> f99b49c82 Fix Hive test Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d5d5dd9c Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d5d5dd9c Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d5d5dd9c Branch: refs/heads/branch-1.7.0 Commit: d5d5dd9c6ec783d16a866519715119a019c9e0f6 Parents: bf671fe Author: Mahadev Konar Authored: Fri Nov 7 22:38:51 2014 -0800 Committer: Mahadev Konar Committed: Sat Nov 8 01:44:03 2014 -0800 -- .../services/HIVE/package/scripts/service_check.py | 15 --- 1 file changed, 15 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/d5d5dd9c/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/service_check.py -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/service_check.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/service_check.py index bd7537b..d665da5 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/service_check.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/service_check.py @@ -34,21 +34,6 @@ class HiveServiceCheck(Script): port=int(format("{hive_server_port}")) print "Test connectivity to hive server" -if params.security_enabled: - kinitcmd=format("{kinit_path_local} -kt {smoke_user_keytab} {smokeuser}; ") -else: - kinitcmd=None - -try: - check_thrift_port_sasl(address, port, params.hive_server2_authentication, - params.hive_server_principal, kinitcmd) - print "Successfully connected to %s on port %s" % (address, port) -except: - print "Connection to %s on port %s failed" % (address, port) - exit(1) - -hcat_service_check() -webhcat_service_check() if __name__ == "__main__": HiveServiceCheck().execute()
[2/2] ambari git commit: AMBARI-8227. Fix hive service check for Beeline. (mahadev)
AMBARI-8227. Fix hive service check for Beeline. (mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f99b49c8 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f99b49c8 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f99b49c8 Branch: refs/heads/branch-1.7.0 Commit: f99b49c8251e9c5fed0210f3daab43b09dcbe28f Parents: d5d5dd9 Author: Mahadev Konar Authored: Sat Nov 8 01:47:23 2014 -0800 Committer: Mahadev Konar Committed: Sat Nov 8 01:47:23 2014 -0800 -- .../libraries/functions/hive_check.py | 2 +- .../HIVE/package/scripts/hive_service.py| 31 --- .../HIVE/package/scripts/hive_service.py| 32 .../stacks/1.3.2/HIVE/test_hive_server.py | 9 -- .../1.3.2/HIVE/test_hive_service_check.py | 4 +-- .../stacks/2.0.6/HIVE/test_hive_server.py | 5 --- .../2.0.6/HIVE/test_hive_service_check.py | 2 +- 7 files changed, 4 insertions(+), 81 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/f99b49c8/ambari-common/src/main/python/resource_management/libraries/functions/hive_check.py -- diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/hive_check.py b/ambari-common/src/main/python/resource_management/libraries/functions/hive_check.py index 77a36e6..9e6087f 100644 --- a/ambari-common/src/main/python/resource_management/libraries/functions/hive_check.py +++ b/ambari-common/src/main/python/resource_management/libraries/functions/hive_check.py @@ -26,7 +26,7 @@ def check_thrift_port_sasl(address, port, hive_auth = "NOSASL", key = None, kini """ Hive thrift SASL port check """ - BEELINE_CHECK_TIMEOUT = 7 + BEELINE_CHECK_TIMEOUT = 30 if kinitcmd: url = format("jdbc:hive2://{address}:{port}/;principal={key}") http://git-wip-us.apache.org/repos/asf/ambari/blob/f99b49c8/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HIVE/package/scripts/hive_service.py -- diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HIVE/package/scripts/hive_service.py b/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HIVE/package/scripts/hive_service.py index 33bfd79..09f49c0 100644 --- a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HIVE/package/scripts/hive_service.py +++ b/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HIVE/package/scripts/hive_service.py @@ -57,38 +57,7 @@ def hive_service( Execute(db_connection_check_command, path='/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin', tries=5, try_sleep=10) -# AMBARI-5800 - wait for the server to come up instead of just the PID existance -if name == 'hiveserver2': - SOCKET_WAIT_SECONDS = 120 - address=params.hive_server_host - port=int(params.hive_server_port) - - start_time = time.time() - end_time = start_time + SOCKET_WAIT_SECONDS - - is_service_socket_valid = False - print "Waiting for the Hive server to start..." - if params.security_enabled: -kinitcmd=format("{kinit_path_local} -kt {smoke_user_keytab} {smokeuser}; ") - else: -kinitcmd=None - - while time.time() < end_time: -try: - check_thrift_port_sasl(address, port, params.hive_server2_authentication, - params.hive_server_principal, kinitcmd) - is_service_socket_valid = True - break -except: - time.sleep(2) - elapsed_time = time.time() - start_time - - if is_service_socket_valid == False: -raise Fail("Connection to Hive server %s on port %s failed after %d seconds" % (address, port, elapsed_time)) - - print "Successfully connected to Hive at %s on port %s after %d seconds" % (address, port, elapsed_time) - elif action == 'stop': demon_cmd = format("kill `cat {pid_file}` >/dev/null 2>&1 && rm -f {pid_file}") Execute(demon_cmd, http://git-wip-us.apache.org/repos/asf/ambari/blob/f99b49c8/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/hive_service.py -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/hive_service.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/hive_service.py index 54de40a..7a26beb 100644 --- a/ambari-server/src/main/resource
ambari git commit: Revert "Fix Hive test"
Repository: ambari Updated Branches: refs/heads/branch-1.7.0 f99b49c82 -> 5002575ba Revert "Fix Hive test" This reverts commit d5d5dd9c6ec783d16a866519715119a019c9e0f6. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5002575b Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5002575b Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5002575b Branch: refs/heads/branch-1.7.0 Commit: 5002575ba67eff2296d9c50a400f99e5ef0d60fc Parents: f99b49c Author: Mahadev Konar Authored: Sat Nov 8 01:51:00 2014 -0800 Committer: Mahadev Konar Committed: Sat Nov 8 01:51:00 2014 -0800 -- .../services/HIVE/package/scripts/service_check.py | 15 +++ 1 file changed, 15 insertions(+) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/5002575b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/service_check.py -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/service_check.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/service_check.py index d665da5..bd7537b 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/service_check.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/service_check.py @@ -34,6 +34,21 @@ class HiveServiceCheck(Script): port=int(format("{hive_server_port}")) print "Test connectivity to hive server" +if params.security_enabled: + kinitcmd=format("{kinit_path_local} -kt {smoke_user_keytab} {smokeuser}; ") +else: + kinitcmd=None + +try: + check_thrift_port_sasl(address, port, params.hive_server2_authentication, + params.hive_server_principal, kinitcmd) + print "Successfully connected to %s on port %s" % (address, port) +except: + print "Connection to %s on port %s failed" % (address, port) + exit(1) + +hcat_service_check() +webhcat_service_check() if __name__ == "__main__": HiveServiceCheck().execute()
ambari git commit: AMBARI-8337. Add wizard hangs adding hosts with NPE. (Nate via mahadev)
Repository: ambari Updated Branches: refs/heads/branch-1.7.0 1901f2a70 -> 56beaef95 AMBARI-8337. Add wizard hangs adding hosts with NPE. (Nate via mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/56beaef9 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/56beaef9 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/56beaef9 Branch: refs/heads/branch-1.7.0 Commit: 56beaef955adb4cc5a0dca2cb0378871dfb50039 Parents: 1901f2a Author: Mahadev Konar Authored: Fri Nov 14 15:48:39 2014 -0800 Committer: Mahadev Konar Committed: Fri Nov 14 15:48:39 2014 -0800 -- .../main/java/org/apache/ambari/server/state/host/HostImpl.java| 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/56beaef9/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java index 619859c..098a7a4 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java @@ -121,7 +121,7 @@ public class HostImpl implements Host { // In-memory status, based on host components states - private String status; + private String status = HealthStatus.UNKNOWN.name(); // In-memory prefix of log file paths that is retrieved when the agent registers with the server private String prefix;
ambari git commit: AMBARI-8337. Add wizard hangs adding hosts with NPE. (Nate via mahadev)
Repository: ambari Updated Branches: refs/heads/trunk c7aea4b32 -> 135b00e22 AMBARI-8337. Add wizard hangs adding hosts with NPE. (Nate via mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/135b00e2 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/135b00e2 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/135b00e2 Branch: refs/heads/trunk Commit: 135b00e22cd116ee54413ef8acc049a1ac75ad32 Parents: c7aea4b Author: Mahadev Konar Authored: Fri Nov 14 15:48:39 2014 -0800 Committer: Mahadev Konar Committed: Fri Nov 14 15:49:20 2014 -0800 -- .../main/java/org/apache/ambari/server/state/host/HostImpl.java| 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/135b00e2/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java index 53f5f40..9ba38eb 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java @@ -121,7 +121,7 @@ public class HostImpl implements Host { private Map maintMap = null; // In-memory status, based on host components states - private String status; + private String status = HealthStatus.UNKNOWN.name(); // In-memory prefix of log file paths that is retrieved when the agent registers with the server private String prefix;
ambari git commit: AMBARI-8333. Ambari-agent restart fails on Ubuntu. (aonishuk)
Repository: ambari Updated Branches: refs/heads/branch-1.7.0 283cbae8d -> 0e25a431b AMBARI-8333. Ambari-agent restart fails on Ubuntu. (aonishuk) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0e25a431 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0e25a431 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0e25a431 Branch: refs/heads/branch-1.7.0 Commit: 0e25a431b8c840cdb6455147108289e787035271 Parents: 283cbae Author: Andrew Onishuk Authored: Fri Nov 14 15:08:41 2014 +0200 Committer: Mahadev Konar Committed: Sat Nov 15 10:15:56 2014 -0800 -- ambari-agent/src/main/python/ambari_agent/main.py | 6 +++--- ambari-agent/src/test/python/ambari_agent/TestMain.py | 8 2 files changed, 7 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/0e25a431/ambari-agent/src/main/python/ambari_agent/main.py -- diff --git a/ambari-agent/src/main/python/ambari_agent/main.py b/ambari-agent/src/main/python/ambari_agent/main.py index 5d33ca4..341df3e 100644 --- a/ambari-agent/src/main/python/ambari_agent/main.py +++ b/ambari-agent/src/main/python/ambari_agent/main.py @@ -168,16 +168,16 @@ def stop_agent(): pid = f.read() pid = int(pid) f.close() -os.kill(pid, signal.SIGTERM) +os.killpg(os.getpgid(pid), signal.SIGTERM) time.sleep(5) if os.path.exists(ProcessHelper.pidfile): raise Exception("PID file still exists.") os._exit(0) - except Exception, err: + except Exception: if pid == -1: print ("Agent process is not running") else: - os.kill(pid, signal.SIGKILL) + os.killpg(os.getpgid(pid), signal.SIGKILL) os._exit(1) http://git-wip-us.apache.org/repos/asf/ambari/blob/0e25a431/ambari-agent/src/test/python/ambari_agent/TestMain.py -- diff --git a/ambari-agent/src/test/python/ambari_agent/TestMain.py b/ambari-agent/src/test/python/ambari_agent/TestMain.py index 7b1a8c8..4e1a5e7 100644 --- a/ambari-agent/src/test/python/ambari_agent/TestMain.py +++ b/ambari-agent/src/test/python/ambari_agent/TestMain.py @@ -189,7 +189,7 @@ class TestMain(unittest.TestCase): @patch("time.sleep") - @patch("os.kill") + @patch("os.killpg") @patch("os._exit") @patch("os.path.exists") def test_daemonize_and_stop(self, exists_mock, _exit_mock, kill_mock, sleep_mock): @@ -207,7 +207,7 @@ class TestMain(unittest.TestCase): # Testing normal exit exists_mock.return_value = False main.stop_agent() -kill_mock.assert_called_with(int(pid), signal.SIGTERM) +kill_mock.assert_called_with(os.getpgid(int(pid)), signal.SIGTERM) _exit_mock.assert_called_with(0) # Restore @@ -217,8 +217,8 @@ class TestMain(unittest.TestCase): # Testing exit when failed to remove pid file exists_mock.return_value = True main.stop_agent() -kill_mock.assert_any_call(int(pid), signal.SIGTERM) -kill_mock.assert_any_call(int(pid), signal.SIGKILL) +kill_mock.assert_any_call(os.getpgid(int(pid)), signal.SIGTERM) +kill_mock.assert_any_call(os.getpgid(int(pid)), signal.SIGKILL) _exit_mock.assert_called_with(1) # Restore
ambari git commit: Revert "AMBARI-8333. Ambari-agent restart fails on Ubuntu. (aonishuk)"
Repository: ambari Updated Branches: refs/heads/branch-1.7.0 92037a7f3 -> 6db439f44 Revert "AMBARI-8333. Ambari-agent restart fails on Ubuntu. (aonishuk)" This reverts commit 0e25a431b8c840cdb6455147108289e787035271. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6db439f4 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6db439f4 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6db439f4 Branch: refs/heads/branch-1.7.0 Commit: 6db439f44fda673aa7bb3f4602ed0a6ddbe2701d Parents: 92037a7 Author: Mahadev Konar Authored: Sun Nov 16 12:17:04 2014 -0800 Committer: Mahadev Konar Committed: Sun Nov 16 12:17:04 2014 -0800 -- ambari-agent/src/main/python/ambari_agent/main.py | 6 +++--- ambari-agent/src/test/python/ambari_agent/TestMain.py | 8 2 files changed, 7 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/6db439f4/ambari-agent/src/main/python/ambari_agent/main.py -- diff --git a/ambari-agent/src/main/python/ambari_agent/main.py b/ambari-agent/src/main/python/ambari_agent/main.py index 341df3e..5d33ca4 100644 --- a/ambari-agent/src/main/python/ambari_agent/main.py +++ b/ambari-agent/src/main/python/ambari_agent/main.py @@ -168,16 +168,16 @@ def stop_agent(): pid = f.read() pid = int(pid) f.close() -os.killpg(os.getpgid(pid), signal.SIGTERM) +os.kill(pid, signal.SIGTERM) time.sleep(5) if os.path.exists(ProcessHelper.pidfile): raise Exception("PID file still exists.") os._exit(0) - except Exception: + except Exception, err: if pid == -1: print ("Agent process is not running") else: - os.killpg(os.getpgid(pid), signal.SIGKILL) + os.kill(pid, signal.SIGKILL) os._exit(1) http://git-wip-us.apache.org/repos/asf/ambari/blob/6db439f4/ambari-agent/src/test/python/ambari_agent/TestMain.py -- diff --git a/ambari-agent/src/test/python/ambari_agent/TestMain.py b/ambari-agent/src/test/python/ambari_agent/TestMain.py index 4e1a5e7..7b1a8c8 100644 --- a/ambari-agent/src/test/python/ambari_agent/TestMain.py +++ b/ambari-agent/src/test/python/ambari_agent/TestMain.py @@ -189,7 +189,7 @@ class TestMain(unittest.TestCase): @patch("time.sleep") - @patch("os.killpg") + @patch("os.kill") @patch("os._exit") @patch("os.path.exists") def test_daemonize_and_stop(self, exists_mock, _exit_mock, kill_mock, sleep_mock): @@ -207,7 +207,7 @@ class TestMain(unittest.TestCase): # Testing normal exit exists_mock.return_value = False main.stop_agent() -kill_mock.assert_called_with(os.getpgid(int(pid)), signal.SIGTERM) +kill_mock.assert_called_with(int(pid), signal.SIGTERM) _exit_mock.assert_called_with(0) # Restore @@ -217,8 +217,8 @@ class TestMain(unittest.TestCase): # Testing exit when failed to remove pid file exists_mock.return_value = True main.stop_agent() -kill_mock.assert_any_call(os.getpgid(int(pid)), signal.SIGTERM) -kill_mock.assert_any_call(os.getpgid(int(pid)), signal.SIGKILL) +kill_mock.assert_any_call(int(pid), signal.SIGTERM) +kill_mock.assert_any_call(int(pid), signal.SIGKILL) _exit_mock.assert_called_with(1) # Restore
ambari git commit: Revert "AMBARI-8333. Ambari-agent restart fails on Ubuntu. (aonishuk)"
Repository: ambari Updated Branches: refs/heads/trunk d5dae8730 -> c8f8045e0 Revert "AMBARI-8333. Ambari-agent restart fails on Ubuntu. (aonishuk)" This reverts commit 02f535cf9ff204dd53f7d78272c07eb33ac4b532. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c8f8045e Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c8f8045e Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c8f8045e Branch: refs/heads/trunk Commit: c8f8045e0c18af0b1872912354c1bc56673aa82c Parents: d5dae87 Author: Mahadev Konar Authored: Sun Nov 16 12:19:20 2014 -0800 Committer: Mahadev Konar Committed: Sun Nov 16 12:19:20 2014 -0800 -- ambari-agent/src/main/python/ambari_agent/main.py | 6 +++--- ambari-agent/src/test/python/ambari_agent/TestMain.py | 8 2 files changed, 7 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/c8f8045e/ambari-agent/src/main/python/ambari_agent/main.py -- diff --git a/ambari-agent/src/main/python/ambari_agent/main.py b/ambari-agent/src/main/python/ambari_agent/main.py index 84182c0..e43d901 100644 --- a/ambari-agent/src/main/python/ambari_agent/main.py +++ b/ambari-agent/src/main/python/ambari_agent/main.py @@ -153,16 +153,16 @@ def stop_agent(): pid = f.read() pid = int(pid) f.close() -os.killpg(os.getpgid(pid), signal.SIGTERM) +os.kill(pid, signal.SIGTERM) time.sleep(5) if os.path.exists(ProcessHelper.pidfile): raise Exception("PID file still exists.") os._exit(0) - except Exception: + except Exception, err: if pid == -1: print ("Agent process is not running") else: - os.killpg(os.getpgid(pid), signal.SIGKILL) + os.kill(pid, signal.SIGKILL) os._exit(1) def reset_agent(options): http://git-wip-us.apache.org/repos/asf/ambari/blob/c8f8045e/ambari-agent/src/test/python/ambari_agent/TestMain.py -- diff --git a/ambari-agent/src/test/python/ambari_agent/TestMain.py b/ambari-agent/src/test/python/ambari_agent/TestMain.py index 55901b5..bb75bac 100644 --- a/ambari-agent/src/test/python/ambari_agent/TestMain.py +++ b/ambari-agent/src/test/python/ambari_agent/TestMain.py @@ -189,7 +189,7 @@ class TestMain(unittest.TestCase): @patch("time.sleep") - @patch("os.killpg") + @patch("os.kill") @patch("os._exit") @patch("os.path.exists") def test_daemonize_and_stop(self, exists_mock, _exit_mock, kill_mock, sleep_mock): @@ -207,7 +207,7 @@ class TestMain(unittest.TestCase): # Testing normal exit exists_mock.return_value = False main.stop_agent() -kill_mock.assert_called_with(os.getpgid(int(pid)), signal.SIGTERM) +kill_mock.assert_called_with(int(pid), signal.SIGTERM) _exit_mock.assert_called_with(0) # Restore @@ -217,8 +217,8 @@ class TestMain(unittest.TestCase): # Testing exit when failed to remove pid file exists_mock.return_value = True main.stop_agent() -kill_mock.assert_any_call(os.getpgid(int(pid)), signal.SIGTERM) -kill_mock.assert_any_call(os.getpgid(int(pid)), signal.SIGKILL) +kill_mock.assert_any_call(int(pid), signal.SIGTERM) +kill_mock.assert_any_call(int(pid), signal.SIGKILL) _exit_mock.assert_called_with(1) # Restore
ambari git commit: AMBARI-8378. Flume version is incorrect in HDP 2.2 stack. (mahadev)
Repository: ambari Updated Branches: refs/heads/branch-1.7.0 df306cfc7 -> 6edd9aae5 AMBARI-8378. Flume version is incorrect in HDP 2.2 stack. (mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6edd9aae Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6edd9aae Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6edd9aae Branch: refs/heads/branch-1.7.0 Commit: 6edd9aae509e94f73cc406faa28492fd11e3f1e2 Parents: df306cf Author: Mahadev Konar Authored: Tue Nov 18 15:23:47 2014 -0800 Committer: Mahadev Konar Committed: Tue Nov 18 15:23:47 2014 -0800 -- .../src/main/resources/stacks/HDP/2.2/services/FLUME/metainfo.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/6edd9aae/ambari-server/src/main/resources/stacks/HDP/2.2/services/FLUME/metainfo.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/FLUME/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/services/FLUME/metainfo.xml index 4293a60..c5b38b3 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/FLUME/metainfo.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/FLUME/metainfo.xml @@ -21,7 +21,7 @@ FLUME Flume - 1.5.1.2.2.0.0 + 1.5.2.2.2.0.0
ambari git commit: AMBARI-8378. Flume version is incorrect in HDP 2.2 stack. (mahadev)
Repository: ambari Updated Branches: refs/heads/trunk 4ca08bbe4 -> 3d9962970 AMBARI-8378. Flume version is incorrect in HDP 2.2 stack. (mahadev) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3d996297 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3d996297 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3d996297 Branch: refs/heads/trunk Commit: 3d99629705a8ea59f8fce91fa3e64728f9ed5de1 Parents: 4ca08bb Author: Mahadev Konar Authored: Tue Nov 18 15:23:47 2014 -0800 Committer: Mahadev Konar Committed: Tue Nov 18 15:24:20 2014 -0800 -- .../src/main/resources/stacks/HDP/2.2/services/FLUME/metainfo.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/3d996297/ambari-server/src/main/resources/stacks/HDP/2.2/services/FLUME/metainfo.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/FLUME/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/services/FLUME/metainfo.xml index 4293a60..c5b38b3 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/FLUME/metainfo.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/FLUME/metainfo.xml @@ -21,7 +21,7 @@ FLUME Flume - 1.5.1.2.2.0.0 + 1.5.2.2.2.0.0
[1/3] Removing the stack from 1.4.2
Updated Branches: refs/heads/branch-1.4.2 292b58e38 -> c4a111571 http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/c4a11157/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/ZOOKEEPER/configuration/global.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/ZOOKEEPER/configuration/global.xml b/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/ZOOKEEPER/configuration/global.xml deleted file mode 100644 index f78df89..000 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/ZOOKEEPER/configuration/global.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - -zk_user -zookeeper -ZooKeeper User. - - -zookeeperserver_host - -ZooKeeper Server Hosts. - - -zk_data_dir -/hadoop/zookeeper -Data directory for ZooKeeper. - - -zk_log_dir -/var/log/zookeeper -ZooKeeper Log Dir - - -zk_pid_dir -/var/run/zookeeper -ZooKeeper Pid Dir - - -zk_pid_file -/var/run/zookeeper/zookeeper_server.pid -ZooKeeper Pid File - - -tickTime -2000 -The length of a single tick in milliseconds, which is the basic time unit used by ZooKeeper - - -initLimit -10 -Ticks to allow for sync at Init. - - -syncLimit -5 -Ticks to allow for sync at Runtime. - - -clientPort -2181 -Port for running ZK Server. - - - http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/c4a11157/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/ZOOKEEPER/metainfo.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/ZOOKEEPER/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/ZOOKEEPER/metainfo.xml deleted file mode 100644 index c9afa00..000 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/ZOOKEEPER/metainfo.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - -root -Centralized service which provides highly reliable distributed coordination -3.4.5.2.0.8.0 - - - -ZOOKEEPER_SERVER -MASTER - - - -ZOOKEEPER_CLIENT -CLIENT - - - -
git commit: AMBARI-3681. Provide TVI rules for service start for SLA quantification. (Artem Baranchuk via mahadev)
Updated Branches: refs/heads/branch-1.4.2 1b63b3b8f -> 38d5399c9 AMBARI-3681. Provide TVI rules for service start for SLA quantification. (Artem Baranchuk via mahadev) Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/38d5399c Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/38d5399c Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/38d5399c Branch: refs/heads/branch-1.4.2 Commit: 38d5399c9eac9cefb454617fb0acd9cb6bdbe68e Parents: 1b63b3b Author: Mahadev Konar Authored: Fri Nov 22 14:55:43 2013 -0800 Committer: Mahadev Konar Committed: Fri Nov 22 14:58:00 2013 -0800 -- .../hdp-nagios/templates/contacts.cfg.erb | 25 ++- .../templates/hadoop-commands.cfg.erb | 10 ++ .../templates/hadoop-services.cfg.erb | 8 +- .../src/addOns/nagios/plugins/sys_logger.py | 95 --- .../test/nagios/plugins/test_sys_logger.py | 167 +++ 5 files changed, 271 insertions(+), 34 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/38d5399c/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/contacts.cfg.erb -- diff --git a/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/contacts.cfg.erb b/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/contacts.cfg.erb index e967457..ee6f09e 100644 --- a/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/contacts.cfg.erb +++ b/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/contacts.cfg.erb @@ -49,14 +49,29 @@ # template which is defined elsewhere. define contact{ -contact_name <%=scope.function_hdp_template_var("nagios_web_login")%> ; Short name of user - use generic-contact ; Inherit default values from generic-contact template (defined above) -alias Nagios Admin ; Full name of user +contact_name <%=scope.function_hdp_template_var("nagios_web_login")%>; Short name of user +use generic-contact ; Inherit default values from generic-contact template (defined above) +alias Nagios Admin ; Full name of user email <%=scope.function_hdp_template_var("nagios_contact")%> ; <<* CHANGE THIS TO YOUR EMAIL ADDRESS ** } - +# Contact which writes all Nagios alerts to the system logger. +define contact{ +contact_namesys_logger ; Short name of user +use generic-contact; Inherit default values from generic-contact template (defined above) +alias System Logger ; Full name of user +host_notifications_enabled 1 +service_notifications_enabled 1 +service_notification_period 24x7 +host_notification_period24x7 +service_notification_optionsw,u,c,r,s +host_notification_options d,u,r,s +can_submit_commands 1 +retain_status_information 1 +service_notification_commands service_sys_logger +host_notification_commands host_sys_logger +} ### ### @@ -72,5 +87,5 @@ define contact{ define contactgroup { contactgroup_name admins alias Nagios Administrators -members <%=scope.function_hdp_template_var("nagios_web_login")%> +members <%=scope.function_hdp_template_var("nagios_web_login")%>,sys_logger } http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/38d5399c/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/hadoop-commands.cfg.erb -- diff --git a/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/hadoop-commands.cfg.erb b/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/hadoop-commands.cfg.erb index ca1585b..e49199b 100644 --- a/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/hadoop-commands.cfg.erb +++ b/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/hadoop-commands.cfg.erb @@ -102,3 +102,13 @@ define command{ command_namecheck_nodemanager_health command_line$USER1$/check_nodem
[1/2] git commit: AMBARI-3681. Provide TVI rules for service start for SLA quantification. (Artem Baranchuk via mahadev)
Updated Branches: refs/heads/trunk 87bf327a7 -> f071cc6c0 AMBARI-3681. Provide TVI rules for service start for SLA quantification. (Artem Baranchuk via mahadev) Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/37565def Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/37565def Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/37565def Branch: refs/heads/trunk Commit: 37565defb6a417607d7b911a462928e6b771893b Parents: 87bf327 Author: Mahadev Konar Authored: Fri Nov 22 14:55:43 2013 -0800 Committer: Mahadev Konar Committed: Fri Nov 22 14:55:43 2013 -0800 -- .../hdp-nagios/templates/contacts.cfg.erb | 25 ++- .../templates/hadoop-commands.cfg.erb | 10 ++ .../templates/hadoop-services.cfg.erb | 8 +- .../src/addOns/nagios/plugins/sys_logger.py | 95 --- .../test/nagios/plugins/test_sys_logger.py | 167 +++ 5 files changed, 271 insertions(+), 34 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/37565def/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/contacts.cfg.erb -- diff --git a/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/contacts.cfg.erb b/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/contacts.cfg.erb index e967457..ee6f09e 100644 --- a/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/contacts.cfg.erb +++ b/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/contacts.cfg.erb @@ -49,14 +49,29 @@ # template which is defined elsewhere. define contact{ -contact_name <%=scope.function_hdp_template_var("nagios_web_login")%> ; Short name of user - use generic-contact ; Inherit default values from generic-contact template (defined above) -alias Nagios Admin ; Full name of user +contact_name <%=scope.function_hdp_template_var("nagios_web_login")%>; Short name of user +use generic-contact ; Inherit default values from generic-contact template (defined above) +alias Nagios Admin ; Full name of user email <%=scope.function_hdp_template_var("nagios_contact")%> ; <<* CHANGE THIS TO YOUR EMAIL ADDRESS ** } - +# Contact which writes all Nagios alerts to the system logger. +define contact{ +contact_namesys_logger ; Short name of user +use generic-contact; Inherit default values from generic-contact template (defined above) +alias System Logger ; Full name of user +host_notifications_enabled 1 +service_notifications_enabled 1 +service_notification_period 24x7 +host_notification_period24x7 +service_notification_optionsw,u,c,r,s +host_notification_options d,u,r,s +can_submit_commands 1 +retain_status_information 1 +service_notification_commands service_sys_logger +host_notification_commands host_sys_logger +} ### ### @@ -72,5 +87,5 @@ define contact{ define contactgroup { contactgroup_name admins alias Nagios Administrators -members <%=scope.function_hdp_template_var("nagios_web_login")%> +members <%=scope.function_hdp_template_var("nagios_web_login")%>,sys_logger } http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/37565def/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/hadoop-commands.cfg.erb -- diff --git a/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/hadoop-commands.cfg.erb b/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/hadoop-commands.cfg.erb index ca1585b..e49199b 100644 --- a/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/hadoop-commands.cfg.erb +++ b/ambari-agent/src/main/puppet/modules/hdp-nagios/templates/hadoop-commands.cfg.erb @@ -102,3 +102,13 @@ define command{ command_namecheck_nodemanager_health command_line$USER1$/check_nodemanager_health.sh $H
[2/2] git commit: AMBARI-3814. Enable data locality in YARN. (mahadev)
AMBARI-3814. Enable data locality in YARN. (mahadev) Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/f071cc6c Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/f071cc6c Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/f071cc6c Branch: refs/heads/trunk Commit: f071cc6c0fe10581fd982f015cf868c6ab0a201e Parents: 37565de Author: Mahadev Konar Authored: Fri Nov 22 15:02:29 2013 -0800 Committer: Mahadev Konar Committed: Fri Nov 22 15:02:29 2013 -0800 -- .../2.0.6/services/YARN/configuration/capacity-scheduler.xml | 8 .../2.0.8/services/YARN/configuration/capacity-scheduler.xml | 8 2 files changed, 16 insertions(+) -- http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/f071cc6c/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/configuration/capacity-scheduler.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/configuration/capacity-scheduler.xml b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/configuration/capacity-scheduler.xml index ccfb779..4a19779 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/configuration/capacity-scheduler.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/configuration/capacity-scheduler.xml @@ -116,5 +116,13 @@ No description + +yarn.scheduler.capacity.node-locality-delay +40 + + No description + + + http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/f071cc6c/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/YARN/configuration/capacity-scheduler.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/YARN/configuration/capacity-scheduler.xml b/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/YARN/configuration/capacity-scheduler.xml index ccfb779..4a19779 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/YARN/configuration/capacity-scheduler.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.8/services/YARN/configuration/capacity-scheduler.xml @@ -116,5 +116,13 @@ No description + +yarn.scheduler.capacity.node-locality-delay +40 + + No description + + +
git commit: AMBARI-3814. Enable data locality in YARN. (mahadev)
Updated Branches: refs/heads/branch-1.4.2 38d5399c9 -> f2406bc77 AMBARI-3814. Enable data locality in YARN. (mahadev) Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/f2406bc7 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/f2406bc7 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/f2406bc7 Branch: refs/heads/branch-1.4.2 Commit: f2406bc773e75dfadba1f77332e1124f76711e21 Parents: 38d5399 Author: Mahadev Konar Authored: Fri Nov 22 15:06:27 2013 -0800 Committer: Mahadev Konar Committed: Fri Nov 22 15:06:27 2013 -0800 -- .../2.0.6/services/YARN/configuration/capacity-scheduler.xml | 8 1 file changed, 8 insertions(+) -- http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/f2406bc7/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/configuration/capacity-scheduler.xml -- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/configuration/capacity-scheduler.xml b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/configuration/capacity-scheduler.xml index ccfb779..4a19779 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/configuration/capacity-scheduler.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/YARN/configuration/capacity-scheduler.xml @@ -116,5 +116,13 @@ No description + +yarn.scheduler.capacity.node-locality-delay +40 + + No description + + +