Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Error using SET operator command with zos_operator #353

Closed
dvdrbn-m9 opened this issue Jul 13, 2022 · 7 comments · Fixed by #501
Closed

[Bug] Error using SET operator command with zos_operator #353

dvdrbn-m9 opened this issue Jul 13, 2022 · 7 comments · Fixed by #501
Assignees
Labels
Bug Something isn't working as designed. In Plan Issue has been accepted put into a planned release Resolved The issue is resolved, authors issue has been addressed

Comments

@dvdrbn-m9
Copy link

SUMMARY

When using SET command with the zos_operator causes an error with the following message:

fatal: [lpar25]: FAILED! => changed=false 
  msg: 'OperatorCmdError('' 0 "SET IKJTSO=M9" VERB WAIT'', 12, [''===================='', ''result code:  12'', ''===================='', '''', ''Action messages'', '''', '''', ''ISF302E "=" was seen in command position 20 where one of the following was expected: (, END-OF-STMT, QUOTED-STRING, UNQUOTED-STRING.'', ''ISF767I Request completed.'', '''', '''', ''Ran:  0 "SET IKJTSO=M9" VERB WAIT''])'

If I use T, which is a shortcut to SET, the task completes successfully.

COMPONENT NAME

zos_operator module

ANSIBLE VERSION
ansible [core 2.12.1]
  config file = /home/davidr/project/ansible/ansible.cfg
  configured module search path = ['/home/davidr/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/davidr/.local/lib/python3.10/site-packages/ansible
  ansible collection location = /home/davidr/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/davidr/.local/bin/ansible
  python version = 3.10.5 (main, Jun  6 2022, 18:49:26) [GCC 12.1.0]
  jinja version = 3.1.2
  libyaml = True
SPECIFY ANSIBLE COLLECTION VERSION

1.4.0-beta.1
also tried with 1.3.5, same result

SPECIFY THE Z OPEN AUTOMATION UTILITIES VERSION

2021/08/05 22:12:58 CUT V1.2.0

ENVIRONMENT

z/OS v2.5

STEPS TO REPRODUCE

The following task should cause the issue:

- name: operator command
  ibm.ibm_zos_core.zos_operator:
    cmd: "SET IKJTSO=M9"
    verbose: true
    wait: true

This works:

- name: operator command
  ibm.ibm_zos_core.zos_operator:
    cmd: "T IKJTSO=M9"
    verbose: true
    wait: true
EXPECTED RESULTS

Operator command ran and is visible in SYSLOG, task finishes successfully.
When running with T and -vvvv:

changed: [lpar25] => changed=true 
  content:
  - CPAC      2022194  06:23:52.92             ISF031I CONSOLE M9ANSBL ACTIVATED
  - CPAC      2022194  06:23:52.92            -T IKJTSO=M9
  - CPAC      2022194  06:23:52.98             IKJ712I DEFAULT VALUES WERE USED FOR CONSOLE
  - CPAC      2022194  06:23:52.98             IKJ712I DEFAULT VALUES WERE USED FOR HELP
  - CPAC      2022194  06:23:52.98             IKJ712I DEFAULT VALUES WERE USED FOR TEST
  - CPAC      2022194  06:23:52.98             IKJ712I DEFAULT VALUES WERE USED FOR PLATCMD
  - CPAC      2022194  06:23:52.98             IKJ712I DEFAULT VALUES WERE USED FOR PLATPGM
  - CPAC      2022194  06:23:52.98             IKJ712I DEFAULT VALUES WERE USED FOR LOGON
  - CPAC      2022194  06:23:52.98             IKJ55107I SYSTEM DEFAULTS WERE UPDATED USING MEMBER IKJTSOM9 OF DATASET CPAC.PARMLIB
  - ====================
  - 'result code:  0'
  - ====================
  - ''
  - Action messages
  - COMMAND ISSUED
  - ''
  - ISF147I REXX variable ISFTRACE fetched, return code 00000001 value is ''.
  - ISF147I REXX variable ISFTRMASK fetched, return code 00000001 value is ''.
  - ISF147I REXX variable ISFSECTRACE fetched, return code 00000000 value is 'ON'.
  - ISF147I REXX variable ISFSCHARS fetched, return code 00000001 value is ''.
  - ISF147I REXX variable ISFACTIONS fetched, return code 00000001 value is ''.
  - ISF147I REXX variable ISFAPPC fetched, return code 00000001 value is ''.
  - ISF147I REXX variable ISFPRTCCASA fetched, return code 00000001 value is ''.
  - ISF147I REXX variable ISFCKLIM fetched, return code 00000001 value is ''.
  - ISF147I REXX variable ISFCMODE fetched, return code 00000001 value is ''.
  - ISF147I REXX variable ISFCONS fetched, return code 00000001 value is ''.
  - ISF147I REXX variable ISFCONMOD fetched, return code 00000001 value is ''.
  - ISF147I REXX variable ISFDATE fetched, return code 00000001 value is ''.
  - ISF147I REXX variable ISFDELAY fetched, return code 00000001 value is ''.
  - ISF147I REXX variable ISFDEST fetched, return code 00000001 value is ''.
  - ISF147I REXX variable ISFDISPLAYMODE fetched, return code 00000001 value is ''.
  - ISF147I REXX variable ISFDUPDS fetched, return code 00000001 value is ''.
  - ISF147I REXX variable ISFINPUT fetched, return code 00000001 value is ''.
  - ISF147I REXX variable ISFOWNER fetched, return code 00000001 value is ''.
  - ISF147I REXX variable ISFPREFIX fetched, return code 00000001 value is ''.
  - ISF147I REXX variable ISFSYSID fetched, return code 00000001 value is ''.
  - ISF147I REXX variable ISFSYSNAME fetched, return code 00000001 value is ''.
  - ISF147I REXX variable ISFTIMEOUT fetched, return code 00000001 value is ''.
  - ISF754I Command 'SET SECTRACE ON' generated from associated variable ISFSECTRACE.
  - ISF051I SAF Access allowed SAFRC=0 ACCESS=READ CLASS=SDSF RESOURCE=ISFOPER.SYSTEM Reqstor=ISFOPSYS
  - 'ISF769I System command issued, command text: T IKJTSO=M9.'
  - ISF146I REXX variable ISFDIAG set, return code 00000001 value is '00000000 00000000 00000000 00000000 00000000'.
  - 'ISF766I Request completed, status: COMMAND ISSUED.'
  - ''
  - ''
  - ''
  - Ran 0 "T IKJTSO=M9" VERB WAIT
  invocation:
    module_args:
      cmd: T IKJTSO=M9
      verbose: true
      wait: true
      wait_time_s: 0
  rc: 0
ACTUAL RESULTS
The full traceback is:
  File "/tmp/ansible_ibm.ibm_zos_core.zos_operator_payload_soqb5fl4/ansible_ibm.ibm_zos_core.zos_operator_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_operator.py", line 174, in run_module
  File "/tmp/ansible_ibm.ibm_zos_core.zos_operator_payload_soqb5fl4/ansible_ibm.ibm_zos_core.zos_operator_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_operator.py", line 369, in run_operator_command
fatal: [lpar25]: FAILED! => changed=false 
  invocation:
    module_args:
      cmd: SET IKJTSO=M9
      verbose: true
      wait: true
      wait_time_s: 0
  msg: 'OperatorCmdError('' 0 "SET IKJTSO=M9" VERB WAIT'', 12, [''===================='', ''result code:  12'', ''===================='', '''', ''Action messages'', '''', '''', ''ISF302E "=" was seen in command position 20 where one of the following was expected: (, END-OF-STMT, QUOTED-STRING, UNQUOTED-STRING.'', ''ISF767I Request completed.'', '''', '''', ''Ran:  0 "SET IKJTSO=M9" VERB WAIT''])'

