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 python #2109

Merged
merged 17 commits into from
Sep 16, 2018
Merged

Servicenow python #2109

merged 17 commits into from
Sep 16, 2018

Conversation

liorblob
Copy link
Contributor

@liorblob liorblob commented Sep 6, 2018

No description provided.

@liorblob liorblob requested a review from Itay4 September 6, 2018 12:10
@liorblob
Copy link
Contributor Author

liorblob commented Sep 6, 2018

I ran the test playbook and it passed, though it's not in the build because the instance keeps hibernating. doc: https://github.com/demisto/etc/issues/12838

@@ -0,0 +1,1728 @@
commonfields:
id: ServiceNow_python
Copy link
Contributor

Choose a reason for hiding this comment

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

should override the old one (same id + name)

Integrations/integration-ServiceNowPython.yml Outdated Show resolved Hide resolved
Integrations/integration-ServiceNowPython.yml Outdated Show resolved Hide resolved

def load_proxy():
proxy = {}
if "proxy" in demisto.params():
Copy link
Contributor

Choose a reason for hiding this comment

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

you should verify that the value is true.
possible bug:

  1. create instance -> no proxy in params
  2. set proxy -> proxy=true in params
  3. disable proxy -> proxy=false in params (but it will exist)

PASSWORD = demisto.params()['credentials']['password']
VERIFY_SSL = not demisto.params().get('insecure', False)
API = '/api/now/'
VERSION = demisto.params().get('api_version', None)
Copy link
Contributor

Choose a reason for hiding this comment

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

no need to specify default value in case of None

file_id = demisto.args()['file_id']
file_name = demisto.args().get('file_name',
demisto.dt(demisto.context(), "File(val.EntryID=='"+file_id+"').Name"))
file_name = file_name[0] if isinstance(file_name, list) else file_name
Copy link
Contributor

Choose a reason for hiding this comment

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

when will it be a list?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If there's more than one file in the context

return 'Computer not found'

hr = {
'Id': computer['sys_id'],
Copy link
Contributor

Choose a reason for hiding this comment

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

should be ID

Copy link
Contributor Author

Choose a reason for hiding this comment

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

backward compatibility, can add ID in addition

for group in res['result']:
if group['name'] == group_name:
hr_groups.append({
'Id': group['sys_id'],
Copy link
Contributor

Choose a reason for hiding this comment

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

should be ID

Copy link
Contributor Author

Choose a reason for hiding this comment

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

backward compatibility, can add ID in addition

Copy link
Contributor

Choose a reason for hiding this comment

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

that's the Human-readable, not context

query_params = {}
incidents = []
sysparm_query = demisto.params().get('sysparm_query', None)
sysparm_limit = demisto.params().get('fetch_limit', DEFAULTS['limit'])
Copy link
Contributor

Choose a reason for hiding this comment

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

should be DEFAULTS['fetch_limit']

res = send_request(path, 'get', params = query_params)

for result in res['result']:
incident = result
Copy link
Contributor

Choose a reason for hiding this comment

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

why?

@yaakovi yaakovi merged commit 36da66f into master Sep 16, 2018
@yaakovi yaakovi deleted the servicenow-python branch September 16, 2018 16:52
anara123 pushed a commit that referenced this pull request Dec 6, 2018
* add the integration

* fetch incidents

* fixes

* file upload

* get computer, groups

* change human readable, incident -> ticket

* output types

* fix version

* add file context

* descriptions

* return SNOW error

* CR fixes #1

* delete unnecessary file

* fix dictionary/string
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.

2 participants