Skip to content

Commit

Permalink
Merge pull request #4 from TACC-Cloud/develop
Browse files Browse the repository at this point in the history
merge develop branch
  • Loading branch information
johnfonner authored Feb 27, 2019
2 parents 53bfcdb + f2df77d commit 2e374f3
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 8 deletions.
2 changes: 1 addition & 1 deletion abaco-executions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ else
fi

function filter_list() {
eval $@ | jq -r '.result | .ids | .[]' | column -t
eval $@ | jq -r '.result | .executions | .[] | [.id, .status] | "\(.[0]) \(.[1])"' | column -t
}

function filter_description() {
Expand Down
2 changes: 1 addition & 1 deletion abaco-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$DIR/abaco-common.sh"

function slugify {
echo "${1}" | tr -c -d [0-9A-Za-z\ _-] | tr ' ' '_' | tr '[:upper:]' '[:lower:]'
$DIR/slugify.py "${1}"
}

name=
Expand Down
2 changes: 1 addition & 1 deletion abaco-submit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ is required and can be string or JSON.
Options:
-h show help message
-z api access token
-m value of actor env variable $MSG
-m value of actor env variable \$MSG
-q query string to pass to actor env
-v verbose output
-V very verbose output
Expand Down
16 changes: 11 additions & 5 deletions abaco-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Options:
-E read environment variables from json file
-p add privileged status
-f force update
-s make stateless actor
-u use actor uid
-v verbose output
-V very verbose output
Expand All @@ -30,11 +31,13 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

source "$DIR/abaco-common.sh"

privileged="false"
stateless="false"
force="false"
use_uid="false"
tok=
force=false
use_uid=false
privileged=false
while getopts ":he:E:pfuvz:V" o; do

while getopts ":he:E:pfsuvz:V" o; do
case "${o}" in
z) # custom token
tok=${OPTARG}
Expand All @@ -51,6 +54,9 @@ while getopts ":he:E:pfuvz:V" o; do
f) # force
force=true
;;
s) # stateless
stateless="true"
;;
u) # use uid
use_uid=true
;;
Expand Down Expand Up @@ -99,7 +105,7 @@ args_default_env=$(build_json_from_array "${env_args[@]}")
default_env=$(echo "$file_default_env $args_default_env" | jq -s add)

# curl command
data="{\"image\":\"${image}\", \"privileged\":${privileged}, \"force\":${force}, \"useContainerUid\":${use_uid}, \"defaultEnvironment\":${default_env}}"
data="{\"stateless\":\"${stateless}\", \"image\":\"${image}\", \"privileged\":${privileged}, \"force\":${force}, \"useContainerUid\":${use_uid}, \"defaultEnvironment\":${default_env}}"
curlCommand="curl -X PUT -sk -H \"Authorization: Bearer $TOKEN\" -H \"Content-Type: application/json\" --data '$data' '$BASE_URL/actors/v2/${actorid}'"

function filter() {
Expand Down
32 changes: 32 additions & 0 deletions slugify.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env python
"""
Usage: slugify.py "string_to_convert"
Convert strings potentially containing special characters to a slugified
ASCII version safe for directory names, git repositories, and Abaco.
Example:
slugify.py "cr@zy $tr1ng t0 (onver!"
"""

from __future__ import print_function
import argparse
import re

parser = argparse.ArgumentParser(
description="Copy files to/from/between remote systems")

parser.add_argument(
"unsafe_string",
action="store",
help="String to convert into a safe slug")

def slugify(unsafe_string):
temp_string = re.sub('[^A-Za-z0-9 _-]+', '', unsafe_string)
temp_string = re.sub(' ', '_', temp_string)
return temp_string.lower()

if __name__ == "__main__":
args = parser.parse_args()
unsafe_string = args.unsafe_string
safe_string = slugify(unsafe_string)
print(safe_string)

0 comments on commit 2e374f3

Please sign in to comment.