X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=common%2Ftrack;h=6b478261e8daf88ec8f50b7f29e5ed6e55c5045c;hb=a474e0794fc5f43134745429d033182e9d1016b4;hp=627c680d9b955b960aa45c1acf1f7cd411abdfcf;hpb=0bc87527a95d1c5afc7725981ef0a2e3f55fd274;p=osm%2Fdevops.git diff --git a/common/track b/common/track index 627c680d..6b478261 100644 --- a/common/track +++ b/common/track @@ -16,16 +16,27 @@ function track(){ # Tracks events by sending HTTP GET requests with query strings to a web server -# - First argument: event name -# - Rest of arguments (if they exist): tuples of operation-value-comment-tags -# - operation: particular operation in an event (if it is not provided, the operation will be named after the event) -# - value: particular value for an operation -# - comment -# - none will be passed when empty -# - will be parsed to replace spaces by underscores -# - tags -# - none will be passed when empty -# - will be parsed to replace spaces by ~ +# Input: +# - First argument (mandatory): event name +# - Rest of arguments: +# - If they exist, they correspond to tuples of operation-value-comment-tags +# - operation: particular operation in an event +# - value: particular value for an operation +# - comment +# - none will be passed when empty +# - will be parsed to replace spaces by underscores +# - tags +# - none will be passed when empty +# - will be parsed to replace spaces by ~ +# - If no arguments: +# - operation: like event +# - value: "" +# - comment: "" +# - tags: "" +# Output: +# Sends as many HTTP requests as operations with the following query string +# "&{OSM_TRACK_INSTALLATION_ID}&{TIMESTAMP}&{EVENT}&{OPERATION}&{VALUE}&{COMMENT}&{TAGS}" +# if [ $# -lt 1 ]; then echo "Unexpected error in track function. At least 1 arg is expected: event" @@ -54,19 +65,20 @@ function track(){ final_query_string="${final_query_string}&tags=${tags}" url="https://osm.etsi.org/InstallLog.php?${final_query_string}" echo "Track $osm_track_event_name $operation: ${url}" - wget -q -O /dev/null $url + LANG=C wget -q -O /dev/null "$url" else while (( "$#" > 0 )); do operation="${1:-${osm_track_event_name}}" shift 1 value="${1:-}" + value="${value// /_}" shift 1 comment="${1:-}" - shift 1 comment="${comment// /_}" - tags="${1:-}" shift 1 + tags="${1:-}" tags="${tags//,/\~}" + shift 1 [ "$value" == "none" ] && value="" [ "$comment" == "none" ] && comment="" [ "$tags" == "none" ] && tags="" @@ -77,10 +89,8 @@ function track(){ final_query_string="${final_query_string}&tags=${tags}" url="https://osm.etsi.org/InstallLog.php?${final_query_string}" echo "Track $osm_track_event_name $operation: ${url}" - wget -q -O /dev/null $url + LANG=C wget -q -O /dev/null "$url" done fi return 0 } - -