<commit_before>import json
import os
import sys
import base64


def run():
    deploymentName = sys.argv[1]
    regions = json.loads(base64.b64decode(sys.argv[2]))
    nodesPerRegion = int(sys.argv[3])
    sshkey = sys.argv[4]

    document = generateDocument(deploymentName, sshkey, regions, nodesPerRegion)

    with open('provision.json', 'w') as outputFile:
        json.dump(document, outputFile, sort_keys=True, indent=4, ensure_ascii=False)


def getNodeInformation(deploymentName, region, numberOfNodes):
    nodeInformation = []

    for nodeIndex in range(1, numberOfNodes+1):
        nodeName = deploymentName + '-service-' + region + '-' + str(nodeIndex) + '-vm'
        nodeIP = nodeName
        document = {
            "public_ip": nodeIP,
            "private_ip": nodeIP,
            "node_type": "cassandra",
            "rack": "rack1"
        }
        nodeInformation.append(document)
    return nodeInformation


def getLocalDataCenters(deploymentName, regions, nodesPerRegion):
    localDataCenters = []
    for region in regions:
        localDataCenter = {
            "location": region,
            "node_information": getNodeInformation(deploymentName, region, nodesPerRegion),
            "dc": region
        }
        localDataCenters.append(localDataCenter)
    return localDataCenters


def getFingerprint(ip):
    os.system('ssh-keyscan -p 22 -t rsa ' + ip + ' > /tmp/tmpsshkeyhost.pub')
    os.system('ssh-keygen -lf /tmp/tmpsshkeyhost.pub > /tmp/tmpgenkey')

    with open("/tmp/tmpgenkey", "r") as inputFile:
        data = inputFile.read()
    array = data.split()
    fingerprint = array[0] + ' ' + array[1] + ' ' + array[3]
    return fingerprint


def getAcceptedFingerprints(deploymentName, regions, nodesPerRegion):
    acceptedFingerprints = {}
    for region in regions:
        for nodeIndex in range(1, nodesPerRegion+1):
            nodeName = deploymentName + '-service-' + region + '-' + str(nodeIndex) + '-vm'
            nodeIP = nodeName<commit_msg>resolve hostnames to ip<commit_after>import json
import os
import sys
import base64
import socket

def run():
    deploymentName = sys.argv[1]
    regions = json.loads(base64.b64decode(sys.argv[2]))
    nodesPerRegion = int(sys.argv[3])
    sshkey = sys.argv[4]

    document = generateDocument(deploymentName, sshkey, regions, nodesPerRegion)

    with open('provision.json', 'w') as outputFile:
        json.dump(document, outputFile, sort_keys=True, indent=4, ensure_ascii=False)


def getNodeInformation(deploymentName, region, numberOfNodes):
    nodeInformation = []

    for nodeIndex in range(1, numberOfNodes+1):
        nodeName = deploymentName + '-service-' + region + '-' + str(nodeIndex) + '-vm'
        nodeIP = socket.gethostbyname_ex(nodeName)[2][0]
        document = {
            "public_ip": nodeIP,
            "private_ip": nodeIP,
            "node_type": "cassandra",
            "rack": "rack1"
        }
        nodeInformation.append(document)
    return nodeInformation


def getLocalDataCenters(deploymentName, regions, nodesPerRegion):
    localDataCenters = []
    for region in regions:
        localDataCenter = {
            "location": region,
            "node_information": getNodeInformation(deploymentName, region, nodesPerRegion),
            "dc": region
        }
        localDataCenters.append(localDataCenter)
    return localDataCenters


def getFingerprint(ip):
    os.system('ssh-keyscan -p 22 -t rsa ' + ip + ' > /tmp/tmpsshkeyhost.pub')
    os.system('ssh-keygen -lf /tmp/tmpsshkeyhost.pub > /tmp/tmpgenkey')

    with open("/tmp/tmpgenkey", "r") as inputFile:
        data = inputFile.read()
    array = data.split()
    fingerprint = array[0] + ' ' + array[1] + ' ' + array[3]
    return fingerprint


def getAcceptedFingerprints(deploymentName, regions, nodesPerRegion):
    acceptedFingerprints = {}
    for region in regions:
        for nodeIndex in range(1, nodesPerRegion+1):
            nodeName = deploymentName + '-service-' + region + '-' + str(nodeIndex) + '-vm'
            nodeIP = socket.gethostbyname_ex(nodeName)[2][0]
{'fraction_non_alphanumeric': 0.12081193445830277, 'fraction_numerical': 0.011249694301785278, 'mean_word_length': 2.9824732229795523, 'pattern_counts': {'":': 14, '<': 3, '<?xml version=': 0, '>': 7, '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': '219415', 'n_tokens_mistral': 1287, 'n_tokens_neox': 1247, 'n_words': 272}