Commit graph

79 commits

Author SHA1 Message Date
Major Hayden
97d6807ec5 File module cannot create relative paths
When trying to create a directory relative to the current working
directory, a directory is created at the root of the filesystem
instead.  This patch ensures that directories specified with relative
paths will be created in the current working directory.  Fully
qualified paths aren't affected

Signed-off-by: Major Hayden <major@mhtx.net>
2014-08-21 15:31:06 -05:00
Michael DeHaan
d78e16ff36 Move doc fragments back into file module. 2014-08-05 20:45:16 -04:00
RomanDolejsi
7cd6d6fb89 file: prevent replace failure when overwriting empty directory with hard/link (force=yes) 2014-07-29 10:46:32 +02:00
trbs
6567e40b6d In check mode if a symlink does not exist there is no need to check the ownership properties (which causes an exception) 2014-06-19 15:47:46 +02:00
James Cammarata
c276dec487 Fix issue with symlink path detection
Fixes #7627
Fixes #7664
2014-06-04 23:31:59 -05:00
James Cammarata
090fd0a224 Fix linking issue to directories in file module
The os.path.isdir() returns True for symlinks that point to directories,
so we also need to check to make sure it's not a symlink too.

Fixes #7657
2014-06-04 22:48:08 -05:00
Brian Coca
ffb87adbc2 Correctly examine path for relative links in file module
Fixes #7515
Fixes #7537
2014-05-28 11:47:44 -05:00
James Cammarata
5ec0297c04 Fixing absolute path calculation for file module when linking
Fixes #7403
2014-05-21 12:49:42 -05:00
telsacolton
ee60f8f710 Make file hardlink error message reasonble
When we hard-link a file, and the link path already exists, give the link path in the error message instead of the source
2014-05-14 16:54:26 -05:00
telsacolton
133cbee473 Give reasonable error when symlink fails
When a symlink fails because the path already exists and force=no, we should output path in the error message instead of source.
2014-05-14 16:31:20 -05:00
James Cammarata
8c7aafd5ae Merge branch 'file_new_dirs_perms' of https://github.com/bcoca/ansible into bcoca-file_new_dirs_perms 2014-05-14 13:53:08 -05:00
James Cammarata
5ce5ba5e58 Refuse to convert a non-empty directory into a link with the file module
Also adds an integration test for the above.

Fixes #7254
2014-05-02 14:46:38 -05:00
Brian Coca
1e3860c47b now when making multiple dirs in path to make dir, same permissions are assigned (but only for NEW dirs)
Signed-off-by: Brian Coca <briancoca+ansible@gmail.com>
2014-04-23 10:38:38 -04:00
Erika Heidi
40e7c6eddc Possible docs error: 'path' instead of 'src'
I came to this example today (line 50), and when I tried it, I got an error:

`msg: src and dest are required for creating links`

So, I changed **path** to **src** and it worked fine. Looks like the example is wrong, since the docs say "dest" is already an alias for "path", in which case we would have 2 "path" definitions.
2014-04-23 16:00:22 +02:00
James Tanner
199992adb6 Fixes #6894 create docs fragment for files 2014-04-08 13:20:15 -04:00
Michael DeHaan
63a1330263 Use common file argument system previously implemented by @sivel for rax modules on the file modules as well (copy/file/template).
Application to other cloud providers would make very good sense.
2014-04-03 16:52:39 -04:00
James Tanner
7b72004eb4 Merge #5903 from rhaido/ansible
Update files documentation for usage of force=True and hardlinks
2014-03-31 12:53:03 -04:00
Michael DeHaan
38c3332b8a Merge pull request #6597 from tarka/handle-uncreated-symlink-tmpfile
Handle missing symlink tempfile
2014-03-28 11:11:32 -04:00
Steve Smith
5b5af14921 Only unlink the symlink tempfile on error if it was created in the
previous operation.
2014-03-20 13:14:24 +01:00
Brian Coca
a395eb3aba fixed issue with tmp file (path can include filename) and added missing
else which made it try to link x2
2014-03-20 07:55:53 -04:00
Brian Coca
4fd957620a now correctly checks absolute path for src= existance for links
also updated docs to be a bit clearer on symlink behaviour
2014-03-20 07:49:25 -04:00
Brian Coca
402cd11c52 fixed issue with directory permissions on copy #6552 2014-03-18 22:29:22 -04:00
James Cammarata
d60ac967b9 Merge branch 'file_fixes_clean' of https://github.com/bcoca/ansible into bcoca-file_fixes_clean 2014-03-17 14:03:26 -05:00
Cristian Ciupitu
7f681c33a2 Micro-optimization: replace s.find(x)!=-1 with x in s
timeit shows a speedup of ~3x on Python 2.7.5 x86_64.
It also makes the code a bit shorter.
2014-03-16 13:10:28 -04:00
Brian Coca
7ca6343ca3 Fixes and cleanup to file functions and module
- unified set attribute functions ... not sure why 2 identical functions
exist with diff names, now there are 3 while i repoint all modules to 1
- fixed issue with symlinks being created w/o existing src when force=no
- refactored conditionals, simplified where possible
- added tests for symlink to nonexistant source, with both force options
- made symlink on existing attomic (force)
2014-03-15 13:54:24 -04:00
Sven Schliesing
b55f99b803 Fix link in documentation
c(dest) -> c(path)
2014-03-06 13:16:29 +01:00
Michael DeHaan
2f12c6ddf6 Simplify file module parameter description. 2014-02-28 13:55:07 -05:00
Mike Grozak
3f74dd6592 Updated the force parameter description; added one example how to create the symlinks pointing to non-absolute paths 2014-02-07 14:29:20 +01:00
Mike Grozak
ecd8b5d064 Found a way how to have symlinks towards files without absolute paths in prefixes; fixed incorrect force setting on the hard links, which can not point to non-existing files 2014-02-07 14:13:41 +01:00
Mike Grozak
4f262779cd Started the development of the 'chdir' functionality for file module - creation symlinks without the base directory prefix 2014-02-06 17:20:32 +01:00
jctanner
95131937df Merge pull request #5282 from rhaido/hard_link_fix
file module: Added to the file module the functionality to force conversion hard link...
2014-01-14 07:15:46 -08:00
jctanner
87b58666f9 Merge pull request #5264 from drewlll2ll/file-fix
file module: Fixed missing prev_state == 'directory' in file
2014-01-06 14:07:07 -08:00
Maykel Moya
8f766bdcdd Missing "is" in file module description 2013-12-26 12:34:46 +01:00
Jens Rantil
38d0df65d8 module(file): Fail instead of exit on exception 2013-12-13 21:34:19 +01:00
Jens Rantil
4262e76aec module(file): state what went wrong on exception 2013-12-13 21:33:19 +01:00
Mike Grozak
5a66a95bf3 Added to the file module the functionality to force conversion hard link and symlink when the force attribute is set to 'yes' 2013-12-13 17:10:50 +01:00
drewlll2ll
8fe3b05262 Added prev_state for directory 2013-12-12 09:44:29 -05:00
Jens Rantil
b8347a3144 file module: Don't catch SystemExit
This fixes issue #5159.
2013-12-04 13:13:49 +01:00
James Tanner
4f9aadcc07 Addresses #5023 Fix import comments 2013-12-02 15:13:49 -05:00
James Tanner
38edad70ac Fixes #5023 Convert all modules to use new snippet import pattern 2013-12-02 15:11:23 -05:00
Michael DeHaan
08996d78d6 Add version_added to all modules missing version_added information, the docs formatter will now
raise errors when omitted, updated changelog with new modules.
2013-11-18 18:55:49 -05:00
James Tanner
0f3093516d Merge pull request #4375 from pfalcon/ansible
copy: Implement recursive copying if src is a directory.
2013-11-13 15:52:40 -05:00
James Tanner
53ba890312 Fixes #4884 Do not prematurely exit from file module if src not defined 2013-11-12 18:17:20 -05:00
James Tanner
2c57b999fc Addresses #4801 Update file module docs to indicate behavior for relative src paths 2013-11-07 17:02:34 -05:00
sspans
9f322a5178 skip absolute path creation for old_src, not needed with the new relative links 2013-11-04 10:44:06 +01:00
sspans
4957115e51 only require absolute paths for hardlinks 2013-11-04 10:37:36 +01:00
James Tanner
c3159fefab Fixes #4516 file module: check prev_state earlier and use that if state is not specified 2013-11-01 09:31:32 -04:00
Michael DeHaan
772bd33a0f Revert "fix conversion from file to hardlink when force=yes"
This reverts commit 4d4518ed52.
2013-10-27 11:51:43 -04:00
Dave Simons
1f86abcba6 fix conversion from file to hardlink when force=yes
Signed-off-by: Dave Simons <dave@inuits.eu>
2013-10-22 10:46:45 +02:00
jctanner
9543169cca Merge pull request #4480 from joemaller/absent_path_fix
ignore src when file module state=absent
2013-10-16 17:29:21 -07:00