From 77707682595a9000e66e2b4083bd9d3ce4043dff Mon Sep 17 00:00:00 2001 From: btorres Date: Mon, 4 Jun 2018 17:08:15 -0700 Subject: [PATCH] fix script to work with new api that downcases things --- gitlab.bash | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gitlab.bash b/gitlab.bash index 17098df..ae07f48 100644 --- a/gitlab.bash +++ b/gitlab.bash @@ -9,10 +9,12 @@ function __mass_gitlab_utils_generate_request() { } function __mass_gitlab_utils_get_last_pagination_page_of_object() { + paginated_object=$1 # gitlab apis are paginated. Grab the first page of an object and extract the "last" page number - object_pages=$(__mass_gitlab_utils_generate_request "GET" "${paginated_object}" "-I" \?per_page=100 | egrep "X-Total-Pages") + object_pages=$(__mass_gitlab_utils_generate_request "GET" "${paginated_object}" "-I" \?per_page=100) + # Regex to match the "last page" - regex_pattern='X-Total-Pages: ([0-9]+)' + regex_pattern='x-total-pages: ([0-9]+)' [[ ${object_pages[@]} =~ $regex_pattern ]] # Grab the "last page" [[ $object_pages =~ $regex_pattern ]]