<commit_before>import json
import os
import os.path
import subprocess
import re
import sys
import time
import rstr

from collections import OrderedDict
from verify_e2e import check_e2e

from json2html import *

images_list = { 'ubuntu14': 'Canonical:UbuntuServer:14.04.5-LTS:14.04.201808180',
         'ubuntu16': 'Canonical:UbuntuServer:16.04-LTS:latest',
         'ubuntu18': 'Canonical:UbuntuServer:18.04-LTS:latest',
         'debian8': 'credativ:Debian:8:latest',
         'debian9': 'credativ:Debian:9:latest',
         'redhat6': 'RedHat:RHEL:6.9:latest',
         'redhat7': 'RedHat:RHEL:7.3:latest',
         'centos6': 'OpenLogic:CentOS:6.9:latest',
         'centos7': 'OpenLogic:CentOS:7.5:latest',
         'oracle6': 'Oracle:Oracle-Linux:6.9:latest',
         'oracle7': 'Oracle:Oracle-Linux:7.5:latest',
         'suse12': 'SUSE:SLES:12-SP2:latest'}

vmnames = []

if len(sys.argv) > 1:
    vms_list = sys.argv[1:]
    images = {}
    for vm in vms_list:
        vm_dict = { vm: images_list[vm] }
        images.update(vm_dict)
else:
    images = images_list

with open('{0}/parameters.json'.format(os.getcwd()), 'r') as f:
    parameters = f.read()
    if re.search(r'"<.*>"', parameters):
        print('Please replace placeholders in parameters.json')
        exit()
    parameters = json.loads(parameters)

resource_group = parameters['resource group']
location = parameters['location']
username = parameters['username']
password = parameters['password']
nsg_group = parameters['nsg group']
nsg_resource_group = parameters['nsg resource group']
size = parameters['size'] # Preferred: 'Standard_B1ms'
extension = parameters['extension'] #OmsAgentForLinux
publisher = parameters['publisher'] # Microsoft.EnterpriseCloud.Monitoring
key_vault = parameters['key vault']
subscription = str(json.loads(subprocess.check_output('az keyvault secret show --name susbscription-id --vault-name omslinux-automation-kv', shell=True))["value"])
workspace_id = str(json.loads(subprocess.check_output('az keyvault secret show --name workspace-id --vault-name {0}'.format(key_vault), shell=True))["value"])
workspace_key = str(json.loads(subprocess.check_output('az keyvault secret show --name workspace-key --vault-name {0}'.format(key_vault), shell=True))["value"])
public_settings = { "workspaceId": workspace_id }
private_settings = { "workspaceKey": workspace_key }
nsg = "/subscriptions/"+ subscription + "/resourceGroups/" + nsg_resource_group + "/providers/Microsoft.Network/networkSecurityGroups/" + nsg_group

if os.system('az network nsg show --resource-group {0} --name {1}'.format(nsg_resource_group, nsg_group)) == 0:
    print "Network Security Group successfully validated"
else:
    print("""Please verify that the nsg or nsg resource group are valid and are in the right subscription.
If there is no Network Security Group, please create new one. NSG is a must to create a VM in this testing.""")
    exit()

<commit_msg>correct key-vault name<commit_after>import json
import os
import os.path
import subprocess
import re
import sys
import time
import rstr

from collections import OrderedDict
from verify_e2e import check_e2e

from json2html import *

images_list = { 'ubuntu14': 'Canonical:UbuntuServer:14.04.5-LTS:14.04.201808180',
         'ubuntu16': 'Canonical:UbuntuServer:16.04-LTS:latest',
         'ubuntu18': 'Canonical:UbuntuServer:18.04-LTS:latest',
         'debian8': 'credativ:Debian:8:latest',
         'debian9': 'credativ:Debian:9:latest',
         'redhat6': 'RedHat:RHEL:6.9:latest',
         'redhat7': 'RedHat:RHEL:7.3:latest',
         'centos6': 'OpenLogic:CentOS:6.9:latest',
         'centos7': 'OpenLogic:CentOS:7.5:latest',
         'oracle6': 'Oracle:Oracle-Linux:6.9:latest',
         'oracle7': 'Oracle:Oracle-Linux:7.5:latest',
         'suse12': 'SUSE:SLES:12-SP2:latest'}

vmnames = []

if len(sys.argv) > 1:
    vms_list = sys.argv[1:]
    images = {}
    for vm in vms_list:
        vm_dict = { vm: images_list[vm] }
        images.update(vm_dict)
else:
    images = images_list

with open('{0}/parameters.json'.format(os.getcwd()), 'r') as f:
    parameters = f.read()
    if re.search(r'"<.*>"', parameters):
        print('Please replace placeholders in parameters.json')
        exit()
    parameters = json.loads(parameters)

resource_group = parameters['resource group']
location = parameters['location']
username = parameters['username']
password = parameters['password']
nsg_group = parameters['nsg group']
nsg_resource_group = parameters['nsg resource group']
size = parameters['size'] # Preferred: 'Standard_B1ms'
extension = parameters['extension'] #OmsAgentForLinux
publisher = parameters['publisher'] # Microsoft.EnterpriseCloud.Monitoring
key_vault = parameters['key vault']
subscription = str(json.loads(subprocess.check_output('az keyvault secret show --name susbscription-id --vault-name {0}'.format(key_vault), shell=True))["value"])
workspace_id = str(json.loads(subprocess.check_output('az keyvault secret show --name workspace-id --vault-name {0}'.format(key_vault), shell=True))["value"])
workspace_key = str(json.loads(subprocess.check_output('az keyvault secret show --name workspace-key --vault-name {0}'.format(key_vault), shell=True))["value"])
public_settings = { "workspaceId": workspace_id }
private_settings = { "workspaceKey": workspace_key }
nsg = "/subscriptions/"+ subscription + "/resourceGroups/" + nsg_resource_group + "/providers/Microsoft.Network/networkSecurityGroups/" + nsg_group

if os.system('az network nsg show --resource-group {0} --name {1}'.format(nsg_resource_group, nsg_group)) == 0:
    print "Network Security Group successfully validated"
else:
    print("""Please verify that the nsg or nsg resource group are valid and are in the right subscription.
If there is no Network Security Group, please create new one. NSG is a must to create a VM in this testing.""")
    exit()


{'fraction_non_alphanumeric': 0.14237172952769284, 'fraction_numerical': 0.024294937138973835, 'mean_word_length': 4.644295302013423, 'pattern_counts': {'":': 4, '<': 5, '<?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': '2357901', 'n_tokens_mistral': 1990, 'n_tokens_neox': 1900, 'n_words': 438}