<commit_before>#!/bin/sh

scheduler_install_dir='/opt/cloudconductor/bin'
scheduler_config_dir='/etc/scheduler'

install_scheduler() {
  rm -rf ${scheduler_install_dir}/scheduler
  remote_file https://s3-ap-northeast-1.amazonaws.com/dev.cloudconductor.jp/tools/scheduler \
      ${scheduler_install_dir}/scheduler \
      || return $?

  chmod 755 ${scheduler_install_dir}/scheduler || return $?

  directory ${scheduler_config_dir} root:root 755 || return $?

  values=(`echo $http_proxy | tr -s '/:' ' '`)
  proxy_host=${values[1]}
  proxy_port=${values[2]}

  file_copy ${tmpls_dir}/default/config.yml ${scheduler_config_dir}/config.yml root:root 644 || return $?
  sed -i \
      -e "s@__role__@${ROLE}@g" \
      -e "s@__token__@${CONSUL_SECRET_KEY}@g" \
      -e "s@__proxy-host__@${proxy_host}@g" \
      -e "s@__proxy-port__@${proxy_port}@g" \
      ${scheduler_config_dir}/config.yml \
      || return $?

  if [ ! -f /etc/init.d/scheduler ]; then
    ${scheduler_install_dir}/scheduler install || return $?
  fi
}<commit_msg>Delete proxy configuration in config.yml when instance doesn't have proxy<commit_after>#!/bin/sh

scheduler_install_dir='/opt/cloudconductor/bin'
scheduler_config_dir='/etc/scheduler'

install_scheduler() {
  rm -rf ${scheduler_install_dir}/scheduler
  remote_file https://s3-ap-northeast-1.amazonaws.com/dev.cloudconductor.jp/tools/scheduler \
      ${scheduler_install_dir}/scheduler \
      || return $?

  chmod 755 ${scheduler_install_dir}/scheduler || return $?

  directory ${scheduler_config_dir} root:root 755 || return $?

  values=(`echo $http_proxy | tr -s '/:' ' '`)
  proxy_host=${values[1]}
  proxy_port=${values[2]}

  file_copy ${tmpls_dir}/default/config.yml ${scheduler_config_dir}/config.yml root:root 644 || return $?
  sed -i \
      -e "s@__role__@${ROLE}@g" \
      -e "s@__token__@${CONSUL_SECRET_KEY}@g" \
      ${scheduler_config_dir}/config.yml \
      || return $?

  if [ -n "${proxy_host}" ]; then
    sed -i \
        -e "s@__proxy-host__@${proxy_host}@g" \
        ${scheduler_config_dir}/config.yml \
        || return $?
  else
    sed -i \
        -e "/__proxy-host__/d" \
        ${scheduler_config_dir}/config.yml \
        || return $?
  fi

  if [ -n "${proxy_port}" ]; then
    sed -i \
        -e "s@__proxy-port__@${proxy_port}@g" \
        ${scheduler_config_dir}/config.yml \
        || return $?
  else
    sed -i \
        -e "/__proxy-port__/d" \
        ${scheduler_config_dir}/config.yml \
        || return $?
  fi

  if [ ! -f /etc/init.d/scheduler ]; then
    ${scheduler_install_dir}/scheduler install || return $?
  fi
}
{'fraction_non_alphanumeric': 0.1685823754789272, 'fraction_numerical': 0.00996168582375479, 'mean_word_length': 3.0860719874804383, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '6295853', 'n_tokens_mistral': 1013, 'n_tokens_neox': 965, 'n_words': 145}