<commit_before>---
title: 
layout: module
---

# Oozie

    module.exports = []
    module.exports.push 'masson/bootstrap/'

    module.exports.push module.exports.configure = (ctx) ->
      return if ctx.oozie__configured
      ctx.oozie__configured = true
      require('./core').configure ctx
      oozie_server = ctx.host_with_module 'phyla/hadoop/oozie_server'
      {realm} = ctx.config.hdp
      ctx.config.hdp.oozie_port ?= 11000
      ctx.config.hdp.oozie_user ?= 'oozie'
      ctx.config.hdp.oozie_test_principal ?= "test@#{realm}"
      ctx.config.hdp.oozie_test_password ?= "<PASSWORD>"
      ctx.config.hdp.oozie_conf_dir ?= '/etc/oozie/conf'
      ctx.config.hdp.oozie_data ?= '/var/db/oozie'
      ctx.config.hdp.oozie_log_dir ?= '/var/log/oozie'
      ctx.config.hdp.oozie_pid_dir ?= '/var/run/oozie'
      ctx.config.hdp.oozie_tmp_dir ?= '/var/tmp/oozie'
      ctx.config.hdp.oozie_site ?= {}
      ctx.config.hdp.oozie_site['oozie.base.url'] = "http://#{oozie_server}:11000/oozie"

    module.exports.push name: 'HDP Oozie # Install', timeout: -1, callback: (ctx, next) ->
      ctx.service [
        name: 'oozie-client'
      ], (err, serviced) ->
        next err, if serviced then ctx.OK else ctx.PASS

    module.exports.push name: 'HDP Oozie # Users & Groups', callback: (ctx, next) ->
      {oozie_user, hadoop_group} = ctx.config.hdp
      ctx.execute
        cmd: "useradd oozie -r -M -g #{hadoop_group} -s /bin/bash -c \"Used by Hadoop Oozie service\""
        code: 0
        code_skipped: 9
      , (err, executed) ->
        next err, if executed then ctx.OK else ctx.PASS

    module.exports.push name: 'HDP Oozie # Environment', callback: (ctx, next) ->
      {oozie_user, hadoop_group, oozie_conf_dir, oozie_log_dir, oozie_pid_dir, oozie_data} = ctx.config.hdp
      ctx.write
        source: "#{__dirname}/files/oozie/oozie-env.sh"
        destination: "#{oozie_conf_dir}/oozie-env.sh"
        local_source: true
        write: [
          match: /^export JAVA_HOME=.*$/mg
          replace: "export JAVA_HOME=/usr/java/default" # TODO, discover value from masson/commons/java
          append: true
        ,
          match: /^export OOZIE_LOG=.*$/mg
          replace: "export OOZIE_LOG=#{oozie_log_dir}"
          append: true
        ,
          match: /^export CATALINA_PID=.*$/mg
          replace: "export CATALINA_PID=#{oozie_pid_dir}"
          append: true
        ,
          match: /^export OOZIE_DATA=.*$/mg
          replace: "export OOZIE_DATA=#{OOZIE_DATA}"
          append: true
        ]
        uid: oozie_user
        gid: hadoop_group
        mode: 0o0755
      , (err, rendered) ->
        next err, if rendered then ctx.OK else ctx.PASS

    module.exports.push name: 'HDP Oozie # Profile', callback: (ctx, next) ->
      {oozie_site} = ctx.config.hdp
      ctx.write
        destination: '/etc/profile.d/oozie.sh'
        content: """
        #!/bin/bash
        export OOZIE_URL=#{oozie_site['oozie.base.url']}
        """
        mode: 0o0755
      , (err, written) ->
        next null, if written then ctx.OK else ctx.PASS
<commit_msg>fix oozie<commit_after>---
title: 
layout: module
---

# Oozie

    module.exports = []
    module.exports.push 'masson/bootstrap/'

    module.exports.push module.exports.configure = (ctx) ->
      return if ctx.oozie__configured
      ctx.oozie__configured = true
      require('./core').configure ctx
      oozie_server = ctx.host_with_module 'phyla/hadoop/oozie_server'
      {realm} = ctx.config.hdp
      ctx.config.hdp.oozie_port ?= 11000
      ctx.config.hdp.oozie_user ?= 'oozie'
      ctx.config.hdp.oozie_test_principal ?= "test@#{realm}"
      ctx.config.hdp.oozie_test_password ?= "<PASSWORD>"
      ctx.config.hdp.oozie_conf_dir ?= '/etc/oozie/conf'
      ctx.config.hdp.oozie_data ?= '/var/db/oozie'
      ctx.config.hdp.oozie_log_dir ?= '/var/log/oozie'
      ctx.config.hdp.oozie_pid_dir ?= '/var/run/oozie'
      ctx.config.hdp.oozie_tmp_dir ?= '/var/tmp/oozie'
      ctx.config.hdp.oozie_site ?= {}
      ctx.config.hdp.oozie_site['oozie.base.url'] = "http://#{oozie_server}:11000/oozie"

    module.exports.push name: 'HDP Oozie # Install', timeout: -1, callback: (ctx, next) ->
      ctx.service [
        name: 'oozie-client'
      ], (err, serviced) ->
        next err, if serviced then ctx.OK else ctx.PASS

    module.exports.push name: 'HDP Oozie # Users & Groups', callback: (ctx, next) ->
      {oozie_user, hadoop_group} = ctx.config.hdp
      ctx.execute
        cmd: "useradd oozie -r -M -g #{hadoop_group} -s /bin/bash -c \"Used by Hadoop Oozie service\""
        code: 0
        code_skipped: 9
      , (err, executed) ->
        next err, if executed then ctx.OK else ctx.PASS

    module.exports.push name: 'HDP Oozie # Environment', callback: (ctx, next) ->
      {oozie_user, hadoop_group, oozie_conf_dir, oozie_log_dir, oozie_pid_dir, oozie_data} = ctx.config.hdp
      ctx.write
        source: "#{__dirname}/files/oozie/oozie-env.sh"
        destination: "#{oozie_conf_dir}/oozie-env.sh"
        local_source: true
        write: [
          match: /^export JAVA_HOME=.*$/mg
          replace: "export JAVA_HOME=/usr/java/default" # TODO, discover value from masson/commons/java
          append: true
        ,
          match: /^export OOZIE_LOG=.*$/mg
          replace: "export OOZIE_LOG=#{oozie_log_dir}"
          append: true
        ,
          match: /^export CATALINA_PID=.*$/mg
          replace: "export CATALINA_PID=#{oozie_pid_dir}"
          append: true
        ,
          match: /^export OOZIE_DATA=.*$/mg
          replace: "export OOZIE_DATA=#{oozie_data}"
          append: true
        ]
        uid: oozie_user
        gid: hadoop_group
        mode: 0o0755
      , (err, rendered) ->
        next err, if rendered then ctx.OK else ctx.PASS

    module.exports.push name: 'HDP Oozie # Profile', callback: (ctx, next) ->
      {oozie_site} = ctx.config.hdp
      ctx.write
        destination: '/etc/profile.d/oozie.sh'
        content: """
        #!/bin/bash
        export OOZIE_URL=#{oozie_site['oozie.base.url']}
        """
        mode: 0o0755
      , (err, written) ->
        next null, if written then ctx.OK else ctx.PASS

{'fraction_non_alphanumeric': 0.13912201420271142, 'fraction_numerical': 0.007424144609425436, 'mean_word_length': 2.2927736450584484, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2096111', 'n_tokens_mistral': 2271, 'n_tokens_neox': 2196, 'n_words': 429}