Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

subversion: export fails if dest directory exists #370

Closed
earchibald opened this issue Nov 21, 2014 · 3 comments
Closed

subversion: export fails if dest directory exists #370

earchibald opened this issue Nov 21, 2014 · 3 comments

Comments

@earchibald
Copy link
Contributor

Using the following syntax, the task always fails if /tmp/foo already exists.

- name: (testing) svn export of desired callflow.xml subversion: repo=http://repo.local/repos/target/ dest=/tmp/foo/ export=yes

The error shown is:
msg: ERROR: /tmp/foo/ folder already exists, but its not a subversion repository.

This appears to be happening because the subversion module does not account for exporting if the target directory exists (but is not a working copy):

if not os.path.exists(dest):
...export and checkout both handled
elif os.path.exists("%s/.svn" % (dest, )):
...checkout handled. export presumably not handled because this is a working directory
else: module.fail_json(msg="ERROR: %s folder already exists, but its not a subversion repository." % (dest, ))

I think if we insert another case before the else of elif os.path.exists(dest) and export: and handle export to a preexisting directory there, it should work.

mscherer added a commit to mscherer/ansible-modules-core that referenced this issue Dec 13, 2014
The default is changed from 'yes' to 'no' to follow
subversion behavior (ie, requiring explicit confirmation
to erase a existing repository). Since that was not working before
cf ansible#370 and since the option was ignored before and unused, this
should be safe to change.
@mscherer mscherer mentioned this issue Dec 13, 2014
abadger added a commit that referenced this issue Jan 29, 2015
@jimsmith
Copy link

This isn't work as expected I'm getting this same error with 1.8.4

I am using the export and force switches from the subversion module but as you will see below force is being outputted but still get the error message, so I'm having to use the shell module and revert back to the svn cli :(

TASK: [subversion] ************************************************************
username=svnuser force=yes dest=~/checkout/ repo=https://my.svn.server/PROJECT/develop export=yes password=VALUE_HIDDEN revision=HEAD


u'LANG=C LC_CTYPE=C /usr/bin/python /home/svnuser/.ansible/tmp/ansible-tmp-1426256869.1-122427451446849/subversion; rm -rf /home/svnuser/.ansible/tmp/ansible-tmp-1426256869.1-122427451446849/ >/dev/null 2>&1']
failed: [localhost] => {"failed": true}
msg: ERROR: /home/svnuser/checkout/ folder already exists, but its not a subversion repository.

@abadger
Copy link
Contributor

abadger commented Mar 13, 2015

@jimsmith Could you open a new issue and include a sample playbook and the error message you're getting? Thanks!

@abadger
Copy link
Contributor

abadger commented Mar 13, 2015

@jimsmith Actually one other thing you can test before opening a bug -- 1.8.4 doesn't have the fix. The fix involved changing the behaviour of the force parameter so we decided it should wait until 1.9. If you can test with 1.9 or devel then we'll know if there's still a bug lurking. If not, 1.9 will be out shortly. We tagged 1.9rc1 on Tuesday. 1.9rc2 will be out on this coming Tuesday.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants