diff --git a/ambari-agent/src/main/python/ambari_agent/CommandHooksOrchestrator.py b/ambari-agent/src/main/python/ambari_agent/CommandHooksOrchestrator.py index 4ed38af68eb..13ec01c5369 100644 --- a/ambari-agent/src/main/python/ambari_agent/CommandHooksOrchestrator.py +++ b/ambari-agent/src/main/python/ambari_agent/CommandHooksOrchestrator.py @@ -105,7 +105,7 @@ def build(self, prefix, command, service, role): if "service" in hook_definition and service is None: continue - if "role" is hook_definition and role is None: + if "role" == hook_definition and role is None: continue yield hook_definition.format( diff --git a/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/__init__.py b/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/__init__.py index 50264b459f7..3d95b0b5aa5 100644 --- a/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/__init__.py +++ b/ambari-common/src/main/python/ambari_jinja2/ambari_jinja2/__init__.py @@ -30,9 +30,10 @@ __docformat__ = "restructuredtext en" try: - __version__ = __import__("pkg_resources").get_distribution("Jinja2").version -except: - __version__ = "unknown" + from importlib.metadata import version + __version__ = version('Jinja2') +except Exception: + __version__ = 'unknown' # high level interface from ambari_jinja2.environment import Environment, Template