<commit_before>#!/bin/bash

disable_apis() {
    $pssh_run "echo 'backend maintenance' >> /etc/haproxy.cfg"
    $pssh_run "for f in \$(grep -L 'mode *tcp' /etc/haproxy/conf.d/*); \
        do echo '  use_backend maintenance if TRUE' >> \$f; done"
    $pssh_run "pkill haproxy"
}

enable_apis() {
    $pssh_run "sed -i '/use_backend maintenance if TRUE/d' \
        \$(grep -L 'mode *tcp' /etc/haproxy/conf.d/*)"
    $pss_run "pkill haproxy"
}

stop_corosync_services() {
    $pssh_run "crm status | awk '/clone/ {print \$4}' \
        | tr -d [] | grep -vE '(mysql|haproxy)' \
        | xargs -tI{} sh -c 'crm resource stop {}'"
}

stop_upstart_services() {
    local command
    command=$(cat <<EOF
services="nova keystone heat neutron cinder glance"; \
echo -n \$services \
        | xargs -d" " -I{} sh -c 'ls /etc/init/{}* \
        | grep -Ev override \
        | sed -E "s,.*/([^\.]+)(\.conf|override)?$,\1," \
        | sort -u | xargs -I@ sh -c "status @ \
        | grep start/running >/dev/null 2>&1 && echo @"' \
        | tee services;
    for s in \$(cat services);
        do
            stop \$s;<commit_msg>Properly disable haproxy in services management script<commit_after>#!/bin/bash

disable_apis() {
    $pssh_run "echo 'backend maintenance' >> /etc/haproxy/haproxy.cfg"
    $pssh_run "for f in \$(grep -L 'mode *tcp' /etc/haproxy/conf.d/*); \
        do echo '  use_backend maintenance if TRUE' >> \$f; done"
    $pssh_run "pkill haproxy"
}

enable_apis() {
    $pssh_run "sed -i '/use_backend maintenance if TRUE/d' \
        \$(grep -L 'mode *tcp' /etc/haproxy/conf.d/*)"
    $pss_run "pkill haproxy"
}

stop_corosync_services() {
    $pssh_run "crm status | awk '/clone/ {print \$4}' \
        | tr -d [] | grep -vE '(mysql|haproxy)' \
        | xargs -tI{} sh -c 'crm resource stop {}'"
}

stop_upstart_services() {
    local command
    command=$(cat <<EOF
services="nova keystone heat neutron cinder glance"; \
echo -n \$services \
        | xargs -d" " -I{} sh -c 'ls /etc/init/{}* \
        | grep -Ev override \
        | sed -E "s,.*/([^\.]+)(\.conf|override)?$,\1," \
        | sort -u | xargs -I@ sh -c "status @ \
        | grep start/running >/dev/null 2>&1 && echo @"' \
        | tee services;
    for s in \$(cat services);
        do
            stop \$s;
{'fraction_non_alphanumeric': 0.1860566448801743, 'fraction_numerical': 0.003485838779956427, 'mean_word_length': 2.188888888888889, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, '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': '7123765', 'n_tokens_mistral': 903, 'n_tokens_neox': 863, 'n_words': 229}