Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 8c669e682 -> 1d40e6394
  refs/heads/trunk 27c6d7542 -> 9ca9a1deb


AMBARI-11972. Atlas and Kafka Start fail with non-root agent (aonishuk)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9ca9a1de
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9ca9a1de
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9ca9a1de

Branch: refs/heads/trunk
Commit: 9ca9a1deb36f2fa9536f50d9e6f575d4bae1c8fa
Parents: 27c6d75
Author: Andrew Onishuk <aonis...@hortonworks.com>
Authored: Wed Jun 17 15:46:09 2015 +0300
Committer: Andrew Onishuk <aonis...@hortonworks.com>
Committed: Wed Jun 17 15:46:09 2015 +0300

----------------------------------------------------------------------
 .../python/resource_management/core/source.py   |  2 +-
 .../ATLAS/0.1.0.2.3/package/scripts/metadata.py | 11 ++----
 .../package/scripts/properties_config.py        | 33 -----------------
 .../package/scripts/atlas_plugin_utils.py       | 39 --------------------
 .../0.12.0.2.0/package/scripts/hcat_client.py   |  5 +--
 .../HIVE/0.12.0.2.0/package/scripts/hive.py     | 12 ++----
 .../0.12.0.2.0/package/scripts/hive_client.py   |  3 --
 .../package/scripts/hive_metastore.py           |  4 --
 .../0.12.0.2.0/package/scripts/hive_server.py   |  4 --
 .../0.12.0.2.0/package/scripts/params_linux.py  |  7 +++-
 .../package/scripts/setup_atlas_hive.py         | 37 +++++++++++++++++++
 .../package/scripts/webhcat_server.py           |  6 +--
 .../KAFKA/0.8.1.2.2/package/scripts/kafka.py    | 11 +++---
 .../0.8.1.2.2/package/scripts/kafka_broker.py   |  1 -
 .../package/scripts/properties_config.py        | 32 ----------------
 .../0.8.1.2.2/package/scripts/service_check.py  |  3 ++
 .../stacks/2.3/ATLAS/test_metadata_server.py    | 15 +++-----
 17 files changed, 67 insertions(+), 158 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9ca9a1de/ambari-common/src/main/python/resource_management/core/source.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/core/source.py 
b/ambari-common/src/main/python/resource_management/core/source.py
index 1f888ac..916a618 100644
--- a/ambari-common/src/main/python/resource_management/core/source.py
+++ b/ambari-common/src/main/python/resource_management/core/source.py
@@ -55,7 +55,7 @@ class Source(object):
   
   def __eq__(self, other):
     return (isinstance(other, self.__class__)
-        and self.get_content() == other.get_content())
+        and ((self.name.startswith(os.sep) and self.name == other.name) or 
self.get_content() == other.get_content()))
 
 
 class StaticFile(Source):

http://git-wip-us.apache.org/repos/asf/ambari/blob/9ca9a1de/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata.py
 
b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata.py
index 2eae71b..a1627b9 100644
--- 
a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata.py
+++ 
b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/metadata.py
@@ -17,8 +17,6 @@ See the License for the specific language governing 
permissions and
 limitations under the License.
 
 """
-import os
-import shutil
 from resource_management import Directory, Fail, Logger, File, \
     InlineTemplate, PropertiesFile, StaticFile
 from resource_management.libraries.functions import format
@@ -67,12 +65,9 @@ def metadata():
               recursive=True
     )
 
-    metadata_war_file = 
format('{params.metadata_home}/server/webapp/atlas.war')
-    if not os.path.isfile(metadata_war_file):
-        raise Fail("Unable to copy {0} because it does not 
exist".format(metadata_war_file))
-
-    Logger.info("Copying {0} to {1}".format(metadata_war_file, 
params.expanded_war_dir))
-    shutil.copy2(metadata_war_file, params.expanded_war_dir)
+    File(format("{expanded_war_dir}/atlas.war"),
+         content = 
StaticFile(format('{metadata_home}/server/webapp/atlas.war'))
+    )
 
     PropertiesFile(format('{conf_dir}/application.properties'),
          properties = params.application_properties,

http://git-wip-us.apache.org/repos/asf/ambari/blob/9ca9a1de/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/properties_config.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/properties_config.py
 
b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/properties_config.py
deleted file mode 100644
index 2144f71..0000000
--- 
a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/properties_config.py
+++ /dev/null
@@ -1,33 +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.core import source, File
-from resource_management.libraries.functions import format
-
-
-def properties_inline_template(configurations):
-  return source.InlineTemplate('''{% for key, value in 
configurations_dict.items() %}{{ key }}={{ value }}
-{% endfor %}''', configurations_dict=configurations)
-
-def properties_config(filename, configurations = None, conf_dir = None,
-                      mode = None, owner = None, group = None):
-    config_content = properties_inline_template(configurations)
-    File (format("{conf_dir}/{filename}"), content = config_content, owner = 
owner,
-          group = group, mode = mode)

http://git-wip-us.apache.org/repos/asf/ambari/blob/9ca9a1de/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/atlas_plugin_utils.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/atlas_plugin_utils.py
 
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/atlas_plugin_utils.py
deleted file mode 100644
index d3228c8..0000000
--- 
a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/atlas_plugin_utils.py
+++ /dev/null
@@ -1,39 +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 import Script
-from resource_management.core import Logger
-
-
-def configure_for_plugin(command_data_file):
-    import json
-    savedConfig = Script.get_config()
-    if savedConfig['hostLevelParams'].get('custom_command', '') == 'RESTART':
-        try:
-            with open(command_data_file) as f:
-                pass
-                Script.config = json.load(f)
-                Script.config['hostLevelParams']['package_list'] = \
-                    "[{\"name\":\"atlas-metadata*-hive-plugin\"}]"
-
-        except IOError:
-            Logger.error("Can not read json file with command parameters: ")
-
-    return savedConfig
-

http://git-wip-us.apache.org/repos/asf/ambari/blob/9ca9a1de/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hcat_client.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hcat_client.py
 
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hcat_client.py
index 46ed31b..1b5b768 100644
--- 
a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hcat_client.py
+++ 
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hcat_client.py
@@ -21,23 +21,22 @@ limitations under the License.
 import sys
 from resource_management import *
 from hcat import hcat
+from setup_atlas_hive import setup_atlas_hive
 from ambari_commons import OSConst
 from ambari_commons.os_family_impl import OsFamilyImpl
-from atlas_plugin_utils import configure_for_plugin
 
 
 class HCatClient(Script):
   def install(self, env):
     import params
-    savedConfig = configure_for_plugin(self.command_data_file)
     self.install_packages(env, exclude_packages=params.hive_exclude_packages)
-    Script.config = savedConfig
     self.configure(env)
 
   def configure(self, env):
     import params
     env.set_params(params)
     hcat()
+    setup_atlas_hive()
 
   def status(self, env):
     raise ClientComponentHasNoStatus()

http://git-wip-us.apache.org/repos/asf/ambari/blob/9ca9a1de/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
 
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
index 519e97f..6081b39 100644
--- 
a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
+++ 
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
@@ -21,7 +21,6 @@ limitations under the License.
 import os
 import glob
 from urlparse import urlparse
-from resource_management import PropertiesFile
 
 from resource_management.libraries.script.script import Script
 from resource_management.libraries.resources.hdfs_resource import HdfsResource
@@ -39,6 +38,8 @@ from resource_management.core.exceptions import Fail
 from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
 from ambari_commons import OSConst
 
+from setup_atlas_hive import setup_atlas_hive
+
 
 @OsFamilyFuncImpl(os_family=OSConst.WINSRV_FAMILY)
 def hive(name=None):
@@ -213,13 +214,8 @@ def hive(name=None):
             group=params.user_group,
             mode=0644)
 
-  if params.atlas_hosts:
-      PropertiesFile(format('{hive_config_dir}/client.properties'),
-                     properties = params.atlas_client_props,
-                     owner = params.hive_user,
-                     group = params.user_group,
-                     mode = 0644)
-
+  setup_atlas_hive()
+  
   if params.hive_specific_configs_supported and name == 'hiveserver2':
     XmlConfig("hiveserver2-site.xml",
               conf_dir=params.hive_server_conf_dir,

http://git-wip-us.apache.org/repos/asf/ambari/blob/9ca9a1de/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_client.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_client.py
 
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_client.py
index a09f02a..d2855b1 100644
--- 
a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_client.py
+++ 
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_client.py
@@ -24,14 +24,11 @@ from resource_management.libraries.functions import 
hdp_select
 from hive import hive
 from ambari_commons.os_family_impl import OsFamilyImpl
 from ambari_commons import OSConst
-from atlas_plugin_utils import configure_for_plugin
 
 class HiveClient(Script):
   def install(self, env):
     import params
-    savedConfig = configure_for_plugin(self.command_data_file)
     self.install_packages(env, exclude_packages=params.hive_exclude_packages)
-    Script.config = savedConfig
     self.configure(env)
 
   def status(self, env):

http://git-wip-us.apache.org/repos/asf/ambari/blob/9ca9a1de/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_metastore.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_metastore.py
 
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_metastore.py
index e6f3e97..a17ea4f 100644
--- 
a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_metastore.py
+++ 
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_metastore.py
@@ -38,7 +38,6 @@ from hive import jdbc_connector
 from hive_service import hive_service
 from ambari_commons.os_family_impl import OsFamilyImpl
 from ambari_commons import OSConst
-from atlas_plugin_utils import configure_for_plugin
 
 # the legacy conf.server location in HDP 2.2
 LEGACY_HIVE_SERVER_CONF = "/etc/hive/conf.server"
@@ -62,9 +61,6 @@ class HiveMetastore(Script):
   def configure(self, env):
     import params
     env.set_params(params)
-    savedConfig = configure_for_plugin(self.command_data_file)
-    self.install_packages(env, exclude_packages = params.hive_exclude_packages)
-    Script.config = savedConfig
     hive(name = 'metastore')
 
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/9ca9a1de/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server.py
 
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server.py
index e29df4f..b20c461 100644
--- 
a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server.py
+++ 
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server.py
@@ -36,7 +36,6 @@ if OSCheck.is_windows_family():
   from resource_management.libraries.functions.windows_service_utils import 
check_windows_service_status
 from setup_ranger_hive import setup_ranger_hive
 from ambari_commons.os_family_impl import OsFamilyImpl
-from atlas_plugin_utils import configure_for_plugin
 from resource_management.core.logger import Logger
 
 import hive_server_upgrade
@@ -52,9 +51,6 @@ class HiveServer(Script):
   def configure(self, env):
     import params
     env.set_params(params)
-    savedConfig = configure_for_plugin(self.command_data_file)
-    self.install_packages(env, exclude_packages=params.hive_exclude_packages)
-    Script.config = savedConfig
     hive(name='hiveserver2')
 
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/9ca9a1de/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
 
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
index 2c231d1..53ae99e 100644
--- 
a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
+++ 
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
@@ -354,9 +354,12 @@ hive_site_config = 
dict(config['configurations']['hive-site'])
 ########################################################
 
 atlas_hosts = default('/clusterHostInfo/atlas_server_hosts', [])
+has_atlas = len(atlas_hosts) > 0
 classpath_addition = ""
-if not atlas_hosts:
-  hive_exclude_packages.append('atlas-metadata*-hive-plugin')
+atlas_plugin_package = "atlas-metadata*-hive-plugin"
+
+if not has_atlas:
+  hive_exclude_packages.append(atlas_plugin_package)
 else:
   # hive-site
   hive_site_config['hive.cluster.name'] = config['clusterName']

http://git-wip-us.apache.org/repos/asf/ambari/blob/9ca9a1de/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/setup_atlas_hive.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/setup_atlas_hive.py
 
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/setup_atlas_hive.py
new file mode 100644
index 0000000..a956c6c
--- /dev/null
+++ 
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/setup_atlas_hive.py
@@ -0,0 +1,37 @@
+#!/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.resources.properties_file import 
PropertiesFile
+from resource_management.core.resources.packaging import Package
+from resource_management.libraries.functions.format import format
+
+def setup_atlas_hive():
+  import params
+  
+  if params.has_atlas:
+    if not params.host_sys_prepped:
+      Package(params.atlas_plugin_package, # FIXME HACK: install the package 
during RESTART/START when install_packages is not triggered.
+      )
+
+    PropertiesFile(format('{hive_config_dir}/client.properties'),
+                   properties = params.atlas_client_props,
+                   owner = params.hive_user,
+                   group = params.user_group,
+                   mode = 0644)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/9ca9a1de/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/webhcat_server.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/webhcat_server.py
 
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/webhcat_server.py
index 6ea8ee6..0473d17 100644
--- 
a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/webhcat_server.py
+++ 
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/webhcat_server.py
@@ -26,9 +26,9 @@ from resource_management.libraries.functions.security_commons 
import build_expec
   FILE_TYPE_XML
 from webhcat import webhcat
 from webhcat_service import webhcat_service
+from setup_atlas_hive import setup_atlas_hive
 from ambari_commons import OSConst
 from ambari_commons.os_family_impl import OsFamilyImpl
-from atlas_plugin_utils import configure_for_plugin
 
 
 class WebHCatServer(Script):
@@ -50,10 +50,8 @@ class WebHCatServer(Script):
   def configure(self, env):
     import params
     env.set_params(params)
-    savedConfig = configure_for_plugin(self.command_data_file)
-    self.install_packages(env, exclude_packages=params.hive_exclude_packages)
-    Script.config = savedConfig
     webhcat()
+    setup_atlas_hive()
 
 
 @OsFamilyImpl(os_family=OSConst.WINSRV_FAMILY)

http://git-wip-us.apache.org/repos/asf/ambari/blob/9ca9a1de/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/kafka.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/kafka.py
 
b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/kafka.py
index 0957215..4210e96 100644
--- 
a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/kafka.py
+++ 
b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/kafka.py
@@ -19,7 +19,7 @@ limitations under the License.
 """
 
 from resource_management import *
-from properties_config import properties_config
+from resource_management.libraries.resources.properties_file import 
PropertiesFile
 from resource_management.libraries.resources.template_config import 
TemplateConfig
 import sys, os
 from copy import deepcopy
@@ -67,13 +67,12 @@ def kafka():
               group=params.user_group,
               recursive=True)
 
-    conf_dir = params.conf_dir
-    properties_config("server.properties",
-                      conf_dir=params.conf_dir,
-                      configurations=kafka_server_config,
+    PropertiesFile("server.properties",
+                      dir=params.conf_dir,
+                      properties=kafka_server_config,
                       owner=params.kafka_user,
                       group=params.user_group,
-                      brokerid=brokerid)
+    )
 
     File(format("{conf_dir}/kafka-env.sh"),
           owner=params.kafka_user,

http://git-wip-us.apache.org/repos/asf/ambari/blob/9ca9a1de/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/kafka_broker.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/kafka_broker.py
 
b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/kafka_broker.py
index dd210b7..20e3d59 100644
--- 
a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/kafka_broker.py
+++ 
b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/kafka_broker.py
@@ -31,7 +31,6 @@ class KafkaBroker(Script):
 
   def install(self, env):
     self.install_packages(env)
-    self.configure(env)
 
   def configure(self, env):
     import params

http://git-wip-us.apache.org/repos/asf/ambari/blob/9ca9a1de/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/properties_config.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/properties_config.py
 
b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/properties_config.py
deleted file mode 100644
index 56bab2c..0000000
--- 
a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/properties_config.py
+++ /dev/null
@@ -1,32 +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 re
-from resource_management import *
-
-def properties_inline_template(configurations):
-  return source.InlineTemplate('''{% for key, value in 
configurations_dict.items() %}{{ key }}={{ value }}
-{% endfor %}''', configurations_dict=configurations)
-
-def properties_config(filename, configurations = None, conf_dir = None,
-                      mode = None, owner = None, group = None, brokerid = 
None):
-    config_content = properties_inline_template(configurations)
-    File (format("{conf_dir}/{filename}"), content = config_content, owner = 
owner,
-          group = group, mode = mode)

http://git-wip-us.apache.org/repos/asf/ambari/blob/9ca9a1de/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/service_check.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/service_check.py
 
b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/service_check.py
index ef6f62f..f76e954 100644
--- 
a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/service_check.py
+++ 
b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/service_check.py
@@ -47,6 +47,9 @@ class ServiceCheck(Script):
     kafka_config = {}
     with open(params.conf_dir+"/server.properties", "r") as conf_file:
       for line in conf_file:
+        if line.startswith("#") or not line.strip():
+          continue 
+        
         key,value = line.split("=")
         kafka_config[key] = value.replace("\n","")
     

http://git-wip-us.apache.org/repos/asf/ambari/blob/9ca9a1de/ambari-server/src/test/python/stacks/2.3/ATLAS/test_metadata_server.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/python/stacks/2.3/ATLAS/test_metadata_server.py 
b/ambari-server/src/test/python/stacks/2.3/ATLAS/test_metadata_server.py
index 8d72faf..fd4c1ed 100644
--- a/ambari-server/src/test/python/stacks/2.3/ATLAS/test_metadata_server.py
+++ b/ambari-server/src/test/python/stacks/2.3/ATLAS/test_metadata_server.py
@@ -64,6 +64,9 @@ class TestMetadataServer(RMFTestCase):
                                 cd_access='a',
                                 mode=0644
       )