Nothing is written in the SYSLOG.

@dvdrbn-m9 dvdrbn-m9 added the Bug Something isn't working as designed. label Jul 13, 2022
@ddimatos ddimatos self-assigned this Jul 22, 2022
@ddimatos ddimatos added the In Progress This issue is under review by a team member. label Jul 22, 2022
@ddimatos ddimatos moved this to 👀 In review in IBM Ansible z/OS Core Collection Aug 26, 2022
@ddimatos
Copy link
Collaborator

@dvdrbn-m9 looking into this so I can size the work, I want to try a few things before I have anything else to report.

@dvdrbn-m9
Copy link
Author

Thanks for your time! Tell me if I can help and test something.

@ddimatos
Copy link
Collaborator

ddimatos commented Aug 29, 2022

Thanks @dvdrbn-m9 i might take you up on that , I saw some particular code and I am not sure why it’s there… so if I edit it I may reach out to you , thanks for offering

@ddimatos
Copy link
Collaborator

@richp405 - in 1.3.0-beta.2 we introduced the REXX code to run the operator commands likely because wanted to support WAIT allowing a user to configure the time to wait before returning on an operator command. Looking over this issue I do see that this line here does a evaluation of the command looking for QUERY, SET, etc if( ffwd == 'QUERY' | ffwd == 'SET' | ffwd == 'WHO' | fch == '/' ) then and when it sees SET it branches off to run the command without the forward slash, so something this will not work from our module:

    - name: Execute operator command
      zos_operator:
        wait_time_s: 10
        cmd: "SET DATE=2022.123"
        verbose: true
      register: result

