Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

confluence labels remain after cli reportes removal

Peter Kahn
Contributor
August 16, 2012

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

1 answer

1 accepted

1 vote
Answer accepted
Bob Swift
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 16, 2012

Probably you are running into an historical inconsistency in the CLI. Confluence CLI uses: Comma separated list of labels. JIRA CLI uses a blank separated list (which is better in this case). Confluence CLI should be changed to support both, but for now use a comma. Please open an issue for the change.

Peter Kahn
Contributor
August 16, 2012
Thanks Bob, but it fails on a list on one as well. There must be something special about the label in question. 'HasFields'. Is the repository in bit bucket? I found cli, but not confluence cli. I want to take a stab at debugging this one. Peter
Bob Swift
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 16, 2012

Please open an issue and provide an example of the CLI actions run using -v parameter. The bitbucket repository is now private, you will have to use the older version source zip.

Peter Kahn
Contributor
August 23, 2012

Ah figured out the problem. My space generator takes javadoc and builds a space xml out of it. It splits the package names into labels but doesn't track and re-use labels. So, I have 200 + "com" labels. I think this is why I ran into the problems. I fixed the generator code and I think Atlassian fixed import so duplicate labels are no longer a problem.

Thanks for the comments. I think this is self manufacturered.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events