<commit_before>#!/bin/bash

set -e

# /usr/local/bin isn't set yet in our PATH
export PATH=/usr/local/bin:$PATH

# Wait for nubis-metadata, we will be invoked again soon
if [ "$(nubis-metadata status)" != 'ready' ]; then
    exit 0
fi

NUBIS_SUDO_GROUPS="$(nubis-metadata NUBIS_SUDO_GROUPS)"
NUBIS_USER_GROUPS="$(nubis-metadata NUBIS_USER_GROUPS)"

if [ -z "${NUBIS_SUDO_GROUPS}" ]; then
    NUBIS_SUDO_GROUPS_TMP="[]"
else
    NUBIS_SUDO_GROUPS_TMP=$(echo "${NUBIS_SUDO_GROUPS}" | sed -e's/^/["/g' | sed -e's/$/"]/' | sed -e's/,/","/g' )
fi

if [ -z "${NUBIS_USER_GROUPS}" ]; then
    NUBIS_USER_GROUPS_TMP="[]"
else
    NUBIS_USER_GROUPS_TMP=$(echo "${NUBIS_USER_GROUPS}" | sed -e's/^/["/g' | sed -e's/$/"]/' | sed -e's/,/","/g')
fi

cat <<EOF > /etc/nubis/puppet/nubis_users.pp
# Generated by gen-puppet.sh
class { 'nubis_users::setup':
    sudo_users    => ${NUBIS_SUDO_GROUPS_TMP},
    nubis_users   => ${NUBIS_USER_GROUPS_TMP},
}
EOF

puppet apply /etc/nubis/puppet/nubis_users.pp<commit_msg>Fixing gen-puppet to deal with the error<commit_after>#!/bin/bash

set -e

# /usr/local/bin isn't set yet in our PATH
export PATH=/usr/local/bin:$PATH

# Wait for nubis-metadata, we will be invoked again soon
if [ "$(nubis-metadata status)" != 'ready' ]; then
    exit 0
fi

if nubis-metadata NUBIS_SUDO_GROUPS > /dev/null 2>&1; then
    NUBIS_SUDO_GROUPS_TMP=$(nubis-metadata NUBIS_SUDO_GROUPS | sed -e's/^/["/g' | sed -e's/$/"]/' | sed -e's/,/","/g')
else
    NUBIS_SUDO_GROUPS_TMP="[]"
fi

if nubis-metadata NUBIS_USER_GROUPS > /dev/null 2>&1; then
    NUBIS_USER_GROUPS_TMP=$(nubis-metadata NUBIS_USER_GROUPS | sed -e's/^/["/g' | sed -e's/$/"]/' | sed -e's/,/","/g')
else
    NUBIS_USER_GROUPS_TMP="[]"
fi

cat <<EOF > /etc/nubis/puppet/nubis_users.pp
# Generated by gen-puppet.sh
class { 'nubis_users::setup':
    sudo_users    => ${NUBIS_SUDO_GROUPS_TMP},
    nubis_users   => ${NUBIS_USER_GROUPS_TMP},
}
EOF

puppet apply /etc/nubis/puppet/nubis_users.pp
{'fraction_non_alphanumeric': 0.183256763654926, 'fraction_numerical': 0.0030627871362940277, 'mean_word_length': 4.0, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, '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': '7454884', 'n_tokens_mistral': 904, 'n_tokens_neox': 897, 'n_words': 163}