<commit_before>#AZURE specific functions

#### start $cloud_provider customizations

# $1 vm name
vm_exists() {
  logger "Checking if VM $1 exists..."

  if [ ! -z "$(azure vm list -s "$subscriptionID"|grep " $1 " | grep " $dnsName.cloudapp.net ")" ] ; then
    return 0
  else
    return 1
  fi
}

#$1 name $2 location
azure_create_group() {
  if [ "$1" ] && [ "$2" ] ; then
    echo "azure account affinity-group create --location $2 -s $subscriptionID --label $1 $1"
    azure account affinity-group create --location "$2" -s "$subscriptionID" --label "$1" "$1"
  else
    logger "ERROR: invalid parameters for creating affinity group name=$1 location=$2"
  fi
}

#$1 vnet name $2 affinity group
azure_create_vnet() {
  if [ "$1" ] && [ "$2" ] ; then
    echo "azure network vnet create --affinity-group $2 -s $subscriptionID $1"
    azure network vnet create --affinity-group "$2"  -s "$subscriptionID" "$1"
  else
    logger "ERROR: invalid parameters for creating vnet group name=$1 affinity=$2"
  fi
}

# $1 vm name $2 ssh port
vm_create() {

  #check if the port was specified, for Windows this will be the RDP port
  if [ ! -z "$2" ] ; then
    ssh_port="$2"
  else
    ssh_port=$(( ( RANDOM % 65535 )  + 1024 ))
  fi

  if [ "$vmType" != "windows" ] ; then

    logger "Creating Linux VM $1 with SSH port $ssh_port..."

    #if a virtual network is specified
    if [ "$virtualNetworkName" ] ; then

      #uncomment to create at first deploy
      #azure_create_group "$affinityGroup" "$azureLocation"
      #azure_create_vnet  "$virtualNetworkName" "$affinityGroup"

      azure vm create \
            -s "$subscriptionID" \
            --connect "$dnsName" `#Deployment name` \
            --vm-name "$1" \
            --vm-size "$vmSize" \
            `#--location 'West Europe'` \
            --location "$azureLocation" \
            --virtual-network-name "$virtualNetworkName" \
            `#--subnet-names "$subnetNames"` \
            --ssh "$ssh_port" \
            --ssh-cert "$sshCert" \
            `#-v` \
            `#'test-11'` `#DNS name` \
            "$vmImage" \
            "$userAloja" "$<PASSWORD>"
    #no virtual network preference
    else
      azure vm create \
            -s "$subscriptionID" \
            --connect "$dnsName" `#Deployment name` \
            --vm-name "$1" \
            --vm-size "$vmSize" \
            --location "$azureLocation" \
            --ssh "$ssh_port" \
            --ssh-cert "$sshCert" \
            "$vmImage" \
            "$userAloja" "$<PASSWORD>"
    fi
  else
    logger "Creating Windows VM $1 with RDP port $ssh_port..."

    azure vm create \
          -s "$subscriptionID" \
          --connect "$dnsName" `#Deployment name` \
          --vm-name "$1" \
          --vm-size "$vmSize" \
          `#--location 'West Europe'` \
          --location "$azureLocation" \
          --virtual-network-name "$virtualNetworkName" \
          --subnet-names "$subnetNames" \
          --rdp "$ssh_port" \
          `#-v` \
          `#'test-11'` `#DNS name` \
          "$vmImage" \
          "$userAloja" "$<PASSWORD>"
  fi

#--location 'West Europe' \

}<commit_msg>DEPLOY: forcing asm mode for creating VMs<commit_after>#AZURE specific functions

#### start $cloud_provider customizations

# $1 vm name
vm_exists() {
  logger "Checking if VM $1 exists..."

  if [ ! -z "$(azure vm list -s "$subscriptionID"|grep " $1 " | grep " $dnsName.cloudapp.net ")" ] ; then
    return 0
  else
    return 1
  fi
}

#$1 name $2 location
azure_create_group() {
  if [ "$1" ] && [ "$2" ] ; then
    echo "azure account affinity-group create --location $2 -s $subscriptionID --label $1 $1"
    azure account affinity-group create --location "$2" -s "$subscriptionID" --label "$1" "$1"
  else
    logger "ERROR: invalid parameters for creating affinity group name=$1 location=$2"
  fi
}

#$1 vnet name $2 affinity group
azure_create_vnet() {
  if [ "$1" ] && [ "$2" ] ; then
    echo "azure network vnet create --affinity-group $2 -s $subscriptionID $1"
    azure network vnet create --affinity-group "$2"  -s "$subscriptionID" "$1"
  else
    logger "ERROR: invalid parameters for creating vnet group name=$1 affinity=$2"
  fi
}

# $1 vm name $2 ssh port
vm_create() {

  #check if the port was specified, for Windows this will be the RDP port
  if [ ! -z "$2" ] ; then
    ssh_port="$2"
  else
    ssh_port=$(( ( RANDOM % 65535 )  + 1024 ))
  fi

  if [ "$vmType" != "windows" ] ; then

    logger "Creating Linux VM $1 with SSH port $ssh_port..."

    #if a virtual network is specified
    if [ "$virtualNetworkName" ] ; then

      #uncomment to create at first deploy
      #azure_create_group "$affinityGroup" "$azureLocation"
      #azure_create_vnet  "$virtualNetworkName" "$affinityGroup"

      azure config mode asm;
      azure vm create \
            -s "$subscriptionID" \
            --connect "$dnsName" `#Deployment name` \
            --vm-name "$1" \
            --vm-size "$vmSize" \
            `#--location 'West Europe'` \
            --location "$azureLocation" \
            --virtual-network-name "$virtualNetworkName" \
            `#--subnet-names "$subnetNames"` \
            --ssh "$ssh_port" \
            --ssh-cert "$sshCert" \
            `#-v` \
            `#'test-11'` `#DNS name` \
            "$vmImage" \
            "$userAloja" "$passwordAloja"
    #no virtual network preference
    else
      azure config mode asm;
      azure vm create \
            -s "$subscriptionID" \
            --connect "$dnsName" `#Deployment name` \
            --vm-name "$1" \
            --vm-size "$vmSize" \
            --location "$azureLocation" \
            --ssh "$ssh_port" \
            --ssh-cert "$sshCert" \
            "$vmImage" \
            "$userAloja" "$<PASSWORD>"
    fi
  else
    logger "Creating Windows VM $1 with RDP port $ssh_port..."

    azure config mode asm;
    azure vm create \
          -s "$subscriptionID" \
          --connect "$dnsName" `#Deployment name` \
          --vm-name "$1" \
          --vm-size "$vmSize" \
          `#--location 'West Europe'` \
          --location "$azureLocation" \
          --virtual-network-name "$virtualNetworkName" \
          --subnet-names "$subnetNames" \
          --rdp "$ssh_port" \
          `#-v` \
          `#'test-11'` `#DNS name` \
          "$vmImage" \
          "$userAloja" "$<PASSWORD>"
  fi

#--location 'West Europe' \

}
{'fraction_non_alphanumeric': 0.1523096129837703, 'fraction_numerical': 0.01529338327091136, 'mean_word_length': 1.9331807780320367, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '4530021', 'n_tokens_mistral': 2121, 'n_tokens_neox': 2031, 'n_words': 600}