|Ambari||1.7.x / 2.x|
Restarting components via Ambari will fail on one or more nodes with this message in Ambari:
Traceback (most recent call last):
File "/var/lib/ambari-agent/cache/stacks/PHD/2.0.6/hooks/before-START/scripts/hook.py", line 39, in <module>
File "/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py", line 216, in execute
File "/var/lib/ambari-agent/cache/stacks/PHD/2.0.6/hooks/before-START/scripts/hook.py", line 33, in hook
File "/var/lib/ambari-agent/cache/stacks/PHD/2.0.6/hooks/before-START/scripts/shared_initialization.py", line 74, in setup_hadoop
File "/usr/lib/python2.6/site-packages/resource_management/core/source.py", line 133, in __init__
autoescape=False, undefined=StrictUndefined, trim_blocks=True)
File "/usr/lib/python2.6/site-packages/ambari_jinja2/ambari_jinja2/environment.py", line 280, in __init__
File "/usr/lib/python2.6/site-packages/ambari_jinja2/ambari_jinja2/environment.py", line 82, in _environment_sanity_check
assert issubclass(environment.undefined, Undefined), 'undefined must ' \
AssertionError: undefined must be a subclass of undefined because filters depend on it.
This was caused by a problem with the Python installation. Although the root cause was not fully understood in the most recent case, it was believed that there were some missing libraries in Python.
The easiest way to resolve this is to remove and clean up the Ambari agent and then re-install the Ambari agent:
1. Stop the Ambari agent service:
2. Backup the current Ambari configuration and installation files:
tar czvf ambari_backup_<date>.tgz /var/lib/ambari-agent/* /var/run/ambari-agent/* /usr/lib/ambari-agent/* /etc/ambari-agent/* /var/log/ambari-agent/* /usr/lib/python2.6/site-packages/ambari*
3. Remove Ambari agent via the relevant package manager, for example in CentOS / RHEL:
yum erase ambari-agent
4. Remove the following directories:
#rm -rf /var/lib/ambari-agent
#rm -rf /var/run/ambari-agent
#rm -rf /usr/lib/ambari-agent
#rm -rf /etc/ambari-agent
#rm -rf /var/log/ambari-agent
#rm -rf /usr/lib/python2.6/site-
5. Re-install the Ambari agent.
yum install ambari-agent
6. Re-register the Ambari agent with the Ambari Server:
ambari-agent reset <AMBARI SERVER HOSTNAME>
7. Start the Ambari agent:
[root@dn1 ~]# ambari-agent start
Verifying Python version compatibility...
Using python /usr/bin/python2.6
Checking for previously running Ambari Agent...
chown: cannot access ` /var/lib/ambari-agent/keys': No such file or directory
Verifying ambari-agent process status...
Ambari Agent successfully started
Agent PID at: /var/run/ambari-agent/ambari-agent.pid
Agent out at: /var/log/ambari-agent/ambari-agent.out
Agent log at: /var/log/ambari-agent/ambari-agent.log