grundic/confluence-page-copier

--dry-run mode is broken

Closed this issue · 2 comments

--dry-run mode simulates creating page in the destination, but then actually searches it in the Confluence using ID "-1" and crashes

c:\python27\python.exe copier.py --username="" --password="" --endpoint="https://_.atlassian.net/wiki" --dst-space=~rf --src-title="test page 1" --src-space="DOC" --dst-title-template="{title}" --dst-parent-id=66322435 --dry-run
DEBUG:confl-copier:Searching page by space 'DOC' and title 'test page 1'
DEBUG:confl-copier:Found 1 page(s)
DEBUG:confl-copier:Searching page by space '~rf' and title 'test page 1'
DEBUG:confl-copier:Found 0 page(s)
DEBUG:confl-copier:Searching page by id '26574918'
DEBUG:confl-copier:Searching page by id '66322435'
INFO:confl-copier:Copying [DOC]:'Documentation'/'test page 1' => [~rf]:'R... F...’s Home'/'test page 1'
INFO:api-proxy:[DRY-RUN] create_new_content({'body': {'storage': {'representation': 'storage', 'value': u'

some contents

'}}, 'title': u'test page 1', 'type': u'page', 'ancestors': [{'id': '66322435'}], 'space': {'key': '~rf'}})
DEBUG:confl-copier:Searching page by id '74514464'
DEBUG:confl-copier:Searching page by space '~rf' and title 'child page 1'
DEBUG:confl-copier:Found 0 page(s)
DEBUG:confl-copier:Searching page by id '-1'
Traceback (most recent call last):
File "copier.py", line 470, in
recursion_limit=args.recursion_limit
File "copier.py", line 138, in copy
skip_attachments=skip_attachments
File "copier.py", line 104, in copy
page_copy = self._copy_page(source, ancestor_id, dst_space_key, dst_title)
File "copier.py", line 269, in _copy_page
dst_parent_page = self._find_page(content_id=ancestor_id)
File "c:\python27\lib\site-packages\boltons\cacheutils.py", line 542, in call
ret = cache[key] = self.func(_args, *_kwargs)
File "copier.py", line 148, in _find_page
expand=self.EXPAND_FIELDS
File "c:\python27\lib\site-packages\PythonConfluenceAPI\api.py", line 225, in get_content_by_id
callback=callback)
File "c:\python27\lib\site-packages\PythonConfluenceAPI\api.py", line 131, in _service_get_request
return self._service_request("GET", *args, _kwargs)
File "c:\python27\lib\site-packages\PythonConfluenceAPI\api.py", line 116, in _service_request
response.raise_for_status()
File "c:\python27\lib\site-packages\requests\models.py", line 844, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://
.atlassian.net/wiki/rest/api/content/-1?expand=body.storage%2Cspace%2Cancestors%2Cversion

copies pages correctly after removing --dry-run

c:\python27\python.exe copier.py --username="" --password="" --endpoint="https://*.atlassian.net/wiki" --dst-space=~rf --src-title="test page 1" --src-space="DOC" --dst-title-template="{title}" --dst-parent-id=66322435
DEBUG:confl-copier:Searching page by space 'DOC' and title 'test page 1'
DEBUG:confl-copier:Found 1 page(s)
DEBUG:confl-copier:Searching page by space '~rf' and title 'test page 1'
DEBUG:confl-copier:Found 0 page(s)
DEBUG:confl-copier:Searching page by id '26574918'
DEBUG:confl-copier:Searching page by id '66322435'
INFO:confl-copier:Copying [DOC]:'Documentation'/'test page 1' => [~rf]:'R... F...’s Home'/'test page 1'
DEBUG:confl-copier:Searching page by id '74514464'
DEBUG:confl-copier:Searching page by space '~rf' and title 'child page 1'
DEBUG:confl-copier:Found 0 page(s)
DEBUG:confl-copier:Searching page by id '74514552'
INFO:confl-copier:Copying [DOC]:'Documentation'/'child page 1' => [~rf]:'test page 1'/'child page 1'
INFO:confl-copier:Copying 1 attachment(s)
DEBUG:confl-copier:Downloading 'image2016-6-15.png' attachment
DEBUG:confl-copier:Creating new attachment 'image2016-6-15.png'
DEBUG:confl-copier:Removing temp directory 'c:\users\roman\appdata\local\temp\tmprha6rg'

Fixed, can you verify, please?

confirm, --dry-run mode works now