From dda4cd8a6d862ad91d670181ddbacb53a5355c49 Mon Sep 17 00:00:00 2001 From: Onno Zweers Date: Fri, 2 May 2025 16:48:09 +0200 Subject: [PATCH 1/2] Fixed a typo and some indentations --- ada/ada | 68 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/ada/ada b/ada/ada index 02313c8..712e613 100755 --- a/ada/ada +++ b/ada/ada @@ -305,7 +305,7 @@ set_defaults() { resume=false # Default options to curl for various activities; - # these can be overidden in configuration files, see below. + # these can be overridden in configuration files, see below. # Don't override them unless you know what you're doing. curl_options_common=( -H "accept: application/json" @@ -919,9 +919,9 @@ pathtype () { get_pnfsid () { local path=$(urlencode "$1") command='curl "${curl_authorization[@]}" \ - "${curl_options_no_errors[@]}" \ - -X GET "$api/namespace/$path" \ - | jq -r .pnfsId' + "${curl_options_no_errors[@]}" \ + -X GET "$api/namespace/$path" \ + | jq -r .pnfsId' if $dry_run ; then echo "$command" else @@ -935,10 +935,10 @@ is_online () { # The locality should be ONLINE or ONLINE_AND_NEARLINE. local path=$(urlencode "$1") command='curl "${curl_authorization[@]}" \ - "${curl_options_no_errors[@]}" \ - -X GET "$api/namespace/$path?locality=true&qos=true" \ - | jq -r ".fileLocality" \ - | grep --silent "ONLINE"' + "${curl_options_no_errors[@]}" \ + -X GET "$api/namespace/$path?locality=true&qos=true" \ + | jq -r ".fileLocality" \ + | grep --silent "ONLINE"' if $dry_run ; then echo "$command" else @@ -951,9 +951,9 @@ get_subdirs () { local path=$(urlencode "$1") str='.children | .[] | if .fileType == "DIR" then .fileName else empty end' command='curl "${curl_authorization[@]}" \ - "${curl_options_common[@]}" \ - -X GET "$api/namespace/$path?children=true" \ - | jq -r "$str"' + "${curl_options_common[@]}" \ + -X GET "$api/namespace/$path?children=true" \ + | jq -r "$str"' if $dry_run ; then echo "$command" else @@ -966,9 +966,9 @@ get_files_in_dir () { local path=$(urlencode "$1") str='.children | .[] | if .fileType == "REGULAR" then .fileName else empty end' command='curl "${curl_authorization[@]}" \ - "${curl_options_common[@]}" \ - -X GET "$api/namespace/$path?children=true" \ - | jq -r "$str"' + "${curl_options_common[@]}" \ + -X GET "$api/namespace/$path?children=true" \ + | jq -r "$str"' if $dry_run ; then echo "$command" else @@ -980,9 +980,9 @@ get_files_in_dir () { get_children () { local path=$(urlencode "$1") command='curl "${curl_authorization[@]}" \ - "${curl_options_common[@]}" \ - -X GET "$api/namespace/$path?children=true" \ - | jq -r ".children | .[] | .fileName"' + "${curl_options_common[@]}" \ + -X GET "$api/namespace/$path?children=true" \ + | jq -r ".children | .[] | .fileName"' if $dry_run ; then echo "$command" else @@ -1446,8 +1446,8 @@ list_subscription () { curl "${curl_authorization[@]}" \ "${curl_options_common[@]}" \ -X GET "$subscription" \ - | jq -r 'to_entries[] | [.key, .value] | @tsv' \ - | tr '\t' '=' + | jq -r 'to_entries[] | [.key, .value] | @tsv' \ + | tr '\t' '=' ) } @@ -2009,7 +2009,7 @@ api_call () { curl "${curl_authorization[@]}" \ "${curl_options_common[@]}" \ -X GET "$api/user" \ - | jq . + | jq . ) ;; list ) @@ -2199,9 +2199,9 @@ api_call () { labels=$( $debug && set -x # If --debug is specified, show curl & jq command curl "${curl_authorization[@]}" \ - "${curl_options_common[@]}" \ - "${curl_options_post[@]}" \ - -X GET "$api/namespace/$encoded_path?labels=true" \ + "${curl_options_common[@]}" \ + "${curl_options_post[@]}" \ + -X GET "$api/namespace/$encoded_path?labels=true" \ | jq -r '.labels[]' ) if [ "$labels" == "" ] ; then @@ -2293,9 +2293,9 @@ api_call () { attributes=$( $debug && set -x # If --debug is specified, show curl command curl "${curl_authorization[@]}" \ - "${curl_options_common[@]}" \ - "${curl_options_post[@]}" \ - -X GET "$api/namespace/$encoded_path?xattr=true" + "${curl_options_common[@]}" \ + "${curl_options_post[@]}" \ + -X GET "$api/namespace/$encoded_path?xattr=true" ) if [ -n "$attribute_name" ] ; then attribute_value=$(echo "$attributes" | jq ".extendedAttributes.$attribute_name") @@ -2316,9 +2316,9 @@ api_call () { names_json=$( $debug && set -x # If --debug is specified, show curl & jq command curl "${curl_authorization[@]}" \ - "${curl_options_common[@]}" \ - "${curl_options_post[@]}" \ - -X GET "$api/namespace/$encoded_path?xattr=true" \ + "${curl_options_common[@]}" \ + "${curl_options_post[@]}" \ + -X GET "$api/namespace/$encoded_path?xattr=true" \ | jq --compact-output '.extendedAttributes | keys' ) if [ "$names_json" == "[]" ] ; then @@ -2475,11 +2475,11 @@ api_call () { fi # Show channel properties (for now only the timeout) channel_properties=$( - curl "${curl_authorization[@]}" \ - "${curl_options_common[@]}" \ - -X GET "$channel" \ - | jq -r 'to_entries[] | [.key, .value] | @tsv' \ - | tr '\t' '=' + curl "${curl_authorization[@]}" \ + "${curl_options_common[@]}" \ + -X GET "$channel" \ + | jq -r 'to_entries[] | [.key, .value] | @tsv' \ + | tr '\t' '=' ) # Show event ID, if available channel_status_file="${ada_dir}/channels/channel-status-${channel_id}" From bdd616cb957d5cfed50846e267652cb5003c8b4a Mon Sep 17 00:00:00 2001 From: Onno Zweers Date: Fri, 2 May 2025 16:56:49 +0200 Subject: [PATCH 2/2] Fix indentation also in unit tests --- tests/unit_test.sh | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/unit_test.sh b/tests/unit_test.sh index 57ca491..16b197f 100755 --- a/tests/unit_test.sh +++ b/tests/unit_test.sh @@ -53,9 +53,9 @@ test_create_path() { test_get_pnfsid() { result=`get_pnfsid "/test/a/b/c"` expected='curl "${curl_authorization[@]}" \ - "${curl_options_no_errors[@]}" \ - -X GET "$api/namespace/$path" \ - | jq -r .pnfsId' + "${curl_options_no_errors[@]}" \ + -X GET "$api/namespace/$path" \ + | jq -r .pnfsId' assertEquals \ "the result of get_pnfsid() was wrong" \ "${expected}" "${result}" @@ -65,10 +65,10 @@ test_get_pnfsid() { test_is_online() { result=`is_online "/test/a/b/c"` expected='curl "${curl_authorization[@]}" \ - "${curl_options_no_errors[@]}" \ - -X GET "$api/namespace/$path?locality=true&qos=true" \ - | jq -r ".fileLocality" \ - | grep --silent "ONLINE"' + "${curl_options_no_errors[@]}" \ + -X GET "$api/namespace/$path?locality=true&qos=true" \ + | jq -r ".fileLocality" \ + | grep --silent "ONLINE"' assertEquals \ "the result of is_online() was wrong" \ "${expected}" "${result}" @@ -78,9 +78,9 @@ test_is_online() { test_get_subdirs() { result=`get_subdirs "/test/a/b/c"` expected='curl "${curl_authorization[@]}" \ - "${curl_options_common[@]}" \ - -X GET "$api/namespace/$path?children=true" \ - | jq -r "$str"' + "${curl_options_common[@]}" \ + -X GET "$api/namespace/$path?children=true" \ + | jq -r "$str"' assertEquals \ "the result of get_subdirs() was wrong" \ "${expected}" "${result}" @@ -90,9 +90,9 @@ test_get_subdirs() { test_get_files_in_dir() { result=`get_files_in_dir "/test/a/b/c"` expected='curl "${curl_authorization[@]}" \ - "${curl_options_common[@]}" \ - -X GET "$api/namespace/$path?children=true" \ - | jq -r "$str"' + "${curl_options_common[@]}" \ + -X GET "$api/namespace/$path?children=true" \ + | jq -r "$str"' assertEquals \ "the result of get_files_in_dir() was wrong" \ "${expected}" "${result}" @@ -102,9 +102,9 @@ test_get_files_in_dir() { test_get_children() { result=`get_files_in_dir "/test/a/b/c"` expected='curl "${curl_authorization[@]}" \ - "${curl_options_common[@]}" \ - -X GET "$api/namespace/$path?children=true" \ - | jq -r "$str"' + "${curl_options_common[@]}" \ + -X GET "$api/namespace/$path?children=true" \ + | jq -r "$str"' assertEquals \ "the result of get_files_in_dir() was wrong" \ "${expected}" "${result}"