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

ServiceNow Pack Update #16

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

TimothyDJones
Copy link

Proposed Revision Number: 0.5.0

Objective: Update to pack to prevent deprecation warnings from use of
the old style API calls by replacing them with the
PySNow library
Resource
APIs.

Scope: This update applies to the following actions of the Stackstorm
ServiceNow
pack
:

  • get
  • create
  • update
  • delete
    None of the "custom" methods were updated.

Approach/Implementation: A new pack-level (in config.schema.yaml)
boolean configuration flag named use_new_service_now_api is
introduced. When enabled (checked), a new code block in each of the
specified actions above is executed that uses the Resource APIs.
Otherwise, the existing module code is used.

In addition, the get module/method includes one new optional array
(list) parameter: fields. This parameter accepts a comma-separated
list of field names for the specified ServiceNow table and returns only
those fields in the response (result set) for each record. Note: This
attribute applies ONLY to the new API.

Tim Jones added 4 commits February 8, 2021 16:17
Proposed Revision Number: 0.5.0

Objective: Update to pack to prevent deprecation warnings from use of
the old style API calls by replacing them with the
[PySNow](https://pysnow.readthedocs.io/) library
[Resource](https://pysnow.readthedocs.io/en/latest/api/resource.html)
APIs.

Scope: This update applies to the following *actions* of the [Stackstorm
ServiceNow
pack](https://github.com/StackStorm-Exchange/stackstorm-servicenow):
* get
* create
* update
* delete
None of the "custom" methods were updated.

Approach/Implementation: A new pack-level (in `config.schema.yaml`)
boolean configuration flag named `use_new_service_now_api` is
introduced. When enabled (checked), a new code block in each of the
specified actions above is executed that uses the Resource APIs.
Otherwise, the existing module code is used.

In addition, the `get` module/method includes one new _optional_ *array*
(list) parameter: `fields`. This parameter accepts a comma-separated
list of field names for the specified ServiceNow table and returns only
those fields in the response (result set) for each record. Note: This
attribute applies *ONLY* to the new API.
…self.config['use_new_service_now_api']' from CI/CD errors.
Copy link
Contributor

@amanda11 amanda11 left a comment

Choose a reason for hiding this comment

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

Thanks for the update. I've added a couple of comments, but also pack.yaml when I view it in the PR is showing as empty now - so can you check if something has gone funny on the upload?

# If using new ServiceNew API...
if self.config['use_new_service_now_api']:
client = self.client
resource = client.resource(api_path="/table/{0}".format(table))
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be nicer to use python fstrings instead of format strings now that we are python 3 only, e.g. api_path=f"/table/{table}" for simplicity, but not essential. Applies to other places as well.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks, Amanda! This is a good suggestion; I'll keep this in mind in the future. I'm a little set in my ways about format() and adjusting to fstrings. :)

@CLAassistant
Copy link

CLAassistant commented May 11, 2022

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ TimothyDJones
❌ Tim Jones


Tim Jones seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Co-authored-by: Amanda McGuinness <[email protected]>
@amanda11
Copy link
Contributor

@jamesdreid @TimothyDJones It looks like one of the commits is associated with user "Tim Jones" rather than "TimothyDJones" - so this means we get an error as only TimothyDJones has signed the CLA.

Copy link
Contributor

@amanda11 amanda11 left a comment

Choose a reason for hiding this comment

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

There is a problem with the pack.yaml change, as its not coming up in the PR.
We need a pack.yaml with version 1.5.0 in, and then I think this can be merged.

For some reason it comes up as a blank file, as it looks like its associated with a fork that isn't quite linked properly to the PR.

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