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] zos_operator throws TypeError when wait_time_s is specified #391

Merged
merged 14 commits into from
Sep 2, 2022

Conversation

fernandofloresg
Copy link
Collaborator

@fernandofloresg fernandofloresg commented Aug 30, 2022

SUMMARY

After ZOAU implemented timeout option in opercmd support was missing from zos_operator. Changed the opercmd.execute_command call to use the latest interface and explicitly provide the timeout value, had to be done this way since zoau python utils does a validation in this value over kwargs.
Added the case when wait_time_s is 0 to default to 1 and be true to the docs "When set to 0, the system default is used".

Also changed the test to now validate for timeouts and enabled the quick delay test.

Update, in addition to the original issue these updates are have included in this PR:

  • bugfixes:
    • ibm_zos_operator - fixed such that specifying wait_time_s would throw an error (original issue in this PR)
    • ibm_zos_operator - fixed case sensitive error checks, invalid, error & unidentifiable
    • ibm_zos_operator - fixed the wait_time_s to default to 1 second
  • minor_changes:
    • ibm_zos_operator - deprecated the wait option, not needed with wait_time_s minor_changes
    • ibm_zos_operator - added in the response the cmd result
    • ibm_zos_operator - added in the response the wait_time_s set
    • ibm_zos_operator - added in the response the elapsed time

fixes #389
fixes #377

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

zos_operator

ADDITIONAL INFORMATION

@fernandofloresg
Copy link
Collaborator Author

fernandofloresg commented Aug 30, 2022

Screenshot 2022-08-30 at 15 53 25

Screenshot 2022-08-30 at 15 52 43

Corrected for the correct build

Copy link
Collaborator

@richp405 richp405 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine from here.

@ddimatos
Copy link
Collaborator

ddimatos commented Sep 2, 2022

Updated changes return a result (below), what is new in the response is the wait_time_s, cmd and elapsed.

ok: [zvm] => {
    "result": {
        "changed": true,
        "cmd": "d u,all",
        "content": [
            "EC33017A   2022244  22:14:53.00             ISF031I CONSOLE OMVS0000 ACTIVATED",
            "EC33017A   2022244  22:14:53.00            -D U,ALL ",
            "EC33017A   2022244  22:14:53.00             IEE457I 22.14.53 UNIT STATUS 067",
            "                                           UNIT TYPE STATUS        VOLSER     VOLSTATE      SS",
            "                                           0000 3390 F-NRD                        /RSDNT     0",
            "                                           0001 3211 OFFLINE                                 0",
            "                                           0002 3211 OFFLINE                                 0",
            "                                           0003 3211 OFFLINE                                 0",
            "                                           0004 3211 OFFLINE                                 0",
            "                                           0005 3211 OFFLINE                                 0",
            "                                           0006 3211 OFFLINE                                 0",
            "                                           0007 3211 OFFLINE                                 0",
            "                                           0008 3211 OFFLINE                                 0",
            "                                           0009 3277 OFFLINE                                 0",
            "                                           000C 2540 A                                       0",
            "                                           000D 2540 A                                       0",
            "                                           000E 1403 A                                       0",
            "                                           000F 1403 A                                       0",
            "                                           0010 3211 A                                       0",
            "                                           0011 3211 A                                       0",
            "",
            ""
        ],
        "elapsed": 0.52,
        "failed": false,
        "rc": 0,
        "wait_time_s": 1
    }
}

@ddimatos
Copy link
Collaborator

ddimatos commented Sep 2, 2022

Regression with updated responses:

image

100% regression success, internal link/log

For the long running command which is commented out, we need a MVS command that can take a while to run, they all average 1/2 - 1 second , not long enough to evaluate. I do have a long running command I used that can not to be publicly shared that I tested with and it all ran fine. I will look for a valid command we can share by discussing it with some of the system admins. In the case of the long running command it worked as designed.

Command sanitized for reasons noted. Once it reached 50 seconds it returned. Even though the wait_time_s did work I do think there is room for improvement and opened this issue #398

ok: [zvm] => {
    "result": {
        "changed": true,
        "cmd": "DISPLAY ...........................................",
        "content": [
            "EC33017A   2022244  20:41:25.00             ISF031I CONSOLE OMVS0000 ACTIVATED",
            "EC33017A   2022244  20:41:25.00            -DISPLAY ..................................................... ",
            "EC33017A   2022244  20:41:25.00             Error retrieving operator message RC=0C,RSN=00",
            "",
            ""
        ],
        "deprecations": [
            {
                "collection_name": "ibm.ibm_zos_core",
                "date": "2022-09-01",
                "msg": "Support for configuring wait has been deprecated.Configuring wait is now managed by setting 'wait_time_s'"
            }
        ],
        "elapsed": 51.53,
        "failed": false,
        "rc": 0,
        "wait_time_s": 50
    }
}

@ddimatos
Copy link
Collaborator

ddimatos commented Sep 2, 2022

Also addresses #377

Copy link
Collaborator Author

@fernandofloresg fernandofloresg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, this refactor removes unnecessary steps and simplifies the verbose and wait logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants