<commit_before>"""
  Implementation for rebalance, add, remove, stop rebalance.
"""

import time
import os
import sys
import util_cli as util
import socket

from usage import usage
from restclient import *
from listservers import *

# the rest commands and associated URIs for various node operations

rest_cmds = {
    'rebalance'         :'/controller/rebalance',
    'rebalance-stop'    :'/controller/stopRebalance',
    'rebalance-status'  :'/pools/default/rebalanceProgress',
    'server-add'        :'/controller/addNode',
    'server-readd'      :'/controller/reAddNode',
    'failover'          :'/controller/failOver',
    'cluster-init'      :'/settings/web',
    'cluster-edit'      :'/settings/web',
    'node-init'         :'/nodes/self/controller/settings',
    'setting-compaction'    :'/controller/setAutoCompaction',
    'setting-notification'  :'/settings/stats',
    'setting-autofailover'  :'/settings/autoFailover',
    'setting-alert'         :'/settings/alerts'
}

server_no_remove = [
    'rebalance-stop',
    'rebalance-status',
    'server-add',
    'server-readd',
    'failover'
]
server_no_add = [
    'rebalance-stop',
    'rebalance-status',
    'failover',
]

# Map of operations and the HTTP methods used against the REST interface

methods = {
    'rebalance'         :'POST',
    'rebalance-stop'    :'POST',
    'rebalance-status'  :'GET',
    'eject-server'      :'POST',
    'server-add'        :'POST',
    'server-readd'      :'POST',
    'failover'          :'POST',
    'cluster-init'      :'POST',
    'cluster-edit'      :'POST',
    'node-init'         :'POST',
    'setting-compaction'    :'POST',
    'setting-notification'  :'POST',
    'setting-autofailover'  :'POST',
    'setting-alert'         :'POST',
}

bool_to_str = lambda value: str(bool(value)).lower()

# Map of HTTP success code, success message and error message for
# handling HTTP response properly<commit_msg>MB-8135: Make sure 0 interprets as false<commit_after>"""
  Implementation for rebalance, add, remove, stop rebalance.
"""

import time
import os
import sys
import util_cli as util
import socket

from usage import usage
from restclient import *
from listservers import *

# the rest commands and associated URIs for various node operations

rest_cmds = {
    'rebalance'         :'/controller/rebalance',
    'rebalance-stop'    :'/controller/stopRebalance',
    'rebalance-status'  :'/pools/default/rebalanceProgress',
    'server-add'        :'/controller/addNode',
    'server-readd'      :'/controller/reAddNode',
    'failover'          :'/controller/failOver',
    'cluster-init'      :'/settings/web',
    'cluster-edit'      :'/settings/web',
    'node-init'         :'/nodes/self/controller/settings',
    'setting-compaction'    :'/controller/setAutoCompaction',
    'setting-notification'  :'/settings/stats',
    'setting-autofailover'  :'/settings/autoFailover',
    'setting-alert'         :'/settings/alerts'
}

server_no_remove = [
    'rebalance-stop',
    'rebalance-status',
    'server-add',
    'server-readd',
    'failover'
]
server_no_add = [
    'rebalance-stop',
    'rebalance-status',
    'failover',
]

# Map of operations and the HTTP methods used against the REST interface

methods = {
    'rebalance'         :'POST',
    'rebalance-stop'    :'POST',
    'rebalance-status'  :'GET',
    'eject-server'      :'POST',
    'server-add'        :'POST',
    'server-readd'      :'POST',
    'failover'          :'POST',
    'cluster-init'      :'POST',
    'cluster-edit'      :'POST',
    'node-init'         :'POST',
    'setting-compaction'    :'POST',
    'setting-notification'  :'POST',
    'setting-autofailover'  :'POST',
    'setting-alert'         :'POST',
}

bool_to_str = lambda value: str(bool(int(value))).lower()

# Map of HTTP success code, success message and error message for
# handling HTTP response properly
{'fraction_non_alphanumeric': 0.14690721649484537, 'fraction_numerical': 0.001288659793814433, 'mean_word_length': 2.8501984126984126, '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': '2505198', 'n_tokens_mistral': 1279, 'n_tokens_neox': 1199, 'n_words': 279}