AMBARI-3808. If hdfs-exclude-file config type already exists then installing DATANODE (e.g. while adding new host) fails (Vitaly Brodetskyi via dlysnichenko)
diff --git a/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/init.pp b/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/init.pp
index 08330d7..1b69e12 100644
--- a/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/init.pp
+++ b/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/init.pp
@@ -190,7 +190,9 @@
 
   if (hdp_get_major_stack_version($hdp::params::stack_version) >= 2) {
     if (hdp_is_empty($configuration) == false and hdp_is_empty($configuration['hdfs-site']) == false) {
-      if (hdp_is_empty($configuration['hdfs-site']['dfs.hosts.exclude']) == false) {
+      if (hdp_is_empty($configuration['hdfs-site']['dfs.hosts.exclude']) == false) and
+         (hdp_is_empty($configuration['hdfs-exclude-file']) or
+          has_key($configuration['hdfs-exclude-file'], 'datanodes') == false) {
         $exlude_file_path = $configuration['hdfs-site']['dfs.hosts.exclude']
         file { $exlude_file_path :
         ensure => present,