diff --git a/create-task.sh b/create-task.sh index aa87aa4..5fe607d 100755 --- a/create-task.sh +++ b/create-task.sh @@ -26,7 +26,7 @@ formtoken=$( cat cookies.txt | grep trac_form_token | cut -f 7 | tr -d "\r" ) # login; try to log in either form based or with HTTP authentication # make it in a single run; instead just doing both ways works - either one will work -echo "Logging into $agilo" +#echo "Logging into $agilo" # try logging login for form based login loginData="__FORM_TOKEN=$formtoken&user=$user&password=$pass" curl -s -b "$cookies" -c "$cookies" -d "$loginData" $agilo/login > /dev/null @@ -36,12 +36,12 @@ curl -s -b "$cookies" -c "$cookies" --digest -u "$user:$pass" $agilo/login > / # create task DATA="field_summary=${task_summary}&field_reporter=${task_reporter}&field_description=${task_description}&field_remaining_time=${task_remaining_time}&field_status=new&submit=Create%2BTicket&field_type=task&__FORM_TOKEN=${formtoken}" -curl -s -d "${DATA}" -b "$cookies" $agilo/newticket > /dev/null -if [ $? -ne 0 ]; +ticket_url=`curl -s -d "${DATA}" -i -b "$cookies" $agilo/newticket | grep Location | grep -i ticket | awk '{print $2}'` +if [ -n $ticket_url ]; then - echo "ERROR: Problem creating task" + echo "Task created = $ticket_url" else - echo "Task created" + echo "ERROR: problem creating ticket" fi rm "$cookies"