<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License. See accompanying LICENSE file.
-->

<!-- Put site-specific property overrides in this file. -->

<configuration>
    <property>
        <name>this.cluster.name</name>
        <value><%= node['hadoop']['this.cluster.name'] %></value>
        <!-- <value>pleiades</value> -->
    </property>
    <property>
        <name>this.domain</name>
        <value><%= node['hadoop']['this.domain'] %></value>
        <!-- <value>grid.example.com</value> -->
    </property>
<% if node['hadoop']['with_security'] then -%>
    <property>
        <name>this.realm</name>
        <value><%= node['hadoop']['this.realm'] %></value>
        <!-- <value>GRID.EXAMPLE.COM</value> -->
    </property>
    <property>
        <name>this.keytab.dir</name>
        <value><%= node['hadoop']['this.keytab.dir'] %></value>
    </property>
<% end -%>
    <property>
        <name>this.namenode.fqdn</name>
        <value><%= node['hadoop']['this.namenode.fqdn'] %></value>
        <!-- <value>${this.cluster.name}-nn.${this.domain}</value> -->
    </property>

    <property>
        <name>fs.defaultFS</name>
        <value><%= node['hadoop']['fs.defaultFS'] %></value>
    </property>
    <property>
        <name>hadoop.tmp.dir</name>
        <value><%= node['hadoop']['hadoop.tmp.dir'] %></value>
    </property>

<% if node['hadoop']['with_security'] then -%>
    <property>
        <name>hadoop.security.authentication</name>
        <value><%= node['hadoop']['hadoop.security.authentication'] %></value>
        <description>
            Set the authentication for the cluster. Valid values are: simple or
            kerberos.
        </description>
    </property>
    <property>
        <name>hadoop.security.authorization</name>
        <value><%= node['hadoop']['hadoop.security.authorization'] %></value>
        <description>
            Enable authorization for different protocols.
        </description>
    </property>
    <property>
        <name>hadoop.security.auth_to_local</name>
        <value><%= node['hadoop']['hadoop.security.auth_to_local'] %></value>
    </property>
    <property>
        <name>hadoop.security.group.mapping</name>
        <value><%= node['hadoop']['hadoop.security.group.mapping'] %></value>
    </property>
    <property>
        <name>hadoop.security.groups.cache.secs</name>
        <value><%= node['hadoop']['hadoop.security.groups.cache.secs'] %></value>
    </property>
    <property>
        <name>hadoop.kerberos.kinit.command</name>
        <value><%= node['hadoop']['hadoop.kerberos.kinit.command'] %></value>
    </property>

    <property>
        <name>hadoop.http.filter.initializers</name>
        <value><%= node['hadoop']['hadoop.http.filter.initializers'] %></value>
        <!-- <value>org.apache.hadoop.http.lib.StaticUserWebFilter</value> -->
        <description>The name of a class that initializes an input filter for Jetty.
            This filter will always return Dr.Who as the web user when the servlets
            query for the authenticated user </description>
    </property>
    <property>
        <name>hadoop.http.authentication.signature.secret.file</name>
        <value><%= node['hadoop']['hadoop.http.authentication.signature.secret.file'] %></value>
    </property>
    <property>
        <name>hadoop.http.authentication.cookie.domain</name>
        <value><%= node['hadoop']['hadoop.http.authentication.cookie.domain'] %></value>
    </property>
    <property>
        <name>hadoop.http.authentication.type</name>
        <value><%= node['hadoop']['hadoop.http.authentication.type'] %></value>
        <description>Defines authentication used for the HTTP web-consoles.
            The supported values are: simple | kerberos | #AUTHENTICATION_HANDLER_CLASSNAME#.
            The dfeault value is simple.</description>
    </property>
    <property>
        <name>hadoop.http.authentication.kerberos.principal</name>
        <value><%= node['hadoop']['hadoop.http.authentication.kerberos.principal'] %></value>
        <!-- <value>HTTP/_HOST@${this.realm}</value>
            _HOST N/A!: v1.0, HDP1.2; OK: v2.0, CDH3, CDH4 -->
    </property>
    <property>
        <name>hadoop.http.authentication.kerberos.keytab</name>
        <value><%= node['hadoop']['hadoop.http.authentication.kerberos.keytab'] %></value>
    </property>

  <%- node['hadoop']['hadoop.proxyuser'].each do |name, values| -%>
    <property>
        <name>hadoop.proxyuser.<%= name %>.hosts</name>
        <value><%= values['hosts'] %></value>
    </property>
    <property>
        <name>hadoop.proxyuser.<%= name %>.groups</name>
        <value><%= values['groups'] %></value>
    </property>
  <%- end -%>
<% end -%>
<%
this_file = 'core-site.xml'
if defined? node['hadoop']['extra_configs'][this_file] \
  && node['hadoop']['extra_configs'][this_file] != nil then
  node['hadoop']['extra_configs'][this_file].each do |key,value|
-%>
    <property>
        <name><%= key %></name>
        <value><%= value %></value>
    </property>
<%
  end
end 
-%>
</configuration>
