From 9396d367c12b43283ab367a581442479d86556ff Mon Sep 17 00:00:00 2001 From: John Fonner Date: Fri, 14 Dec 2018 14:36:21 -0600 Subject: [PATCH 1/4] Changed slugify function of abaco-init to use python 2/3 Signed-off-by: John Fonner --- abaco-init.sh | 2 +- slugify.py | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100755 slugify.py diff --git a/abaco-init.sh b/abaco-init.sh index ec942e1..c5d3bb4 100755 --- a/abaco-init.sh +++ b/abaco-init.sh @@ -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= diff --git a/slugify.py b/slugify.py new file mode 100755 index 0000000..2f909cb --- /dev/null +++ b/slugify.py @@ -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) From c32578d5672e6292a986f6ac875e0822a048c871 Mon Sep 17 00:00:00 2001 From: John Fonner Date: Mon, 28 Jan 2019 14:06:24 -0600 Subject: [PATCH 2/4] Changed abaco-update.sh to accept a stateless argument and explicitly specify the 'stateless' status in the update request. False by default. Signed-off-by: John Fonner --- abaco-update.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/abaco-update.sh b/abaco-update.sh index e42f22b..d9e3481 100755 --- a/abaco-update.sh +++ b/abaco-update.sh @@ -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 @@ -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} @@ -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 ;; @@ -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() { From d36a931d7f13bbfc3cb4b48807743d1832d7eaac Mon Sep 17 00:00:00 2001 From: John Fonner Date: Thu, 31 Jan 2019 17:11:39 -0600 Subject: [PATCH 3/4] fix help message for abaco submit Signed-off-by: John Fonner --- abaco-submit.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/abaco-submit.sh b/abaco-submit.sh index 1acdd58..aacd487 100755 --- a/abaco-submit.sh +++ b/abaco-submit.sh @@ -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 From f2df77d9091df4550a924bfd63b6a01f76a7c8b7 Mon Sep 17 00:00:00 2001 From: John Fonner Date: Wed, 27 Feb 2019 10:11:39 -0600 Subject: [PATCH 4/4] update JSON parsing for executions --- abaco-executions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/abaco-executions.sh b/abaco-executions.sh index 72e9d06..eecedc2 100755 --- a/abaco-executions.sh +++ b/abaco-executions.sh @@ -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() {