<commit_before><commit_msg>Adding puppet-demo-setup.sh to steup the demo on vagrant up<commit_after>#!/bin/bash
set -e

# check if cumulus user exists
getent passwd 'cumulus' > /dev/null 2>&1 && ret=true

if $ret; then
  echo "Found cumulus user. Continue with install"
else
  echo "Cumulus user not found. Check if user 'cumulus' exists"
  exit 1
fi

example_ospf_dir='/home/cumulus/example-ospfunnum-puppet'

if [ ! -d $example_ospf_dir ]; then
  echo "Git clone example-ospfunnum-puppet"
  git clone https://github.com/CumulusNetworks/example-ospfunnum-puppet.git $example_ospf_dir
fi

echo "Cd into /home/cumulus/example-ospfunnum-puppet"
cd $example_ospf_dir

echo "install puppet librarian"
bundle install

echo "execute librarian to install puppet modules"
librarian-puppet install

echo "symlink puppet files from ospfunnum-puppet dir to /etc/puppet"
dirlocs=(files manifests modules templates)

echo "remove puppet files in /etc/ that will be overriding"
for i in "${dirlocs[@]}"
do
  rm -rf /etc/puppet/$i
done

echo "create symlinks into ${example_ospf_dir}"
for i in "${dirlocs[@]}"
do
  ln -sf $example_ospf_dir/$i /etc/puppet/$i
done

echo "symlink site.pp to topology specific version"
WBENCHCLASS=`jq -r '.[] | .workbench.wbench_class_base' /var/www/wbench.json`
ln -sf /etc/puppet/manifests/site-${WBENCHCLASS}.pp /etc/puppet/manifests/site.pp

echo "copy license files"
cp -f /var/www/*.lic /etc/puppet/modules/base/files/

echo "change ownership of example-ospfunnum-puppet to cumulus"
chown -R cumulus:cumulus $example_ospf_dir

echo "puppet plugin sync"
/usr/bin/puppet plugin download
{'fraction_non_alphanumeric': 0.1133250311332503, 'fraction_numerical': 0.0018679950186799503, 'mean_word_length': 4.560553633217993, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6267468', 'n_tokens_mistral': 613, 'n_tokens_neox': 583, 'n_words': 169}