Error while installing ambari agent

Hi Sir, On installing the agent I am getting the below error:

File “/var/lib/ambari-agent/cache/common-services/AMBARI_METRICS/0.1.0/package/scripts/”, line 131, in
File “/usr/lib/python2.6/site-packages/resource_management/libraries/script/”, line 218, in execute

And there is some more lines of error in the file. Would you be able to tell me what things I could check please! By checking the links online I was able to do the below troubleshooting :

  1. Checked the path configured in HDP.repo, ambari.repo and hdp.repo. The paths resolve fine.
  2. Ran “yum search ambari-agent ambari-server ambari-metrics-collector” to check whether ambari-metrics-collector exists or not, but it does exist.
  3. Changed the ownber of hdp.repo from root to ec2-user and then ran, but still the same issue.

Sir, please tell me what are the things that I could check please!!