Commit graph

50 commits

Author SHA1 Message Date
Michael DeHaan
663a8fef3f chmod -x for all module files in source checkout 2012-11-19 13:47:40 -05:00
Daniel Hokka Zakrisson
7a8009f979 When atomically replacing files, copy attributes 2012-10-25 21:40:05 -04:00
Jan-Piet Mens
feab57e270 Reformat code: examples consistently
- added terse syntax to modules.rst
 - added description of special variables to template module
2012-10-23 15:14:01 +02:00
Michael DeHaan
cbc12f0dba Various performance streamlining and making the file features usable in all modules without daisy chaining. 2012-10-20 22:55:09 -04:00
Luke Antins
6354898b09 Copy module can replace symlink with a real file. 2012-10-18 01:04:52 +01:00
Michael DeHaan
c5d2f6b0d3 implement lookup plugins for arbitrary enumeration over arbitrary things. See the mailing list for some cool examples. 2012-10-12 20:07:05 -04:00
Jan-Piet Mens
e0fb264a89 Module DOCUMENTATION: assemble, authorized_key, command, copy
plus a small fix in rst.j2 template
  manpages generated & checked
  modules.html generated & checked
2012-09-28 21:55:49 +02:00
Stephen Fromm
f52624f6d2 Give nice error message if destination directory doesn't exist (issue #1048) 2012-09-25 14:57:32 -07:00
Brian Coca
88d1285f33 time is what i wanted, not gmtime
Signed-off-by: Brian Coca <briancoca+ansible@gmail.com>
2012-09-12 14:52:54 -04:00
Brian Coca
06b914c5b3 small fix to prevent temp file from living past its succesful usage
Signed-off-by: Brian Coca <briancoca+ansible@gmail.com>
2012-09-12 14:47:06 -04:00
Brian Coca
f5481621f8 made copy atomic by creating tmp file in dest location (ensures same partition)
uses pid and epoch to prevent collisions, good enough for most cases
Signed-off-by: Brian Coca <briancoca+ansible@gmail.com>
2012-09-12 14:42:51 -04:00
Michael DeHaan
aa704a6111 backuplocal => backup_local for API standardization reasons 2012-09-04 19:49:49 -04:00
Daniel Hokka Zakrisson
dfcb9d3c2d Move backup to module_common 2012-09-04 16:04:53 +02:00
Seth Vidal
588b129018 fix case where destination does not yet exist - no backup can be made 2012-08-09 15:33:05 -04:00
Seth Vidal
28e9b1128f add backup= option to copy. makes a backup of the file on the target
in a file named: $filename.YYYY-MM-DD@HH:MM~

backup=False is default
2012-08-09 14:24:21 -04:00
Michael DeHaan
faed4b5a33 whitespace + remove deprecated YAML parser (migration script lives in examples/scripts and warning was added
in 0.6 release)
2012-08-06 20:07:02 -04:00
Michael DeHaan
7e9e29011e Add encoding lines to python modules such that they can take unicode options if they are fed them, since the
AnsibleModule stuff no longer base64 encodes for simplicity and speed reasons.
2012-08-02 21:29:10 -04:00
Will Thames
0e26ef9bdd Revert acceptance of directory as dest for copy
Although library/copy can be corrected to understand that dest is
a directory, I can't see how to let _execute_copy know this and let the
file module know.

As a better solution than before #733, the copy module now explicitly (rather
than silently) fails when dest is a directory.
2012-08-02 16:54:03 +10:00
Michael DeHaan
ed14312ad6 reinstate invalid argument checks where possible, daisy chainee/chained modules turn it off 2012-08-01 19:42:31 -04:00
u348095
3cb51acd78 Allow copy dest argument to be a directory
Could have used shutil.copy rather than shutil.copyfile, but this
implementation preserves the md5 comparison to avoid unnecessary copies
2012-07-31 14:47:01 +10:00
Michael DeHaan
9f149c9f1a imports not needed 2012-07-21 17:25:47 -04:00
Michael DeHaan
d0f4358730 Port the copy module over to the new "common module" logic. 2012-07-21 17:07:42 -04:00
John Kleint
375a1eaf43 Use iterative MD5 hashing. 2012-07-09 13:27:47 -04:00
Dave Hatton
55694db7c3 switch to hashlib.md5 or md5 instead of OS md5 commands 2012-07-09 08:52:00 +01:00
Dave Hatton
ecaa794f7f copy always returned change=true 2012-07-06 13:43:19 +01:00
Dave Hatton
9d85a55434 switch to shutil.copy rather than os.system(cp) 2012-07-04 12:26:25 +01:00
Dave Hatton
263fcab594 md5 allow copy if file is missing 2012-07-03 20:07:08 +01:00
Jeremy Smitherman
3003aa2d47 Added IndexError catch for copy module, IndexError is thrown if a destination file doesn't exist 2012-07-03 14:12:19 -04:00
Dave Hatton
d47de18b6c improve error trapping for md5 2012-07-03 12:44:37 +01:00
Ingo Gottwald
a42167ca73 Copy module: Extended error handling and fixed error messages 2012-06-25 20:45:05 +02:00
Ingo Gottwald
270266e920 Added to copy module: Error handling for missing permissions on the copy destination 2012-06-23 21:39:37 +02:00
Michael DeHaan
25083953fc Merge pull request #495 from nafeger/devel
make copy module implemented closer to other newer modules when returning results
2012-06-20 13:12:24 -07:00
Nathan A. Feger
26816b72ec attempt to make copy more idiomatic. 2012-06-20 14:17:15 -05:00
Fred Alger
834f6a216d Make shell outs to md5sum work on FreeBSD and OS X
Tested with OS X local connection and Linux remote. The paths to the
md5sum and md5 commands are hardcoded to the most common location. This
will definitely fail if the commands are elsewhere, or if the md5
command doesn't support the -q 'quiet' option.
2012-06-15 00:04:01 -04:00
Stephen Fromm
aea022b002 Apply logging of arguments to modules (issue #122)
The ohai and facter modules use /usr/bin/logger to log the fact that
they have been invoked.  I added 'import os' to the ping module
so that it could have the same syslog statements as the other modules.
I separated the condensed:
    shlex.split(open(argfile, 'r').read())
into two separate statements similar to the other modules.
2012-05-09 15:19:20 -07:00
Seth Vidal
c701e59592 very minor indentation issue in librar/copy 2012-04-27 16:45:28 -04:00
Michael DeHaan
7794493952 Don't try to expand path for None values 2012-04-20 08:02:12 -04:00
Michael DeHaan
445e48b991 Call os.path.expanduser in modules so things work as expected even when using ./hacking/test-module script 2012-04-20 07:57:39 -04:00
Jeroen Hoekx
38a33c54a6 Make copy module idempotent.
Check md5sum before overwriting a file. Unconditionally copying changes the timestamp.
2012-03-31 13:59:41 +02:00
Michael DeHaan
4bde4926c3 Modules don't have to return JSON, key=value pairs is ok. 2012-03-14 21:16:15 -04:00
Michael DeHaan
aeea46678d Fix the copy module to use the argsfile method 2012-03-14 19:09:44 -04:00
Michael DeHaan
eaa7714ff8 Laying the groundwork for async mode, async status script still needs to be done, and async_wrapper
still needs to daemonize.  Then, once done, playbook can be taught how to poll async within the
timing window.
2012-03-03 12:25:56 -05:00
Michael DeHaan
be4cb64c92 Relicensing to GPLv3, all previous committers ok'd on mailing list. 2012-02-28 19:08:09 -05:00
Michael DeHaan
ba4e36a9a9 Rename 'ensure' to 'state' because I think it's a bit cleaner and doesn't imply
all modules take a common parameter name.  But more or less we still work idempotently
in modules.
2012-02-26 22:31:42 -05:00
Michael DeHaan
61d064d011 Fixed up KV munging in runner, misc fixes to copy, setup, and template modules 2012-02-26 19:55:26 -05:00
Michael DeHaan
e5f62f20b1 make copy & template module take key/value parameters so we're consistent. Only the command
module works differently now

starter manpage for modules

allow template file location to be passed into template & setup modules
2012-02-26 19:21:44 -05:00
Michael DeHaan
deb71da91e trim md5sum string so it does not contain the filename
also fix a bug/typo in the reporting from playbook
2012-02-26 12:10:57 -05:00
Michael DeHaan
b44ae0af90 applying indentation patch from skvidal 2012-02-25 17:16:23 -05:00
Michael DeHaan
6cceaa5f6a Implment copy with an actual minion-side module such that we can get md5sum's and
onchange events like Puppet's file providers do.
2012-02-24 05:15:28 -05:00
Michael DeHaan
3807824c6d Added file copy support w/ readme updates 2012-02-23 16:07:10 -05:00