But something like this will:

    - name: Execute operator command
      zos_operator:
        wait_time_s: 10
        cmd: "T DATE=2022.123"
        verbose: true
      register: result

Where T is the shorter version of SET.

Its odd to me be because I don't believe QUERY or WHO are operator commands and checking for a forward shlash and then removing it makes no sense.

I know this is not in issue in the 1.5.0-beat.1 code that will not be out till late in 4Q because its all C code now but this is a problem in 1.4.0-beta.1 and we are about to release 1.4.0-beta.2, if we could get some time on this we might be able to get it in before we release.

MVS command reference
Code in question:

if( ffwd == 'QUERY' | ffwd == 'SET' | ffwd == 'WHO' | fch == '/' ) then
  do
    sdsfcmd = True
  end
if sdsfcmd == True then
  do
    address SDSF "ISFEXEC " command verbose
  end
else
  do
    address SDSF "ISFEXEC '/"command"'" verbose
  end
saverc = rc

@ddimatos ddimatos moved this from 👀 In review to 🏗 In progress in IBM Ansible z/OS Core Collection Sep 23, 2022
@ddimatos ddimatos assigned richp405 and unassigned ddimatos Sep 23, 2022
@ddimatos ddimatos added this to the 2022 - Q4 Bugs milestone Sep 23, 2022
@ddimatos ddimatos added the In Plan Issue has been accepted put into a planned release label Sep 24, 2022
@richp405
Copy link
Collaborator

richp405 commented Oct 3, 2022

The rexx was a bit awkward here... I can not reproduce to original issue that led to the search query, but my notes had an explanation involving simple (non-parameterized commands). I have an experiment to run, where the search is still in place, but the command gets a set of apostrophes, which should fix it. If that fails, we will need to strategize, because SET is not the same as /SET, as I understand it. That was why the check for SET and / was in there originally.

@richp405
Copy link
Collaborator

richp405 commented Oct 3, 2022

The fix has been validated, and new tests added to the unit test system so we keep SET and QUERY working the way they should.

@richp405 richp405 moved this from 🏗 In progress to 👀 In review in IBM Ansible z/OS Core Collection Oct 3, 2022
@ddimatos ddimatos moved this from 👀 Reviewing to 🔍 Validation in IBM Ansible z/OS Core Collection Oct 4, 2022
@ddimatos ddimatos added Resolved The issue is resolved, authors issue has been addressed and removed In Progress This issue is under review by a team member. labels Oct 5, 2022
@ddimatos ddimatos moved this from 🔍 Validation to ✅ Done in IBM Ansible z/OS Core Collection Oct 5, 2022
@ddimatos
Copy link
Collaborator

ddimatos commented Oct 5, 2022

Merged into 1.4.0-beta.2 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working as designed. In Plan Issue has been accepted put into a planned release Resolved The issue is resolved, authors issue has been addressed
Projects
Development

Successfully merging a pull request may close this issue.

3 participants