You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by vg...@apache.org on 2012/05/10 00:41:00 UTC

svn commit: r1336435 - /incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp/lib/puppet/parser/functions/hdp_host_attribute.rb

Author: vgogate
Date: Wed May  9 22:41:00 2012
New Revision: 1336435

URL: http://svn.apache.org/viewvc?rev=1336435&view=rev
Log:
AMBARI-200: External hostnames should be used for links on dashboard UI by Ramya

Added:
    incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp/lib/puppet/parser/functions/hdp_host_attribute.rb

Added: incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp/lib/puppet/parser/functions/hdp_host_attribute.rb
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp/lib/puppet/parser/functions/hdp_host_attribute.rb?rev=1336435&view=auto
==============================================================================
--- incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp/lib/puppet/parser/functions/hdp_host_attribute.rb (added)
+++ incubator/ambari/branches/ambari-186/hmc/puppet/modules/hdp/lib/puppet/parser/functions/hdp_host_attribute.rb Wed May  9 22:41:00 2012
@@ -0,0 +1,20 @@
+module Puppet::Parser::Functions
+  newfunction(:hdp_host_attribute, :type => :rvalue) do |args|
+    args = function_hdp_args_as_array(args)
+    hash,attr,source = args
+    ret_val = lambda do |hash,attr,s|
+      ret = ""
+      ndx = hash[s]
+      unless function_hdp_is_empty(ndx)
+        val = ndx[attr]
+        ret = function_hdp_is_empty(val) ? "" : val
+      end
+      ret
+    end
+    if source.kind_of?(Array)
+      source.map{|s|ret_val.call(hash,attr,s)}
+    else
+     ret_val.call(hash,attr,source)
+    end
+  end
+end