+      self.assertResourceCalled('File', 
'/var/lib/atlas/server/webapp/atlas.war',
+          content = 
StaticFile('/usr/hdp/current/atlas-server/server/webapp/atlas.war'),
+      )
       appprops =  dict(self.getConfig()['configurations'][
           'application-properties'])
       appprops['atlas.http.authentication.kerberos.name.rules'] = ' \\ 
\n'.join(appprops['atlas.http.authentication.kerberos.name.rules'].splitlines())
@@ -91,11 +94,7 @@ class TestMetadataServer(RMFTestCase):
                                 mode=0644,
       )
 
-  @patch("shutil.copy2", new = MagicMock())
-  @patch("os.path.isfile")
-  def test_configure_default(self, isfile_mock):
-    isfile_mock.return_value = True
-
+  def test_configure_default(self):
     self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + 
"/scripts/metadata_server.py",
                        classname = "MetadataServer",
                        command = "configure",
@@ -107,11 +106,7 @@ class TestMetadataServer(RMFTestCase):
     self.configureResourcesCalled()
     self.assertNoMoreResources()
 
-  @patch("shutil.copy2", new = MagicMock())
-  @patch("os.path.isfile")
-  def test_start_default(self, isfile_mock):
-    isfile_mock.return_value = True
-
+  def test_start_default(self):
     self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + 
"/scripts/metadata_server.py",
                        classname = "MetadataServer",
                        command = "start",

Reply via email to