Hi all,
I have a script (shown below) that traverses all pages in a space and removes labels. This works great for some cases but not all. If I create a new space, add pages and labels the script cleans them nicely. If I use on of my javadoc spaces which has 4000+ labels the script reports label removal, but the labels remain.
Example Output:
PAGE: my page
LBLS: FooBar
Labels: 'FooBar ' were removed from item: 'my page' from space: 'javadoc'
remaining LBLS: FooBar
I exported the space to xml and looked at the labels. I see nothing special about them. I am concerned by the trailing space on the labels output. I tried executing the command manually and I get the same result. I'm not sure what is blocking the removal.
Please let me know if you see an issue that I'm missing. I'm going to dig into the source code.
Thanks
Peter
#!/usr/bin/env bash
function listLabels
{
space=$1
page=$2
./confluence.sh -a getLabelList --space $space --title "$page"|egrep -v 'labels in list'|sed ':a;N;$!ba;s/\n/,/g;s/,$//'
}
function listPages
{
space=$1
echo Creating PageList ${space}.pages ...
./confluence.sh -a getPageList --space $space |egrep -v 'pages in list' > ${space}.pages
echo PageList Complete...
}
function removeLabelsFromPage
{
space=$1
page=$2
labels=`listLabels $space "$page"`
echo PAGE: $page
echo LBLS: $labels
./confluence.sh -a removeLabels --space $space --title "$page" --labels $labels
echo remaining LBLS: `listLabels $space "$page"`
echo "-----------"
}
function removeLabelsFromSpacePages
{
space=$1
pageListFile=$2
while read line
do
removeLabelsFromPage $space "$line"
done < ${pageListFile}
}
## ---------------------
## MAIN
## ---------------------
space=$1
listPages $space
removeLabelsFromSpacePages $space ${space}.pages