<commit_before>#!/bin/bash
# set -x

# Setup for Openshift to support the ovn-cni plugin
#
# This script runs on the ovn-master node on the cluster
# since it sets up a configmap with information on how
# to access the ovn-master.
#
# This script is run as part of installation after the cluster is
# up and before the ovn daemonsets are created.

trap 'kill $(jobs -p); exit 0' TERM

cfg=${1:-"/etc/origin/master/master-config.yaml"}

is_cluster_up () {
  health=$(kubectl get --raw /healthz/ready)
  if [[ $health != 'ok' ]]; then
    return 1
  fi
  return 0
}

is_api_server_ready () {
  # kubectl cluster-info leaves ^[[0 in output string
  #apiserver=$(kubectl cluster-info | gawk '/Kubernetes master/{ print $6 }')
  apiserver=$(oc whoami --show-server)
  if [[ ${apiserver} == '' ]]; then
    return 1
  fi
  return 0
}

wait_for_condition () {
  msg="$1"
  retries=0
  while true; do
    $1
    if [[ $? != 0 ]]; then
      (( retries += 1 ))
      if [[ "${retries}" -gt 4 ]]; then
        echo "error: ${msg} - NO, exiting"
        exit 1
      fi
      echo "info: Waiting 2 sec for ${msg} - YES ..."
      sleep 2
    else
      break
    fi<commit_msg>Change to kubectl command in ovn-setup.sh<commit_after>#!/bin/bash
# set -x

# Setup for Openshift to support the ovn-cni plugin
#
# This script runs on the ovn-master node on the cluster
# since it sets up a configmap with information on how
# to access the ovn-master.
#
# This script is run as part of installation after the cluster is
# up and before the ovn daemonsets are created.

trap 'kill $(jobs -p); exit 0' TERM

cfg=${1:-"/etc/origin/master/master-config.yaml"}

is_cluster_up () {
  health=$(kubectl get --raw /healthz/ready)
  if [[ $health != 'ok' ]]; then
    return 1
  fi
  return 0
}

is_api_server_ready () {
  #apiserver=$(oc whoami --show-server)
  apiserver=$(kubectl config view -o jsonpath='{.clusters[0].cluster.server}')
  if [[ ${apiserver} == '' ]]; then
    return 1
  fi
  return 0
}

wait_for_condition () {
  msg="$1"
  retries=0
  while true; do
    $1
    if [[ $? != 0 ]]; then
      (( retries += 1 ))
      if [[ "${retries}" -gt 4 ]]; then
        echo "error: ${msg} - NO, exiting"
        exit 1
      fi
      echo "info: Waiting 2 sec for ${msg} - YES ..."
      sleep 2
    else
      break
    fi
{'fraction_non_alphanumeric': 0.13908145580589254, 'fraction_numerical': 0.014298093587521665, 'mean_word_length': 2.641955835962145, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2742628', 'n_tokens_mistral': 846, 'n_tokens_neox': 806, 'n_words': 277}