|
61 | 61 | export ZOAU_ROOT
|
62 | 62 | export _BPXK_AUTOCVT"""
|
63 | 63 |
|
| 64 | +TEST_CONTENT_ADVANCED_REGULAR_EXPRESSION="""if [ -z STEPLIB ] && tty -s; |
| 65 | +then |
| 66 | + D160882 |
| 67 | + D160882 |
| 68 | + ED160882 |
| 69 | + export STEPLIB=none |
| 70 | + exec -a 0 SHELL |
| 71 | +fi |
| 72 | +PATH=/usr/lpp/zoautil/v100/bin:/usr/lpp/rsusr/ported/bin:/bin:/var/bin |
| 73 | +export PATH |
| 74 | +ZOAU_ROOT=/usr/lpp/zoautil/v100 |
| 75 | +export ZOAU_ROOT |
| 76 | +export _BPXK_AUTOCVT""" |
| 77 | + |
64 | 78 | EXPECTED_REPLACE="""if [ -z STEPLIB ] && tty -s;
|
65 | 79 | then
|
66 | 80 | export STEPLIB=none
|
@@ -538,6 +552,28 @@ def test_uss_line_absent(ansible_zos_module):
|
538 | 552 | remove_uss_environment(ansible_zos_module, full_path)
|
539 | 553 |
|
540 | 554 |
|
| 555 | +@pytest.mark.uss |
| 556 | +def test_uss_advanced_regular_expression_absent(ansible_zos_module): |
| 557 | + hosts = ansible_zos_module |
| 558 | + params = { |
| 559 | + "regexp":"[A-Za-z][0-9]{6}", |
| 560 | + "state":"absent" |
| 561 | + } |
| 562 | + full_path = get_random_file_name(dir=TMP_DIRECTORY) |
| 563 | + content = TEST_CONTENT_ADVANCED_REGULAR_EXPRESSION |
| 564 | + try: |
| 565 | + set_uss_environment(ansible_zos_module, content, full_path) |
| 566 | + params["path"] = full_path |
| 567 | + results = hosts.all.zos_lineinfile(**params) |
| 568 | + for result in results.contacted.values(): |
| 569 | + assert result.get("changed") == 1 |
| 570 | + results = hosts.all.shell(cmd="cat {0}".format(params["path"])) |
| 571 | + for result in results.contacted.values(): |
| 572 | + assert result.get("stdout") == TEST_CONTENT |
| 573 | + finally: |
| 574 | + remove_uss_environment(ansible_zos_module, full_path) |
| 575 | + |
| 576 | + |
541 | 577 | @pytest.mark.uss
|
542 | 578 | def test_uss_line_replace_quoted_escaped(ansible_zos_module):
|
543 | 579 | hosts = ansible_zos_module
|
|
0 commit comments