<commit_before>#!/bin/bash
# 
# this installs the VM images
# if this is the final stage:
# restart required after this stage (exit=1)
#
#set -x

cd $(dirname $0)
. ../etc/common.sh  

# this is done as root
cd /home/virl/virl-bootstrap

# check that Salt is available and key is OK
wait_for_salt

# install the router VMs (lengthy)
echo "installing Cisco OS VM images"
salt-call state.sls virl.routervms.all

# get all VM Maestro images
echo "installing VM Maestro images"
salt-call state.sls virl.vmm.vmmall

# DHCP server on guest not working reliably: 
# also requires no guest account in virl.ini for the workaround to work
# guest_account: False
# this is a workaround (FIXME)
# PS1=xxx is needed, otherwise .bashrc will exit right away and no OS_* variables
# are defined.
su -lc 'PS1=xxx; . ~/.bashrc; virl_uwm_client --username uwmadmin --password password project-create --name guest --user-password guest' virl

# add external nameservers to guest network
su -lc 'PS1=xxx; . ~/.bashrc; neutron subnet-update guest --dns_nameservers list=true 8.8.8.8 8.8.4.4' virl

# VMM connects to interface w/ default route (external interface)
# in this case we want it to show the internal interface
crudini --set /etc/virl/virl.cfg env virl_local_ip 172.16.1.1
crudini --set /etc/virl/virl.cfg env virl_std_process_count 20

# restart openstack services (to avoid a restart)
# echo "restarting OpenStack services"
# salt-call state.sls openstack-restart

exit $STATE_OK

<commit_msg>restart STD after image install and virl.cfg mod<commit_after>#!/bin/bash
# 
# this installs the VM images
# if this is the final stage:
# restart required after this stage (exit=1)
#
#set -x

cd $(dirname $0)
. ../etc/common.sh  

# this is done as root
cd /home/virl/virl-bootstrap

# check that Salt is available and key is OK
wait_for_salt

# install the router VMs (lengthy)
echo "installing Cisco OS VM images"
salt-call state.sls virl.routervms.all

# get all VM Maestro images
echo "installing VM Maestro images"
salt-call state.sls virl.vmm.vmmall

# DHCP server on guest not working reliably: 
# also requires no guest account in virl.ini for the workaround to work
# guest_account: False
# this is a workaround (FIXME)
# PS1=xxx is needed, otherwise .bashrc will exit right away and no OS_* variables
# are defined.
su -lc 'PS1=xxx; . ~/.bashrc; virl_uwm_client --username uwmadmin --password password project-create --name guest --user-password guest' virl

# add external nameservers to guest network
su -lc 'PS1=xxx; . ~/.bashrc; neutron subnet-update guest --dns_nameservers list=true 8.8.8.8 8.8.4.4' virl

# VMM connects to interface w/ default route (external interface)
# in this case we want it to show the internal interface
crudini --set /etc/virl/virl.cfg env virl_local_ip 172.16.1.1
crudini --set /etc/virl/virl.cfg env virl_std_process_count 20

# restart openstack services (to avoid a restart)
# echo "restarting OpenStack services"
# salt-call state.sls openstack-restart

# to make the changes in virl.cfg effective we need to restart STD
# (or restart the box, but this is the lesser of two evils)
echo "restarting STD..."
service virl-std restart


exit $STATE_OK


{'fraction_non_alphanumeric': 0.09088050314465408, 'fraction_numerical': 0.013836477987421384, 'mean_word_length': 3.9241486068111455, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, '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': '2182690', 'n_tokens_mistral': 1099, 'n_tokens_neox': 1052, 'n_words': 417}