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

[PLGN-362]- Pager Duty - Refactor to use requests rather than pypd #2103

Merged
merged 1 commit into from
Nov 7, 2023

Conversation

rbowden-r7
Copy link
Collaborator

Proposed Changes

Description

https://issues.corp.rapid7.com/browse/PLGN-362

The current version of the plugin uses the PYPD package to make calls to the pager duty api (https://github.com/PagerDuty/pagerduty-api-python-client) this has been deprecated for a while and some of the calls are no longer working

Describe the proposed changes:

  • To update all of the actions to now use http requests rather than pypd
  • to update the spec / help.d to ensure that all the actions now have correct examples
  • to add in the unit tests for all of the actions

PR Requirements

Developers, verify you have completed the following items by checking them off:

Testing

testing all of the actions on stging server - https://issues.corp.rapid7.com/browse/PLGN-362?focusedCommentId=2126831&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-2126831

All of the actions have been tested locally in a docker container using postman to create the requests and the outputs have been verified when looking at the pager duty UI

Unit Tests

new unit tests have been added for all actions

Review our documentation on generating and writing plugin unit tests

  • Unit tests written for any new or updated code

In-Product Tests

If you are an InsightConnect customer or have access to an InsightConnect instance, the following in-product tests should be done:

  • Screenshot of job output with the plugin changes
  • Screenshot of the changed connection, actions, or triggers input within the InsightConnect workflow builder

Style

Review the style guide

  • For dependencies, pin OS package and Python package versions
  • For security, set least privileged account with USER nobody in the Dockerfile when possible
  • For size, use the slim SDK images when possible: rapid7/insightconnect-python-3-38-slim-plugin:{sdk-version-num} and rapid7/insightconnect-python-3-38-plugin:{sdk-version-num}
  • For error handling, use of PluginException and ConnectionTestException
  • For logging, use self.logger
  • For docs, use changelog style
  • For docs, validate markdown with insight-plugin validate which calls icon_validate to lint help.md

Functional Checklist

  • Work fully completed
  • Functional
    • Any new actions/triggers include JSON test files in the tests/ directory created with insight-plugin samples
    • Tests should all pass unless it's a negative test. Negative tests have a naming convention of tests/$action_bad.json
    • Unsuccessful tests should fail by raising an exception causing the plugin to die and an object should be returned on successful test
    • Add functioning test results to PR, sanitize any output if necessary
      • Single action/trigger insight-plugin run -T tests/example.json --debug --jq
      • All actions/triggers shortcut insight-plugin run -T all --debug --jq (use PR format at end)
    • Add functioning run results to PR, sanitize any output if necessary
      • Single action/trigger insight-plugin run -R tests/example.json --debug --jq
      • All actions/triggers shortcut insight-plugin run --debug --jq (use PR format at end)

Assessment

You must validate your work to reviewers:

  1. Run insight-plugin validate and make sure everything passes
  2. Run the assessment tool: insight-plugin run -A. For single action validation: insight-plugin run tests/{file}.json -A
  3. Copy (insight-plugin ... | pbcopy) and paste the output in a new post on this PR
  4. Add required screenshots from the In-Product Tests section

…2033)

* PLGN-362-Updating pager duty to use http rather than pypd

* PLGN-362-Reducing complexity of get_on_calls method and send_request method

* PLGN-362-Adding parameterized to requirements.txt to allow unit tests to now run on git

* PLGN-362-Running black formatter on get_on_call and util/api

* PLGN-362-Updating to use correct input and output objects, also removing redunant checks for required fields

* PLGN-362-Updating to use newest version of error messages from insightconnect_plugin_runtime.exceptions

* PLGN-362-Removing redunant required check

* PLGN-362-Running black formatter on get_on_call and util/api

* PLGN-362-Adding docstrings, using the input object in the connection class

* PLGN-362-Running black formatter on get_on_call and util/api

* PLGN-362-Updating docstrings to use sphinx format

* PLGN-362-Updating examples to user real fake data

* PLGN-362-Updating black format

* PLGN-362-Making sure return for delete is of type string

* PLGN-362-Making sure return for delete is of type string

* PLGN-362-Fixing typos / tidying up code

* PLGN-362-Adding back in get user by email action + tests

* PLGN-362-using black format

* PLGN-362-adding back in  prefix to eah actions description
@joneill-r7 joneill-r7 merged commit 1711779 into master Nov 7, 2023
6 checks passed
@joneill-r7 joneill-r7 deleted the pagerduty-3.0.0-release branch December 23, 2024 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants