<commit_before><commit_msg>add mistral dev tools for patching deployment<commit_after>#!/bin/bash

git clone https://github.com/openstack/python-tripleoclient.git
git clone https://git.openstack.org/openstack/tripleo-common

cat <<EOF>> patch-cli.sh
for i in \$1; do
    curl "https://review.openstack.org/changes/\$i/revisions/current/patch" |base64 --decode > /home/stack/"\$i.patch"
    cd ~/python-tripleoclient; patch -N -p1 -b -z .first < /home/stack/\$i.patch
done
EOF

chmod +x patch-cli.sh

cat <<EOF>> patch-common.sh
for i in \$1; do
    curl "https://review.openstack.org/changes/\$i/revisions/current/patch" |base64 --decode > /home/stack/"\$i.patch"
    cd ~/tripleo-common; patch -N -p1 -b -z .first < /home/stack/\$i.patch
done
EOF

chmod +x patch-common.sh

cat <<EOF>> mistral.sh
pushd ~/tripleo-common
sudo rm -Rf /usr/lib/python2.7/site-packages/tripleo_common*
sudo python setup.py install
sudo cp /usr/share/tripleo-common/sudoers /etc/sudoers.d/tripleo-common
sudo systemctl restart openstack-mistral-executor
sudo systemctl restart openstack-mistral-engine
# this loads the actions via entrypoints
sudo mistral-db-manage populate
# make sure the new actions got loaded
mistral action-list | grep tripleo
popd
EOF

chmod +x mistral.sh

# patch:
# https://review.openstack.org/#/c/463765/ tripleo-common
./patch-common.sh 487496
#463765

# https://review.openstack.org/#/c/463728/ tripleoclient
./patch-cli.sh 487488
#463728

sudo yum remove -y python-tripleoclient

pushd python-tripleoclient
sudo python setup.py install
popd

./mistral.sh
# Create or update the workbook:
#mistral workbook-update /usr/share/openstack-tripleo-common/workbooks/major_upgrade.yaml
mistral workbook-update /usr/share/openstack-tripleo-common/workbooks/package_update.yaml


{'fraction_non_alphanumeric': 0.13329583802024747, 'fraction_numerical': 0.025871766029246346, 'mean_word_length': 3.9831932773109244, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 6, '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': '879479', 'n_tokens_mistral': 691, 'n_tokens_neox': 632, 'n_words': 152}