Awesome-CloudOps-Automation icon indicating copy to clipboard operation
Awesome-CloudOps-Automation copied to clipboard

Enhancement to unskript-ctl CLI

Open jayasimha-raghavan-unskript opened this issue 1 year ago • 3 comments

Feature Request

Currently unskript-ctl can be used to run a given Runbook or list the existing runbooks that are avilable in the Awesome docker. This Issue is to request enhancements to the unskript-ctl tool.

Ability to run checks

unskript-ctl --run-checks [all | connector | failing]

Here the intention is to Run

  • All available checks
  • Run all checks for a given connector
  • Run checks that have failed in the past (Re-run failed checks)
  1. When all option is selected, the unskript-ctl should find out all available checks packaged in the system and run them and report the status against each checks, these result should be logged and the user should be able to display the failed checks and display the logs from the failed checks.

  2. When a connector is specified, the script should fetch all checks available in the system for that particular connector and run them/report status and log the results for later use.

  3. When execution_id is specified (we can get the failed execution_id from -df display-failed option), the script should re-run the check corresponding to the the execution_id and report status and log them for later use.

Ability to display failing checks

unskript-ctl --show-faling-checks [ all | connector ]

Here the intention is to show

  • All checks that have failed since last run
  • All checks that have failed for a given connector type
  1. When all option is provided, the script should display details like check id, name and timestamp of the last failure run
  2. When a connector is provided, the script should display details like check-id, name and timestamp of the last failure for that connector only.

Ability to display audit logs for check runs

unskript-ctl --show-audit-trail [ all | connector | check-id ]

Here the intention is to show

  • All Audit trails recorded in the system detailed passed/failed/errored checks
  • All Audit trails recorded for a given connector in the system detailing passed/failed/errored checks
  • Audit trails recorded for a given check-id in the system detailing passed/failed/errored runs for the given check-id

Ability to list all checks

unskript-ctl --list-checks [all | connector ]

Here the intention is to show

  • All Checks available in the sytem
  • All Checks for a given connector available to run in the system

Feature Request

Currently unskript-ctl can be used to run a given Runbook or list the existing runbooks that are avilable in the Awesome docker. This Issue is to request enhancements to the unskript-ctl tool.

Ability to run checks

unskript-ctl --run-checks [all | connector | failing]

Here the intention is to Run

  • All available checks
  • Run all checks for a given connector
  • Run checks that have failed in the past (Re-run failed checks)
  1. When all option is selected, the unskript-ctl should find out all available checks packaged in the system and run them and report the status against each checks, these result should be logged and the user should be able to display the failed checks and display the logs from the failed checks.
  2. When a connector is specified, the script should fetch all checks available in the system for that particular connector and run them/report status and log the results for later use.
  3. When execution_id is specified (we can get the failed execution_id from -df display-failed option), the script should re-run the check corresponding to the the execution_id and report status and log them for later use.

No execution_id is being provided in the failing case. We should collect the checks with current status as failing from the DB and run those checks. Could you provide the implementation summary - what will you be implementing for each of these three? ie a design note.

Ability to display failing checks

unskript-ctl --show-faling-checks [ all | connector ]

Here the intention is to show

  • All checks that have failed since last run
  • All checks that have failed for a given connector type
  1. When all option is provided, the script should display details like check id, name and timestamp of the last failure run
  2. When a connector is provided, the script should display details like check-id, name and timestamp of the last failure for that connector only.

Ability to display audit logs for check runs

unskript-ctl --show-audit-trail [ all | connector | check-id ]

Here the intention is to show

  • All Audit trails recorded in the system detailed passed/failed/errored checks
  • All Audit trails recorded for a given connector in the system detailing passed/failed/errored checks
  • Audit trails recorded for a given check-id in the system detailing passed/failed/errored runs for the given check-id

Ability to list all checks

unskript-ctl --list-checks [all | connector ]

Here the intention is to show

  • All Checks available in the sytem
  • All Checks for a given connector available to run in the system

abhishek-unskript avatar Feb 28 '23 15:02 abhishek-unskript

Ability to run checks

unskript-ctl --run-checks [all | connector | failing]

Here the intention is to Run

  • All available checks
  • Run all checks for a given connector
  • Run checks that have failed in the past (Re-run failed checks)
  1. When all option is selected, the unskript-ctl should find out all available checks packaged and user defined in the system and run them and report the status against each checks, these result should be logged and the user should be able to display the failed checks and display the logs from the failed checks.

Implementation Notes:

  • [x] Query ZoDB for action_is_check = true This would give all the checks
  1. When a connector is specified, the script should fetch all checks available in the system for that particular connector and run them/report status and log the results for later use.

Implementation Notes:

  • [x] Query ZoDB for action_is_check = true for the given connector
  1. When failed is specified, the script should query ZoDB to find out the last-failed checks. Query would be action_is_check = true && status = failed This would return the failed Check IDs.

Common Implementation

  • [x] Iterate over each snippet and create a temporary runbook with Frist and Last cell added to the snippet
  • [x] Create a mapping of stored connector ID (credential schema id) to connector Name. 1. Create a new collection called default_credential_id 2. Load it with data from credential-save folder
  • [x] Need to fill in the task.configure(...) for credentialsJson. The Connector ID stored above will be used to fill in the credentialJson entry for the given connector.
  • [x] Run the temporary runbook,
  • [x] capture the execution result in the Audit log.
  • [x] Process Audit log and update Checks Status in the checks-status table of ZoDB and update the failed_checks timestamp in the last_failed table.

PR is in https://github.com/unskript/Awesome-CloudOps-Automation/pull/242