mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 05:10:22 -07:00
Move from md5 to sha1 to work on fips-140 enabled systems
This commit is contained in:
parent
716f3eb6d9
commit
f1267c0b05
31 changed files with 238 additions and 139 deletions
|
@ -37,7 +37,19 @@
|
|||
assert:
|
||||
that:
|
||||
- "result.state == 'file'"
|
||||
- "result.md5sum == '96905702a2ece40de6bf3a94b5062513'"
|
||||
- "result.changed == True"
|
||||
- "result.checksum == '048a1bd1951aa5ccc427eeb4ca19aee45e9c68b3'"
|
||||
|
||||
- name: test assemble with all fragments
|
||||
assemble: src="{{output_dir}}/src" dest="{{output_dir}}/assembled1"
|
||||
register: result
|
||||
|
||||
- name: assert that the same assemble made no changes
|
||||
assert:
|
||||
that:
|
||||
- "result.state == 'file'"
|
||||
- "result.changed == False"
|
||||
- "result.checksum == '048a1bd1951aa5ccc427eeb4ca19aee45e9c68b3'"
|
||||
|
||||
- name: test assemble with fragments matching a regex
|
||||
assemble: src="{{output_dir}}/src" dest="{{output_dir}}/assembled2" regexp="^fragment[1-3]$"
|
||||
|
@ -47,7 +59,7 @@
|
|||
assert:
|
||||
that:
|
||||
- "result.state == 'file'"
|
||||
- "result.md5sum == 'eb9e3486a9cd6943b5242e573b9b9349'"
|
||||
- "result.checksum == 'edfe2d7487ef8f5ebc0f1c4dc57ba7b70a7b8e2b'"
|
||||
|
||||
- name: test assemble with a delimiter
|
||||
assemble: src="{{output_dir}}/src" dest="{{output_dir}}/assembled3" delimiter="#--- delimiter ---#"
|
||||
|
@ -57,7 +69,7 @@
|
|||
assert:
|
||||
that:
|
||||
- "result.state == 'file'"
|
||||
- "result.md5sum == '4773eac67aba3f0be745876331c8a450'"
|
||||
- "result.checksum == '505359f48c65b3904127cf62b912991d4da7ed6d'"
|
||||
|
||||
- name: test assemble with remote_src=False
|
||||
assemble: src="./" dest="{{output_dir}}/assembled4" remote_src=no
|
||||
|
@ -67,7 +79,7 @@
|
|||
assert:
|
||||
that:
|
||||
- "result.state == 'file'"
|
||||
- "result.md5sum == '96905702a2ece40de6bf3a94b5062513'"
|
||||
- "result.checksum == '048a1bd1951aa5ccc427eeb4ca19aee45e9c68b3'"
|
||||
|
||||
- name: test assemble with remote_src=False and a delimiter
|
||||
assemble: src="./" dest="{{output_dir}}/assembled5" remote_src=no delimiter="#--- delimiter ---#"
|
||||
|
@ -77,5 +89,5 @@
|
|||
assert:
|
||||
that:
|
||||
- "result.state == 'file'"
|
||||
- "result.md5sum == '4773eac67aba3f0be745876331c8a450'"
|
||||
- "result.checksum == '505359f48c65b3904127cf62b912991d4da7ed6d'"
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@
|
|||
"multiline echo" \
|
||||
"with a new line
|
||||
in quotes" \
|
||||
| md5sum \
|
||||
| sha1sum \
|
||||
| tr -s ' ' \
|
||||
| cut -f1 -d ' '
|
||||
echo "this is a second line"
|
||||
|
@ -197,7 +197,7 @@
|
|||
assert:
|
||||
that:
|
||||
- "shell_result6.changed"
|
||||
- "shell_result6.stdout == '32f3cc201b69ed8afa3902b80f554ca8\nthis is a second line'"
|
||||
- "shell_result6.stdout == '5575bb6b71c9558db0b6fbbf2f19909eeb4e3b98\nthis is a second line'"
|
||||
|
||||
- name: execute a shell command using a literal multiline block with arguments in it
|
||||
shell: |
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
- "'group' in copy_result"
|
||||
- "'gid' in copy_result"
|
||||
- "'md5sum' in copy_result"
|
||||
- "'checksum' in copy_result"
|
||||
- "'owner' in copy_result"
|
||||
- "'size' in copy_result"
|
||||
- "'src' in copy_result"
|
||||
|
@ -51,10 +52,11 @@
|
|||
that:
|
||||
- "copy_result.changed == true"
|
||||
|
||||
- name: verify that the file md5sum is correct
|
||||
assert:
|
||||
that:
|
||||
- name: verify that the file checksums are correct
|
||||
assert:
|
||||
that:
|
||||
- "copy_result.md5sum == 'c47397529fe81ab62ba3f85e9f4c71f2'"
|
||||
- "copy_result.checksum == 'c79a6506c1c948be0d456ab5104d5e753ab2f3e6'"
|
||||
|
||||
- name: check the stat results of the file
|
||||
stat: path={{output_file}}
|
||||
|
@ -71,6 +73,7 @@
|
|||
- "stat_results.stat.isreg == true"
|
||||
- "stat_results.stat.issock == false"
|
||||
- "stat_results.stat.md5 == 'c47397529fe81ab62ba3f85e9f4c71f2'"
|
||||
- "stat_results.stat.checksum == 'c79a6506c1c948be0d456ab5104d5e753ab2f3e6'"
|
||||
|
||||
- name: overwrite the file via same means
|
||||
copy: src=foo.txt dest={{output_file}}
|
||||
|
@ -180,7 +183,7 @@
|
|||
that:
|
||||
- "copy_result6.changed"
|
||||
- "copy_result6.dest == '{{output_dir|expanduser}}/multiline.txt'"
|
||||
- "copy_result6.md5sum == '1627d51e7e607c92cf1a502bf0c6cce3'"
|
||||
- "copy_result6.checksum == '9cd0697c6a9ff6689f0afb9136fa62e0b3fee903'"
|
||||
|
||||
# test overwriting a file as an unprivileged user (pull request #8624)
|
||||
# this can't be relative to {{output_dir}} as ~root usually has mode 700
|
||||
|
@ -202,7 +205,7 @@
|
|||
that:
|
||||
- "copy_result7.changed"
|
||||
- "copy_result7.dest == '/tmp/worldwritable/file.txt'"
|
||||
- "copy_result7.md5sum == '73feffa4b7f6bb68e44cf984c85f6e88'"
|
||||
- "copy_result7.checksum == 'bbe960a25ea311d21d40669e93df2003ba9b90a2'"
|
||||
|
||||
- name: clean up
|
||||
file: dest=/tmp/worldwritable state=absent
|
||||
|
@ -230,10 +233,10 @@
|
|||
- stat_link_result.stat.islnk
|
||||
|
||||
- name: get the md5 of the link target
|
||||
shell: md5sum {{output_dir}}/follow_test | cut -f1 -sd ' '
|
||||
shell: sha1sum {{output_dir}}/follow_test | cut -f1 -sd ' '
|
||||
register: target_file_result
|
||||
|
||||
- name: assert that the link target was updated
|
||||
assert:
|
||||
that:
|
||||
- replace_follow_result.md5sum == target_file_result.stdout
|
||||
- replace_follow_result.checksum == target_file_result.stdout
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
- "result.md5sum == '6be7fb7fa7fb758c80a6dc0722979c40'"
|
||||
- "result.checksum == '5feac65e442c91f557fc90069ce6efc4d346ab51'"
|
||||
- "result.state == 'file'"
|
||||
|
||||
- name: insert a line at the beginning of the file, and back it up
|
||||
|
@ -42,19 +42,19 @@
|
|||
stat: path={{result.backup}}
|
||||
register: result
|
||||
|
||||
- name: assert the backup file matches the previous md5
|
||||
- name: assert the backup file matches the previous hash
|
||||
assert:
|
||||
that:
|
||||
- "result.stat.md5 == '6be7fb7fa7fb758c80a6dc0722979c40'"
|
||||
- "result.stat.checksum == '5feac65e442c91f557fc90069ce6efc4d346ab51'"
|
||||
|
||||
- name: stat the test after the insert at the head
|
||||
stat: path={{output_dir}}/test.txt
|
||||
register: result
|
||||
|
||||
- name: assert test md5 matches after the insert at the head
|
||||
- name: assert test hash is what we expect for the file with the insert at the head
|
||||
assert:
|
||||
that:
|
||||
- "result.stat.md5 == '07c16434644a2a3cc1807c685917443a'"
|
||||
- "result.stat.checksum == '7eade4042b23b800958fe807b5bfc29f8541ec09'"
|
||||
|
||||
- name: insert a line at the end of the file
|
||||
lineinfile: dest={{output_dir}}/test.txt state=present line="New line at the end" insertafter="EOF"
|
||||
|
@ -70,10 +70,10 @@
|
|||
stat: path={{output_dir}}/test.txt
|
||||
register: result
|
||||
|
||||
- name: assert test md5 matches after the insert at the end
|
||||
- name: assert test checksum matches after the insert at the end
|
||||
assert:
|
||||
that:
|
||||
- "result.stat.md5 == 'da4c2150e5782fcede1840280ab87eff'"
|
||||
- "result.stat.checksum == 'fb57af7dc10a1006061b000f1f04c38e4bef50a9'"
|
||||
|
||||
- name: insert a line after the first line
|
||||
lineinfile: dest={{output_dir}}/test.txt state=present line="New line after line 1" insertafter="^This is line 1$"
|
||||
|
@ -89,10 +89,10 @@
|
|||
stat: path={{output_dir}}/test.txt
|
||||
register: result
|
||||
|
||||
- name: assert test md5 matches after the insert after the first line
|
||||
- name: assert test checksum matches after the insert after the first line
|
||||
assert:
|
||||
that:
|
||||
- "result.stat.md5 == '196722c8faaa28b960bee66fa4cce58c'"
|
||||
- "result.stat.checksum == '5348da605b1bc93dbadf3a16474cdf22ef975bec'"
|
||||
|
||||
- name: insert a line before the last line
|
||||
lineinfile: dest={{output_dir}}/test.txt state=present line="New line after line 5" insertbefore="^This is line 5$"
|
||||
|
@ -108,10 +108,10 @@
|
|||
stat: path={{output_dir}}/test.txt
|
||||
register: result
|
||||
|
||||
- name: assert test md5 matches after the insert before the last line
|
||||
- name: assert test checksum matches after the insert before the last line
|
||||
assert:
|
||||
that:
|
||||
- "result.stat.md5 == 'd5955ee042139dfef16dbe3a7334475f'"
|
||||
- "result.stat.checksum == 'e1cae425403507feea4b55bb30a74decfdd4a23e'"
|
||||
|
||||
- name: replace a line with backrefs
|
||||
lineinfile: dest={{output_dir}}/test.txt state=present line="This is line 3" backrefs=yes regexp="^(REF) .* \\1$"
|
||||
|
@ -127,16 +127,16 @@
|
|||
stat: path={{output_dir}}/test.txt
|
||||
register: result
|
||||
|
||||
- name: assert test md5 matches after backref line was replaced
|
||||
- name: assert test checksum matches after backref line was replaced
|
||||
assert:
|
||||
that:
|
||||
- "result.stat.md5 == '0f585270054e17be242743dd31c6f593'"
|
||||
- "result.stat.checksum == '2ccdf45d20298f9eaece73b713648e5489a52444'"
|
||||
|
||||
- name: remove the middle line
|
||||
lineinfile: dest={{output_dir}}/test.txt state=absent regexp="^This is line 3$"
|
||||
register: result
|
||||
|
||||
- name: assert that the line was inserted at the head of the file
|
||||
- name: assert that the line was removed
|
||||
assert:
|
||||
that:
|
||||
- "result.changed == true"
|
||||
|
@ -146,10 +146,10 @@
|
|||
stat: path={{output_dir}}/test.txt
|
||||
register: result
|
||||
|
||||
- name: assert test md5 matches after the middle line was removed
|
||||
- name: assert test checksum matches after the middle line was removed
|
||||
assert:
|
||||
that:
|
||||
- "result.stat.md5 == '661603660051991b79429c2dc68d9a67'"
|
||||
- "result.stat.checksum == 'a6ba6865547c19d4c203c38a35e728d6d1942c75'"
|
||||
|
||||
- name: run a validation script that succeeds
|
||||
lineinfile: dest={{output_dir}}/test.txt state=absent regexp="^This is line 5$" validate="true %s"
|
||||
|
@ -165,10 +165,10 @@
|
|||
stat: path={{output_dir}}/test.txt
|
||||
register: result
|
||||
|
||||
- name: assert test md5 matches after the validation succeeded
|
||||
- name: assert test checksum matches after the validation succeeded
|
||||
assert:
|
||||
that:
|
||||
- "result.stat.md5 == '9af984939bd859f7794661e501b4f1a4'"
|
||||
- "result.stat.checksum == '76955a4516a00a38aad8427afc9ee3e361024ba5'"
|
||||
|
||||
- name: run a validation script that fails
|
||||
lineinfile: dest={{output_dir}}/test.txt state=absent regexp="^This is line 1$" validate="/bin/false %s"
|
||||
|
@ -184,10 +184,10 @@
|
|||
stat: path={{output_dir}}/test.txt
|
||||
register: result
|
||||
|
||||
- name: assert test md5 matches the previous after the validation failed
|
||||
- name: assert test checksum matches the previous after the validation failed
|
||||
assert:
|
||||
that:
|
||||
- "result.stat.md5 == '9af984939bd859f7794661e501b4f1a4'"
|
||||
- "result.stat.checksum == '76955a4516a00a38aad8427afc9ee3e361024ba5'"
|
||||
|
||||
- name: use create=yes
|
||||
lineinfile: dest={{output_dir}}/new_test.txt create=yes insertbefore=BOF state=present line="This is a new file"
|
||||
|
@ -204,10 +204,10 @@
|
|||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- name: assert the newly created test md5 matches
|
||||
- name: assert the newly created test checksum matches
|
||||
assert:
|
||||
that:
|
||||
- "result.stat.md5 == 'fef1d487711facfd7aa2c87d788c19d9'"
|
||||
- "result.stat.checksum == '038f10f9e31202451b093163e81e06fbac0c6f3a'"
|
||||
|
||||
# Test EOF in cases where file has no newline at EOF
|
||||
- name: testnoeof deploy the file for lineinfile
|
||||
|
@ -238,10 +238,10 @@
|
|||
stat: path={{output_dir}}/testnoeof.txt
|
||||
register: result
|
||||
|
||||
- name: testnoeof assert test md5 matches after the insert at the end
|
||||
- name: testnoeof assert test checksum matches after the insert at the end
|
||||
assert:
|
||||
that:
|
||||
- "result.stat.md5 == 'f75c9d51f45afd7295000e63ce655220'"
|
||||
- "result.stat.checksum == 'f9af7008e3cb67575ce653d094c79cabebf6e523'"
|
||||
|
||||
# Test EOF with empty file to make sure no unneccessary newline is added
|
||||
- name: testempty deploy the testempty file for lineinfile
|
||||
|
@ -262,18 +262,18 @@
|
|||
stat: path={{output_dir}}/testempty.txt
|
||||
register: result
|
||||
|
||||
- name: testempty assert test md5 matches after the insert at the end
|
||||
- name: testempty assert test checksum matches after the insert at the end
|
||||
assert:
|
||||
that:
|
||||
- "result.stat.md5 == '357dcbee8dfb4436f63bab00a235c45a'"
|
||||
- "result.stat.checksum == 'f440dc65ea9cec3fd496c1479ddf937e1b949412'"
|
||||
|
||||
- stat: path={{output_dir}}/test.txt
|
||||
register: result
|
||||
|
||||
- name: assert test md5 matches after insert the multiple lines
|
||||
- name: assert test checksum matches after inserting multiple lines
|
||||
assert:
|
||||
that:
|
||||
- "result.stat.md5 == 'c2510d5bc8fdef8e752b8f8e74c784c2'"
|
||||
- "result.stat.checksum == 'bf5b711f8f0509355aaeb9d0d61e3e82337c1365'"
|
||||
|
||||
- name: replace a line with backrefs included in the line
|
||||
lineinfile: dest={{output_dir}}/test.txt state=present line="New \\1 created with the backref" backrefs=yes regexp="^This is (line 4)$"
|
||||
|
@ -289,10 +289,10 @@
|
|||
stat: path={{output_dir}}/test.txt
|
||||
register: result
|
||||
|
||||
- name: assert test md5 matches after backref line was replaced
|
||||
- name: assert test checksum matches after backref line was replaced
|
||||
assert:
|
||||
that:
|
||||
- "result.stat.md5 == '65f955c2a9722fd43d07103d7756ff9b'"
|
||||
- "result.stat.checksum == '04b7a54d0fb233a4e26c9e625325bb4874841b3c'"
|
||||
|
||||
###################################################################
|
||||
# issue 8535
|
||||
|
@ -332,10 +332,10 @@
|
|||
stat: path={{output_dir}}/test_quoting.txt
|
||||
register: result
|
||||
|
||||
- name: assert test md5 matches after backref line was replaced
|
||||
- name: assert test checksum matches after backref line was replaced
|
||||
assert:
|
||||
that:
|
||||
- "result.stat.md5 == '29f349baf1b9c6703beeb346fe8dc669'"
|
||||
- "result.stat.checksum == '7dc3cb033c3971e73af0eaed6623d4e71e5743f1'"
|
||||
|
||||
- name: insert a line into the quoted file with a single quote
|
||||
lineinfile: dest={{output_dir}}/test_quoting.txt line="import g'"
|
||||
|
@ -350,9 +350,9 @@
|
|||
stat: path={{output_dir}}/test_quoting.txt
|
||||
register: result
|
||||
|
||||
- name: assert test md5 matches after backref line was replaced
|
||||
- name: assert test checksum matches after backref line was replaced
|
||||
assert:
|
||||
that:
|
||||
- "result.stat.md5 == 'fbe9c4ba2490f70eb1974ce31ec4a39f'"
|
||||
- "result.stat.checksum == '73b271c2cc1cef5663713bc0f00444b4bf9f4543'"
|
||||
|
||||
###################################################################
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
assert:
|
||||
that:
|
||||
- "install_result.dest == '/usr/sbin/ansible_test_service'"
|
||||
- "install_result.md5sum == '9ad49eaf390b30b1206b793ec71200ed'"
|
||||
- "install_result.checksum == 'baaa79448a976922c080f1971321d203c6df0961'"
|
||||
- "install_result.state == 'file'"
|
||||
- "install_result.mode == '0755'"
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
- "install_systemd_result.dest == '/usr/lib/systemd/system/ansible_test.service'"
|
||||
- "install_systemd_result.state == 'file'"
|
||||
- "install_systemd_result.mode == '0644'"
|
||||
- "install_systemd_result.md5sum == '6be64a1e44e9e72a467e70a0b562444f'"
|
||||
- "install_systemd_result.checksum == 'ca4b413fdf3cb2002f51893b9e42d2e449ec5afb'"
|
||||
- "install_broken_systemd_result.dest == '/usr/lib/systemd/system/ansible_test_broken.service'"
|
||||
- "install_broken_systemd_result.state == 'link'"
|
||||
|
||||
|
|
|
@ -8,5 +8,5 @@
|
|||
- "install_sysv_result.dest == '/etc/init.d/ansible_test'"
|
||||
- "install_sysv_result.state == 'file'"
|
||||
- "install_sysv_result.mode == '0755'"
|
||||
- "install_sysv_result.md5sum == 'ebf6a9064ca8628187f3a6caf8e2a279'"
|
||||
- "install_sysv_result.md5sum == '174fa255735064b420600e4c8637ea0eff28d0c1'"
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
- "install_upstart_result.dest == '/etc/init/ansible_test.conf'"
|
||||
- "install_upstart_result.state == 'file'"
|
||||
- "install_upstart_result.mode == '0644'"
|
||||
- "install_upstart_result.md5sum == 'ab3900ea4de8423add764c12aeb90c01'"
|
||||
- "install_upstart_result.checksum == '5c314837b6c4dd6c68d1809653a2974e9078e02a'"
|
||||
- "install_upstart_broken_result.dest == '/etc/init/ansible_broken_test.conf'"
|
||||
- "install_upstart_broken_result.state == 'file'"
|
||||
- "install_upstart_broken_result.mode == '0644'"
|
||||
- "install_upstart_broken_result.md5sum == '015e183d10c311276c3e269cbeb309b7'"
|
||||
- "install_upstart_broken_result.checksum == 'e66497894f2b2bf71e1380a196cc26089cc24a10'"
|
||||
|
|
|
@ -46,6 +46,8 @@
|
|||
- "'isuid' in stat_result.stat"
|
||||
- "'md5' in stat_result.stat"
|
||||
- "stat_result.stat.md5 == '5eb63bbbe01eeed093cb22bb8f5acdc3'"
|
||||
- "'checksum' in stat_result.stat"
|
||||
- "stat_result.stat.checksum == '2aae6c35c94fcfb415dbe95f408b9ce91ee846ed'"
|
||||
- "'mode' in stat_result.stat" # why is this 420?
|
||||
- "'mtime' in stat_result.stat"
|
||||
- "'nlink' in stat_result.stat"
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
- "'group' in template_result"
|
||||
- "'gid' in template_result"
|
||||
- "'md5sum' in template_result"
|
||||
- "'checksum' in template_result"
|
||||
- "'owner' in template_result"
|
||||
- "'size' in template_result"
|
||||
- "'src' in template_result"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue