diff --git a/changelogs/fragments/4288-fix-4259-support-busybox-dd.yml b/changelogs/fragments/4288-fix-4259-support-busybox-dd.yml new file mode 100644 index 0000000000..c1d69d9466 --- /dev/null +++ b/changelogs/fragments/4288-fix-4259-support-busybox-dd.yml @@ -0,0 +1,5 @@ +--- +bugfixes: + - filesize - add support for busybox dd implementation, that is used by default on Alpine linux + (https://github.com/ansible-collections/community.general/pull/4288, + https://github.com/ansible-collections/community.general/issues/4259). diff --git a/plugins/modules/files/filesize.py b/plugins/modules/files/filesize.py index 81701438ca..83edbe58ae 100644 --- a/plugins/modules/files/filesize.py +++ b/plugins/modules/files/filesize.py @@ -83,7 +83,7 @@ options: - Whether or not the file to create should be a sparse file. - This option is effective only on newly created files, or when growing a file, only for the bytes to append. - - This option is not supported on OpenBSD, Solaris and AIX. + - This option is not supported on OSes or filesystems not supporting sparse files. - I(force=true) and I(sparse=true) are mutually exclusive. type: bool default: false @@ -129,6 +129,10 @@ seealso: - name: dd(1) manpage for NetBSD description: Manual page of the NetBSD's dd implementation. link: https://man.netbsd.org/dd.1 + + - name: busybox(1) manpage for Linux + description: Manual page of the GNU/Linux's busybox, that provides its own dd implementation. + link: https://www.unix.com/man-page/linux/1/busybox ''' EXAMPLES = r''' @@ -377,12 +381,10 @@ def complete_dd_cmdline(args, dd_cmd): return list() bs = args['size_spec']['blocksize'] - conv = list() # For sparse files (create, truncate, grow): write count=0 block. if args['sparse']: seek = args['size_spec']['blocks'] - conv += ['sparse'] elif args['force'] or not os.path.exists(args['path']): # Create file seek = 0 elif args['size_diff'] < 0: # Truncate file @@ -394,8 +396,6 @@ def complete_dd_cmdline(args, dd_cmd): count = args['size_spec']['blocks'] - seek dd_cmd += ['bs=%s' % str(bs), 'seek=%s' % str(seek), 'count=%s' % str(count)] - if conv: - dd_cmd += ['conv=%s' % ','.join(conv)] return dd_cmd diff --git a/tests/integration/targets/filesize/tasks/main.yml b/tests/integration/targets/filesize/tasks/main.yml index d156e6c56f..14415dac9a 100644 --- a/tests/integration/targets/filesize/tasks/main.yml +++ b/tests/integration/targets/filesize/tasks/main.yml @@ -29,7 +29,6 @@ include_tasks: sparse.yml when: - not (ansible_os_family == 'Darwin' and ansible_distribution_version is version('11', '<')) - - not (ansible_os_family == 'Alpine') # TODO figure out why it fails - name: Include tasks to test playing with symlinks include_tasks: symlinks.yml