Project

General

Profile

Bug #7871

redmine-lib fails silent against current FNAL redmine production server.

Added by Christopher Green almost 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Start date:
02/16/2015
Due date:
% Done:

100%

Estimated time:
1.00 h
Duration:

Description

I have a script which does the following, "new_version":

#!/bin/bash

project="${1}" 
version="${2}" 
date="${3}" 
if [[ "${project}" == "art" ]]; then
  wiki="Release Notes ${version}" 
else
  wiki="" 
fi
status=${4:-closed}

. $(dirname "${BASH_SOURCE}")/redmine_lib || { echo "ERROR: unable to source required functions." 1>&2; exit 1; }

do_login || { echo "Unable to authenticate to ${site}" 1>&2; exit 1; }

add_version "${project}" "${version}" "${wiki}" "${date}" "" "tree" "${status}"

It now fails silent.

In the interests of full disclosure, my redmine-lib has the following local changes to allow passage of certain characters in the password and to allow the setting of the version status:

diff --git a/bash/redmine_lib b/bash/redmine_lib
index d68ec4c..9219032 100755
--- a/bash/redmine_lib
+++ b/bash/redmine_lib
@@ -92,8 +92,8 @@ do_login() {
        "${site}/login" \
        "back_url=$site" \
        "authenticity_token=$authenticity_token" \
-       "username=$user" \
-       "password=$pass" \
+       "username=`echo "$user" | urlencode`" \
+       "password=`echo "$pass" | urlencode`" \
        "login=Login »" 

      if grep '>Sign in' $listf > /dev/null
@@ -388,6 +388,16 @@ upload_wiki_page() {
          > /dev/null
 }

+# Sharing values:
+#   none
+#   descendents
+#   hieraarchy
+#   tree
+#
+# Status values:
+#   open
+#   closed
+#   locked
 add_version() {
    project="$1" 
    version="$2" 
@@ -395,14 +405,14 @@ add_version() {
    effective_date="$4" 
    description="$5" 
    sharing="${6:-none}" 
-
+   status="${7:-open}" 
    get_auth_token "${site}/projects/${project}/versions/new" 
    post_url "${site}/projects/${project}/versions" \
         "back_url=${site}/projects/${project}/settings" \
         "authenticity_token=$authenticity_token" \
         "version[name]=$version" \
         "version[description]=$description" \
-        "version[status]=open" \
+        "version[status]=$status" \
         "version[wiki_page_title]=$wiki_page" \
         "version[effective_date]=$effective_date" \
         "version[sharing]=$sharing" \

I can provide details of log and returned output from wget if desired.

Thanks,
Chris.

History

#1 Updated by Marc Mengel almost 5 years ago

Rolled in your diffs, checked for new fields, added the new hidden "utf8" field, and ran a quick test; which seems to be working for me...

Please git pull the latest and make a quick test, and if it's still failing, send me a trace.

marc

#2 Updated by Christopher Green almost 5 years ago

Still failing: no evidence of new version appearance. Sanitized trace and /tmp information sent by private email.

Thanks,
Chris.

#3 Updated by Marc Mengel almost 5 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100
  • Estimated time set to 1.00 h

On 2/17/15 11:17 AM, Marc W. Mengel wrote:

Ahh...
If I view the result page (list_p20938), it says:
Date is not a valid date

It appears to want ISO dates (2015-02-17) not slashed dates (which
are ambiguous by region YYYY/MM/DD vs YYYY/DD/MM...)

Patch to catch error messages in responses committed & pushed.

Great, thank you. I've also altered my helper scripts to auto-convert '/' in the date argument to '-'.

The change to catch error messages in the response is in f805f3db



Also available in: Atom PDF