ambari icon indicating copy to clipboard operation
ambari copied to clipboard

[AMBARI-25492] Ambari Sends Empty metrics_collector_hosts parameters after AMS service is deleted

Open Akhilsnaik opened this issue 5 years ago • 1 comments

What changes were proposed in this pull request?

Fix the issue below:

Traceback (most recent call last):
  File "/var/lib/ambari-agent/cache/common-services/NIFI/1.0.0/package/scripts/nifi.py", line 304, in <module>
    Master().execute()
  File "/usr/lib/ambari-agent/lib/resource_management/libraries/script/script.py", line 352, in execute
    method(env)
  File "/var/lib/ambari-agent/cache/common-services/NIFI/1.0.0/package/scripts/nifi.py", line 139, in start
    import params
  File "/var/lib/ambari-agent/cache/common-services/NIFI/1.0.0/package/scripts/params.py", line 302, in <module>
    metrics_collector_host = str(config['clusterHostInfo']['metrics_collector_hosts'][0])
IndexError: list index out of range

How was this patch tested?

manually tested

Akhilsnaik avatar Mar 05 '20 08:03 Akhilsnaik

@Akhilsnaik , actually sending empty array when there are no such hosts/components/services etc. is an architectural decision in Ambari, because that has some information content. You can find such behaviour in many places in the code. The python code must handle these cases properly, like the way you have suggested.

payert avatar Mar 05 '20 10:03 payert