Skip to content

Commit

Permalink
fix sha lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
bcumming committed Mar 16, 2024
1 parent a762e25 commit 6f18654
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 26 deletions.
47 changes: 23 additions & 24 deletions activate
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,30 @@ function uenv {

if [ "$1" = "--version" ]; then
echo "@@version@@";
break
fi

flags=""
while [[ $# -gt 0 ]]; do
case $1 in
-?*|--*)
flags="$flags $1"
shift
;;
*)
break
;;
esac
done

if [[ $# -eq 0 ]]; then
uenv_usage;
elif [ "$1" = "image" ]; then
shift;
$UENV_IMG_CMD $flags "$@"
elif [[ " $* " =~ [[:space:]](-h|--help)[[:space:]] ]]; then
echo "$($UENV_CMD $flags "$@")"
else
eval "$($UENV_CMD $flags "$@")"
flags=""
while [[ $# -gt 0 ]]; do
case $1 in
-?*|--*)
flags="$flags $1"
shift
;;
*)
break
;;
esac
done

if [[ $# -eq 0 ]]; then
uenv_usage;
elif [ "$1" = "image" ]; then
shift;
$UENV_IMG_CMD $flags "$@"
elif [[ " $* " =~ [[:space:]](-h|--help)[[:space:]] ]]; then
echo "$($UENV_CMD $flags "$@")"
else
eval "$($UENV_CMD $flags "$@")"
fi
fi

unset -f uenv_usage
Expand Down
4 changes: 2 additions & 2 deletions lib/datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ def images(self):

# return a list of records that match a sha
def get_record(self, sha: str) -> Record:
if is_full_sha256(sha):
if names.is_full_sha256(sha):
return self._images.get(sha, [])
elif is_short_sha256(sha):
elif names.is_short_sha256(sha):
return self._images.get(self._short_sha[sha], [])
raise ValueError(f"{sha} is not a valid sha256 or short (16 character) sha")

Expand Down

0 comments on commit 6f18654

Please sign in to comment.