Merge branch 'copy-diff-take2' of git://github.com/stoned/ansible into better_diff
Conflicts: library/file
This commit is contained in:
commit
113db71bf6
1 changed files with 14 additions and 0 deletions
14
file
14
file
|
@ -141,6 +141,7 @@ def main():
|
||||||
state = dict(choices=['file','directory','link','absent'], default='file'),
|
state = dict(choices=['file','directory','link','absent'], default='file'),
|
||||||
path = dict(aliases=['dest', 'name'], required=True),
|
path = dict(aliases=['dest', 'name'], required=True),
|
||||||
recurse = dict(default='no', type='bool')
|
recurse = dict(default='no', type='bool')
|
||||||
|
diff_peek = dict(default=None)
|
||||||
),
|
),
|
||||||
add_file_common_args=True,
|
add_file_common_args=True,
|
||||||
supports_check_mode=True
|
supports_check_mode=True
|
||||||
|
@ -150,6 +151,19 @@ def main():
|
||||||
state = params['state']
|
state = params['state']
|
||||||
params['path'] = path = os.path.expanduser(params['path'])
|
params['path'] = path = os.path.expanduser(params['path'])
|
||||||
|
|
||||||
|
# short-circuit for diff_peek
|
||||||
|
if params.get('diff_peek', None) is not None:
|
||||||
|
appears_binary = False
|
||||||
|
try:
|
||||||
|
f = open(path)
|
||||||
|
b = f.read(8192)
|
||||||
|
f.close()
|
||||||
|
if b.find("\x00") != -1:
|
||||||
|
appears_binary = True
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
module.exit_json(path=path, changed=False, appears_binary=appears_binary)
|
||||||
|
|
||||||
# source is both the source of a symlink or an informational passing of the src for a template module
|
# source is both the source of a symlink or an informational passing of the src for a template module
|
||||||
# or copy module, even if this module never uses it, it is needed to key off some things
|
# or copy module, even if this module never uses it, it is needed to key off some things
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue