Skip to content

Instantly share code, notes, and snippets.

@ericdill
Created May 19, 2016 20:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ericdill/9748a2477a3335985b5b84a353111196 to your computer and use it in GitHub Desktop.
Save ericdill/9748a2477a3335985b5b84a353111196 to your computer and use it in GitHub Desktop.
replace conda with condalog to get pass through behavior
#! /bin/bash
LOGBOOK=bs-testing
pkg_list_base="/tmp/automated-list-of-conda-packages"
echo "pkg_list_base=$pkg_list_base"
#exit 1
echo "
Capturing current list of conda packages in
[$CONDA_DEFAULT_ENV]
(if empty, you are in the root environment
"
conda list -e > $pkg_list_base-before.txt
conda $*
#source activate /tmp/foo
echo "
Capturing current list of conda packages in
[$CONDA_DEFAULT_ENV]
(if empty, you are in the root environment
"
conda list -e > $pkg_list_base-after.txt
diff $pkg_list_base-before.txt $pkg_list_base-after.txt > $pkg_list_base-diff.txt
echo "
Package diff:
"
cat $pkg_list_base-diff.txt
echo "
Uploading to $LOGBOOK
"
python -c "from pyOlog.cli.ipy import olog; \
from pyOlog.OlogDataTypes import Attachment; \
import os; \
olog(msg='conda $*', \
logbooks='$LOGBOOK', \
attachments=[Attachment(open('$pkg_list_base-before.txt', 'r')), \
Attachment(open('$pkg_list_base-after.txt', 'r')), \
Attachment(open('$pkg_list_base-diff.txt', 'r'))])"
@tacaswell
Copy link

awesome.

The (if empty .. lines are missing a closing ).

Logbook should be "DAMA Software". Will talk to mizuki tomorrow about getting this distributed in our /opt/conda puppet module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment