Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 34 additions & 34 deletions ada/ada
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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[@]}" \
Copy link
Contributor

@hailihu hailihu Jun 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly, now you want to change these indentations, right? And the ones below as well.

-X GET "$api/namespace/$path" \
| jq -r .pnfsId'
if $dry_run ; then
echo "$command"
else
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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' '='
)
}

Expand Down Expand Up @@ -2009,7 +2009,7 @@ api_call () {
curl "${curl_authorization[@]}" \
"${curl_options_common[@]}" \
-X GET "$api/user" \
| jq .
| jq .
)
;;
list )
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand All @@ -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
Expand Down Expand Up @@ -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}"
Expand Down
32 changes: 16 additions & 16 deletions tests/unit_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand All @@ -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}"
Expand All @@ -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}"
Expand All @@ -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}"
Expand All @@ -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}"
Expand Down